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]

gfs2-utils: master - split tree into separate projects


Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=1ff7bd8452bc0813f736cde98dc15389e7f8060d
Commit:        1ff7bd8452bc0813f736cde98dc15389e7f8060d
Parent:        a6345b21f2946cc9c93caa5852044f0929069529
Author:        Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate:    Wed Jan 7 14:16:10 2009 +0100
Committer:     Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Wed Jan 7 14:16:10 2009 +0100

split tree into separate projects

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
 Makefile                                           |   33 +-
 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                                          |  374 +-
 contrib/Makefile                                   |    2 +-
 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 -
 gfs-kernel/src/gfs/Makefile                        |   70 -
 gfs-kernel/src/gfs/acl.c                           |  396 -
 gfs-kernel/src/gfs/acl.h                           |   34 -
 gfs-kernel/src/gfs/bits.c                          |  211 -
 gfs-kernel/src/gfs/bits.h                          |   18 -
 gfs-kernel/src/gfs/bmap.c                          | 1393 -
 gfs-kernel/src/gfs/bmap.h                          |   35 -
 gfs-kernel/src/gfs/daemon.c                        |  181 -
 gfs-kernel/src/gfs/daemon.h                        |   11 -
 gfs-kernel/src/gfs/dio.c                           | 1342 -
 gfs-kernel/src/gfs/dio.h                           |  157 -
 gfs-kernel/src/gfs/dir.c                           | 2394 --
 gfs-kernel/src/gfs/dir.h                           |   42 -
 gfs-kernel/src/gfs/eaops.c                         |  173 -
 gfs-kernel/src/gfs/eaops.h                         |   21 -
 gfs-kernel/src/gfs/eattr.c                         | 2008 --
 gfs-kernel/src/gfs/eattr.h                         |   97 -
 gfs-kernel/src/gfs/file.c                          |  437 -
 gfs-kernel/src/gfs/file.h                          |   42 -
 gfs-kernel/src/gfs/fixed_div64.h                   |  107 -
 gfs-kernel/src/gfs/format.h                        |   17 -
 gfs-kernel/src/gfs/gfs.h                           |   89 -
 gfs-kernel/src/gfs/gfs_ioctl.h                     |   31 -
 gfs-kernel/src/gfs/gfs_ondisk.h                    | 1904 --
 gfs-kernel/src/gfs/glock.c                         | 2996 --
 gfs-kernel/src/gfs/glock.h                         |  138 -
 gfs-kernel/src/gfs/glops.c                         |  664 -
 gfs-kernel/src/gfs/glops.h                         |   13 -
 gfs-kernel/src/gfs/incore.h                        | 1211 -
 gfs-kernel/src/gfs/inode.c                         | 2223 --
 gfs-kernel/src/gfs/inode.h                         |   57 -
 gfs-kernel/src/gfs/ioctl.c                         | 1605 -
 gfs-kernel/src/gfs/ioctl.h                         |    9 -
 gfs-kernel/src/gfs/lm.c                            |  233 -
 gfs-kernel/src/gfs/lm.h                            |   32 -
 gfs-kernel/src/gfs/lm_interface.h                  |  269 -
 gfs-kernel/src/gfs/lock_dlm.h                      |  173 -
 gfs-kernel/src/gfs/lock_dlm_lock.c                 |  518 -
 gfs-kernel/src/gfs/lock_dlm_main.c                 |   31 -
 gfs-kernel/src/gfs/lock_dlm_mount.c                |  278 -
 gfs-kernel/src/gfs/lock_dlm_sysfs.c                |  229 -
 gfs-kernel/src/gfs/lock_dlm_thread.c               |  358 -
 gfs-kernel/src/gfs/lock_nolock_main.c              |  221 -
 gfs-kernel/src/gfs/locking.c                       |  171 -
 gfs-kernel/src/gfs/log.c                           | 1440 -
 gfs-kernel/src/gfs/log.h                           |   66 -
 gfs-kernel/src/gfs/lops.c                          | 1648 --
 gfs-kernel/src/gfs/lops.h                          |  166 -
 gfs-kernel/src/gfs/lvb.c                           |  135 -
 gfs-kernel/src/gfs/lvb.h                           |   53 -
 gfs-kernel/src/gfs/main.c                          |  134 -
 gfs-kernel/src/gfs/mount.c                         |  166 -
 gfs-kernel/src/gfs/mount.h                         |    6 -
 gfs-kernel/src/gfs/ondisk.c                        |   15 -
 gfs-kernel/src/gfs/ops_address.c                   |  479 -
 gfs-kernel/src/gfs/ops_address.h                   |    6 -
 gfs-kernel/src/gfs/ops_dentry.c                    |  111 -
 gfs-kernel/src/gfs/ops_dentry.h                    |    6 -
 gfs-kernel/src/gfs/ops_export.c                    |  403 -
 gfs-kernel/src/gfs/ops_export.h                    |    6 -
 gfs-kernel/src/gfs/ops_file.c                      | 1911 --
 gfs-kernel/src/gfs/ops_file.h                      |   11 -
 gfs-kernel/src/gfs/ops_fstype.c                    |  816 -
 gfs-kernel/src/gfs/ops_fstype.h                    |   13 -
 gfs-kernel/src/gfs/ops_inode.c                     | 1679 --
 gfs-kernel/src/gfs/ops_inode.h                     |    9 -
 gfs-kernel/src/gfs/ops_super.c                     |  455 -
 gfs-kernel/src/gfs/ops_super.h                     |    6 -
 gfs-kernel/src/gfs/ops_vm.c                        |  233 -
 gfs-kernel/src/gfs/ops_vm.h                        |    7 -
 gfs-kernel/src/gfs/page.c                          |  266 -
 gfs-kernel/src/gfs/page.h                          |   13 -
 gfs-kernel/src/gfs/proc.c                          |  491 -
 gfs-kernel/src/gfs/proc.h                          |   14 -
 gfs-kernel/src/gfs/quota.c                         | 1139 -
 gfs-kernel/src/gfs/quota.h                         |   28 -
 gfs-kernel/src/gfs/recovery.c                      |  780 -
 gfs-kernel/src/gfs/recovery.h                      |   23 -
 gfs-kernel/src/gfs/rgrp.c                          | 2152 --
 gfs-kernel/src/gfs/rgrp.h                          |   75 -
 gfs-kernel/src/gfs/super.c                         | 1274 -
 gfs-kernel/src/gfs/super.h                         |   53 -
 gfs-kernel/src/gfs/sys.c                           |  128 -
 gfs-kernel/src/gfs/sys.h                           |   14 -
 gfs-kernel/src/gfs/trans.c                         |  453 -
 gfs-kernel/src/gfs/trans.h                         |   24 -
 gfs-kernel/src/gfs/unlinked.c                      |  432 -
 gfs-kernel/src/gfs/unlinked.h                      |   19 -
 gfs-kernel/src/gfs/util.c                          |  571 -
 gfs-kernel/src/gfs/util.h                          |  330 -
 gfs/Makefile                                       |   23 -
 gfs/gfs_debug/Makefile                             |   32 -
 gfs/gfs_debug/basic.c                              |  436 -
 gfs/gfs_debug/basic.h                              |   26 -
 gfs/gfs_debug/block_device.c                       |  117 -
 gfs/gfs_debug/block_device.h                       |   14 -
 gfs/gfs_debug/gfs_debug.h                          |   83 -
 gfs/gfs_debug/main.c                               |  179 -
 gfs/gfs_debug/ondisk.c                             |   18 -
 gfs/gfs_debug/readfile.c                           |  236 -
 gfs/gfs_debug/readfile.h                           |   14 -
 gfs/gfs_debug/util.c                               |  334 -
 gfs/gfs_debug/util.h                               |   29 -
 gfs/gfs_fsck/FEATURES                              |   25 -
 gfs/gfs_fsck/Makefile                              |   72 -
 gfs/gfs_fsck/TODO                                  |   49 -
 gfs/gfs_fsck/bio.c                                 |  168 -
 gfs/gfs_fsck/bio.h                                 |   23 -
 gfs/gfs_fsck/bitmap.c                              |  118 -
 gfs/gfs_fsck/bitmap.h                              |   20 -
 gfs/gfs_fsck/block_list.c                          |  263 -
 gfs/gfs_fsck/block_list.h                          |   88 -
 gfs/gfs_fsck/eattr.c                               |  100 -
 gfs/gfs_fsck/eattr.h                               |   21 -
 gfs/gfs_fsck/file.c                                |  229 -
 gfs/gfs_fsck/file.h                                |   10 -
 gfs/gfs_fsck/fs_bits.c                             |  350 -
 gfs/gfs_fsck/fs_bits.h                             |   34 -
 gfs/gfs_fsck/fs_bmap.c                             |  529 -
 gfs/gfs_fsck/fs_bmap.h                             |   10 -
 gfs/gfs_fsck/fs_dir.c                              | 1756 --
 gfs/gfs_fsck/fs_dir.h                              |   33 -
 gfs/gfs_fsck/fs_inode.c                            |  600 -
 gfs/gfs_fsck/fs_inode.h                            |   22 -
 gfs/gfs_fsck/fs_recovery.c                         |   75 -
 gfs/gfs_fsck/fs_recovery.h                         |    9 -
 gfs/gfs_fsck/fsck.h                                |   35 -
 gfs/gfs_fsck/fsck_incore.h                         |  136 -
 gfs/gfs_fsck/hash.c                                |   91 -
 gfs/gfs_fsck/hash.h                                |    7 -
 gfs/gfs_fsck/initialize.c                          |  428 -
 gfs/gfs_fsck/inode.c                               |  335 -
 gfs/gfs_fsck/inode.h                               |   13 -
 gfs/gfs_fsck/inode_hash.c                          |   74 -
 gfs/gfs_fsck/inode_hash.h                          |    7 -
 gfs/gfs_fsck/link.c                                |   94 -
 gfs/gfs_fsck/link.h                                |    8 -
 gfs/gfs_fsck/log.c                                 |  145 -
 gfs/gfs_fsck/log.h                                 |   87 -
 gfs/gfs_fsck/lost_n_found.c                        |  133 -
 gfs/gfs_fsck/lost_n_found.h                        |    8 -
 gfs/gfs_fsck/main.c                                |  277 -
 gfs/gfs_fsck/metawalk.c                            |  862 -
 gfs/gfs_fsck/metawalk.h                            |   65 -
 gfs/gfs_fsck/ondisk.c                              | 1342 -
 gfs/gfs_fsck/ondisk.h                              | 2045 --
 gfs/gfs_fsck/pass1.c                               |  885 -
 gfs/gfs_fsck/pass1b.c                              |  521 -
 gfs/gfs_fsck/pass1c.c                              |  274 -
 gfs/gfs_fsck/pass2.c                               |  888 -
 gfs/gfs_fsck/pass3.c                               |  274 -
 gfs/gfs_fsck/pass4.c                               |  181 -
 gfs/gfs_fsck/pass5.c                               |  365 -
 gfs/gfs_fsck/rgrp.c                                |  632 -
 gfs/gfs_fsck/rgrp.h                                |   20 -
 gfs/gfs_fsck/super.c                               | 1369 -
 gfs/gfs_fsck/super.h                               |   11 -
 gfs/gfs_fsck/test_bitmap.c                         |   38 -
 gfs/gfs_fsck/test_block_list.c                     |   91 -
 gfs/gfs_fsck/util.c                                |  333 -
 gfs/gfs_fsck/util.h                                |   27 -
 gfs/gfs_grow/Makefile                              |   34 -
 gfs/gfs_grow/main.c                                |  915 -
 gfs/gfs_grow/ondisk.c                              |   18 -
 gfs/gfs_jadd/Makefile                              |   34 -
 gfs/gfs_jadd/main.c                                |  908 -
 gfs/gfs_jadd/ondisk.c                              |   18 -
 gfs/gfs_mkfs/Makefile                              |   44 -
 gfs/gfs_mkfs/device_geometry.c                     |  153 -
 gfs/gfs_mkfs/fs_geometry.c                         |  180 -
 gfs/gfs_mkfs/locking.c                             |  102 -
 gfs/gfs_mkfs/main.c                                |  426 -
 gfs/gfs_mkfs/mkfs_gfs.h                            |  181 -
 gfs/gfs_mkfs/ondisk.c                              |   17 -
 gfs/gfs_mkfs/structures.c                          |  845 -
 gfs/gfs_quota/Makefile                             |   31 -
 gfs/gfs_quota/check.c                              |  633 -
 gfs/gfs_quota/gfs_quota.h                          |   94 -
 gfs/gfs_quota/layout.c                             |  600 -
 gfs/gfs_quota/main.c                               |  734 -
 gfs/gfs_quota/names.c                              |   84 -
 gfs/gfs_quota/ondisk.c                             |   18 -
 gfs/gfs_tool/Makefile                              |   35 -
 gfs/gfs_tool/counters.c                            |  202 -
 gfs/gfs_tool/decipher_lockstate_dump               |  172 -
 gfs/gfs_tool/df.c                                  |  257 -
 gfs/gfs_tool/gfs_tool.h                            |   90 -
 gfs/gfs_tool/layout.c                              |  842 -
 gfs/gfs_tool/main.c                                |  264 -
 gfs/gfs_tool/misc.c                                |  731 -
 gfs/gfs_tool/ondisk.c                              |   21 -
 gfs/gfs_tool/parse_lockdump                        |  158 -
 gfs/gfs_tool/sb.c                                  |  152 -
 gfs/gfs_tool/tune.c                                |  135 -
 gfs/gfs_tool/util.c                                |  270 -
 gfs/include/global.h                               |   42 -
 gfs/include/linux_endian.h                         |   68 -
 gfs/include/list.h                                 |  325 -
 gfs/include/osi_list.h                             |   84 -
 gfs/include/osi_user.h                             |  421 -
 gfs/init.d/Makefile                                |   17 -
 gfs/init.d/gfs.in                                  |  149 -
 gfs/libgfs/Makefile                                |   33 -
 gfs/libgfs/bio.c                                   |  167 -
 gfs/libgfs/bitmap.c                                |  116 -
 gfs/libgfs/block_list.c                            |  267 -
 gfs/libgfs/file.c                                  |  231 -
 gfs/libgfs/fs_bits.c                               |  348 -
 gfs/libgfs/fs_bmap.c                               |  522 -
 gfs/libgfs/fs_dir.c                                | 1683 --
 gfs/libgfs/fs_inode.c                              |  470 -
 gfs/libgfs/incore.h                                | 1271 -
 gfs/libgfs/inode.c                                 |  322 -
 gfs/libgfs/libgfs.h                                |  395 -
 gfs/libgfs/log.c                                   |  136 -
 gfs/libgfs/ondisk.c                                | 1282 -
 gfs/libgfs/rgrp.c                                  |  593 -
 gfs/libgfs/size.c                                  |   81 -
 gfs/libgfs/super.c                                 |  531 -
 gfs/libgfs/util.c                                  |  271 -
 gfs/man/Makefile                                   |   12 -
 gfs/man/gfs.8                                      |   37 -
 gfs/man/gfs_edit.8                                 |    1 -
 gfs/man/gfs_fsck.8                                 |   59 -
 gfs/man/gfs_grow.8                                 |   63 -
 gfs/man/gfs_jadd.8                                 |   75 -
 gfs/man/gfs_mkfs.8                                 |   82 -
 gfs/man/gfs_mount.8                                |  193 -
 gfs/man/gfs_quota.8                                |  101 -
 gfs/man/gfs_tool.8                                 |  137 -
 gfs/tests/Makefile                                 |    4 -
 gfs/tests/filecon2/Makefile                        |   19 -
 gfs/tests/filecon2/filecon2.h                      |  146 -
 gfs/tests/filecon2/filecon2_client.c               |  841 -
 gfs/tests/filecon2/filecon2_server.c               |  597 -
 gfs/tests/mmdd/Makefile                            |   25 -
 gfs/tests/mmdd/mmdd.c                              |  703 -
 gfs2/mount/Makefile                                |    1 -
 gfs2/mount/gfs_ondisk.h                            | 1904 ++
 group/Makefile                                     |    6 +-
 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_controld/Makefile                        |   19 +-
 group/lib/Makefile                                 |   14 -
 group/lib/libgroup.c                               |  524 -
 group/lib/libgroup.h                               |   81 -
 group/man/Makefile                                 |    5 +-
 group/man/dlm_controld.8                           |  123 -
 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                              |   52 +-
 make/fencebuild.mk                                 |   25 -
 make/install.mk                                    |   34 -
 make/uninstall.mk                                  |   24 -
 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 -
 868 files changed, 1963 insertions(+), 248406 deletions(-)

diff --git a/Makefile b/Makefile
index 78bcdee..ee73c87 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 = group gfs2 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))
 
@@ -27,23 +15,8 @@ all: ${SUBDIRS}
 ${SUBDIRS}:
 	[ -n "${without_$@}" ] || ${MAKE} -C $@ all
 
-# Kernel
-
-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:
+group: 
 gfs2: group
-rgmanager: cman dlm
-bindings: cman
 contrib: gfs2
 
 oldconfig:
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..f8b2a87 100755
--- a/configure
+++ b/configure
@@ -29,83 +29,45 @@ my %options = (
 	objdir => \$objdir,
 	kernel_build => \$kernel_build,
 	kernel_src => \$kernel_src,
-	module_dir => \$module_dir,
-	gfskincdir => \$gfskincdir,
         incdir => \$incdir,
 	libdir => \$libdir,
         ccsincdir => \$ccsincdir,
 	ccslibdir => \$ccslibdir,
 	cmanincdir => \$cmanincdir,
 	cmanlibdir => \$cmanlibdir,
-	dlmincdir => \$dlmincdir,
-	dlmlibdir => \$dlmlibdir,
+	groupincdir => \$groupincdir,
+	grouplibdir => \$grouplibdir,
 	dlmcontrolincdir => \$dlmcontrolincdir,
 	dlmcontrollibdir => \$dlmcontrollibdir,
-	fenceincdir => \$fenceincdir,
-	fencelibdir => \$fencelibdir,
+	fencedincdir => \$fencedincdir,
+	fencedlibdir => \$fencedlibdir,
 	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,
 );
 
@@ -120,83 +82,45 @@ my $err = &GetOptions (\%options,
 		    'objdir=s',
 		    'kernel_build=s',
 		    'kernel_src=s',
-		    'module_dir=s',
-		    'gfskincdir=s',
 		    'incdir=s',
 		    'libdir=s',
 		    'ccsincdir=s',
 		    'ccslibdir=s',
 		    'cmanincdir=s',
 		    'cmanlibdir=s',
-		    'dlmincdir=s',
-		    'dlmlibdir=s',
+		    'groupincdir=s',
+		    'grouplibdir=s',
 		    'dlmcontrolincdir=s',
 		    'dlmcontrollibdir=s',
-		    'fenceincdir=s',
-		    'fencelibdir=s',
+		    'fencedincdir=s',
+		    'fencedlibdir=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');
 
 if(!$err) {
@@ -215,19 +139,11 @@ 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";
   print "--cc=\t\tcompiler to use.  (Default: gcc)\n";
   print "--debug\t\tEnable debugging build. Changes default CFLAGS to -Wall -O0 -DDEBUG -g.\n";
@@ -239,62 +155,32 @@ 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 "--ccsincdir=\tthe base directory for ccs include files.  (Default: {incdir})\n";
+  print "--ccslibdir=\tthe base directory for ccs libraries.  (Default: {libdir})\n";
+  print "--cmanincdir=\tthe base directory for cman include files.  (Default: {incdir})\n";
+  print "--cmanlibdir=\tthe base directory for cman libraries.  (Default: {libdir})\n";
+  print "--groupincdir=\tthe base directory for group include files.  (Default: {incdir})\n";
+  print "--grouplibdir=\tthe base directory for group libraries.  (Default: {libdir})\n";
+  print "--dlmcontrolincdir=\tthe base directory for dlmcontrol include files.  (Default: {incdir})\n";
+  print "--dlmcontrollibdir=\tthe base directory for dlmcontrol libraries.  (Default: {libdir})\n";
+  print "--fencedincdir=\tthe base directory for fenced include files.  (Default: {incdir})\n";
+  print "--fencedlibdir=\tthe base directory for fenced libraries.  (Default: {libdir})\n";
+  print "--logtincdir=\tthe base directory for logthread include files.  (Default: {incdir})\n";
+  print "--logtlibdir=\tthe base directory for logthread libraries.  (Default: {libdir})\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";
   exit $ret;
 }
@@ -405,8 +291,6 @@ if (! -d "$objdir/make") {
   mkdir "$objdir";
   symlinks(".","Makefile");
   symlinks(".","*.mk");
-  symlinks("gfs-kernel","*.c");
-  symlinks("gfs-kernel","*.h");
   symlinks("bindings","*.bindings");
   symlinks("bindings","*.pl");
   symlinks("bindings","*.xs");
@@ -435,12 +319,6 @@ if (!$kernel_src) {
 if (not $disable_kernel_check and !kernel_version($kernel_src,$required_kernelversion)) {
   exit 1;
 }
-if (!$module_dir) {
-  $module_dir="/lib/modules/$un[2]/kernel";
-}
-if (!$gfskincdir) {
-  $gfskincdir="${cdir}/gfs-kernel/src/gfs";
-}
 if (!$incdir) {
   $incdir="${prefix}/include";
 }
@@ -448,40 +326,40 @@ if (!$libdir) {
   $libdir="${prefix}/lib";
 }
 if (!$ccsincdir) {
-  $ccsincdir="${cdir}/config/libs/libccsconfdb";
+  $ccsincdir="${incdir}";
 }
 if (!$ccslibdir) {
-  $ccslibdir="${objdir}/config/libs/libccsconfdb";
+  $ccslibdir="${libdir}";
 }
 if (!$cmanincdir) {
-  $cmanincdir="${cdir}/cman/lib";
+  $cmanincdir="${incdir}";
 }
 if (!$cmanlibdir) {
-  $cmanlibdir="${objdir}/cman/lib";
+  $cmanlibdir="${libdir}";
 }
-if (!$dlmincdir) {
-  $dlmincdir="${cdir}/dlm/libdlm";
+if (!$groupincdir) {
+  $groupincdir="${incdir}";
 }
-if (!$dlmlibdir) {
-  $dlmlibdir="${objdir}/dlm/libdlm";
+if (!$grouplibdir) {
+  $grouplibdir="${libdir}";
 }
 if (!$dlmcontrolincdir) {
-  $dlmcontrolincdir="${cdir}/dlm/libdlmcontrol";
+  $dlmcontrolincdir="${incdir}";
 }
 if (!$dlmcontrollibdir) {
-  $dlmcontrollibdir="${objdir}/dlm/libdlmcontrol";
+  $dlmcontrollibdir="${libdir}";
 }
-if (!$fenceincdir) {
-  $fenceincdir="${cdir}/fence/libfence";
+if (!$fencedincdir) {
+  $fencedincdir="${incdir}";
 }
-if (!$fencelibdir) {
-  $fencelibdir="${objdir}/fence/libfence";
+if (!$fencedlibdir) {
+  $fencedlibdir="${libdir}";
 }
 if (!$logtincdir) {
-  $logtincdir="${cdir}/common/liblogthread";
+  $logtincdir="${incdir}";
 }
 if (!$logtlibdir) {
-  $logtlibdir="${objdir}/common/liblogthread";
+  $logtlibdir="${libdir}";
 }
 if (!$volidincdir) {
   $volidincdir="${incdir}";
@@ -489,27 +367,12 @@ if (!$volidincdir) {
 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}";
 }
@@ -522,48 +385,6 @@ if (!$openaisincdir) {
 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 +394,18 @@ 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,47 +427,15 @@ 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="";
 }
-if (!$without_kernel_modules) {
-  $without_gfskernel=$without_gfs;
-} else {
-  $without_gfskernel=1;
-}
 if (!$disable_kernel_check) {
   $disable_kernel_check=0;
 }
@@ -684,27 +449,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";
 
@@ -719,78 +463,40 @@ while (<IFILE>) {
   $_ =~ s/\@OBJDIR\@/$objdir/;
   $_ =~ s/\@KERNEL_BUILD\@/$kernel_build/;
   $_ =~ s/\@KERNEL_SRC\@/$kernel_src/;
-  $_ =~ s/\@MODULE_DIR\@/$module_dir/;
-  $_ =~ 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/\@GROUPINCDIR\@/$groupincdir/;
+  $_ =~ s/\@GROUPLIBDIR\@/$grouplibdir/;
   $_ =~ s/\@DLMCONTROLINCDIR\@/$dlmcontrolincdir/;
   $_ =~ s/\@DLMCONTROLLIBDIR\@/$dlmcontrollibdir/;
-  $_ =~ s/\@FENCEINCDIR\@/$fenceincdir/;
-  $_ =~ s/\@FENCELIBDIR\@/$fencelibdir/;
+  $_ =~ s/\@FENCEDINCDIR\@/$fencedincdir/;
+  $_ =~ s/\@FENCEDLIBDIR\@/$fencedlibdir/;
   $_ =~ 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..5504bd1 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=askant
 endif
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/gfs-kernel/src/gfs/Makefile b/gfs-kernel/src/gfs/Makefile
deleted file mode 100644
index aa12e01..0000000
--- a/gfs-kernel/src/gfs/Makefile
+++ /dev/null
@@ -1,70 +0,0 @@
-TARGET= gfs.ko
-
-KMODT=$(TARGET)
-KDIRT=fs/gfs
-KHEADT=gfs_ondisk.h gfs_ioctl.h
-
-all: ${TARGET}
-
-ifndef USING_KBUILD
-include ../../../make/defines.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-endif
-
-PWD := $(shell pwd)
-
-SYMVERFILE := ${KERNEL_BUILD}/Module.symvers
-
-obj-m := gfs.o
-gfs-objs := acl.o \
-	bits.o \
-	bmap.o \
-	daemon.o \
-	dio.o \
-	dir.o \
-	eaops.o \
-	eattr.o \
-	file.o \
-	glock.o \
-	glops.o \
-	inode.o \
-	ioctl.o \
-	lm.o \
-	locking.o \
-	lock_nolock_main.o \
-	lock_dlm_lock.o \
-	lock_dlm_main.o \
-	lock_dlm_mount.o \
-	lock_dlm_sysfs.o \
-	lock_dlm_thread.o \
-	log.o \
-	lops.o \
-	lvb.o \
-	main.o \
-	mount.o \
-	ondisk.o \
-	ops_address.o \
-	ops_dentry.o \
-	ops_export.o \
-	ops_file.o \
-	ops_fstype.o \
-	ops_inode.o \
-	ops_super.o \
-	ops_vm.o \
-	page.o \
-	proc.o \
-	quota.o \
-	recovery.o \
-	rgrp.o \
-	super.o \
-	sys.o \
-	trans.o \
-	unlinked.o \
-	util.o
-
-${TARGET}:
-	${MAKE} -C ${KERNEL_BUILD} M=${PWD} symverfile=${SYMVERFILE} modules USING_KBUILD=yes
-
-clean: generalclean
diff --git a/gfs-kernel/src/gfs/acl.c b/gfs-kernel/src/gfs/acl.c
deleted file mode 100644
index a3e30b0..0000000
--- a/gfs-kernel/src/gfs/acl.c
+++ /dev/null
@@ -1,396 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <linux/posix_acl.h>
-#include <linux/posix_acl_xattr.h>
-
-#include "gfs.h"
-#include "acl.h"
-#include "eattr.h"
-#include "inode.h"
-
-/**
- * gfs_acl_validate_set -
- * @ip:
- * @access:
- * @er:
- * @mode:
- * @remove:
- *
- * Returns: errno
- */
-
-int
-gfs_acl_validate_set(struct gfs_inode *ip, int access,
-		     struct gfs_ea_request *er,
-		     int *remove, mode_t *mode)
-{
-	struct posix_acl *acl;
-	int error;
-
-	error = gfs_acl_validate_remove(ip, access);
-	if (error)
-		return error;
-
-	if (!er->er_data)
-		return -EINVAL;
-
-	acl = posix_acl_from_xattr(er->er_data, er->er_data_len);
-	if (IS_ERR(acl))
-		return PTR_ERR(acl);
-	if (!acl) {
-		*remove = TRUE;
-		return 0;
-	}
-
-	error = posix_acl_valid(acl);
-	if (error)
-		goto out;
-
-	if (access) {
-		error = posix_acl_equiv_mode(acl, mode);
-		if (!error)
-			*remove = TRUE;
-		else if (error > 0)
-			error = 0;
-	}
-
- out:
-	posix_acl_release(acl);
-
-	return error;
-}
-
-/**
- * gfs_acl_validate_remove -
- * @ip:
- * @access:
- *
- * Returns: errno
- */
-
-int
-gfs_acl_validate_remove(struct gfs_inode *ip, int access)
-{
-	if (!ip->i_sbd->sd_args.ar_posix_acls)
-		return -EOPNOTSUPP;
-	if (current->fsuid != ip->i_di.di_uid && !capable(CAP_FOWNER))
-		return -EPERM;
-	if (ip->i_di.di_type == GFS_FILE_LNK)
-		return -EOPNOTSUPP;
-	if (!access && ip->i_di.di_type != GFS_FILE_DIR)
-		return -EACCES;
-
-	return 0;
-}
-
-/**
- * gfs_acl_get -
- * @ip:
- * @access:
- * @acl:
- *
- * Returns: errno
- */
-
-int
-gfs_acl_get(struct gfs_inode *ip, int access, struct posix_acl **acl)
-{
-	struct gfs_ea_request er;
-	struct gfs_ea_location el;
-	int error;
-
-	if (!ip->i_di.di_eattr)
-		return 0;
-
-	memset(&er, 0, sizeof(struct gfs_ea_request));
-	if (access) {
-		er.er_name = GFS_POSIX_ACL_ACCESS;
-		er.er_name_len = GFS_POSIX_ACL_ACCESS_LEN;
-	} else {
-		er.er_name = GFS_POSIX_ACL_DEFAULT;
-		er.er_name_len = GFS_POSIX_ACL_DEFAULT_LEN;
-	}
-	er.er_type = GFS_EATYPE_SYS;
-
-	error = gfs_ea_find(ip, &er, &el);
-	if (error)
-		return error;
-	if (!el.el_ea)
-		return 0;
-	if (!GFS_EA_DATA_LEN(el.el_ea))
-		goto out;
-
-	er.er_data = kmalloc(GFS_EA_DATA_LEN(el.el_ea), GFP_KERNEL);
-	error = -ENOMEM;
-	if (!er.er_data)
-		goto out;
-
-	error = gfs_ea_get_copy(ip, &el, er.er_data);
-	if (error)
-		goto out_kfree;
-
-	*acl = posix_acl_from_xattr(er.er_data, GFS_EA_DATA_LEN(el.el_ea));
-	if (IS_ERR(*acl))
-		error = PTR_ERR(*acl);
-
- out_kfree:
-	kfree(er.er_data);
-
- out:
-	brelse(el.el_bh);
-
-	return error;
-}
-
-/**
- * gfs_check_acl - Check an ACL for to see if we're allowed to do something
- * @inode: the file we want to do something to
- * @mask: what we want to do
- *
- * Returns: errno
- */
-
-int
-gfs_check_acl(struct inode *inode, int mask)
-{
-	struct posix_acl *acl = NULL;
-	int error;
-
-	error = gfs_acl_get(get_v2ip(inode), TRUE, &acl);
-	if (error)
-		return error;
-
-	if (acl) {
-		error = posix_acl_permission(inode, acl, mask);
-		posix_acl_release(acl);
-		return error;
-	}
-	
-	return -EAGAIN;
-}
-
-/**
- * gfs_acl_new_prep - 
- * @dip:
- * @type:
- * @mode:
- * @a_acl:
- * @d_acl:
- * @blocks:
- * @data:
- *
- * Returns: errno
- */
-
-int
-gfs_acl_new_prep(struct gfs_inode *dip,
-		 unsigned int type, mode_t *mode,
-		 void **a_data, void **d_data,
-		 unsigned int *size,
-		 unsigned int *blocks)
-{
-	struct posix_acl *acl = NULL;
-	int set_a = FALSE, set_d = FALSE;
-	int error;
-
-	if (!dip->i_sbd->sd_args.ar_posix_acls)
-		return 0;
-	if (type == GFS_FILE_LNK)
-		return 0;
-
-	error = gfs_acl_get(dip, FALSE, &acl);
-	if (error)
-		return error;
-	if (!acl) {
-		(*mode) &= ~current->fs->umask;
-		return 0;
-	}
-
-	{
-		struct posix_acl *clone = posix_acl_clone(acl, GFP_KERNEL);
-		error = -ENOMEM;
-		if (!clone)
-			goto out;
-		posix_acl_release(acl);
-		acl = clone;
-	}
-
-	error = posix_acl_create_masq(acl, mode);
-	if (error < 0)
-		goto out;
-	if (error > 0) {
-		set_a = TRUE;
-		error = 0;
-	}
-	if (type == GFS_FILE_DIR)
-		set_d = TRUE;
-
-	if (set_a || set_d) {
-		struct gfs_ea_request er;
-		void *d;
-		unsigned int s = posix_acl_xattr_size(acl->a_count);
-		unsigned int b;
-
-		memset(&er, 0, sizeof(struct gfs_ea_request));
-		er.er_name_len = GFS_POSIX_ACL_DEFAULT_LEN;
-		er.er_data_len = s;
-		error = gfs_ea_check_size(dip->i_sbd, &er);
-		if (error)
-			goto out;
-
-		b = DIV_RU(er.er_data_len, dip->i_sbd->sd_jbsize);
-		if (set_a && set_d)
-			b *= 2;
-		b++;
-
-		d = kmalloc(s, GFP_KERNEL);
-		error = -ENOMEM;
-		if (!d)
-			goto out;
-		posix_acl_to_xattr(acl, d, s);
-
-		if (set_a)
-			*a_data = d;
-		if (set_d)
-			*d_data = d;
-		*size = s;
-		*blocks = b;
-
-		error = 0;
-	}
-
- out:
-	posix_acl_release(acl);
-
-	return error;
-}
-
-/**
- * gfs_acl_new_init - 
- * @dip:
- * @ip:
- * @a_data:
- * @d_data:
- * @size:
- *
- * Returns: errno
- */
-
-int gfs_acl_new_init(struct gfs_inode *dip, struct gfs_inode *ip,
-		     void *a_data, void *d_data, unsigned int size)
-{
-	void *data = (a_data) ? a_data : d_data;
-	unsigned int x;
-	int error = 0;
-
-	ip->i_alloc = dip->i_alloc; /* Cheesy, but it works. */
-
-	for (x = 0; x < 2; x++) {
-		struct gfs_ea_request er;
-
-		memset(&er, 0, sizeof(struct gfs_ea_request));
-		if (x) {
-			if (!a_data)
-				continue;
-			er.er_name = GFS_POSIX_ACL_ACCESS;
-			er.er_name_len = GFS_POSIX_ACL_ACCESS_LEN;
-		} else {
-			if (!d_data)
-				continue;
-			er.er_name = GFS_POSIX_ACL_DEFAULT;
-			er.er_name_len = GFS_POSIX_ACL_DEFAULT_LEN;
-		}
-		er.er_data = data;
-		er.er_data_len = size;
-		er.er_type = GFS_EATYPE_SYS;
-
-		error = gfs_ea_acl_init(ip, &er);
-		if (error)
-			break;
-	}	
-
-	ip->i_alloc = NULL;
-
-	kfree(data);
-
-	return error;
-}
-
-/**
- * gfs_acl_chmod -
- * @ip:
- * @attr:
- *
- * Returns: errno
- */
-
-int
-gfs_acl_chmod(struct gfs_inode *ip, struct iattr *attr)
-{
-	struct gfs_ea_request er;
-	struct gfs_ea_location el;
-	struct posix_acl *acl;
-	int error;
-
-	if (!ip->i_di.di_eattr)
-		goto simple;
-
-	memset(&er, 0, sizeof(struct gfs_ea_request));
-	er.er_name = GFS_POSIX_ACL_ACCESS;
-	er.er_name_len = GFS_POSIX_ACL_ACCESS_LEN;
-	er.er_type = GFS_EATYPE_SYS;
-
-	error = gfs_ea_find(ip, &er, &el);
-	if (error)
-		return error;
-	if (!el.el_ea)
-		goto simple;
-	if (!GFS_EA_DATA_LEN(el.el_ea))
-		goto simple;
-
-	er.er_data = kmalloc(GFS_EA_DATA_LEN(el.el_ea), GFP_KERNEL);
-	error = -ENOMEM;
-	if (!er.er_data)
-		goto out;
-
-	error = gfs_ea_get_copy(ip, &el, er.er_data);
-	if (error)
-		goto out_kfree;
-
-	acl = posix_acl_from_xattr(er.er_data, GFS_EA_DATA_LEN(el.el_ea));
-	if (IS_ERR(acl)) {
-		error = PTR_ERR(acl);
-		goto out_kfree;
-	} else if (!acl) {
-		kfree(er.er_data);
-		brelse(el.el_bh);
-		goto simple;
-	}
-
-	error = posix_acl_chmod_masq(acl, attr->ia_mode);
-	if (error)
-		goto out_acl;
-
-	posix_acl_to_xattr(acl, er.er_data, GFS_EA_DATA_LEN(el.el_ea));
-
-	error = gfs_ea_acl_chmod(ip, &el, attr, er.er_data);
-
- out_acl:
-	posix_acl_release(acl);
-
- out_kfree:
-	kfree(er.er_data);
-
- out:
-	brelse(el.el_bh);
-
-	return error;
-
- simple:
-	return gfs_setattr_simple(ip, attr);
-}
diff --git a/gfs-kernel/src/gfs/acl.h b/gfs-kernel/src/gfs/acl.h
deleted file mode 100644
index d28fa9c..0000000
--- a/gfs-kernel/src/gfs/acl.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef __ACL_DOT_H__
-#define __ACL_DOT_H__
-
-#define GFS_POSIX_ACL_ACCESS  "posix_acl_access"
-#define GFS_POSIX_ACL_ACCESS_LEN (16)
-#define GFS_POSIX_ACL_DEFAULT "posix_acl_default"
-#define GFS_POSIX_ACL_DEFAULT_LEN (17)
-
-#define GFS_ACL_IS_ACCESS(name, len) \
-         ((len) == GFS_POSIX_ACL_ACCESS_LEN && \
-         !memcmp(GFS_POSIX_ACL_ACCESS, (name), (len)))
-
-#define GFS_ACL_IS_DEFAULT(name, len) \
-         ((len) == GFS_POSIX_ACL_DEFAULT_LEN && \
-         !memcmp(GFS_POSIX_ACL_DEFAULT, (name), (len)))
-
-struct gfs_ea_request;
-
-int gfs_acl_validate_set(struct gfs_inode *ip, int access,
-			 struct gfs_ea_request *er,
-			 int *remove, mode_t *mode);
-int gfs_acl_validate_remove(struct gfs_inode *ip, int access);
-int gfs_acl_get(struct gfs_inode *ip, int access, struct posix_acl **acl);
-int gfs_check_acl(struct inode *inode, int mask);
-int gfs_acl_new_prep(struct gfs_inode *dip,
-		     unsigned int type, mode_t *mode,
-		     void **a_data, void **d_data,
-		     unsigned int *size,
-		     unsigned int *blocks);
-int gfs_acl_new_init(struct gfs_inode *dip, struct gfs_inode *ip,
-		     void *a_data, void *d_data, unsigned int size);
-int gfs_acl_chmod(struct gfs_inode *ip, struct iattr *attr);
-
-#endif /* __ACL_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/bits.c b/gfs-kernel/src/gfs/bits.c
deleted file mode 100644
index af84bf0..0000000
--- a/gfs-kernel/src/gfs/bits.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * These routines are used by the resource group routines (rgrp.c)
- * to keep track of block allocation.  Each block is represented by two
- * bits.  One bit indicates whether or not the block is used.  (1=used,
- * 0=free)  The other bit indicates whether or not the block contains a
- * dinode or not.  (1=dinode, 0=data block) So, each byte represents
- * GFS_NBBY (i.e. 4) blocks.  
- */
-
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-
-#include "gfs.h"
-#include "bits.h"
-
-#if BITS_PER_LONG == 32
-#define LBITMASK   (0x55555555UL)
-#define LBITSKIP55 (0x55555555UL)
-#define LBITSKIP00 (0x00000000UL)
-#else
-#define LBITMASK   (0x5555555555555555UL)
-#define LBITSKIP55 (0x5555555555555555UL)
-#define LBITSKIP00 (0x0000000000000000UL)
-#endif
-
-static const char valid_change[16] = {
-	        /* current */
-	/* n */ 0, 1, 1, 1,
-	/* e */ 1, 0, 0, 0,
-	/* w */ 1, 0, 0, 1,
-	        0, 0, 1, 0
-};
-
-/**
- * gfs_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
- *
- */
-
-void
-gfs_setbit(struct gfs_rgrpd *rgd,
-	   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 / GFS_NBBY);
-	bit = (block % GFS_NBBY) * GFS_BIT_SIZE;
-	end = buffer + buflen;
-
-	gfs_assert(rgd->rd_sbd, byte < end,);
-
-	cur_state = (*byte >> bit) & GFS_BIT_MASK;
-
-	if (valid_change[new_state * 4 + cur_state]) {
-		*byte ^= cur_state << bit;
-		*byte |= new_state << bit;
-	} else
-		gfs_consist_rgrpd(rgd);
-}
-
-/**
- * gfs_testbit - test a bit in the bitmaps
- * @buffer: the buffer that holds the bitmaps
- * @buflen: the length (in bytes) of the buffer
- * @block: the block to read
- *
- */
-
-unsigned char
-gfs_testbit(struct gfs_rgrpd *rgd,
-	    unsigned char *buffer, unsigned int buflen, uint32_t block)
-{
-	unsigned char *byte, *end, cur_state;
-	unsigned int bit;
-
-	byte = buffer + (block / GFS_NBBY);
-	bit = (block % GFS_NBBY) * GFS_BIT_SIZE;
-	end = buffer + buflen;
-
-        gfs_assert(rgd->rd_sbd, byte < end,);
-
-	cur_state = (*byte >> bit) & GFS_BIT_MASK;
-
-	return cur_state;
-}
-
-/**
- * gfs_bitfit - Search an rgrp's bitmap buffer to find a bit-pair representing
- *       a block in a given allocation state.
- * @buffer: the buffer that holds the bitmaps
- * @buflen: the length (in bytes) of the buffer
- * @goal: start search at this block's bit-pair (within @buffer)
- * @old_state: GFS_BLKST_XXX the state of the block we're looking for;
- *       bit 0 = alloc(1)/free(0), bit 1 = meta(1)/data(0)
- * 
- * Scope of @goal and returned block number is only within this bitmap buffer,
- *   not entire rgrp or filesystem.
- * @buffer will be offset from the actual beginning of a bitmap block buffer,
- *   skipping any header structures.
- *
- * Return: the block number (bitmap buffer scope) that was found
- */
-
-uint32_t
-gfs_bitfit(unsigned char *buffer, unsigned int buflen,
-	   uint32_t goal, unsigned char old_state)
-{
-	const u8 *byte, *start, *end;
-	int bit, startbit;
-	u32 g1, g2, misaligned;
-	unsigned long *plong;
-	unsigned long lskipval;
-
-	lskipval = (old_state & GFS_BLKST_USED) ? LBITSKIP00 : LBITSKIP55;
-	g1 = (goal / GFS_NBBY);
-	start = buffer + g1;
-	byte = start;
-        end = buffer + buflen;
-	g2 = ALIGN(g1, sizeof(unsigned long));
-	plong = (unsigned long *)(buffer + g2);
-	startbit = bit = (goal % GFS_NBBY) * GFS_BIT_SIZE;
-	misaligned = g2 - g1;
-	if (!misaligned)
-		goto ulong_aligned;
-/* parse the bitmap a byte at a time */
-misaligned:
-	while (byte < end) {
-		if (((*byte >> bit) & GFS_BIT_MASK) == old_state) {
-			return goal +
-				(((byte - start) * GFS_NBBY) +
-				 ((bit - startbit) >> 1));
-		}
-		bit += GFS_BIT_SIZE;
-		if (bit >= GFS_NBBY * GFS_BIT_SIZE) {
-			bit = 0;
-			byte++;
-			misaligned--;
-			if (!misaligned) {
-				plong = (unsigned long *)byte;
-				goto ulong_aligned;
-			}
-		}
-	}
-	return BFITNOENT;
-
-/* parse the bitmap a unsigned long at a time */
-ulong_aligned:
-	/* Stop at "end - 1" or else prefetch can go past the end and segfault.
-	   We could "if" it but we'd lose some of the performance gained.
-	   This way will only slow down searching the very last 4/8 bytes
-	   depending on architecture.  I've experimented with several ways
-	   of writing this section such as using an else before the goto
-	   but this one seems to be the fastest. */
-	while ((unsigned char *)plong < end - sizeof(unsigned long)) {
-		prefetch(plong + 1);
-		if (((*plong) & LBITMASK) != lskipval)
-			break;
-		plong++;
-	}
-	if ((unsigned char *)plong < end) {
-		byte = (const u8 *)plong;
-		misaligned += sizeof(unsigned long) - 1;
-		goto misaligned;
-	}
-	return BFITNOENT;
-}
-
-/**
- * gfs_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
-gfs_bitcount(struct gfs_rgrpd *rgd,
-	     unsigned char *buffer, unsigned int buflen,
-	     unsigned char state)
-{
-	unsigned char *byte = buffer;
-	unsigned char *end = buffer + buflen;
-	unsigned char state1 = state << 2;
-	unsigned char state2 = state << 4;
-	unsigned char state3 = state << 6;
-	uint32_t count = 0;
-
-	for (; byte < end; byte++) {
-		if (((*byte) & 0x03) == state)
-			count++;
-		if (((*byte) & 0x0C) == state1)
-			count++;
-		if (((*byte) & 0x30) == state2)
-			count++;
-		if (((*byte) & 0xC0) == state3)
-			count++;
-	}
-
-	return count;
-}
diff --git a/gfs-kernel/src/gfs/bits.h b/gfs-kernel/src/gfs/bits.h
deleted file mode 100644
index 2a2372c..0000000
--- a/gfs-kernel/src/gfs/bits.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef __BITS_DOT_H__
-#define __BITS_DOT_H__
-
-#define BFITNOENT (0xFFFFFFFF)
-
-void gfs_setbit(struct gfs_rgrpd *rgd,
-		unsigned char *buffer, unsigned int buflen,
-		uint32_t block, unsigned char new_state);
-unsigned char gfs_testbit(struct gfs_rgrpd *rgd,
-			  unsigned char *buffer, unsigned int buflen,
-			  uint32_t block);
-uint32_t gfs_bitfit(unsigned char *buffer, unsigned int buflen,
-		    uint32_t goal, unsigned char old_state);
-uint32_t gfs_bitcount(struct gfs_rgrpd *rgd,
-		      unsigned char *buffer, unsigned int buflen,
-		      unsigned char state);
-
-#endif /* __BITS_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/bmap.c b/gfs-kernel/src/gfs/bmap.c
deleted file mode 100644
index 0efd1d1..0000000
--- a/gfs-kernel/src/gfs/bmap.c
+++ /dev/null
@@ -1,1393 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-
-#include "gfs.h"
-#include "bmap.h"
-#include "dio.h"
-#include "glock.h"
-#include "inode.h"
-#include "quota.h"
-#include "rgrp.h"
-#include "trans.h"
-
-struct metapath {
-	unsigned int mp_list[GFS_MAX_META_HEIGHT];
-};
-
-typedef int (*block_call_t) (struct gfs_inode *ip, struct buffer_head *dibh,
-			     struct buffer_head *bh, uint64_t *top,
-			     uint64_t *bottom, unsigned int height,
-			     void *data);
-
-struct strip_mine {
-	int sm_first;
-	unsigned int sm_height;
-};
-
-/**
- * gfs_unstuffer_sync - unstuff a dinode synchronously
- * @ip: the inode
- * @dibh: the dinode buffer
- * @block: the block number that was allocated
- * @private: not used
- *
- * Returns: errno
- */
-
-int
-gfs_unstuffer_sync(struct gfs_inode *ip, struct buffer_head *dibh,
-		   uint64_t block, void *private)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct buffer_head *bh;
-	int error;
-
-	error = gfs_get_data_buffer(ip, block, TRUE, &bh);
-	if (error)
-		return error;
-
-	gfs_buffer_copy_tail(bh, 0, dibh, sizeof(struct gfs_dinode));
-
-	error = gfs_dwrite(sdp, bh, DIO_DIRTY | DIO_START | DIO_WAIT);
-
-	brelse(bh);
-
-	return error;
-}
-
-/**
- * gfs_unstuffer_async - unstuff a dinode asynchronously
- * @ip: the inode
- * @dibh: the dinode buffer
- * @block: the block number that was allocated
- * @private: not used
- *
- * Returns: errno
- */
-
-int
-gfs_unstuffer_async(struct gfs_inode *ip, struct buffer_head *dibh,
-		    uint64_t block, void *private)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct buffer_head *bh;
-	int error;
-
-	error = gfs_get_data_buffer(ip, block, TRUE, &bh);
-	if (error)
-		return error;
-
-	gfs_buffer_copy_tail(bh, 0, dibh, sizeof(struct gfs_dinode));
-
-	error = gfs_dwrite(sdp, bh, DIO_DIRTY);
-
-	brelse(bh);
-
-	return error;
-}
-
-/**
- * gfs_unstuff_dinode - Unstuff a dinode when the data has grown too big
- * @ip: The GFS inode to unstuff
- * @unstuffer: the routine that handles unstuffing a non-zero length file
- * @private: private data for the unstuffer
- *
- * This routine unstuffs a dinode and returns it to a "normal" state such 
- * that the height can be grown in the traditional way.
- *
- * Returns: errno
- */
-
-int
-gfs_unstuff_dinode(struct gfs_inode *ip, gfs_unstuffer_t unstuffer,
-		   void *private)
-{
-	struct buffer_head *bh, *dibh;
-	uint64_t block = 0;
-	int journaled = gfs_is_jdata(ip);
-	int error;
-
-	down_write(&ip->i_rw_mutex);
- 
-	error = gfs_get_inode_buffer(ip, &dibh);
-	if (error)
-		goto out;
-
-	if (ip->i_di.di_size) {
-		/* Get a free block, fill it with the stuffed data,
-		   and write it out to disk */
-
-		if (journaled) {
-			error = gfs_metaalloc(ip, &block);
-			if (error)
-				goto out_brelse;
-
-			error = gfs_get_data_buffer(ip, block, TRUE, &bh);
-			if (error)
-				goto out_brelse;
-
-			gfs_buffer_copy_tail(bh, sizeof(struct gfs_meta_header),
-					     dibh, sizeof(struct gfs_dinode));
-
-			brelse(bh);
-		} else {
-			gfs_blkalloc(ip, &block);
-
-			error = unstuffer(ip, dibh, block, private);
-			if (error)
-				goto out_brelse;
-		}
-	}
-
-	/*  Set up the pointer to the new block  */
-
-	gfs_trans_add_bh(ip->i_gl, dibh);
-
-	gfs_buffer_clear_tail(dibh, sizeof(struct gfs_dinode));
-
-	if (ip->i_di.di_size) {
-		*(uint64_t *)(dibh->b_data + sizeof(struct gfs_dinode)) = cpu_to_gfs64(block);
-		ip->i_di.di_blocks++;
-	}
-
-	ip->i_di.di_height = 1;
-
-	gfs_dinode_out(&ip->i_di, dibh->b_data);
-
- out_brelse:
-	brelse(dibh);
-
- out:
- 	up_write(&ip->i_rw_mutex);
-
-	return error;
-}
-
-/**
- * calc_tree_height - Calculate the height of a metadata tree
- * @ip: The GFS inode
- * @size: The proposed size of the file
- *
- * Work out how tall a metadata tree needs to be in order to accommodate a
- * file of a particular size. If size is less than the current size of
- * the inode, then the current size of the inode is used instead of the
- * supplied one.
- *
- * Returns: the height the tree should be
- */
-
-static unsigned int
-calc_tree_height(struct gfs_inode *ip, uint64_t size)
-{
-	struct gfs_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 (gfs_is_jdata(ip)) {
-		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;
-}
-
-/**
- * build_height - Build a metadata tree of the requested height
- * @ip: The GFS inode
- * @height: The height to build to
- *
- * This routine makes sure that the metadata tree is tall enough to hold
- * "size" bytes of data.
- *
- * Returns: errno
- */
-
-static int
-build_height(struct gfs_inode *ip, int height)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct buffer_head *bh, *dibh;
-	uint64_t block, *bp;
-	unsigned int x;
-	int new_block;
-	int error;
-
-	while (ip->i_di.di_height < height) {
-		error = gfs_get_inode_buffer(ip, &dibh);
-		if (error)
-			return error;
-
-		new_block = FALSE;
-		bp = (uint64_t *)(dibh->b_data + sizeof(struct gfs_dinode));
-		for (x = 0; x < sdp->sd_diptrs; x++, bp++)
-			if (*bp) {
-				new_block = TRUE;
-				break;
-			}
-
-		if (new_block) {
-			/*  Get a new block, fill it with the old direct pointers,
-			    and write it out  */
-
-			error = gfs_metaalloc(ip, &block);
-			if (error)
-				goto fail;
-
-			error = gfs_dread(ip->i_gl, block,
-					  DIO_NEW | DIO_START | DIO_WAIT, &bh);
-			if (error)
-				goto fail;
-
-			gfs_trans_add_bh(ip->i_gl, bh);
-			gfs_metatype_set(bh,
-					 GFS_METATYPE_IN,
-					 GFS_FORMAT_IN);
-			memset(bh->b_data + sizeof(struct gfs_meta_header),
-			       0,
-			       sizeof(struct gfs_indirect) -
-			       sizeof(struct gfs_meta_header));
-			gfs_buffer_copy_tail(bh, sizeof(struct gfs_indirect),
-					     dibh, sizeof(struct gfs_dinode));
-
-			brelse(bh);
-		}
-
-		/*  Set up the new direct pointer and write it out to disk  */
-
-		gfs_trans_add_bh(ip->i_gl, dibh);
-
-		gfs_buffer_clear_tail(dibh, sizeof(struct gfs_dinode));
-
-		if (new_block) {
-			*(uint64_t *)(dibh->b_data + sizeof(struct gfs_dinode)) = cpu_to_gfs64(block);
-			ip->i_di.di_blocks++;
-		}
-
-		ip->i_di.di_height++;
-
-		gfs_dinode_out(&ip->i_di, dibh->b_data);
-		brelse(dibh);
-	}
-
-	return 0;
-
- fail:
-	brelse(dibh);
-
-	return error;
-}
-
-/**
- * find_metapath - Find path through the metadata tree
- * @ip: The inode pointer
- * @mp: The metapath to return the result in
- * @block: The disk block to look up
- *
- *   This routine returns a struct metapath structure that defines a path through
- *   the metadata of inode "ip" to get to block "block".
- *
- *   Example:
- *   Given:  "ip" is a height 3 file, "offset" is 101342453, and this is a
- *   filesystem with a blocksize of 4096.
- *
- *   find_metapath() would return a struct metapath structure set to:
- *   mp_offset = 101342453, mp_height = 3, mp_list[0] = 0, mp_list[1] = 48,
- *   and mp_list[2] = 165.
- *
- *   That means that in order to get to the block containing the byte at
- *   offset 101342453, we would load the indirect block pointed to by pointer
- *   0 in the dinode.  We would then load the indirect block pointed to by
- *   pointer 48 in that indirect block.  We would then load the data block
- *   pointed to by pointer 165 in that indirect block.
- *
- *             ----------------------------------------
- *             | Dinode |                             |
- *             |        |                            4|
- *             |        |0 1 2 3 4 5                 9|
- *             |        |                            6|
- *             ----------------------------------------
- *                       |
- *                       |
- *                       V
- *             ----------------------------------------
- *             | Indirect Block                       |
- *             |                                     5|
- *             |            4 4 4 4 4 5 5            1|
- *             |0           5 6 7 8 9 0 1            2|
- *             ----------------------------------------
- *                                |
- *                                |
- *                                V
- *             ----------------------------------------
- *             | Indirect Block                       |
- *             |                         1 1 1 1 1   5|
- *             |                         6 6 6 6 6   1|
- *             |0                        3 4 5 6 7   2|
- *             ----------------------------------------
- *                                           |
- *                                           |
- *                                           V
- *             ----------------------------------------
- *             | Data block containing offset         |
- *             |            101342453                 |
- *             |                                      |
- *             |                                      |
- *             ----------------------------------------
- *
- */
-
-static struct metapath *
-find_metapath(struct gfs_inode *ip, uint64_t block)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct metapath *mp;
-	uint64_t b = block;
-	unsigned int i;
-
-	mp = gmalloc(sizeof(struct metapath));
-	memset(mp, 0, sizeof(struct metapath));
-
-	for (i = ip->i_di.di_height; i--;)
-		mp->mp_list[i] = do_div(b, sdp->sd_inptrs);
-
-	return mp;
-}
-
-/**
- * metapointer - Return pointer to start of metadata in a buffer
- * @bh: The buffer
- * @height: The metadata height (0 = dinode)
- * @mp: The metapath 
- *
- * Return a pointer to the block number of the next height of the metadata
- * tree given a buffer containing the pointer to the current height of the
- * metadata tree.
- */
-
-static __inline__ uint64_t *
-metapointer(struct 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];
-}
-
-/**
- * get_metablock - Get the next metadata block in metadata tree
- * @ip: The GFS inode
- * @bh: Buffer containing the pointers to metadata blocks
- * @height: The height of the tree (0 = dinode)
- * @mp: The metapath
- * @create: Non-zero if we may create a new meatdata block
- * @new: Used to indicate if we did create a new metadata block
- * @block: the returned disk block number
- *
- * Given a metatree, complete to a particular height, checks to see if the next
- * height of the tree exists. If not the next height of the tree is created.
- * The block number of the next height of the metadata tree is returned.
- *
- * Returns: errno
- */
-
-static int
-get_metablock(struct gfs_inode *ip,
-	      struct buffer_head *bh, unsigned int height, struct metapath *mp,
-	      int create, int *new, uint64_t *block)
-{
-	uint64_t *ptr = metapointer(bh, height, mp);
-	int error;
-
-	if (*ptr) {
-		*block = gfs64_to_cpu(*ptr);
-		return 0;
-	}
-
-	*block = 0;
-
-	if (!create)
-		return 0;
-
-	error = gfs_metaalloc(ip, block);
-	if (error)
-		return error;
-
-	gfs_trans_add_bh(ip->i_gl, bh);
-
-	*ptr = cpu_to_gfs64(*block);
-	ip->i_di.di_blocks++;
-
-	*new = 1;
-
-	return 0;
-}
-
-/**
- * get_datablock - Get datablock number from metadata block
- * @ip: The GFS inode
- * @bh: The buffer containing pointers to datablocks
- * @mp: The metapath
- * @create: Non-zero if we may create a new data block
- * @new: Used to indicate if we created a new data block
- * @block: the returned disk block number
- *
- * Given a fully built metadata tree, checks to see if a particular data
- * block exists. It is created if it does not exist and the block number
- * on disk is returned.
- *
- * Returns: errno
- */
-
-static int
-get_datablock(struct gfs_inode *ip,
-	      struct buffer_head *bh, struct metapath *mp,
-	      int create, int *new, uint64_t *block)
-{
-	uint64_t *ptr = metapointer(bh, ip->i_di.di_height - 1, mp);
-
-	if (*ptr) {
-		*block = gfs64_to_cpu(*ptr);
-		return 0;
-	}
-
-	*block = 0;
-
-	if (!create)
-		return 0;
-
-	if (gfs_is_jdata(ip)) {
-		int error;
-		error = gfs_metaalloc(ip, block);
-		if (error)
-			return error;
-	} else
-		gfs_blkalloc(ip, block);
-
-	gfs_trans_add_bh(ip->i_gl, bh);
-
-	*ptr = cpu_to_gfs64(*block);
-	ip->i_di.di_blocks++;
-
-	*new = 1;
-
-	return 0;
-}
-
-/**
- * gfs_block_map - Map a block from an inode to a disk block
- * @ip: The GFS inode
- * @lblock: The logical block number
- * @new: Value/Result argument (1 = may create/did create new blocks)
- * @dblock: the disk block number of the start of an extent
- * @extlen: the size of the extent
- *
- * Find the block number on the current device which corresponds to an
- * inode's block. If the block had to be created, "new" will be set.
- *
- * Returns: errno
- */
-
-int
-gfs_block_map(struct gfs_inode *ip,
-	      uint64_t lblock, int *new,
-	      uint64_t *dblock, uint32_t *extlen)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct buffer_head *bh;
-	struct metapath *mp;
-	int create = *new;
-	unsigned int bsize;
-	unsigned int height;
-	unsigned int end_of_metadata;
-	unsigned int x;
-	int error = 0;
-
-	*new = 0;
-	*dblock = 0;
-	if (extlen)
-		*extlen = 0;
-
-	if (create)
-		down_write(&ip->i_rw_mutex);
-	else
-		down_read(&ip->i_rw_mutex);
-
-	if (gfs_assert_warn(sdp, !gfs_is_stuffed(ip)))
-		goto out;
-
-	bsize = (gfs_is_jdata(ip)) ? sdp->sd_jbsize : sdp->sd_sb.sb_bsize;
-
-	height = calc_tree_height(ip, (lblock + 1) * bsize);
-	if (ip->i_di.di_height < height) {
-		if (!create)
-			goto out;
-
-		error = build_height(ip, height);
-		if (error)
-			goto out;
-	}
-
-	mp = find_metapath(ip, lblock);
-	end_of_metadata = ip->i_di.di_height - 1;
-
-	error = gfs_get_inode_buffer(ip, &bh);
-	if (error)
-		goto out_kfree;
-
-	for (x = 0; x < end_of_metadata; x++) {
-		error = get_metablock(ip, bh, x, mp, create, new, dblock);
-		brelse(bh);
-		if (error || !*dblock)
-			goto out_kfree;
-
-		error = gfs_get_meta_buffer(ip, x + 1, *dblock, *new, &bh);
-		if (error)
-			goto out_kfree;
-	}
-
-	error = get_datablock(ip, bh, mp, create, new, dblock);
-	if (error) {
-		brelse(bh);
-		goto out_kfree;
-	}
-
-	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) {
-				get_datablock(ip, bh, mp,
-					      FALSE, &tmp_new,
-					      &tmp_dblock);
-
-				if (*dblock + *extlen != tmp_dblock)
-					break;
-
-				(*extlen)++;
-			}
-		}
-	}
-
-	brelse(bh);
-
-	if (*new) {
-		error = gfs_get_inode_buffer(ip, &bh);
-		if (!error) {
-			gfs_trans_add_bh(ip->i_gl, bh);
-			gfs_dinode_out(&ip->i_di, bh->b_data);
-			brelse(bh);
-		}
-	}
-
- out_kfree:
-	kfree(mp);
-
- out:
-	if (create)
-		up_write(&ip->i_rw_mutex);
-	else
-		up_read(&ip->i_rw_mutex);
- 
-	return error;
-}
-
-/**
- * do_grow - Make a file look bigger than it is
- * @ip: the inode
- * @size: the size to set the file to
- *
- * Called with an exclusive lock on @ip.
- *
- * Returns: errno
- */
-
-static int
-do_grow(struct gfs_inode *ip, uint64_t size)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_alloc *al;
-	struct buffer_head *dibh;
-	unsigned int h;
-	int journaled = gfs_is_jdata(ip);
-	int error;
-
-	al = gfs_alloc_get(ip);
-
-	error = gfs_quota_lock_m(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
-	if (error)
-		goto out;
-
-	error = gfs_quota_check(ip, ip->i_di.di_uid, ip->i_di.di_gid);
-	if (error)
-		goto out_gunlock_q;
-
-	if (journaled)
-		al->al_requested_meta = sdp->sd_max_height + 1;
-	else {
-		al->al_requested_meta = sdp->sd_max_height;
-		al->al_requested_data = 1;
-	}
-
-	error = gfs_inplace_reserve(ip);
-	if (error)
-		goto out_gunlock_q;
-
-	/* Trans may require:
-	   Full extention of the metadata tree, block allocation,
-	   a dinode modification, and a quota change */
-
-	error = gfs_trans_begin(sdp,
-				sdp->sd_max_height + al->al_rgd->rd_ri.ri_length +
-				1 + !!journaled,
-				1);
-	if (error)
-		goto out_ipres;
-
-	if (size > sdp->sd_sb.sb_bsize - sizeof(struct gfs_dinode)) {
-		if (gfs_is_stuffed(ip)) {
-			error = gfs_unstuff_dinode(ip, gfs_unstuffer_sync, NULL);
-			if (error)
-				goto out_end_trans;
-		}
-
-		h = calc_tree_height(ip, size);
-		if (ip->i_di.di_height < h) {
-			down_write(&ip->i_rw_mutex);
-			error = build_height(ip, h);
-			up_write(&ip->i_rw_mutex);
-			if (error)
-				goto out_end_trans;
-		}
-	}
-
-	ip->i_di.di_size = size;
-	ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds();
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-	if (error)
-		goto out_end_trans;
-
-	gfs_trans_add_bh(ip->i_gl, dibh);
-	gfs_dinode_out(&ip->i_di, dibh->b_data);
-	brelse(dibh);
-
- out_end_trans:
-	gfs_trans_end(sdp);
-
- out_ipres:
-	gfs_inplace_release(ip);
-
- out_gunlock_q:
-	gfs_quota_unlock_m(ip);
-
- out:
-	gfs_alloc_put(ip);
-
-	return error;
-}
-
-/**
- * recursive_scan - recursively scan through the end of a file
- * @ip: the inode
- * @dibh: the dinode buffer
- * @mp: the path through the metadata to the point to start
- * @height: the height the recursion is at
- * @block: the indirect block to look at
- * @first: TRUE if this is the first block
- * @bc: the call to make for each piece of metadata
- * @data: data opaque to this function to pass to @bc
- *
- * When this is first called @height and @block should be zero and
- * @first should be TRUE.
- *
- * Returns: errno
- */
-
-static int
-recursive_scan(struct gfs_inode *ip, struct buffer_head *dibh,
-	       struct metapath *mp, unsigned int height, uint64_t block,
-	       int first, block_call_t bc, void *data)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct buffer_head *bh = NULL;
-	uint64_t *top, *bottom;
-	uint64_t bn;
-	int error;
-
-	if (!height) {
-		error = gfs_get_inode_buffer(ip, &bh);
-		if (error)
-			goto fail;
-		dibh = bh;
-
-		top = (uint64_t *)(bh->b_data + sizeof(struct gfs_dinode)) +
-			mp->mp_list[0];
-		bottom = (uint64_t *)(bh->b_data + sizeof(struct gfs_dinode)) +
-			sdp->sd_diptrs;
-	} else {
-		error = gfs_get_meta_buffer(ip, height, block, FALSE, &bh);
-		if (error)
-			goto fail;
-
-		top = (uint64_t *)(bh->b_data + sizeof(struct gfs_indirect)) +
-			((first) ? mp->mp_list[height] : 0);
-		bottom = (uint64_t *)(bh->b_data + sizeof(struct gfs_indirect)) +
-			sdp->sd_inptrs;
-	}
-
-	error = bc(ip, dibh, bh, top, bottom, height, data);
-	if (error)
-		goto fail;
-
-	if (height < ip->i_di.di_height - 1)
-		for (; top < bottom; top++, first = FALSE) {
-			if (!*top)
-				continue;
-
-			bn = gfs64_to_cpu(*top);
-
-			error = recursive_scan(ip, dibh, mp,
-					       height + 1, bn, first,
-					       bc, data);
-			if (error)
-				goto fail;
-		}
-
-	brelse(bh);
-
-	return 0;
-
- fail:
-	if (bh)
-		brelse(bh);
-
-	return error;
-}
-
-/**
- * do_strip - Look for a layer a particular layer of the file and strip it off
- * @ip: the inode
- * @dibh: the dinode buffer
- * @bh: A buffer of pointers
- * @top: The first pointer in the buffer
- * @bottom: One more than the last pointer
- * @height: the height this buffer is at
- * @data: a pointer to a struct strip_mine
- *
- * Returns: errno
- */
-
-static int
-do_strip(struct gfs_inode *ip, struct buffer_head *dibh,
-	 struct buffer_head *bh, uint64_t *top, uint64_t *bottom,
-	 unsigned int height, void *data)
-{
-	struct strip_mine *sm = (struct strip_mine *)data;
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_rgrp_list rlist;
-	uint64_t bn, bstart;
-	uint32_t blen;
-	uint64_t *p;
-	unsigned int rg_blocks = 0;
-	int metadata;
-	int x;
-	int error;
-
-	if (!*top)
-		sm->sm_first = FALSE;
-
-	if (height != sm->sm_height)
-		return 0;
-
-	if (sm->sm_first) {
-		top++;
-		sm->sm_first = FALSE;
-	}
-
-	metadata = (height != ip->i_di.di_height - 1) || gfs_is_jdata(ip);
-
-	error = gfs_rindex_hold(sdp, &ip->i_alloc->al_ri_gh);
-	if (error)
-		return error;
-
-	memset(&rlist, 0, sizeof(struct gfs_rgrp_list));
-	bstart = 0;
-	blen = 0;
-
-	for (p = top; p < bottom; p++) {
-		if (!*p)
-			continue;
-
-		bn = gfs64_to_cpu(*p);
-
-		if (bstart + blen == bn)
-			blen++;
-		else {
-			if (bstart)
-				gfs_rlist_add(sdp, &rlist, bstart);
-
-			bstart = bn;
-			blen = 1;
-		}
-	}
-
-	if (bstart)
-		gfs_rlist_add(sdp, &rlist, bstart);
-	else
-		goto out; /* Nothing to do */
-
-	gfs_rlist_alloc(&rlist, LM_ST_EXCLUSIVE, 0);
-
-	for (x = 0; x < rlist.rl_rgrps; x++) {
-		struct gfs_rgrpd *rgd;
-		rgd = get_gl2rgd(rlist.rl_ghs[x].gh_gl);
-		rg_blocks += rgd->rd_ri.ri_length;
-	}
-
-	error = gfs_glock_nq_m(rlist.rl_rgrps, rlist.rl_ghs);
-	if (error)
-		goto out_rlist;
-
-	/* Trans may require:
-	   All the bitmaps that were reserved. 
-	   One block for the dinode.
-	   One block for the indirect block being cleared.
-	   One block for a quota change. */
-
-	error = gfs_trans_begin(sdp, rg_blocks + 2, 1);
-	if (error)
-		goto out_rg_gunlock;
-
-	down_write(&ip->i_rw_mutex);
-
-	gfs_trans_add_bh(ip->i_gl, dibh);
-	gfs_trans_add_bh(ip->i_gl, bh);
-
-	bstart = 0;
-	blen = 0;
-
-	for (p = top; p < bottom; p++) {
-		if (!*p)
-			continue;
-
-		bn = gfs64_to_cpu(*p);
-
-		if (bstart + blen == bn)
-			blen++;
-		else {
-			if (bstart) {
-				if (metadata)
-					gfs_metafree(ip, bstart, blen);
-				else
-					gfs_blkfree(ip, bstart, blen);
-			}
-
-			bstart = bn;
-			blen = 1;
-		}
-
-		*p = 0;
-		if (!ip->i_di.di_blocks)
-			gfs_consist_inode(ip);
-		ip->i_di.di_blocks--;
-	}
-	if (bstart) {
-		if (metadata)
-			gfs_metafree(ip, bstart, blen);
-		else
-			gfs_blkfree(ip, bstart, blen);
-	}
-
-	ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds();
-
-	gfs_dinode_out(&ip->i_di, dibh->b_data);
-
-	up_write(&ip->i_rw_mutex);
-
-	gfs_trans_end(sdp);
-
- out_rg_gunlock:
-	gfs_glock_dq_m(rlist.rl_rgrps, rlist.rl_ghs);
-
- out_rlist:
-	gfs_rlist_free(&rlist);
-
- out:
-	gfs_glock_dq_uninit(&ip->i_alloc->al_ri_gh);
-
-	return error;
-}
-
-/**
- * gfs_truncator_default - truncate a partial data block
- * @ip: the inode
- * @size: the size the file should be
- *
- * Returns: errno
- */
-
-int
-gfs_truncator_default(struct gfs_inode *ip, uint64_t size)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct buffer_head *bh;
-	uint64_t bn;
-	int not_new = 0;
-	int error;
-
-	error = gfs_block_map(ip, size >> sdp->sd_sb.sb_bsize_shift, &not_new,
-			      &bn, NULL);
-	if (error)
-		return error;
-	if (!bn)
-		return 0;
-
-	error = gfs_get_data_buffer(ip, bn, FALSE, &bh);
-	if (error)
-		return error;
-
-	gfs_buffer_clear_tail(bh, size & (sdp->sd_sb.sb_bsize - 1));
-
-	error = gfs_dwrite(sdp, bh, DIO_DIRTY);
-
-	brelse(bh);
-
-	return error;
-}
-
-/**
- * truncator_journaled - truncate a partial data block
- * @ip: the inode
- * @size: the size the file should be
- *
- * Returns: errno
- */
-
-static int
-truncator_journaled(struct gfs_inode *ip, uint64_t size)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct buffer_head *bh;
-	uint64_t lbn, dbn;
-	uint32_t off;
-	int not_new = 0;
-	int error;
-
-	lbn = size;
-	off = do_div(lbn, sdp->sd_jbsize);
-
-	error = gfs_block_map(ip, lbn, &not_new, &dbn, NULL);
-	if (error)
-		return error;
-	if (!dbn)
-		return 0;
-
-	error = gfs_trans_begin(sdp, 1, 0);
-	if (error)
-		return error;
-
-	error = gfs_get_data_buffer(ip, dbn, FALSE, &bh);
-	if (!error) {
-		gfs_trans_add_bh(ip->i_gl, bh);
-		gfs_buffer_clear_tail(bh,
-				      sizeof(struct gfs_meta_header) +
-				      off);
-		brelse(bh);
-	}
-
-	gfs_trans_end(sdp);
-
-	return error;
-}
-
-/**
- * gfs_shrink - make a file smaller
- * @ip: the inode
- * @size: the size to make the file
- * @truncator: function to truncate the last partial block
- *
- * Called with an exclusive lock on @ip.
- *
- * Returns: errno
- */
-
-int
-gfs_shrink(struct gfs_inode *ip, uint64_t size, gfs_truncator_t truncator)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_holder ri_gh;
-	struct gfs_rgrpd *rgd;
-	struct buffer_head *dibh;
-	uint64_t block;
-	unsigned int height;
-	int journaled = gfs_is_jdata(ip);
-	int error;
-
-	if (!size)
-		block = 0;
-	else if (journaled) {
-		block = size - 1;
-		do_div(block, sdp->sd_jbsize);
-	}
-	else
-		block = (size - 1) >> sdp->sd_sb.sb_bsize_shift;
-
-	/*  Get rid of all the data/metadata blocks  */
-
-	height = ip->i_di.di_height;
-	if (height) {
-		struct metapath *mp = find_metapath(ip, block);
-		gfs_alloc_get(ip);
-
-		error = gfs_quota_hold_m(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
-		if (error) {
-			gfs_alloc_put(ip);
-			kfree(mp);
-			return error;
-		}
-
-		while (height--) {
-			struct strip_mine sm;
-
-			sm.sm_first = (size) ? TRUE : FALSE;
-			sm.sm_height = height;
-
-			error = recursive_scan(ip, NULL, mp, 0, 0, TRUE,
-					       do_strip, &sm);
-			if (error) {
-				gfs_quota_unhold_m(ip);
-				gfs_alloc_put(ip);
-				kfree(mp);
-				return error;
-			}
-		}
-
-		gfs_quota_unhold_m(ip);
-		gfs_alloc_put(ip);
-		kfree(mp);
-	}
-
-	/*  If we truncated in the middle of a block, zero out the leftovers.  */
-
-	if (gfs_is_stuffed(ip)) {
-		/*  Do nothing  */
-	} else if (journaled) {
-		if (do_mod(size, sdp->sd_jbsize)) {
-			error = truncator_journaled(ip, size);
-			if (error)
-				return error;
-		}
-	} else if (size & (uint64_t)(sdp->sd_sb.sb_bsize - 1)) {
-		error = truncator(ip, size);
-		if (error)
-			return error;
-	}
-
-	/*  Set the new size (and possibly the height)  */
-
-	if (!size) {
-		error = gfs_rindex_hold(sdp, &ri_gh);
-		if (error)
-			return error;
-	}
-
-	error = gfs_trans_begin(sdp, 1, 0);
-	if (error)
-		goto out;
-
-	down_write(&ip->i_rw_mutex);
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-	if (error)
-		goto out_end_trans;
-
-	if (!size) {
-		ip->i_di.di_height = 0;
-
-		rgd = gfs_blk2rgrpd(sdp, ip->i_num.no_addr);
-		if (!rgd) {
-			gfs_consist_inode(ip);
-			error = -EIO;
-			goto out_end_trans;
-		}
-
-		ip->i_di.di_goal_rgrp = rgd->rd_ri.ri_addr;
-		ip->i_di.di_goal_dblk =
-			ip->i_di.di_goal_mblk =
-			ip->i_num.no_addr - rgd->rd_ri.ri_data1;
-	}
-
-	ip->i_di.di_size = size;
-	ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds();
-
-	gfs_trans_add_bh(ip->i_gl, dibh);
-
-	if (!ip->i_di.di_height &&
-	    size < sdp->sd_sb.sb_bsize - sizeof(struct gfs_dinode))
-		gfs_buffer_clear_tail(dibh, sizeof(struct gfs_dinode) + size);
-
-	gfs_dinode_out(&ip->i_di, dibh->b_data);
-	brelse(dibh);
-
- out_end_trans:
-	up_write(&ip->i_rw_mutex);
-
-	gfs_trans_end(sdp);
-
- out:
-	if (!size)
-		gfs_glock_dq_uninit(&ri_gh);
-
-	return error;
-}
-
-/**
- * do_same - truncate to same size (update time stamps)
- * @ip: 
- *
- * Returns: errno
- */
-
-static int
-do_same(struct gfs_inode *ip)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct buffer_head *dibh;
-	int error;
-
-	error = gfs_trans_begin(sdp, 1, 0);
-	if (error)
-		return error;
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-	if (error)
-		goto out;
-
-	ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds();
-
-	gfs_trans_add_bh(ip->i_gl, dibh);
-	gfs_dinode_out(&ip->i_di, dibh->b_data);
-
-	brelse(dibh);
-
- out:
-	gfs_trans_end(sdp);
-
-	return error;
-}
-
-/**
- * gfs_truncatei - make a file a give size
- * @ip: the inode
- * @size: the size to make the file
- * @truncator: function to truncate the last partial block
- *
- * The file size can grow, shrink, or stay the same size.
- *
- * Returns: errno
- */
-
-int
-gfs_truncatei(struct gfs_inode *ip, uint64_t size,
-	      gfs_truncator_t truncator)
-{
-	if (gfs_assert_warn(ip->i_sbd, ip->i_di.di_type == GFS_FILE_REG))
-		return -EINVAL;
-
-	if (size == ip->i_di.di_size)
-		return do_same(ip);
-	else if (size > ip->i_di.di_size)
-		return do_grow(ip, size);
-	else
-		return gfs_shrink(ip, size, truncator);
-}
-
-/**
- * gfs_write_calc_reserv - calculate the number of blocks needed to write to a file
- * @ip: the file
- * @len: the number of bytes to be written to the file
- * @data_blocks: returns the number of data blocks required
- * @ind_blocks: returns the number of indirect blocks required
- *
- */
-
-void
-gfs_write_calc_reserv(struct gfs_inode *ip, unsigned int len,
-		      unsigned int *data_blocks, unsigned int *ind_blocks)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	unsigned int tmp;
-
-	if (gfs_is_jdata(ip)) {
-		*data_blocks = DIV_RU(len, sdp->sd_jbsize) + 2;
-		*ind_blocks = 3 * (sdp->sd_max_jheight - 1);
-	} else {
-		*data_blocks = (len >> sdp->sd_sb.sb_bsize_shift) + 3;
-		*ind_blocks = 3 * (sdp->sd_max_height - 1);
-	}
-
-	for (tmp = *data_blocks; tmp > sdp->sd_diptrs;) {
-		tmp = DIV_RU(tmp, sdp->sd_inptrs);
-		*ind_blocks += tmp;
-	}
-}
-
-/**
- * gfs_write_alloc_required - figure out if a write is going to require an allocation
- * @ip: the file being written to
- * @offset: the offset to write to
- * @len: the number of bytes being written
- * @alloc_required: the int is set to TRUE if an alloc is required, FALSE otherwise
- *
- * Returns: errno
- */
-
-int
-gfs_write_alloc_required(struct gfs_inode *ip,
-			 uint64_t offset, unsigned int len,
-			 int *alloc_required)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	uint64_t lblock, lblock_stop, dblock;
-	uint32_t extlen;
-	int not_new = FALSE;
-	int error = 0;
-
-	*alloc_required = FALSE;
-
-	if (!len)
-		return 0;
-
-	if (gfs_is_stuffed(ip)) {
-		if (offset + len > sdp->sd_sb.sb_bsize - sizeof(struct gfs_dinode))
-			*alloc_required = TRUE;
-		return 0;
-	}
-
-	if (gfs_is_jdata(ip)) {
-		unsigned int bsize = sdp->sd_jbsize;
-		lblock = offset;
-		do_div(lblock, bsize);
-		lblock_stop = offset + len + bsize - 1;
-		do_div(lblock_stop, bsize);
-	} else {
-		unsigned int shift = sdp->sd_sb.sb_bsize_shift;
-		lblock = offset >> shift;
-		lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift;
-	}
-
-	for (; lblock < lblock_stop; lblock += extlen) {
-		error = gfs_block_map(ip, lblock, &not_new, &dblock, &extlen);
-		if (error)
-			return error;
-
-		if (!dblock) {
-			*alloc_required = TRUE;
-			return 0;
-		}
-	}
-
-	return 0;
-}
-
-/**
- * do_gfm - Copy out the dinode/indirect blocks of a file
- * @ip: the file
- * @dibh: the dinode buffer
- * @bh: the indirect buffer we're looking at
- * @top: the first pointer in the block
- * @bottom: one more than the last pointer in the block
- * @height: the height the block is at
- * @data: a pointer to a struct gfs_user_buffer structure
- *
- * If this is a journaled file, copy out the data too.
- *
- * Returns: errno
- */
-
-static int
-do_gfm(struct gfs_inode *ip, struct buffer_head *dibh,
-       struct buffer_head *bh, uint64_t *top, uint64_t *bottom,
-       unsigned int height, void *data)
-{
-	struct gfs_user_buffer *ub = (struct gfs_user_buffer *)data;
-	int error;
-
-	error = gfs_add_bh_to_ub(ub, bh);
-	if (error)
-		return error;
-
-	if (ip->i_di.di_type != GFS_FILE_DIR ||
-	    height + 1 != ip->i_di.di_height)
-		return 0;
-
-	for (; top < bottom; top++)
-		if (*top) {
-			struct buffer_head *data_bh;
-
-			error = gfs_dread(ip->i_gl, gfs64_to_cpu(*top),
-					  DIO_START | DIO_WAIT,
-					  &data_bh);
-			if (error)
-				return error;
-
-			error = gfs_add_bh_to_ub(ub, data_bh);
-
-			brelse(data_bh);
-
-			if (error)
-				return error;
-		}
-
-	return 0;
-}
-
-/**
- * gfs_get_file_meta - return all the metadata for a file
- * @ip: the file
- * @ub: the structure representing the meta
- *
- * Returns: errno
- */
-
-int
-gfs_get_file_meta(struct gfs_inode *ip, struct gfs_user_buffer *ub)
-{
-	int error;
-
-	if (gfs_is_stuffed(ip)) {
-		struct buffer_head *dibh;
-		error = gfs_get_inode_buffer(ip, &dibh);
-		if (!error) {
-			error = gfs_add_bh_to_ub(ub, dibh);
-			brelse(dibh);
-		}
-	} else {
-		struct metapath *mp = find_metapath(ip, 0);
-		error = recursive_scan(ip, NULL, mp, 0, 0, TRUE, do_gfm, ub);
-		kfree(mp);
-	}
-
-	return error;
-}
diff --git a/gfs-kernel/src/gfs/bmap.h b/gfs-kernel/src/gfs/bmap.h
deleted file mode 100644
index b9ce2e7..0000000
--- a/gfs-kernel/src/gfs/bmap.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef __BMAP_DOT_H__
-#define __BMAP_DOT_H__
-
-typedef int (*gfs_unstuffer_t) (struct gfs_inode * ip,
-				struct buffer_head * dibh, uint64_t block,
-				void *private);
-
-int gfs_unstuffer_sync(struct gfs_inode *ip, struct buffer_head *dibh,
-		       uint64_t block, void *private);
-int gfs_unstuffer_async(struct gfs_inode *ip, struct buffer_head *dibh,
-			uint64_t block, void *private);
-
-int gfs_unstuff_dinode(struct gfs_inode *ip, gfs_unstuffer_t unstuffer,
-		       void *private);
-
-int gfs_block_map(struct gfs_inode *ip,
-		  uint64_t lblock, int *new,
-		  uint64_t *dblock, uint32_t *extlen);
-
-typedef int (*gfs_truncator_t) (struct gfs_inode * ip, uint64_t size);
-
-int gfs_truncator_default(struct gfs_inode *ip, uint64_t size);
-
-int gfs_shrink(struct gfs_inode *ip, uint64_t size, gfs_truncator_t truncator);
-int gfs_truncatei(struct gfs_inode *ip, uint64_t size,
-		  gfs_truncator_t truncator);
-
-void gfs_write_calc_reserv(struct gfs_inode *ip, unsigned int len,
-			   unsigned int *data_blocks, unsigned int *ind_blocks);
-int gfs_write_alloc_required(struct gfs_inode *ip, uint64_t offset,
-			     unsigned int len, int *alloc_required);
-
-int gfs_get_file_meta(struct gfs_inode *ip, struct gfs_user_buffer *ub);
-
-#endif /* __BMAP_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/daemon.c b/gfs-kernel/src/gfs/daemon.c
deleted file mode 100644
index 378e0a7..0000000
--- a/gfs-kernel/src/gfs/daemon.c
+++ /dev/null
@@ -1,181 +0,0 @@
-#include <linux/kthread.h>
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/buffer_head.h>
-
-#include "gfs.h"
-#include "daemon.h"
-#include "glock.h"
-#include "log.h"
-#include "quota.h"
-#include "recovery.h"
-#include "super.h"
-#include "unlinked.h"
-
-/**
- * gfs_scand - Look for cached glocks and inodes to toss from memory
- * @sdp: Pointer to GFS superblock
- *
- * One of these daemons runs, finding candidates to add to sd_reclaim_list.
- * See gfs_glockd()
- */
-
-int
-gfs_scand(void *data)
-{
-	struct gfs_sbd *sdp = (struct gfs_sbd *)data;
-
-	while (!kthread_should_stop()) {
-		gfs_scand_internal(sdp);
-		schedule_timeout_interruptible(gfs_tune_get(sdp, gt_scand_secs) * HZ);
-	}
-
-	return 0;
-}
-
-/**
- * gfs_glockd - Reclaim unused glock structures
- * @sdp: Pointer to GFS superblock
- *
- * One or more of these daemons run, reclaiming glocks on sd_reclaim_list.
- * sd_glockd_num says how many daemons are running now.
- * Number of daemons can be set by user, with num_glockd mount option.
- * See gfs_scand()
- */
-
-int
-gfs_glockd(void *data)
-{
-	struct gfs_sbd *sdp = (struct gfs_sbd *)data;
-
-	while (!kthread_should_stop()) {
-		while (atomic_read(&sdp->sd_reclaim_count))
-			gfs_reclaim_glock(sdp);
-
-		wait_event_interruptible(sdp->sd_reclaim_wchan,
-								 (atomic_read(&sdp->sd_reclaim_count) ||
-								  kthread_should_stop()));
-	}
-
-	return 0;
-}
-
-/**
- * gfs_recoverd - Recover dead machine's journals
- * @sdp: Pointer to GFS superblock
- *
- */
-
-int
-gfs_recoverd(void *data)
-{
-	struct gfs_sbd *sdp = (struct gfs_sbd *)data;
-
-	while (!kthread_should_stop()) {
-		gfs_check_journals(sdp);
-		schedule_timeout_interruptible(gfs_tune_get(sdp, gt_recoverd_secs) * HZ);
-	}
-
-	return 0;
-}
-
-/**
- * gfs_logd - Update log tail as Active Items get flushed to in-place blocks
- * @sdp: Pointer to GFS superblock
- *
- * Also, periodically check to make sure that we're using the most recent
- * journal index.
- */
-
-int
-gfs_logd(void *data)
-{
-	struct gfs_sbd *sdp = (struct gfs_sbd *)data;
-	struct gfs_holder ji_gh;
-
-	while (!kthread_should_stop()) {
-		/* Advance the log tail */
-		gfs_ail_empty(sdp);
-
-		/* Check for latest journal index */
-		if (time_after_eq(jiffies,
-				  sdp->sd_jindex_refresh_time +
-				  gfs_tune_get(sdp, gt_jindex_refresh_secs) * HZ)) {
-			if (test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags) &&
-			    !gfs_jindex_hold(sdp, &ji_gh))
-				gfs_glock_dq_uninit(&ji_gh);
-			sdp->sd_jindex_refresh_time = jiffies;
-		}
-
-		schedule_timeout_interruptible(gfs_tune_get(sdp, gt_logd_secs) * HZ);
-	}
-
-	return 0;
-}
-
-/**
- * gfs_quotad - Write cached quota changes into the quota file
- * @sdp: Pointer to GFS superblock
- *
- */
-
-int
-gfs_quotad(void *data)
-{
-	struct gfs_sbd *sdp = (struct gfs_sbd *)data;
-	int error;
-
-	while (!kthread_should_stop()) {
-		/* Update statfs file */
-		if (gfs_tune_get(sdp, gt_statfs_fast) &&
-			time_after_eq(jiffies,
-			sdp->sd_statfs_sync_time +
-			gfs_tune_get(sdp, gt_statfs_fast) * HZ)) {
-			error = gfs_statfs_sync(sdp);
-			if (error && error != -EROFS &&
-				!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))
-				printk("GFS: fsid=%s: statfs: error = %d\n",
-				sdp->sd_fsname, error);
-				sdp->sd_statfs_sync_time = jiffies;
-		}
-		/* Update quota file */
-		if (time_after_eq(jiffies,
-				  sdp->sd_quota_sync_time +
-				  gfs_tune_get(sdp, gt_quota_quantum) * HZ)) {
-			error = gfs_quota_sync(sdp);
-			if (error &&
-			    error != -EROFS &&
-			    !test_bit(SDF_SHUTDOWN, &sdp->sd_flags))
-				printk("GFS: fsid=%s: quotad: error = %d\n",
-				       sdp->sd_fsname, error);
-			sdp->sd_quota_sync_time = jiffies;
-		}
-
-		/* Clean up */
-		gfs_quota_scan(sdp);
-		schedule_timeout_interruptible(gfs_tune_get(sdp, gt_quotad_secs) * HZ);
-	}
-
-	return 0;
-}
-
-/**
- * gfs_inoded - Deallocate unlinked inodes
- * @sdp: Pointer to GFS superblock
- *
- */
-
-int
-gfs_inoded(void *data)
-{
-	struct gfs_sbd *sdp = (struct gfs_sbd *)data;
-
-	while (!kthread_should_stop()) {
-		gfs_unlinked_dealloc(sdp);
-		schedule_timeout_interruptible(gfs_tune_get(sdp, gt_inoded_secs) * HZ);
-	}
-
-	return 0;
-}
diff --git a/gfs-kernel/src/gfs/daemon.h b/gfs-kernel/src/gfs/daemon.h
deleted file mode 100644
index 882c72f..0000000
--- a/gfs-kernel/src/gfs/daemon.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __DAEMON_DOT_H__
-#define __DAEMON_DOT_H__
-
-int gfs_scand(void *data);
-int gfs_glockd(void *data);
-int gfs_recoverd(void *data);
-int gfs_logd(void *data);
-int gfs_quotad(void *data);
-int gfs_inoded(void *data);
-
-#endif /* __DAEMON_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/dio.c b/gfs-kernel/src/gfs/dio.c
deleted file mode 100644
index 0d09023..0000000
--- a/gfs-kernel/src/gfs/dio.c
+++ /dev/null
@@ -1,1342 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <linux/mm.h>
-#include <linux/pagemap.h>
-#include <linux/writeback.h>
-
-#include "gfs.h"
-#include "dio.h"
-#include "glock.h"
-#include "glops.h"
-#include "inode.h"
-#include "log.h"
-#include "lops.h"
-#include "rgrp.h"
-#include "trans.h"
-
-#define buffer_busy(bh) ((bh)->b_state & ((1ul << BH_Dirty) | (1ul << BH_Lock)))
-
-/**
- * aspace_get_block - 
- * @inode:
- * @lblock:
- * @bh_result:
- * @create:
- *
- * Returns: errno
- */
-
-static int
-aspace_get_block(struct inode *inode, sector_t lblock,
-		 struct buffer_head *bh_result, int create)
-{
-	gfs_assert_warn(get_v2sdp(inode->i_sb), FALSE);
-	return -ENOSYS;
-}
-
-/**
- * gfs_aspace_writepage - write an aspace page
- * @page: the page
- * @wbc:
- *
- * Returns: errno
- */
-
-static int 
-gfs_aspace_writepage(struct page *page, struct writeback_control *wbc)
-{
-	return block_write_full_page(page, aspace_get_block, wbc);
-}
-
-/**
- * stuck_releasepage - We're stuck in gfs_releasepage().  Print stuff out.
- * @bh: the buffer we're stuck on
- *
- */
-
-static void
-stuck_releasepage(struct buffer_head *bh)
-{
-	struct gfs_sbd *sdp = get_v2sdp(bh->b_page->mapping->host->i_sb);
-	struct gfs_bufdata *bd = get_v2bd(bh);
-
-	printk("GFS: fsid=%s: stuck in gfs_releasepage()...\n", sdp->sd_fsname);
-	printk("GFS: fsid=%s: blkno = %"PRIu64", bh->b_count = %d\n",
-	       sdp->sd_fsname,
-	       (uint64_t)bh->b_blocknr,
-	       atomic_read(&bh->b_count));
-	printk("GFS: fsid=%s: get_v2bd(bh) = %s\n",
-	       sdp->sd_fsname,
-	       (bd) ? "!NULL" : "NULL");
-
-	if (bd) {
-		struct gfs_glock *gl = bd->bd_gl;
-
-		printk("GFS: fsid=%s: gl = (%u, %"PRIu64")\n",
-		       sdp->sd_fsname,
-		       gl->gl_name.ln_type,
-		       gl->gl_name.ln_number);
-
-		printk("GFS: fsid=%s: bd_new_le.le_trans = %s\n",
-		       sdp->sd_fsname,
-		       (bd->bd_new_le.le_trans) ? "!NULL" : "NULL");
-		printk("GFS: fsid=%s: bd_incore_le.le_trans = %s\n",
-		       sdp->sd_fsname,
-		       (bd->bd_incore_le.le_trans) ? "!NULL" : "NULL");
-		printk("GFS: fsid=%s: bd_frozen = %s\n",
-		       sdp->sd_fsname,
-		       (bd->bd_frozen) ? "!NULL" : "NULL");
-		printk("GFS: fsid=%s: bd_pinned = %u\n",
-		       sdp->sd_fsname, bd->bd_pinned);
-		printk("GFS: fsid=%s: bd_ail_tr_list = %s\n",
-		       sdp->sd_fsname,
-		       (list_empty(&bd->bd_ail_tr_list)) ? "Empty" : "!Empty");
-
-		if (gl->gl_ops == &gfs_inode_glops) {
-			struct gfs_inode *ip = get_gl2ip(gl);
-
-			if (ip) {
-				unsigned int x;
-
-				printk("GFS: fsid=%s: ip = %"PRIu64"/%"PRIu64"\n",
-				       sdp->sd_fsname,
-				       ip->i_num.no_formal_ino,
-				       ip->i_num.no_addr);
-				printk("GFS: fsid=%s: ip->i_count = %d, ip->i_vnode = %s\n",
-				     sdp->sd_fsname,
-				     atomic_read(&ip->i_count),
-				     (ip->i_vnode) ? "!NULL" : "NULL");
-				for (x = 0; x < GFS_MAX_META_HEIGHT; x++)
-					printk("GFS: fsid=%s: ip->i_cache[%u] = %s\n",
-					       sdp->sd_fsname, x,
-					       (ip->i_cache[x]) ? "!NULL" : "NULL");
-			}
-		}
-	}
-}
-
-/**
- * gfs_aspace_releasepage - free the metadata associated with a page 
- * @page: the page that's being released
- * @gfp_mask: passed from Linux VFS, ignored by us
- *
- * Call try_to_free_buffers() if the buffers in this page can be
- * released.
- *
- * Returns: 0
- */
-
-static int
-gfs_aspace_releasepage(struct page *page, gfp_t gfp_mask)
-{
-	struct inode *aspace = page->mapping->host;
-	struct gfs_sbd *sdp = get_v2sdp(aspace->i_sb);
-	struct buffer_head *bh, *head;
-	struct gfs_bufdata *bd;
-	unsigned long t;
-
-	if (!page_has_buffers(page))
-		goto out;
-
-	head = bh = page_buffers(page);
-	do {
-		t = jiffies;
-
-		while (atomic_read(&bh->b_count)) {
-			if (atomic_read(&aspace->i_writecount)) {
-				if (time_after_eq(jiffies,
-						  t +
-						  gfs_tune_get(sdp, gt_stall_secs) * HZ)) {
-					stuck_releasepage(bh);
-					t = jiffies;
-				}
-
-				yield();
-				continue;
-			}
-
-			return 0;
-		}
-
-		bd = get_v2bd(bh);
-		if (bd) {
-			gfs_assert_warn(sdp, bd->bd_bh == bh);
-			gfs_assert_warn(sdp, !bd->bd_new_le.le_trans);
-		        gfs_assert_warn(sdp, !bd->bd_incore_le.le_trans);
-			gfs_assert_warn(sdp, !bd->bd_frozen);
-			gfs_assert_warn(sdp, !bd->bd_pinned);
-			gfs_assert_warn(sdp, list_empty(&bd->bd_ail_tr_list));
-			kmem_cache_free(gfs_bufdata_cachep, bd);
-			atomic_dec(&sdp->sd_bufdata_count);
-			set_v2bd(bh, NULL);
-		}
-
-		bh = bh->b_this_page;
-	}
-	while (bh != head);
-
- out:
-	return try_to_free_buffers(page);
-}
-
-static struct address_space_operations aspace_aops = {
-	.writepage = gfs_aspace_writepage,
-	.releasepage = gfs_aspace_releasepage,
-};
-
-/**
- * gfs_aspace_get - Create and initialize a struct inode structure
- * @sdp: the filesystem the aspace is in
- *
- * Right now a struct inode is just a struct inode.  Maybe Linux
- * will supply a more lightweight address space construct (that works)
- * in the future.
- *
- * Make sure pages/buffers in this aspace aren't in high memory.
- *
- * Returns: the aspace
- */
-
-struct inode *
-gfs_aspace_get(struct gfs_sbd *sdp)
-{
-	struct inode *aspace;
-
-	aspace = new_inode(sdp->sd_vfs);
-	if (aspace) {
-		mapping_set_gfp_mask(aspace->i_mapping, GFP_KERNEL);
-		aspace->i_mapping->a_ops = &aspace_aops;
-		aspace->i_size = ~0ULL;
-		set_v2ip(aspace, NULL);
-		insert_inode_hash(aspace);
-	}
-
-	return aspace;
-}
-
-/**
- * gfs_aspace_put - get rid of an aspace
- * @aspace:
- *
- */
-
-void
-gfs_aspace_put(struct inode *aspace)
-{
-	remove_inode_hash(aspace);
-	iput(aspace);
-}
-
-/**
- * gfs_ail_start_trans - Start I/O on a part of the AIL
- * @sdp: the filesystem
- * @tr: the part of the AIL
- *
- */
-
-void
-gfs_ail_start_trans(struct gfs_sbd *sdp, struct gfs_trans *tr)
-{
-	struct list_head *head, *tmp, *prev;
-	struct gfs_bufdata *bd;
-	struct buffer_head *bh;
-	int retry;
-
-	do {
-		retry = FALSE;
-
-		spin_lock(&sdp->sd_ail_lock);
-
-		for (head = &tr->tr_ail_bufs, tmp = head->prev, prev = tmp->prev;
-		     tmp != head;
-		     tmp = prev, prev = tmp->prev) {
-			bd = list_entry(tmp, struct gfs_bufdata, bd_ail_tr_list);
-			bh = bd->bd_bh;
-
-			if (gfs_trylock_buffer(bh))
-				continue;
-
-			if (bd->bd_pinned) {
-				gfs_unlock_buffer(bh);
-				continue;
-			}
-
-			if (!buffer_busy(bh)) {
-				if (!buffer_uptodate(bh))
-					gfs_io_error_bh(sdp, bh);
-
-				list_del_init(&bd->bd_ail_tr_list);
-				list_del(&bd->bd_ail_gl_list);
-
-				gfs_unlock_buffer(bh);
-				brelse(bh);
-				continue;
-			}
-
-			if (buffer_dirty(bh)) {
-				list_move(&bd->bd_ail_tr_list, head);
-
-				spin_unlock(&sdp->sd_ail_lock);
-				wait_on_buffer(bh);
-				ll_rw_block(WRITE, 1, &bh);
-				spin_lock(&sdp->sd_ail_lock);
-
-				gfs_unlock_buffer(bh);
-				retry = TRUE;
-				break;
-			}
-
-			gfs_unlock_buffer(bh);
-		}
-
-		spin_unlock(&sdp->sd_ail_lock);
-	} while (retry);
-}
-
-/**
- * gfs_ail_empty_trans - Check whether or not a trans in the AIL has been synced
- * @sdp: the filesystem
- * @tr: the transaction
- *
- */
-
-int
-gfs_ail_empty_trans(struct gfs_sbd *sdp, struct gfs_trans *tr)
-{
-	struct list_head *head, *tmp, *prev;
-	struct gfs_bufdata *bd;
-	struct buffer_head *bh;
-	int ret;
-
-	spin_lock(&sdp->sd_ail_lock);
-
-	for (head = &tr->tr_ail_bufs, tmp = head->prev, prev = tmp->prev;
-	     tmp != head;
-	     tmp = prev, prev = tmp->prev) {
-		bd = list_entry(tmp, struct gfs_bufdata, bd_ail_tr_list);
-		bh = bd->bd_bh;
-
-		if (gfs_trylock_buffer(bh))
-			continue;
-
-		if (bd->bd_pinned || buffer_busy(bh)) {
-			gfs_unlock_buffer(bh);
-			continue;
-		}
-
-		if (!buffer_uptodate(bh))
-			gfs_io_error_bh(sdp, bh);
-
-		list_del_init(&bd->bd_ail_tr_list);
-		list_del(&bd->bd_ail_gl_list);
-
-		gfs_unlock_buffer(bh);
-		brelse(bh);
-	}
-
-	ret = list_empty(head);
-
-	spin_unlock(&sdp->sd_ail_lock);
-
-	return ret;
-}
-
-/**
- * ail_empty_gl - remove all buffers for a given lock from the AIL
- * @gl: the glock
- *
- * None of the buffers should be dirty, locked, or pinned.
- */
-
-static void
-ail_empty_gl(struct gfs_glock *gl)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct gfs_bufdata *bd;
-	struct buffer_head *bh;
-
-	spin_lock(&sdp->sd_ail_lock);
-
-	while (!list_empty(&gl->gl_ail_bufs)) {
-		bd = list_entry(gl->gl_ail_bufs.next,
-				struct gfs_bufdata, bd_ail_gl_list);
-		bh = bd->bd_bh;
-
-		gfs_assert_withdraw(sdp, !bd->bd_pinned && !buffer_busy(bh));
-		if (!buffer_uptodate(bh))
-			gfs_io_error_bh(sdp, bh);
-
-		list_del_init(&bd->bd_ail_tr_list);
-		list_del(&bd->bd_ail_gl_list);
-
-		brelse(bh);
-	}
-
-	spin_unlock(&sdp->sd_ail_lock);
-}
-
-/**
- * gfs_inval_buf - Invalidate all buffers associated with a glock
- * @gl: the glock
- *
- */
-
-void
-gfs_inval_buf(struct gfs_glock *gl)
-{
-	struct inode *aspace = gl->gl_aspace;
-	struct address_space *mapping = gl->gl_aspace->i_mapping;
-
-	ail_empty_gl(gl);
-
-	atomic_inc(&aspace->i_writecount);
-	truncate_inode_pages(mapping, 0);
-	atomic_dec(&aspace->i_writecount);
-
-	gfs_assert_withdraw(gl->gl_sbd, !mapping->nrpages);
-}
-
-/**
- * gfs_sync_buf - Sync all buffers associated with a glock
- * @gl: The glock
- * @flags: DIO_START | DIO_WAIT | DIO_CHECK
- *
- */
-
-void
-gfs_sync_buf(struct gfs_glock *gl, int flags)
-{
-	struct address_space *mapping = gl->gl_aspace->i_mapping;
-	int error = 0;
-
-	if (flags & DIO_START)
-		error = filemap_fdatawrite(mapping);
-	if (!error && (flags & DIO_WAIT))
-		error = filemap_fdatawait(mapping);
-	if (!error && (flags & (DIO_INVISIBLE | DIO_CHECK)) == DIO_CHECK)
-		ail_empty_gl(gl);
-
-	if (error)
-		gfs_io_error(gl->gl_sbd);
-}
-
-/**
- * getbuf - Get a buffer with a given address space
- * @sdp: the filesystem
- * @aspace: the address space
- * @blkno: the block number (filesystem scope)
- * @create: TRUE if the buffer should be created
- *
- * Returns: the buffer
- */
-
-static struct buffer_head *
-getbuf(struct gfs_sbd *sdp, struct inode *aspace, uint64_t blkno, int create)
-{
-	struct page *page;
-	struct buffer_head *bh;
-	unsigned int shift;
-	unsigned long index;
-	unsigned int bufnum;
-
-	shift = PAGE_CACHE_SHIFT - sdp->sd_sb.sb_bsize_shift;
-	index = blkno >> shift;             /* convert block to page */
-	bufnum = blkno - (index << shift);  /* block buf index within page */
-
-	if (create) {
-		RETRY_MALLOC(page = grab_cache_page(aspace->i_mapping, index), page);
-	} else {
-		page = find_lock_page(aspace->i_mapping, index);
-		if (!page)
-			return NULL;
-	}
-
-	if (!page_has_buffers(page))
-		create_empty_buffers(page, sdp->sd_sb.sb_bsize, 0);
-
-	/* Locate header for our buffer within our page */
-	for (bh = page_buffers(page); bufnum--; bh = bh->b_this_page)
-		/* Do nothing */;
-	get_bh(bh);
-
-	if (!buffer_mapped(bh))
-		map_bh(bh, sdp->sd_vfs, blkno);
-	else if (gfs_assert_warn(sdp, bh->b_bdev == sdp->sd_vfs->s_bdev &&
-				 bh->b_blocknr == blkno))
-		map_bh(bh, sdp->sd_vfs, blkno);
-
-	unlock_page(page);
-	page_cache_release(page);
-
-	return bh;
-}
-
-/**
- * gfs_dgetblk - Get a block
- * @gl: The glock associated with this block
- * @blkno: The block number
- *
- * Returns: The buffer
- */
-
-struct buffer_head *
-gfs_dgetblk(struct gfs_glock *gl, uint64_t blkno)
-{
-	return getbuf(gl->gl_sbd, gl->gl_aspace, blkno, CREATE);
-}
-
-/**
- * gfs_dread - Read a block from disk
- * @gl: The glock covering the block
- * @blkno: The block number
- * @flags: flags to gfs_dreread()
- * @bhp: the place where the buffer is returned (NULL on failure)
- *
- * Returns: errno
- */
-
-int
-gfs_dread(struct gfs_glock *gl, uint64_t blkno,
-	  int flags, struct buffer_head **bhp)
-{
-	int error;
-
-	*bhp = gfs_dgetblk(gl, blkno);
-	error = gfs_dreread(gl->gl_sbd, *bhp, flags);
-	if (error)
-		brelse(*bhp);
-
-	return error;
-}
-
-/**
- * gfs_prep_new_buffer - Mark a new buffer we just gfs_dgetblk()ed uptodate
- * @bh: the buffer
- *
- */
-
-void
-gfs_prep_new_buffer(struct buffer_head *bh)
-{
-	wait_on_buffer(bh);
-	clear_buffer_dirty(bh);
-	set_buffer_uptodate(bh);
-}
-
-/**
- * gfs_dreread - Reread a block from disk
- * @sdp: the filesystem
- * @bh: The block to read
- * @flags: Flags that control the read
- *
- * Returns: errno
- */
-
-int
-gfs_dreread(struct gfs_sbd *sdp, struct buffer_head *bh, int flags)
-{
-	if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-		return -EIO;
-
-	/* Fill in meta-header if we have a cached copy, else read from disk */
-	if (flags & DIO_NEW) {
-		if (gfs_mhc_fish(sdp, bh))
-			return 0;
-		clear_buffer_uptodate(bh);
-	}
-
-	if (flags & DIO_FORCE)
-		clear_buffer_uptodate(bh);
-
-	if ((flags & DIO_START) && !buffer_uptodate(bh))
-		ll_rw_block(READ, 1, &bh);
-
-	if (flags & DIO_WAIT) {
-		wait_on_buffer(bh);
-
-		if (!buffer_uptodate(bh)) {
-			gfs_io_error_bh(sdp, bh);
-			return -EIO;
-		}
-		if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-			return -EIO;
-	}
-
-	return 0;
-}
-
-/**
- * gfs_dwrite - Write a buffer to disk (and/or wait for write to complete)
- * @sdp: the filesystem
- * @bh: The buffer to write
- * @flags:  DIO_XXX The type of write/wait operation to do
- *
- * Returns: errno
- */
-
-int
-gfs_dwrite(struct gfs_sbd *sdp, struct buffer_head *bh, int flags)
-{
-	if (gfs_assert_warn(sdp, !test_bit(SDF_ROFS, &sdp->sd_flags)))
-		return -EIO;
-	if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-		return -EIO;
-
-	if (flags & DIO_CLEAN) {
-		lock_buffer(bh);
-		clear_buffer_dirty(bh);
-		unlock_buffer(bh);
-	}
-
-	if (flags & DIO_DIRTY) {
-		if (gfs_assert_warn(sdp, buffer_uptodate(bh)))
-			return -EIO;
-		mark_buffer_dirty(bh);
-	}
-
-	if ((flags & DIO_START) && buffer_dirty(bh)) {
-		wait_on_buffer(bh);
-		ll_rw_block(WRITE, 1, &bh);
-	}
-
-	if (flags & DIO_WAIT) {
-		wait_on_buffer(bh);
-
-		if (!buffer_uptodate(bh) || buffer_dirty(bh)) {
-			gfs_io_error_bh(sdp, bh);
-			return -EIO;
-		}
-		if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-			return -EIO;
-	}
-
-	return 0;
-}
-
-/**
- * gfs_attach_bufdata - attach a struct gfs_bufdata structure to a buffer
- * @bh: The buffer to be attached to
- * @gl: the glock the buffer belongs to
- *
- */
-
-void
-gfs_attach_bufdata(struct buffer_head *bh, struct gfs_glock *gl)
-{
-	struct gfs_bufdata *bd;
-
-	lock_page(bh->b_page);
-
-	/* If there's one attached already, we're done */
-	if (get_v2bd(bh)) {
-		unlock_page(bh->b_page);
-		return;
-	}
-
-	RETRY_MALLOC(bd = kmem_cache_alloc(gfs_bufdata_cachep, GFP_KERNEL), bd);
-	atomic_inc(&gl->gl_sbd->sd_bufdata_count);
-
-	memset(bd, 0, sizeof(struct gfs_bufdata));
-
-	bd->bd_bh = bh;
-	bd->bd_gl = gl;
-
-	INIT_LE(&bd->bd_new_le, &gfs_buf_lops);
-	INIT_LE(&bd->bd_incore_le, &gfs_buf_lops);
-
-	init_MUTEX(&bd->bd_lock);
-
-	INIT_LIST_HEAD(&bd->bd_ail_tr_list);
-
-	set_v2bd(bh, bd);
-
-	unlock_page(bh->b_page);
-}
-
-/**
- * gfs_is_pinned - Figure out if a buffer is pinned or not
- * @sdp: the filesystem the buffer belongs to
- * @bh: The buffer to be pinned
- *
- * Returns: TRUE if the buffer is pinned, FALSE otherwise
- */
-
-int
-gfs_is_pinned(struct gfs_sbd *sdp, struct buffer_head *bh)
-{
-	struct gfs_bufdata *bd = get_v2bd(bh);
-	int ret = FALSE;
-
-	if (bd) {
-		gfs_lock_buffer(bh);
-		if (bd->bd_pinned)
-			ret = TRUE;
-		gfs_unlock_buffer(bh);
-	}
-
-	return ret;
-}
-
-/**
- * gfs_dpin - Pin a metadata buffer in memory
- * @sdp: the filesystem the buffer belongs to
- * @bh: The buffer to be pinned
- *
- * "Pinning" means keeping buffer from being written to its in-place location.
- * A buffer should be pinned from the time it is added to a new transaction,
- *   until after it has been written to the log.
- * If an earlier change to this buffer is still pinned, waiting to be written
- *   to on-disk log, we need to keep a "frozen" copy of the old data while this
- *   transaction is modifying the real data.  We keep the frozen copy until
- *   this transaction's incore_commit(), i.e. until the transaction has
- *   finished modifying the real data, at which point we can use the real
- *   buffer for logging, even if the frozen copy didn't get written to the log.
- *
- */
-
-void
-gfs_dpin(struct gfs_sbd *sdp, struct buffer_head *bh)
-{
-	struct gfs_bufdata *bd = get_v2bd(bh);
-	char *data;
-
-	gfs_assert_withdraw(sdp, !test_bit(SDF_ROFS, &sdp->sd_flags));
-
-	gfs_lock_buffer(bh);
-
-	gfs_assert_warn(sdp, !bd->bd_frozen);
-
-	if (!bd->bd_pinned++) {
-		wait_on_buffer(bh);
-
-		/* If this buffer is in the AIL and it has already been written
-		   to in-place disk block, remove it from the AIL. */
-
-		spin_lock(&sdp->sd_ail_lock);
-		if (!list_empty(&bd->bd_ail_tr_list) && !buffer_busy(bh)) {
-			list_del_init(&bd->bd_ail_tr_list);
-			list_del(&bd->bd_ail_gl_list);
-			brelse(bh);
-		}
-		spin_unlock(&sdp->sd_ail_lock);
-
-		clear_buffer_dirty(bh);
-		wait_on_buffer(bh);
-
-		if (!buffer_uptodate(bh))
-			gfs_io_error_bh(sdp, bh);
-	} else {
-		gfs_unlock_buffer(bh);
-
-		gfs_assert_withdraw(sdp, buffer_uptodate(bh));
-
-		data = gmalloc(sdp->sd_sb.sb_bsize);
-
-		gfs_lock_buffer(bh);
-
-		/* Create frozen copy, if needed. */
-		if (bd->bd_pinned > 1) {
-			memcpy(data, bh->b_data, sdp->sd_sb.sb_bsize);
-			bd->bd_frozen = data;
-		} else
-			kfree(data);
-	}
-
-	gfs_unlock_buffer(bh);
-
-	get_bh(bh);
-}
-
-/**
- * gfs_dunpin - Unpin a buffer
- * @sdp: the filesystem the buffer belongs to
- * @bh: The buffer to unpin
- * @tr: The transaction in the AIL that contains this buffer
- *      If NULL, don't attach buffer to any AIL list
- *      (i.e. when dropping a pin reference when merging a new transaction
- *       with an already existing incore transaction)
- *
- * Called for (meta) buffers, after they've been logged to on-disk journal.
- * Make a (meta) buffer writeable to in-place location on-disk, if recursive
- *   pin count is 1 (i.e. no other, later transaction is modifying this buffer).
- * Add buffer to AIL lists of 1) the latest transaction that's modified and
- *   logged (on-disk) the buffer, and of 2) the glock that protects the buffer.
- * A single buffer might have been modified by more than one transaction
- *   since the buffer's previous write to disk (in-place location).  We keep
- *   the buffer on only one transaction's AIL list, i.e. that of the latest
- *   transaction that's completed logging this buffer (no need to write it to
- *   in-place block multiple times for multiple transactions, only once with
- *   the most up-to-date data).
- * A single buffer will be protected by one and only one glock.  If buffer is 
- *   already on a (previous) transaction's AIL, we know that we're already
- *   on buffer's glock's AIL.
- * 
- */
-
-void
-gfs_dunpin(struct gfs_sbd *sdp, struct buffer_head *bh, struct gfs_trans *tr)
-{
-	struct gfs_bufdata *bd = get_v2bd(bh);
-
-	gfs_assert_withdraw(sdp, buffer_uptodate(bh));
-
-	gfs_lock_buffer(bh);
-
-	if (gfs_assert_warn(sdp, bd->bd_pinned)) {
-		gfs_unlock_buffer(bh);
-		return;
-	}
-
-	/* No other (later) transaction is modifying buffer; ready to write */
-	if (bd->bd_pinned == 1)
-		mark_buffer_dirty(bh);
-
-	bd->bd_pinned--;
-
-	gfs_unlock_buffer(bh);
-
-	if (tr) {
-		spin_lock(&sdp->sd_ail_lock);
-
-		if (list_empty(&bd->bd_ail_tr_list)) {
-			/* Buffer not attached to any earlier transaction.  Add
-			   it to glock's AIL, and this trans' AIL (below). */
-			list_add(&bd->bd_ail_gl_list, &bd->bd_gl->gl_ail_bufs);
-		} else {
-			/* Was part of earlier transaction.
-			   Move from that trans' AIL to this newer one's AIL.
-			   Buf is already on glock's AIL. */
-			list_del_init(&bd->bd_ail_tr_list);
-			brelse(bh);
-		}
-		list_add(&bd->bd_ail_tr_list, &tr->tr_ail_bufs);
-
-		spin_unlock(&sdp->sd_ail_lock);
-	} else
-		brelse(bh);
-}
-
-/**
- * logbh_end_io - Called by OS at the end of a logbh ("fake" bh) write to log
- * @bh: the buffer
- * @uptodate: whether or not the write succeeded
- *
- * Interrupt context, no ENTER/RETURN
- *
- */
-
-static void
-logbh_end_io(struct buffer_head *bh, int uptodate)
-{
-	if (uptodate)
-		set_buffer_uptodate(bh);
-	else
-		clear_buffer_uptodate(bh);
-	unlock_buffer(bh);
-}
-
-/**
- * gfs_logbh_init - Initialize a fake buffer head
- * @sdp: the filesystem
- * @bh: the buffer to initialize
- * @blkno: the block address of the buffer
- * @data: the data to be written
- *
- */
-
-void
-gfs_logbh_init(struct gfs_sbd *sdp, struct buffer_head *bh,
-	       uint64_t blkno, char *data)
-{
-	memset(bh, 0, sizeof(struct buffer_head));
-	bh->b_state = (1 << BH_Mapped) | (1 << BH_Uptodate) | (1 << BH_Lock);
-	atomic_set(&bh->b_count, 1);
-	set_bh_page(bh, virt_to_page(data), ((unsigned long)data) & (PAGE_SIZE - 1));
-	bh->b_blocknr = blkno;
-	bh->b_size = sdp->sd_sb.sb_bsize;
-	bh->b_bdev = sdp->sd_vfs->s_bdev;
-	init_buffer(bh, logbh_end_io, NULL);
-	INIT_LIST_HEAD(&bh->b_assoc_buffers);
-}
-
-/**
- * gfs_logbh_uninit - Clean up a fake buffer head
- * @sdp: the filesystem
- * @bh: the buffer to clean
- *
- */
-
-void
-gfs_logbh_uninit(struct gfs_sbd *sdp, struct buffer_head *bh)
-{
-	gfs_assert_warn(sdp, test_bit(SDF_SHUTDOWN, &sdp->sd_flags) ||
-			!buffer_busy(bh));
-	gfs_assert_warn(sdp, atomic_read(&bh->b_count) == 1);
-}
-
-/**
- * gfs_logbh_start - Start writing a fake buffer head
- * @sdp: the filesystem
- * @bh: the buffer to write
- *
- * This starts a block write to our journal.
- */
-
-void
-gfs_logbh_start(struct gfs_sbd *sdp, struct buffer_head *bh)
-{
-	submit_bh(WRITE, bh);
-}
-
-/**
- * gfs_logbh_wait - Wait for the write of a fake buffer head to complete
- * @sdp: the filesystem
- * @bh: the buffer to write
- *
- * This waits for a block write to our journal to complete.
- *
- * Returns: errno
- */
-
-int
-gfs_logbh_wait(struct gfs_sbd *sdp, struct buffer_head *bh)
-{
-	wait_on_buffer(bh);
-
-	if (!buffer_uptodate(bh) || buffer_dirty(bh)) {
-		gfs_io_error_bh(sdp, bh);
-		return -EIO;
-	}
-	if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-		return -EIO;
-
-	return 0;
-}
-
-/**
- * gfs_replay_buf - write a log buffer to its inplace location
- * @gl: the journal's glock 
- * @bh: the buffer
- *
- * Returns: errno
- */
-
-int
-gfs_replay_buf(struct gfs_glock *gl, struct buffer_head *bh)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct gfs_bufdata *bd;
-
-	bd = get_v2bd(bh);
-	if (!bd) {
-		gfs_attach_bufdata(bh, gl);
-		bd = get_v2bd(bh);
-	}
-
-	mark_buffer_dirty(bh);
-
-	if (list_empty(&bd->bd_ail_tr_list)) {
-		get_bh(bh);
-		list_add(&bd->bd_ail_tr_list, &sdp->sd_recovery_bufs);
-	}
-
-	return 0;
-}
-
-/**
- * gfs_replay_check - Check up on journal replay
- * @sdp: the filesystem
- *
- */
-
-void
-gfs_replay_check(struct gfs_sbd *sdp)
-{
-	struct buffer_head *bh;
-	struct gfs_bufdata *bd;
-
-	while (!list_empty(&sdp->sd_recovery_bufs)) {
-		bd = list_entry(sdp->sd_recovery_bufs.prev,
-				struct gfs_bufdata, bd_ail_tr_list);
-		bh = bd->bd_bh;
-
-		if (buffer_busy(bh)) {
-			list_move(&bd->bd_ail_tr_list,
-				  &sdp->sd_recovery_bufs);
-			break;
-		} else {
-			list_del_init(&bd->bd_ail_tr_list);
-			if (!buffer_uptodate(bh))
-				gfs_io_error_bh(sdp, bh);
-			brelse(bh);
-		}
-	}
-}
-
-/**
- * gfs_replay_wait - Wait for all replayed buffers to hit the disk
- * @sdp: the filesystem
- *
- */
-
-void
-gfs_replay_wait(struct gfs_sbd *sdp)
-{
-	struct list_head *head, *tmp, *prev;
-	struct buffer_head *bh;
-	struct gfs_bufdata *bd;
-
-	for (head = &sdp->sd_recovery_bufs, tmp = head->prev, prev = tmp->prev;
-	     tmp != head;
-	     tmp = prev, prev = tmp->prev) {
-		bd = list_entry(tmp, struct gfs_bufdata, bd_ail_tr_list);
-		bh = bd->bd_bh;
-
-		if (!buffer_busy(bh)) {
-			list_del_init(&bd->bd_ail_tr_list);
-			if (!buffer_uptodate(bh))
-				gfs_io_error_bh(sdp, bh);
-			brelse(bh);
-			continue;
-		}
-
-		if (buffer_dirty(bh)) {
-			wait_on_buffer(bh);
-			ll_rw_block(WRITE, 1, &bh);
-		}
-	}
-
-	while (!list_empty(head)) {
-		bd = list_entry(head->prev, struct gfs_bufdata, bd_ail_tr_list);
-		bh = bd->bd_bh;
-
-		wait_on_buffer(bh);
-
-		gfs_assert_withdraw(sdp, !buffer_busy(bh));
-
-		list_del_init(&bd->bd_ail_tr_list);
-		if (!buffer_uptodate(bh))
-			gfs_io_error_bh(sdp, bh);
-		brelse(bh);
-	}
-}
-
-/**
- * gfs_wipe_buffers - make inode's buffers so they aren't dirty/AILed anymore
- * @ip: the inode who owns the buffers
- * @rgd: the resource group
- * @bstart: the first buffer in the run
- * @blen: the number of buffers in the run
- *
- * Called when de-allocating a contiguous run of meta blocks within an rgrp.
- * Make sure all buffers for de-alloc'd blocks are removed from the AIL, if
- * they can be.  Dirty or pinned blocks are left alone.  Add relevant
- * meta-headers to meta-header cache, so we don't need to read disk
- * if we re-allocate blocks.
- */
-
-void
-gfs_wipe_buffers(struct gfs_inode *ip, struct gfs_rgrpd *rgd,
-		 uint64_t bstart, uint32_t blen)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct inode *aspace = ip->i_gl->gl_aspace;
-	struct buffer_head *bh;
-	struct gfs_bufdata *bd;
-	int busy;
-	int add = FALSE;
-
-	while (blen) {
-		bh = getbuf(sdp, aspace, bstart, NO_CREATE);
-		if (bh) {
-
-			bd = get_v2bd(bh);
-
-			if (buffer_uptodate(bh)) {
-				if (bd) {
-					gfs_lock_buffer(bh);
-					gfs_mhc_add(rgd, &bh, 1);
-					busy = bd->bd_pinned || buffer_busy(bh);
-					gfs_unlock_buffer(bh);
-
-					if (busy)
-						add = TRUE;
-					else {
-						spin_lock(&sdp->sd_ail_lock);
-						if (!list_empty(&bd->bd_ail_tr_list)) {
-							list_del_init(&bd->bd_ail_tr_list);
-							list_del(&bd->bd_ail_gl_list);
-							brelse(bh);
-						}
-						spin_unlock(&sdp->sd_ail_lock);
-					}
-				} else {
-					gfs_assert_withdraw(sdp, !buffer_dirty(bh));
-					wait_on_buffer(bh);
-					gfs_assert_withdraw(sdp, !buffer_busy(bh));
-					gfs_mhc_add(rgd, &bh, 1);
-				}
-			} else {
-				gfs_assert_withdraw(sdp, !bd || !bd->bd_pinned);
-				gfs_assert_withdraw(sdp, !buffer_dirty(bh));
-				wait_on_buffer(bh);
-				gfs_assert_withdraw(sdp, !buffer_busy(bh));
-			}
-
-			brelse(bh);
-		}
-
-		bstart++;
-		blen--;
-	}
-
-	if (add)
-		gfs_depend_add(rgd, ip->i_num.no_formal_ino);
-}
-
-/**
- * gfs_sync_meta - sync all the buffers in a filesystem
- * @sdp: the filesystem
- *
- * Flush metadata blocks to on-disk journal, then
- * Flush metadata blocks (now in AIL) to on-disk in-place locations
- * Periodically keep checking until done (AIL empty)
- */
-
-void
-gfs_sync_meta(struct gfs_sbd *sdp)
-{
-	gfs_log_flush(sdp);
-	for (;;) {
-		gfs_ail_start(sdp, DIO_ALL);
-		if (gfs_ail_empty(sdp))
-			break;
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(HZ / 10);
-	}
-}
-
-/**
- * gfs_flush_meta_cache - get rid of any references on buffers for this inode
- * @ip: The GFS inode
- *
- * This releases buffers that are in the most-recently-used array of
- *   blocks used for indirect block addressing for this inode.
- * Don't confuse this with the meta-HEADER cache (mhc)!
- */
-
-void
-gfs_flush_meta_cache(struct gfs_inode *ip)
-{
-	struct buffer_head **bh_slot;
-	unsigned int x;
-
-	spin_lock(&ip->i_spin);
-
-	for (x = 0; x < GFS_MAX_META_HEIGHT; x++) {
-		bh_slot = &ip->i_cache[x];
-		if (*bh_slot) {
-			brelse(*bh_slot);
-			*bh_slot = NULL;
-		}
-	}
-
-	spin_unlock(&ip->i_spin);
-}
-
-/**
- * gfs_get_meta_buffer - Get a metadata buffer
- * @ip: The GFS inode
- * @height: The level of this buf in the metadata (indir addr) tree (if any)
- * @num: The block number (device relative) of the buffer
- * @new: Non-zero if we may create a new buffer
- * @bhp: the buffer is returned here
- *
- * Returns: errno
- */
-
-int
-gfs_get_meta_buffer(struct gfs_inode *ip, int height, uint64_t num, int new,
-		    struct buffer_head **bhp)
-{
-	struct buffer_head *bh, **bh_slot = &ip->i_cache[height];
-	int flags = ((new) ? DIO_NEW : 0) | DIO_START | DIO_WAIT;
-	int error;
-
-	/* Try to use the gfs_inode's MRU metadata tree cache */
-	spin_lock(&ip->i_spin);
-	bh = *bh_slot;
-	if (bh) {
-		if (bh->b_blocknr == num)
-			get_bh(bh);
-		else
-			bh = NULL;
-	}
-	spin_unlock(&ip->i_spin);
-
-	if (bh) {
-		error = gfs_dreread(ip->i_sbd, bh, flags);
-		if (error) {
-			brelse(bh);
-			return error;
-		}
-	} else {
-		error = gfs_dread(ip->i_gl, num, flags, &bh);
-		if (error)
-			return error;
-
-		spin_lock(&ip->i_spin);
-		if (*bh_slot != bh) {
-			if (*bh_slot)
-				brelse(*bh_slot);
-			*bh_slot = bh;
-			get_bh(bh);
-		}
-		spin_unlock(&ip->i_spin);
-	}
-
-	if (new) {
-		if (gfs_assert_warn(ip->i_sbd, height)) {
-			brelse(bh);
-			return -EIO;
-		}
-		gfs_trans_add_bh(ip->i_gl, bh);
-		gfs_metatype_set(bh, GFS_METATYPE_IN, GFS_FORMAT_IN);
-		gfs_buffer_clear_tail(bh, sizeof(struct gfs_meta_header));
-	} else if (gfs_metatype_check(ip->i_sbd, bh,
-				      (height) ? GFS_METATYPE_IN : GFS_METATYPE_DI)) {
-		brelse(bh);
-		return -EIO;
-	}
-
-	*bhp = bh;
-
-	return 0;
-}
-
-/**
- * gfs_get_data_buffer - Get a data buffer
- * @ip: The GFS inode
- * @num: The block number (device relative) of the data block
- * @new: Non-zero if this is a new allocation
- * @bhp: the buffer is returned here
- *
- * Returns: errno
- */
-
-int
-gfs_get_data_buffer(struct gfs_inode *ip, uint64_t block, int new,
-		    struct buffer_head **bhp)
-{
-	struct buffer_head *bh;
-	int error = 0;
-
-	if (block == ip->i_num.no_addr) {
-		if (gfs_assert_warn(ip->i_sbd, !new))
-			return -EIO;
-		error = gfs_dread(ip->i_gl, block, DIO_START | DIO_WAIT, &bh);
-		if (error)
-			return error;
-		if (gfs_metatype_check(ip->i_sbd, bh, GFS_METATYPE_DI)) {
-			brelse(bh);
-			return -EIO;
-		}
-	} else if (gfs_is_jdata(ip)) {
-		if (new) {
-			error = gfs_dread(ip->i_gl, block,
-					  DIO_NEW | DIO_START | DIO_WAIT, &bh);
-			if (error)
-				return error;
-			gfs_trans_add_bh(ip->i_gl, bh);
-			gfs_metatype_set(bh, GFS_METATYPE_JD, GFS_FORMAT_JD);
-			gfs_buffer_clear_tail(bh, sizeof(struct gfs_meta_header));
-		} else {
-			error = gfs_dread(ip->i_gl, block,
-					  DIO_START | DIO_WAIT, &bh);
-			if (error)
-				return error;
-			if (gfs_metatype_check(ip->i_sbd, bh, GFS_METATYPE_JD)) {
-				brelse(bh);
-				return -EIO;
-			}
-		}
-	} else {
-		if (new) {
-			bh = gfs_dgetblk(ip->i_gl, block);
-			gfs_prep_new_buffer(bh);
-		} else {
-			error = gfs_dread(ip->i_gl, block,
-					  DIO_START | DIO_WAIT, &bh);
-			if (error)
-				return error;
-		}
-	}
-
-	*bhp = bh;
-
-	return 0;
-}
-
-/**
- * gfs_start_ra - start readahead on an extent of a file
- * @gl: the glock the blocks belong to
- * @dblock: the starting disk block
- * @extlen: the number of blocks in the extent
- *
- */
-
-void
-gfs_start_ra(struct gfs_glock *gl, uint64_t dblock, uint32_t extlen)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct inode *aspace = gl->gl_aspace;
-	struct buffer_head *first_bh, *bh;
-	uint32_t max_ra = gfs_tune_get(sdp, gt_max_readahead) >> sdp->sd_sb.sb_bsize_shift;
-	int error;
-
-	if (!extlen)
-		return;
-	if (!max_ra)
-		return;
-	if (extlen > max_ra)
-		extlen = max_ra;
-
-	first_bh = getbuf(sdp, aspace, dblock, CREATE);
-
-	if (buffer_uptodate(first_bh))
-		goto out;
-	if (!buffer_locked(first_bh)) {
-		error = gfs_dreread(sdp, first_bh, DIO_START);
-		if (error)
-			goto out;
-	}
-
-	dblock++;
-	extlen--;
-
-	while (extlen) {
-		bh = getbuf(sdp, aspace, dblock, CREATE);
-
-		if (!buffer_uptodate(bh) && !buffer_locked(bh)) {
-			error = gfs_dreread(sdp, bh, DIO_START);
-			brelse(bh);
-			if (error)
-				goto out;
-		} else
-			brelse(bh);
-
-		dblock++;
-		extlen--;
-
-		if (buffer_uptodate(first_bh))
-			break;
-	}
-
- out:
-	brelse(first_bh);
-}
diff --git a/gfs-kernel/src/gfs/dio.h b/gfs-kernel/src/gfs/dio.h
deleted file mode 100644
index 279642e..0000000
--- a/gfs-kernel/src/gfs/dio.h
+++ /dev/null
@@ -1,157 +0,0 @@
-#ifndef __DIO_DOT_H__
-#define __DIO_DOT_H__
-
-void gfs_ail_start_trans(struct gfs_sbd *sdp, struct gfs_trans *tr);
-int gfs_ail_empty_trans(struct gfs_sbd *sdp, struct gfs_trans *tr);
-
-/*  Asynchronous I/O Routines  */
-
-struct buffer_head *gfs_dgetblk(struct gfs_glock *gl, uint64_t blkno);
-int gfs_dread(struct gfs_glock *gl, uint64_t blkno,
-	      int flags, struct buffer_head **bhp);
-
-void gfs_prep_new_buffer(struct buffer_head *bh);
-int gfs_dreread(struct gfs_sbd *sdp, struct buffer_head *bh, int flags);
-int gfs_dwrite(struct gfs_sbd *sdp, struct buffer_head *bh, int flags);
-
-void gfs_attach_bufdata(struct buffer_head *bh, struct gfs_glock *gl);
-int gfs_is_pinned(struct gfs_sbd *sdp, struct buffer_head *bh);
-void gfs_dpin(struct gfs_sbd *sdp, struct buffer_head *bh);
-void gfs_dunpin(struct gfs_sbd *sdp, struct buffer_head *bh,
-		struct gfs_trans *tr);
-
-static __inline__
-void gfs_lock_buffer(struct buffer_head *bh)
-{
-	struct gfs_bufdata *bd = get_v2bd(bh);
-	down(&bd->bd_lock);
-}
-static __inline__
-int gfs_trylock_buffer(struct buffer_head *bh)
-{
-	struct gfs_bufdata *bd = get_v2bd(bh);
-	return down_trylock(&bd->bd_lock);
-}
-static __inline__
-void gfs_unlock_buffer(struct buffer_head *bh)
-{
-	struct gfs_bufdata *bd = get_v2bd(bh);
-	up(&bd->bd_lock);
-}
-
-void gfs_logbh_init(struct gfs_sbd *sdp, struct buffer_head *bh, uint64_t blkno,
-		    char *data);
-void gfs_logbh_uninit(struct gfs_sbd *sdp, struct buffer_head *bh);
-void gfs_logbh_start(struct gfs_sbd *sdp, struct buffer_head *bh);
-int gfs_logbh_wait(struct gfs_sbd *sdp, struct buffer_head *bh);
-
-int gfs_replay_buf(struct gfs_glock *gl, struct buffer_head *bh);
-void gfs_replay_check(struct gfs_sbd *sdp);
-void gfs_replay_wait(struct gfs_sbd *sdp);
-
-void gfs_wipe_buffers(struct gfs_inode *ip, struct gfs_rgrpd *rgd,
-		      uint64_t bstart, uint32_t blen);
-
-void gfs_sync_meta(struct gfs_sbd *sdp);
-
-/*  Buffer Caching routines  */
-
-int gfs_get_meta_buffer(struct gfs_inode *ip, int height, uint64_t num, int new,
-			struct buffer_head **bhp);
-int gfs_get_data_buffer(struct gfs_inode *ip, uint64_t block, int new,
-			struct buffer_head **bhp);
-void gfs_start_ra(struct gfs_glock *gl, uint64_t dblock, uint32_t extlen);
-
-static __inline__ int
-gfs_get_inode_buffer(struct gfs_inode *ip, struct buffer_head **bhp)
-{
-	return gfs_get_meta_buffer(ip, 0, ip->i_num.no_addr, FALSE, bhp);
-}
-
-struct inode *gfs_aspace_get(struct gfs_sbd *sdp);
-void gfs_aspace_put(struct inode *aspace);
-
-void gfs_inval_buf(struct gfs_glock *gl);
-void gfs_sync_buf(struct gfs_glock *gl, int flags);
-
-void gfs_flush_meta_cache(struct gfs_inode *ip);
-
-/*  Buffer Content Functions  */
-
-/**
- * gfs_buffer_clear - Zeros out a buffer
- * @ip: The GFS inode
- * @bh: The buffer to zero
- *
- */
-
-static __inline__ void
-gfs_buffer_clear(struct buffer_head *bh)
-{
-	memset(bh->b_data, 0, bh->b_size);
-}
-
-/**
- * gfs_buffer_clear_tail - Clear buffer beyond the dinode
- * @bh: The buffer containing the on-disk inode
- * @head: the size of the head of the buffer
- *
- * Clears the remaining part of an on-disk inode that is not a dinode.
- * i.e. The data part of a stuffed inode, or the top level of metadata
- * of a non-stuffed inode.
- */
-
-static __inline__ void
-gfs_buffer_clear_tail(struct buffer_head *bh, int head)
-{
-	memset(bh->b_data + head, 0, bh->b_size - head);
-}
-
-/**
- * gfs_buffer_clear_ends - Zero out any bits of a buffer which are not being written
- * @bh: The buffer
- * @offset: Offset in buffer where write starts
- * @amount: Amount of data being written
- * @journaled: TRUE if this is a journaled buffer
- *
- */
-
-static __inline__ void
-gfs_buffer_clear_ends(struct buffer_head *bh, int offset, int amount,
-		      int journaled)
-{
-	int z_off1 = (journaled) ? sizeof(struct gfs_meta_header) : 0;
-	int z_len1 = offset - z_off1;
-	int z_off2 = offset + amount;
-	int z_len2 = (bh)->b_size - z_off2;
-
-	if (z_len1)
-		memset(bh->b_data + z_off1, 0, z_len1);
-
-	if (z_len2)
-		memset(bh->b_data + z_off2, 0, z_len2);
-}
-
-/**
- * gfs_buffer_copy_tail - copies the tail of one buffer to another
- * @to_bh: the buffer to copy to
- * @to_head: the size of the head of to_bh
- * @from_bh: the buffer to copy from
- * @from_head: the size of the head of from_bh
- *
- * from_head is guaranteed to bigger than to_head 
- */
-
-static __inline__ void
-gfs_buffer_copy_tail(struct buffer_head *to_bh, int to_head,
-		     struct buffer_head *from_bh, int from_head)
-{
-	memcpy(to_bh->b_data + to_head,
-	       from_bh->b_data + from_head,
-	       from_bh->b_size - from_head);
-	memset(to_bh->b_data + to_bh->b_size + to_head - from_head,
-	       0,
-	       from_head - to_head);
-}
-
-#endif /* __DIO_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/dir.c b/gfs-kernel/src/gfs/dir.c
deleted file mode 100644
index 7dadf7f..0000000
--- a/gfs-kernel/src/gfs/dir.c
+++ /dev/null
@@ -1,2394 +0,0 @@
-/*
-* Implements Extendible Hashing as described in:
-*   "Extendible Hashing" by Fagin, et al in
-*     __ACM Trans. on Database Systems__, Sept 1979.
-*
-*
-* Here's the layout of dirents which is essentially the same as that of ext2 
-* within a single block. The field de_name_len is the number of bytes
-* actually required for the name (no null terminator). The field de_rec_len
-* is the number of bytes allocated to the dirent. The offset of the next
-* dirent in the block is (dirent + dirent->de_rec_len). When a dirent is
-* deleted, the preceding dirent inherits its allocated space, ie
-* prev->de_rec_len += deleted->de_rec_len. Since the next dirent is obtained
-* by adding de_rec_len to the current dirent, this essentially causes the
-* deleted dirent to get jumped over when iterating through all the dirents.
-*
-* When deleting the first dirent in a block, there is no previous dirent so
-* the field de_ino is set to zero to designate it as deleted. When allocating
-* a dirent, gfs_dirent_alloc iterates through the dirents in a block. If the
-* first dirent has (de_ino == 0) and de_rec_len is large enough, this first
-* dirent is allocated. Otherwise it must go through all the 'used' dirents
-* searching for one in which the amount of total space minus the amount of
-* used space will provide enough space for the new dirent.
-*
-* There are two types of blocks in which dirents reside. In a stuffed dinode,
-* the dirents begin at offset sizeof(struct gfs_dinode) from the beginning of
-* the block.  In leaves, they begin at offset sizeof (struct gfs_leaf) from the
-* beginning of the leaf block. The dirents reside in leaves when 
-* 
-* dip->i_di.di_flags & GFS_DIF_EXHASH is true
-* 
-* Otherwise, the dirents are "linear", within a single stuffed dinode block.
-*
-* When the dirents are in leaves, the actual contents of the directory file are
-* used as an array of 64-bit block pointers pointing to the leaf blocks. The
-* dirents are NOT in the directory file itself. There can be more than one block
-* pointer in the array that points to the same leaf. In fact, when a directory
-* is first converted from linear to exhash, all of the pointers point to the
-* same leaf. 
-*
-* When a leaf is completely full, the size of the hash table can be
-* doubled unless it is already at the maximum size which is hard coded into 
-* GFS_DIR_MAX_DEPTH. After that, leaves are chained together in a linked list,
-* but never before the maximum hash table size has been reached.
-*/
-
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <linux/vmalloc.h>
-
-#include "gfs.h"
-#include "dio.h"
-#include "dir.h"
-#include "file.h"
-#include "glock.h"
-#include "inode.h"
-#include "quota.h"
-#include "rgrp.h"
-#include "trans.h"
-
-#if 1
-#define gfs_dir_hash2offset(h) (((uint64_t)(h)) >> 1)
-#define gfs_dir_offset2hash(p) ((uint32_t)(((uint64_t)(p)) << 1))
-#else
-#define gfs_dir_hash2offset(h) (((uint64_t)(h)))
-#define gfs_dir_offset2hash(p) ((uint32_t)(((uint64_t)(p))))
-#endif
-
-typedef int (*leaf_call_t) (struct gfs_inode *dip,
-			    uint32_t index, uint32_t len, uint64_t leaf_no,
-			    void *data);
-
-/**
- * int gfs_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 TRUE if they are equal.
- *
- * Returns: TRUE (!=0) if the files are the same, otherwise FALSE (0).
- */
-
-int
-gfs_filecmp(struct qstr *file1, char *file2, int len_of_file2)
-{
-	if (file1->len != len_of_file2)
-		return FALSE;
-	if (memcmp(file1->name, file2, file1->len))
-		return FALSE;
-	return TRUE;
-}
-
-/**
- * dirent_first - Return the first dirent
- * @dip: the directory
- * @bh: The buffer
- * @dent: Pointer to list of dirents
- *
- * return first dirent whether bh points to leaf or stuffed dinode
- *
- * Returns: IS_LEAF, IS_DINODE, or -errno
- */
-
-static int
-dirent_first(struct gfs_inode *dip, struct buffer_head *bh,
-	     struct gfs_dirent **dent)
-{
-	struct gfs_meta_header *h = (struct gfs_meta_header *)bh->b_data;
-
-	if (gfs32_to_cpu(h->mh_type) == GFS_METATYPE_LF) {
-		if (gfs_meta_check(dip->i_sbd, bh))
-			return -EIO;
-		*dent = (struct gfs_dirent *)(bh->b_data + sizeof(struct gfs_leaf));
-		return IS_LEAF;
-	} else {
-		if (gfs_metatype_check(dip->i_sbd, bh, GFS_METATYPE_DI))
-			return -EIO;
-		*dent = (struct gfs_dirent *)(bh->b_data + sizeof(struct gfs_dinode));
-		return IS_DINODE;
-	}
-}
-
-/**
- * dirent_next - Next dirent
- * @dip: the directory
- * @bh: The buffer
- * @dent: Pointer to list of dirents
- *
- * Returns: 0 on success, error code otherwise
- */
-
-static int
-dirent_next(struct gfs_inode *dip, struct buffer_head *bh,
-	    struct gfs_dirent **dent)
-{
-	struct gfs_dirent *tmp, *cur;
-	char *bh_end;
-	uint32_t cur_rec_len;
-
-	cur = *dent;
-	bh_end = bh->b_data + bh->b_size;
-	cur_rec_len = gfs16_to_cpu(cur->de_rec_len);
-
-	if ((char *)cur + cur_rec_len >= bh_end) {
-		if ((char *)cur + cur_rec_len > bh_end) {
-			gfs_consist_inode(dip);
-			return -EIO;
-		}
-		return -ENOENT;
-	}
-
-	tmp = (struct gfs_dirent *)((char *)cur + cur_rec_len);
-
-	if ((char *)tmp + gfs16_to_cpu(tmp->de_rec_len) > bh_end) {
-		gfs_consist_inode(dip);
-		return -EIO;
-	}
-        /* Only the first dent could ever have de_ino == 0 */
-	if (!tmp->de_inum.no_formal_ino) {
-		gfs_consist_inode(dip);
-		return -EIO;
-	}
-
-	*dent = tmp;
-
-	return 0;
-}
-
-/**
- * dirent_del - Delete a dirent
- * @dip: The GFS inode
- * @bh: The buffer
- * @prev: The previous dirent
- * @cur: The current dirent
- *
- */
-
-static void
-dirent_del(struct gfs_inode *dip, struct buffer_head *bh,
-	   struct gfs_dirent *prev, struct gfs_dirent *cur)
-{
-	uint32_t cur_rec_len, prev_rec_len;
-
-	if (!cur->de_inum.no_formal_ino) {
-		gfs_consist_inode(dip);
-		return;
-	}
-
-	gfs_trans_add_bh(dip->i_gl, bh);
-
-	/* If there is no prev entry, this is the first entry in the block.
-	   The de_rec_len is already as big as it needs to be.  Just zero
-	   out the inode number and return.  */
-
-	if (!prev) {
-		cur->de_inum.no_formal_ino = 0;	/* No endianess worries */
-		return;
-	}
-
-	/*  Combine this dentry with the previous one.  */
-
-	prev_rec_len = gfs16_to_cpu(prev->de_rec_len);
-	cur_rec_len = gfs16_to_cpu(cur->de_rec_len);
-
-	if ((char *)prev + prev_rec_len != (char *)cur)
-		gfs_consist_inode(dip);
-	if ((char *)cur + cur_rec_len > bh->b_data + bh->b_size)
-		gfs_consist_inode(dip);
-
-	prev_rec_len += cur_rec_len;
-	prev->de_rec_len = cpu_to_gfs16(prev_rec_len);
-}
-
-/**
- * gfs_dirent_alloc - Allocate a directory entry
- * @dip: The GFS inode
- * @bh: The buffer
- * @name_len: The length of the name
- * @dent_out: Pointer to list of dirents
- *
- * Returns: 0 on success, error code otherwise
- */
-
-int
-gfs_dirent_alloc(struct gfs_inode *dip, struct buffer_head *bh, int name_len,
-		 struct gfs_dirent **dent_out)
-{
-	struct gfs_dirent *dent, *new;
-	unsigned int rec_len = GFS_DIRENT_SIZE(name_len);
-	unsigned int entries = 0, offset = 0;
-	int type;
-
-	type = dirent_first(dip, bh, &dent);
-	if (type < 0)
-		return type;
-
-	if (type == IS_LEAF) {
-		struct gfs_leaf *leaf = (struct gfs_leaf *)bh->b_data;
-		entries = gfs16_to_cpu(leaf->lf_entries);
-		offset = sizeof(struct gfs_leaf);
-	} else {
-		struct gfs_dinode *dinode = (struct gfs_dinode *)bh->b_data;
-		entries = gfs32_to_cpu(dinode->di_entries);
-		offset = sizeof(struct gfs_dinode);
-	}
-
-	if (!entries) {
-		if (dent->de_inum.no_formal_ino) {
-			gfs_consist_inode(dip);
-			return -EIO;
-		}
-
-		gfs_trans_add_bh(dip->i_gl, bh);
-
-		dent->de_rec_len = bh->b_size - offset;
-		dent->de_rec_len = cpu_to_gfs16(dent->de_rec_len);
-		dent->de_name_len = cpu_to_gfs16(name_len);
-
-		*dent_out = dent;
-		return 0;
-	}
-
-	do {
-		uint32_t cur_rec_len, cur_name_len;
-
-		cur_rec_len = gfs16_to_cpu(dent->de_rec_len);
-		cur_name_len = gfs16_to_cpu(dent->de_name_len);
-
-		if ((!dent->de_inum.no_formal_ino && cur_rec_len >= rec_len) ||
-		    (cur_rec_len >= GFS_DIRENT_SIZE(cur_name_len) + rec_len)) {
-			gfs_trans_add_bh(dip->i_gl, bh);
-
-			if (dent->de_inum.no_formal_ino) {
-				new = (struct gfs_dirent *)((char *)dent +
-							    GFS_DIRENT_SIZE(cur_name_len));
-				memset(new, 0, sizeof(struct gfs_dirent));
-
-				new->de_rec_len = cpu_to_gfs16(cur_rec_len -
-							       GFS_DIRENT_SIZE(cur_name_len));
-				new->de_name_len = cpu_to_gfs16(name_len);
-
-				dent->de_rec_len = cur_rec_len - gfs16_to_cpu(new->de_rec_len);
-				dent->de_rec_len = cpu_to_gfs16(dent->de_rec_len);
-
-				*dent_out = new;
-				return 0;
-			}
-
-			dent->de_name_len = cpu_to_gfs16(name_len);
-
-			*dent_out = dent;
-			return 0;
-		}
-	} while (dirent_next(dip, bh, &dent) == 0);
-
-	return -ENOSPC;
-}
-
-/**
- * dirent_fits - See if we can fit a entry in this buffer
- * @dip: The GFS inode
- * @bh: The buffer
- * @name_len: The length of the name
- *
- * Returns: TRUE if it can fit, FALSE otherwise
- */
-
-static int
-dirent_fits(struct gfs_inode *dip, struct buffer_head *bh, int name_len)
-{
-	struct gfs_dirent *dent;
-	unsigned int rec_len = GFS_DIRENT_SIZE(name_len);
-	unsigned int entries = 0;
-	int type;
-
-	type = dirent_first(dip, bh, &dent);
-	if (type < 0)
-		return type;
-
-	if (type == IS_LEAF) {
-		struct gfs_leaf *leaf = (struct gfs_leaf *)bh->b_data;
-		entries = gfs16_to_cpu(leaf->lf_entries);
-	} else {
-		struct gfs_dinode *dinode = (struct gfs_dinode *)bh->b_data;
-		entries = gfs32_to_cpu(dinode->di_entries);
-	}
-
-	if (!entries)
-		return TRUE;
-
-	do {
-		uint32_t cur_rec_len, cur_name_len;
-
-		cur_rec_len = gfs16_to_cpu(dent->de_rec_len);
-		cur_name_len = gfs16_to_cpu(dent->de_name_len);
-
-		if ((!dent->de_inum.no_formal_ino && cur_rec_len >= rec_len) ||
-		    (cur_rec_len >= GFS_DIRENT_SIZE(cur_name_len) + rec_len))
-			return TRUE;
-	} while (dirent_next(dip, bh, &dent) == 0);
-
-	return FALSE;
-}
-
-/**
- * leaf_search
- * @bh:
- * @filename:
- * @dent_out:
- * @dent_prev:
- *
- * Returns:
- */
-
-static int
-leaf_search(struct gfs_inode *dip,
-	    struct buffer_head *bh, struct qstr *filename,
-	    struct gfs_dirent **dent_out, struct gfs_dirent **dent_prev)
-{
-	uint32_t hash;
-	struct gfs_dirent *dent, *prev = NULL;
-	unsigned int entries = 0;
-	int type;
-
-	type = dirent_first(dip, bh, &dent);
-	if (type < 0)
-		return type;
-
-	if (type == IS_LEAF) {
-		struct gfs_leaf *leaf = (struct gfs_leaf *)bh->b_data;
-		entries = gfs16_to_cpu(leaf->lf_entries);
-	} else if (type == IS_DINODE) {
-		struct gfs_dinode *dinode = (struct gfs_dinode *)bh->b_data;
-		entries = gfs32_to_cpu(dinode->di_entries);
-	}
-
-	hash = gfs_dir_hash(filename->name, filename->len);
-
-	do {
-		if (!dent->de_inum.no_formal_ino) {
-			prev = dent;
-			continue;
-		}
-
-		if (gfs32_to_cpu(dent->de_hash) == hash &&
-		    gfs_filecmp(filename, (char *)(dent + 1),
-				gfs16_to_cpu(dent->de_name_len))) {
-			*dent_out = dent;
-			if (dent_prev)
-				*dent_prev = prev;
-
-			return 0;
-		}
-
-		prev = dent;
-	} while (dirent_next(dip, bh, &dent) == 0);
-
-	return -ENOENT;
-}
-
-/**
- * get_leaf - Get leaf
- * @dip:
- * @leaf_no:
- * @bh_out:
- *
- * Returns: 0 on success, error code otherwise
- */
-
-static int
-get_leaf(struct gfs_inode *dip, uint64_t leaf_no, struct buffer_head **bhp)
-{
-	int error;
-
-	error = gfs_dread(dip->i_gl, leaf_no, DIO_START | DIO_WAIT, bhp);
-	if (!error && gfs_metatype_check(dip->i_sbd, *bhp, GFS_METATYPE_LF))
-		error = -EIO;
-
-	return error;
-}
-
-/**
- * get_leaf_nr - Get a leaf number associated with the index
- * @dip: The GFS inode
- * @index:
- * @leaf_out:
- *
- * Returns: 0 on success, error code otherwise
- */
-
-static int
-get_leaf_nr(struct gfs_inode *dip, uint32_t index, uint64_t *leaf_out)
-{
-	uint64_t leaf_no;
-	int error;
-
-	error = gfs_internal_read(dip, (char *)&leaf_no,
-				  index * sizeof(uint64_t),
-				  sizeof(uint64_t));
-	if (error != sizeof(uint64_t))
-		return (error < 0) ? error : -EIO;
-
-	*leaf_out = gfs64_to_cpu(leaf_no);
-
-	return 0;
-}
-
-/**
- * get_first_leaf - Get first leaf
- * @dip: The GFS inode
- * @index:
- * @bh_out:
- *
- * Returns: 0 on success, error code otherwise
- */
-
-static int
-get_first_leaf(struct gfs_inode *dip, uint32_t index,
-	       struct buffer_head **bh_out)
-{
-	uint64_t leaf_no;
-	int error;
-
-	error = get_leaf_nr(dip, index, &leaf_no);
-	if (!error)
-		error = get_leaf(dip, leaf_no, bh_out);
-
-	return error;
-}
-
-/**
- * get_next_leaf - Get next leaf
- * @dip: The GFS inode
- * @bh_in: The buffer
- * @bh_out:
- *
- * Returns: 0 on success, error code otherwise
- */
-
-static int
-get_next_leaf(struct gfs_inode *dip, struct buffer_head *bh_in,
-	      struct buffer_head **bh_out)
-{
-	struct gfs_leaf *leaf;
-	int error;
-
-	leaf = (struct gfs_leaf *)bh_in->b_data;
-
-	if (!leaf->lf_next)
-		error = -ENOENT;
-	else
-		error = get_leaf(dip, gfs64_to_cpu(leaf->lf_next), bh_out);
-
-	return error;
-}
-
-/**
- * linked_leaf_search - Linked leaf search
- * @dip: The GFS inode
- * @filename: The filename to search for
- * @dent_out:
- * @dent_prev:
- * @bh_out:
- *
- * Returns: 0 on sucess, error code otherwise
- */
-
-static int
-linked_leaf_search(struct gfs_inode *dip, struct qstr *filename,
-		   struct gfs_dirent **dent_out, struct gfs_dirent **dent_prev,
-		   struct buffer_head **bh_out)
-{
-	struct buffer_head *bh = NULL, *bh_next;
-	uint32_t hsize, index;
-	uint32_t hash;
-	int error;
-
-	hsize = 1 << dip->i_di.di_depth;
-	if (hsize * sizeof(uint64_t) != dip->i_di.di_size) {
-		gfs_consist_inode(dip);
-		return -EIO;
-	}
-
-	/*  Figure out the address of the leaf node.  */
-
-	hash = gfs_dir_hash(filename->name, 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);
-
-		bh = bh_next;
-
-		error = leaf_search(dip, bh, filename, dent_out, dent_prev);
-		switch (error) {
-		case 0:
-			*bh_out = bh;
-			return 0;
-
-		case -ENOENT:
-			break;
-
-		default:
-			brelse(bh);
-			return error;
-		}
-
-		error = get_next_leaf(dip, bh, &bh_next);
-	}
-	while (!error);
-
-	brelse(bh);
-
-	return error;
-}
-
-/**
- * dir_make_exhash - Convert a stuffed directory into an ExHash directory
- * @dip: The GFS inode
- *
- * Returns: 0 on success, error code otherwise
- */
-
-static int
-dir_make_exhash(struct gfs_inode *dip)
-{
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct gfs_dirent *dent;
-	struct buffer_head *bh, *dibh;
-	struct gfs_leaf *leaf;
-	int y;
-	uint32_t x;
-	uint64_t *lp, bn;
-	int error;
-
-	error = gfs_get_inode_buffer(dip, &dibh);
-	if (error)
-		return error;
-
-	/*  Allocate a new block for the first leaf node  */
-
-	error = gfs_metaalloc(dip, &bn);
-	if (error)
-		goto fail;
-
-	/*  Turn over a new leaf  */
-
-	error = gfs_dread(dip->i_gl, bn, DIO_NEW | DIO_START | DIO_WAIT, &bh);
-	if (error)
-		goto fail;
-
-	gfs_trans_add_bh(dip->i_gl, bh);
-	gfs_metatype_set(bh, GFS_METATYPE_LF, GFS_FORMAT_LF);
-	gfs_buffer_clear_tail(bh, sizeof(struct gfs_meta_header));
-
-	/*  Fill in the leaf structure  */
-
-	leaf = (struct gfs_leaf *)bh->b_data;
-
-	gfs_assert(sdp, dip->i_di.di_entries < (1 << 16),);
-
-	leaf->lf_dirent_format = cpu_to_gfs32(GFS_FORMAT_DE);
-	leaf->lf_entries = cpu_to_gfs16(dip->i_di.di_entries);
-
-	/*  Copy dirents  */
-
-	gfs_buffer_copy_tail(bh, sizeof(struct gfs_leaf), dibh,
-			     sizeof(struct gfs_dinode));
-
-	/*  Find last entry  */
-
-	x = 0;
-	dirent_first(dip, bh, &dent);
-
-	do {
-		if (!dent->de_inum.no_formal_ino)
-			continue;
-		if (++x == dip->i_di.di_entries)
-			break;
-	}
-	while (dirent_next(dip, bh, &dent) == 0);
-
-	/*  Adjust the last dirent's record length
-	   (Remember that dent still points to the last entry.)  */
-
-	dent->de_rec_len = gfs16_to_cpu(dent->de_rec_len) +
-		sizeof(struct gfs_dinode) -
-		sizeof(struct gfs_leaf);
-	dent->de_rec_len = cpu_to_gfs16(dent->de_rec_len);
-
-	brelse(bh);
-
-	/*  We're done with the new leaf block, now setup the new
-	    hash table.  */
-
-	gfs_trans_add_bh(dip->i_gl, dibh);
-	gfs_buffer_clear_tail(dibh, sizeof (struct gfs_dinode));
-
-	lp = (uint64_t *)(dibh->b_data + sizeof(struct gfs_dinode));
-
-	for (x = sdp->sd_hash_ptrs; x--; lp++)
-		*lp = cpu_to_gfs64(bn);
-
-	dip->i_di.di_size = sdp->sd_sb.sb_bsize / 2;
-	dip->i_di.di_blocks++;
-	dip->i_di.di_flags |= GFS_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;
-
-	gfs_dinode_out(&dip->i_di, dibh->b_data);
-
-	brelse(dibh);
-
-	return 0;
-
- fail:
-	brelse(dibh);
-	return error;
-}
-
-/**
- * dir_split_leaf - Split a leaf block into two
- * @dip: The GFS inode
- * @index:
- * @leaf_no:
- *
- * Returns: 0 on success, error code on failure
- */
-
-static int
-dir_split_leaf(struct gfs_inode *dip, uint32_t index, uint64_t leaf_no)
-{
-	struct buffer_head *nbh, *obh, *dibh;
-	struct gfs_leaf *nleaf, *oleaf;
-	struct gfs_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 error, lp_vfree=0;
-
-	/*  Allocate the new leaf block  */
-
-	error = gfs_metaalloc(dip, &bn);
-	if (error)
-		return error;
-
-	/*  Get the new leaf block  */
-
-	error = gfs_dread(dip->i_gl, bn,
-			  DIO_NEW | DIO_START | DIO_WAIT, &nbh);
-	if (error)
-		return error;
-
-	gfs_trans_add_bh(dip->i_gl, nbh);
-	gfs_metatype_set(nbh, GFS_METATYPE_LF, GFS_FORMAT_LF);
-	gfs_buffer_clear_tail(nbh, sizeof (struct gfs_meta_header));
-
-	nleaf = (struct gfs_leaf *)nbh->b_data;
-
-	nleaf->lf_dirent_format = cpu_to_gfs32(GFS_FORMAT_DE);
-
-	/*  Get the old leaf block  */
-
-	error = get_leaf(dip, leaf_no, &obh);
-	if (error)
-		goto fail;
-
-	gfs_trans_add_bh(dip->i_gl, obh);
-
-	oleaf = (struct gfs_leaf *)obh->b_data;
-
-	/*  Compute the start and len of leaf pointers in the hash table.  */
-
-	len = 1 << (dip->i_di.di_depth - gfs16_to_cpu(oleaf->lf_depth));
-	half_len = len >> 1;
-	if (!half_len) {
-		gfs_consist_inode(dip);
-		error = -EIO;
-		goto fail_brelse;
-	}
-
-	start = (index & ~(len - 1));
-
-	/* Change the pointers.
-	   Don't bother distinguishing stuffed from non-stuffed.
-	   This code is complicated enough already. */
-
-	lp = kmalloc(half_len * sizeof (uint64_t), GFP_KERNEL);
-	if (unlikely(!lp)) {
-		lp = vmalloc(half_len * sizeof (uint64_t));
-		if (!lp) {
-			printk("GFS: dir_split_leaf vmalloc fail - half_len=%d\n", half_len);
-			error = -ENOMEM;
-			goto fail_brelse;
-		} else
-			lp_vfree = 1;
-	}
-
-	error = gfs_internal_read(dip, (char *)lp, start * sizeof(uint64_t),
-				  half_len * sizeof(uint64_t));
-	if (error != half_len * sizeof(uint64_t)) {
-		if (error >= 0)
-			error = -EIO;
-		goto fail_lpfree;
-	}
-
-	/*  Change the pointers  */
-
-	for (x = 0; x < half_len; x++)
-		lp[x] = cpu_to_gfs64(bn);
-
-	error = gfs_internal_write(dip, (char *)lp, start * sizeof(uint64_t),
-				   half_len * sizeof(uint64_t));
-	if (error != half_len * sizeof(uint64_t)) {
-		if (error >= 0)
-			error = -EIO;
-		goto fail_lpfree;
-	}
-
-	if (unlikely(lp_vfree))
-		vfree(lp);
-	else
-		kfree(lp);
-
-	/*  Compute the divider  */
-
-	divider = (start + half_len) << (32 - dip->i_di.di_depth);
-
-	/*  Copy the entries  */
-
-	dirent_first(dip, obh, &dent);
-
-	do {
-		next = dent;
-		if (dirent_next(dip, obh, &next))
-			next = NULL;
-
-		if (dent->de_inum.no_formal_ino &&
-		    gfs32_to_cpu(dent->de_hash) < divider) {
-			name_len = gfs16_to_cpu(dent->de_name_len);
-
-			gfs_dirent_alloc(dip, nbh, name_len, &new);
-
-			new->de_inum = dent->de_inum; /* No endianness worries */
-			new->de_hash = dent->de_hash; /* No endianness worries */
-			new->de_type = dent->de_type; /* No endianness worries */
-			memcpy((char *)(new + 1), (char *)(dent + 1),
-			       name_len);
-
-			nleaf->lf_entries = gfs16_to_cpu(nleaf->lf_entries) + 1;
-			nleaf->lf_entries = cpu_to_gfs16(nleaf->lf_entries);
-
-			dirent_del(dip, obh, prev, dent);
-
-			if (!oleaf->lf_entries)
-				gfs_consist_inode(dip);
-			oleaf->lf_entries = gfs16_to_cpu(oleaf->lf_entries) - 1;
-			oleaf->lf_entries = cpu_to_gfs16(oleaf->lf_entries);
-
-			if (!prev)
-				prev = dent;
-
-			moved = TRUE;
-		} else
-			prev = dent;
-
-		dent = next;
-	}
-	while (dent);
-
-	/* If none of the entries got moved into the new leaf,
-	   artificially fill in the first entry. */
-
-	if (!moved) {
-		gfs_dirent_alloc(dip, nbh, 0, &new);
-		new->de_inum.no_formal_ino = 0;
-	}
-
-	oleaf->lf_depth = gfs16_to_cpu(oleaf->lf_depth) + 1;
-	oleaf->lf_depth = cpu_to_gfs16(oleaf->lf_depth);
-	nleaf->lf_depth = oleaf->lf_depth;
-
-	error = gfs_get_inode_buffer(dip, &dibh);
-	if (!gfs_assert_withdraw(dip->i_sbd, !error)) {
-		dip->i_di.di_blocks++;
-		gfs_dinode_out(&dip->i_di, dibh->b_data);
-		brelse(dibh);
-	}
-
-	brelse(obh);
-	brelse(nbh);
-
-	return error;
-
- fail_lpfree:
-	if (unlikely(lp_vfree))
-		vfree(lp);
-	else
-		kfree(lp);
-
- fail_brelse:
-	brelse(obh);
-
- fail:
-	brelse(nbh);
-	return error;
-}
-
-/**
- * dir_double_exhash - Double size of ExHash table
- * @dip: The GFS dinode
- *
- * Returns: 0 on success, error code on failure
- */
-
-static int
-dir_double_exhash(struct gfs_inode *dip)
-{
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct buffer_head *dibh;
-	uint32_t hsize;
-	uint64_t *buf;
-	uint64_t *from, *to;
-	uint64_t block;
-	int x;
-	int error = 0;
-
-	hsize = 1 << dip->i_di.di_depth;
-	if (hsize * sizeof(uint64_t) != dip->i_di.di_size) {
-		gfs_consist_inode(dip);
-		return -EIO;
-	}
-
-	/*  Allocate both the "from" and "to" buffers in one big chunk  */
-
-	buf = gmalloc(3 * sdp->sd_hash_bsize);
-
-	for (block = dip->i_di.di_size >> sdp->sd_hash_bsize_shift; block--;) {
-		error = gfs_internal_read(dip, (char *)buf,
-					  block * sdp->sd_hash_bsize,
-					  sdp->sd_hash_bsize);
-		if (error != sdp->sd_hash_bsize) {
-			if (error >= 0)
-				error = -EIO;
-			goto fail;
-		}
-
-		from = buf;
-		to = (uint64_t *)((char *)buf + sdp->sd_hash_bsize);
-
-		for (x = sdp->sd_hash_ptrs; x--; from++) {
-			*to++ = *from;	/*  No endianess worries  */
-			*to++ = *from;
-		}
-
-		error = gfs_internal_write(dip, (char *)buf + sdp->sd_hash_bsize,
-					   block * sdp->sd_sb.sb_bsize,
-					   sdp->sd_sb.sb_bsize);
-		if (error != sdp->sd_sb.sb_bsize) {
-			if (error >= 0)
-				error = -EIO;
-			goto fail;
-		}
-	}
-
-	kfree(buf);
-
-	error = gfs_get_inode_buffer(dip, &dibh);
-	if (!gfs_assert_withdraw(sdp, !error)) {
-		dip->i_di.di_depth++;
-		gfs_dinode_out(&dip->i_di, dibh->b_data);
-		brelse(dibh);
-	}
-
-	return error;
-
- fail:
-	kfree(buf);
-
-	return error;
-}
-
-/**
- * compare_dents - compare directory entries by hash value
- * @a: first dent
- * @b: second dent
- *
- * When comparing the hash entries of @a to @b:
- *   gt: returns 1
- *   lt: returns -1
- *   eq: returns 0
- */
-
-static int
-compare_dents(const void *a, const void *b)
-{
-	struct gfs_dirent *dent_a, *dent_b;
-	uint32_t hash_a, hash_b;
-	int ret = 0;
-
-	dent_a = *(struct gfs_dirent **)a;
-	hash_a = dent_a->de_hash;
-	hash_a = gfs32_to_cpu(hash_a);
-
-	dent_b = *(struct gfs_dirent **)b;
-	hash_b = dent_b->de_hash;
-	hash_b = gfs32_to_cpu(hash_b);
-
-	if (hash_a > hash_b)
-		ret = 1;
-	else if (hash_a < hash_b)
-		ret = -1;
-	else {
-		unsigned int len_a = gfs16_to_cpu(dent_a->de_name_len);
-		unsigned int len_b = gfs16_to_cpu(dent_b->de_name_len);
-
-		if (len_a > len_b)
-			ret = 1;
-		else if (len_a < len_b)
-			ret = -1;
-		else
-			ret = memcmp((char *)(dent_a + 1),
-				     (char *)(dent_b + 1),
-				     len_a);
-	}
-
-	return ret;
-}
-
-/**
- * do_filldir_main - read out directory entries
- * @dip: The GFS inode
- * @offset: The offset in the file to read from
- * @opaque: opaque data to pass to filldir
- * @filldir: The function to pass entries to 
- * @darr: an array of struct gfs_dirent pointers to read
- * @entries: the number of entries in darr
- * @copied: pointer to int that's non-zero if a entry has been copied out
- *
- * Jump through some hoops to make sure that if there are hash collsions,
- * they are read out at the beginning of a buffer.  We want to minimize
- * the possibility that they will fall into different readdir buffers or
- * that someone will want to seek to that location.
- *
- * Returns: errno, >0 on exception from filldir
- */
-
-static int
-do_filldir_main(struct gfs_inode *dip, uint64_t *offset,
-		void *opaque, gfs_filldir_t filldir,
-		struct gfs_dirent **darr, uint32_t entries, int *copied)
-{
-	struct gfs_dirent *dent, *dent_next;
-	struct gfs_inum inum;
-	uint64_t off, off_next;
-	unsigned int x, y;
-	int run = FALSE;
-	int error = 0;
-
-	gfs_sort(darr, entries, sizeof(struct gfs_dirent *), compare_dents);
-
-	dent_next = darr[0];
-	off_next = gfs32_to_cpu(dent_next->de_hash);
-	off_next = gfs_dir_hash2offset(off_next);
-
-	for (x = 0, y = 1; x < entries; x++, y++) {
-		dent = dent_next;
-		off = off_next;
-
-		if (y < entries) {
-			dent_next = darr[y];
-			off_next = gfs32_to_cpu(dent_next->de_hash);
-			off_next = gfs_dir_hash2offset(off_next);
-
-			if (off < *offset)
-				continue;
-			*offset = off;
-
-			if (off_next == off) {
-				if (*copied && !run)
-					return 1;
-				run = TRUE;
-			} else
-				run = FALSE;
-		} else {
-			if (off < *offset)
-				continue;
-			*offset = off;
-		}
-
-		gfs_inum_in(&inum, (char *)&dent->de_inum);
-
-		error = filldir(opaque, (char *)(dent + 1),
-				gfs16_to_cpu(dent->de_name_len),
-				off, &inum,
-				gfs16_to_cpu(dent->de_type));
-		if (error)
-			return 1;
-
-		*copied = TRUE;
-	}
-
-	/* Increment the *offset by one, so the next time we come into the do_filldir fxn, 
-	   we get the next entry instead of the last one in the current leaf */
-
-	(*offset)++;
-
-	return 0;
-}
-
-/**
- * do_filldir_single - Read directory entries out of a single block
- * @dip: The GFS inode
- * @offset: The offset in the file to read from
- * @opaque: opaque data to pass to filldir
- * @filldir: The function to pass entries to 
- * @bh: the block
- * @entries: the number of entries in the block
- * @copied: pointer to int that's non-zero if a entry has been copied out
- *
- * Returns: errno, >0 on exception from filldir
- */
-
-static int
-do_filldir_single(struct gfs_inode *dip, uint64_t *offset,
-		  void *opaque, gfs_filldir_t filldir,
-		  struct buffer_head *bh, uint32_t entries, int *copied)
-{
-	struct gfs_dirent **darr;
-	struct gfs_dirent *de;
-	unsigned int e = 0;
-	int error, do_vfree=0;
-
-	if (!entries)
-		return 0;
-
-	darr = kmalloc(entries * sizeof(struct gfs_dirent *), GFP_KERNEL);
-	if (unlikely(!darr)) {
-		darr = vmalloc(entries * sizeof (struct gfs_dirent *));
-		if (!darr) {
-			printk("GFS: do_filldir_single vmalloc fails, entries=%d\n", entries);
-			return -ENOMEM;
-		}
-	else
-		do_vfree = 1;
-	}
-
-	dirent_first(dip, bh, &de);
-	do {
-		if (!de->de_inum.no_formal_ino)
-			continue;
-		if (e >= entries) {
-			gfs_consist_inode(dip);
-			error = -EIO;
-			goto out;
-		}
-		darr[e++] = de;
-	}
-	while (dirent_next(dip, bh, &de) == 0);
-
-	if (e != entries) {
-		gfs_consist_inode(dip);
-		error = -EIO;
-		goto out;
-	}
-
-	error = do_filldir_main(dip, offset, opaque, filldir, darr,
-				entries, copied);
-
- out:
-	if (unlikely(do_vfree))
-		vfree(darr);
-	else
-		kfree(darr);
-
-	return error;
-}
-
-/**
- * do_filldir_multi - Read directory entries out of a linked leaf list
- * @dip: The GFS inode
- * @offset: The offset in the file to read from
- * @opaque: opaque data to pass to filldir
- * @filldir: The function to pass entries to 
- * @bh: the first leaf in the list
- * @copied: pointer to int that's non-zero if a entry has been copied out
- *
- * Returns: errno, >0 on exception from filldir
- */
-
-static int
-do_filldir_multi(struct gfs_inode *dip, uint64_t *offset,
-		 void *opaque, gfs_filldir_t filldir,
-		 struct buffer_head *bh, int *copied)
-{
-	struct buffer_head **larr = NULL;
-	struct gfs_dirent **darr;
-	struct gfs_leaf *leaf;
-	struct buffer_head *tmp_bh;
-	struct gfs_dirent *de;
-	unsigned int entries, e = 0;
-	unsigned int leaves = 0, l = 0;
-	unsigned int x;
-	uint64_t ln;
-	int error = 0, leaves_vfree=0, entries_vfree=0;
-
-	/*  Count leaves and entries  */
-
-	leaf = (struct gfs_leaf *)bh->b_data;
-	entries = gfs16_to_cpu(leaf->lf_entries);
-	ln = leaf->lf_next;
-
-	while (ln) {
-		ln = gfs64_to_cpu(ln);
-
-		error = get_leaf(dip, ln, &tmp_bh);
-		if (error)
-			return error;
-
-		leaf = (struct gfs_leaf *)tmp_bh->b_data;
-		if (leaf->lf_entries) {
-			entries += gfs16_to_cpu(leaf->lf_entries);
-			leaves++;
-		}
-		ln = leaf->lf_next;
-
-		brelse(tmp_bh);
-	}
-
-	/*  Bail out if there's nothing to do  */
-
-	if (!entries)
-		return 0;
-
-	/*  Alloc arrays  */
-
-	if (leaves) {
-		larr = kmalloc(leaves * sizeof(struct buffer_head *), GFP_KERNEL);
-		if (unlikely(!larr)) {
-			larr = vmalloc(leaves * sizeof (struct buffer_head *));
-			if (!larr) {
-				printk("GFS: do_filldir_multi vmalloc fails leaves=%d\n", leaves);
-				return -ENOMEM;
-			} else
-				leaves_vfree = 1;
-		}
-	}
-
-	darr = kmalloc(entries * sizeof(struct gfs_dirent *), GFP_KERNEL);
-	if (unlikely(!darr)) {
-		darr = vmalloc(entries * sizeof (struct gfs_dirent *));
-		if (!darr) {
-			printk("GFS: do_filldir_multi vmalloc fails entries=%d\n", entries);
-			if (larr) {
-				if (leaves_vfree) 
-					vfree(larr);
-				else 
-					kfree(larr);
-			}
-			return -ENOMEM;
-		} else
-			entries_vfree = 1;
-	} 
-	if (!darr) {
-		if (larr)
-			kfree(larr);
-		return -ENOMEM;
-	}
-
-	/*  Fill in arrays  */
-
-	leaf = (struct gfs_leaf *)bh->b_data;
-	if (leaf->lf_entries) {
-		dirent_first(dip, bh, &de);
-		do {
-			if (!de->de_inum.no_formal_ino)
-				continue;
-			if (e >= entries) {
-				gfs_consist_inode(dip);
-				error = -EIO;
-				goto out;
-			}
-			darr[e++] = de;
-		}
-		while (dirent_next(dip, bh, &de) == 0);
-	}
-	ln = leaf->lf_next;
-
-	while (ln) {
-		ln = gfs64_to_cpu(ln);
-
-		error = get_leaf(dip, ln, &tmp_bh);
-		if (error)
-			goto out;
-
-		leaf = (struct gfs_leaf *)tmp_bh->b_data;
-		if (leaf->lf_entries) {
-			dirent_first(dip, tmp_bh, &de);
-			do {
-				if (!de->de_inum.no_formal_ino)
-					continue;
-				if (e >= entries) {
-					gfs_consist_inode(dip);
-					error = -EIO;
-					goto out;
-				}
-				darr[e++] = de;
-			}
-			while (dirent_next(dip, tmp_bh, &de) == 0);
-
-			larr[l++] = tmp_bh;
-
-			ln = leaf->lf_next;
-		} else {
-			ln = leaf->lf_next;
-			brelse(tmp_bh);
-		}
-	}
-
-	if (gfs_assert_withdraw(dip->i_sbd, l == leaves)) {
-		error = -EIO;
-		goto out;
-	}
-	if (e != entries) {
-		gfs_consist_inode(dip);
-		error = -EIO;
-		goto out;
-	}
-
-	/*  Do work  */
-
-	error = do_filldir_main(dip, offset, opaque, filldir, darr,
-				entries, copied);
-
-	/*  Clean up  */
-
- out:
-	if (unlikely(entries_vfree))
-		vfree(darr);
-	else
-		kfree(darr);
-
-	for (x = 0; x < l; x++)
-		brelse(larr[x]);
-
-	if (leaves) {
-		if (unlikely(leaves_vfree))
-			vfree(larr);
-		else
-			kfree(larr);
-	}
-
-	return error;
-}
-
-/**
- * dir_e_search - Search exhash (leaf) dir for inode matching name
- * @dip: The GFS inode
- * @filename: Filename string
- * @inode: If non-NULL, function fills with formal inode # and block address
- * @type: If non-NULL, function fills with GFS_FILE_... dinode type
- *
- * Returns:
- */
-
-static int
-dir_e_search(struct gfs_inode *dip, struct qstr *filename,
-	     struct gfs_inum *inum, unsigned int *type)
-{
-	struct buffer_head *bh;
-	struct gfs_dirent *dent;
-	int error;
-
-	error = linked_leaf_search(dip, filename, &dent, NULL, &bh);
-	if (error)
-		return error;
-
-	if (inum)
-		gfs_inum_in(inum, (char *)&dent->de_inum);
-	if (type)
-		*type = gfs16_to_cpu(dent->de_type);
-
-	brelse(bh);
-
-	return 0;
-}
-
-/**
- * dir_e_add -
- * @dip: The GFS inode
- * @filename:
- * @inode:
- * @type:
- *
- */
-
-static int
-dir_e_add(struct gfs_inode *dip, struct qstr *filename,
-	  struct gfs_inum *inum, unsigned int type)
-{
-	struct buffer_head *bh, *nbh, *dibh;
-	struct gfs_leaf *leaf, *nleaf;
-	struct gfs_dirent *dent;
-	uint32_t hsize, index;
-	uint32_t hash;
-	uint64_t leaf_no, bn;
-	int error;
-
- restart:
-	hsize = 1 << dip->i_di.di_depth;
-	if (hsize * sizeof(uint64_t) != dip->i_di.di_size) {
-		gfs_consist_inode(dip);
-		return -EIO;
-	}
-
-	/*  Figure out the address of the leaf node.  */
-
-	hash = gfs_dir_hash(filename->name, filename->len);
-	index = hash >> (32 - dip->i_di.di_depth);
-
-	error = get_leaf_nr(dip, index, &leaf_no);
-	if (error)
-		return error;
-
-	/*  Add entry to the leaf  */
-
-	for (;;) {
-		error = get_leaf(dip, leaf_no, &bh);
-		if (error)
-			return error;
-
-		leaf = (struct gfs_leaf *)bh->b_data;
-
-		if (gfs_dirent_alloc(dip, bh, filename->len, &dent)) {
-
-			if (gfs16_to_cpu(leaf->lf_depth) < dip->i_di.di_depth) {
-				/* Can we split the leaf? */
-
-				brelse(bh);
-
-				error = dir_split_leaf(dip, index, leaf_no);
-				if (error)
-					return error;
-
-				goto restart;
-
-			} else if (dip->i_di.di_depth < GFS_DIR_MAX_DEPTH) {
-				/* Can we double the hash table? */
-
-				brelse(bh);
-
-				error = dir_double_exhash(dip);
-				if (error)
-					return error;
-
-				goto restart;
-
-			} else if (leaf->lf_next) {
-				/* Can we try the next leaf in the list? */
-				leaf_no = gfs64_to_cpu(leaf->lf_next);
-				brelse(bh);
-				continue;
-
-			} else {
-				/* Create a new leaf and add it to the list. */
-
-				error = gfs_metaalloc(dip, &bn);
-				if (error) {
-					brelse(bh);
-					return error;
-				}
-
-				error = gfs_dread(dip->i_gl, bn,
-						  DIO_NEW | DIO_START | DIO_WAIT,
-						  &nbh);
-				if (error) {
-					brelse(bh);
-					return error;
-				}
-
-				gfs_trans_add_bh(dip->i_gl, nbh);
-				gfs_metatype_set(nbh,
-						 GFS_METATYPE_LF,
-						 GFS_FORMAT_LF);
-				gfs_buffer_clear_tail(nbh,
-						      sizeof(struct gfs_meta_header));
-
-				gfs_trans_add_bh(dip->i_gl, bh);
-				leaf->lf_next = cpu_to_gfs64(bn);
-
-				nleaf = (struct gfs_leaf *)nbh->b_data;
-				nleaf->lf_depth = leaf->lf_depth;
-				nleaf->lf_dirent_format = cpu_to_gfs32(GFS_FORMAT_DE);
-
-				gfs_dirent_alloc(dip, nbh, filename->len, &dent);
-
-				dip->i_di.di_blocks++;
-
-				brelse(bh);
-
-				bh = nbh;
-				leaf = nleaf;
-			}
-		}
-
-		/*  If the gfs_dirent_alloc() succeeded, it pinned the "bh".  */
-
-		gfs_inum_out(inum, (char *)&dent->de_inum);
-		dent->de_hash = cpu_to_gfs32(hash);
-		dent->de_type = cpu_to_gfs16(type);
-		memcpy((char *)(dent + 1), filename->name, filename->len);
-
-		leaf->lf_entries = gfs16_to_cpu(leaf->lf_entries) + 1;
-		leaf->lf_entries = cpu_to_gfs16(leaf->lf_entries);
-
-		brelse(bh);
-
-		error = gfs_get_inode_buffer(dip, &dibh);
-		if (error)
-			return error;
-
-		dip->i_di.di_entries++;
-		dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds();
-
-		gfs_trans_add_bh(dip->i_gl, dibh);
-		gfs_dinode_out(&dip->i_di, dibh->b_data);
-		brelse(dibh);
-
-		return 0;
-	}
-
-	return -ENOENT;
-}
-
-/**
- * dir_e_del - 
- * @dip: The GFS inode
- * @filename:
- *
- * Returns:
- */
-
-static int
-dir_e_del(struct gfs_inode *dip, struct qstr *filename)
-{
-	struct buffer_head *bh, *dibh;
-	struct gfs_dirent *dent, *prev;
-	struct gfs_leaf *leaf;
-	unsigned int entries;
-	int error;
-
-	error = linked_leaf_search(dip, filename, &dent, &prev, &bh);
-	if (error == -ENOENT) {
-		gfs_consist_inode(dip);
-		return -EIO;
-	}
-	if (error)
-		return error;
-
-	dirent_del(dip, bh, prev, dent); /* Pins bh */
-
-	leaf = (struct gfs_leaf *)bh->b_data;
-	entries = gfs16_to_cpu(leaf->lf_entries);
-	if (!entries)
-		gfs_consist_inode(dip);
-	entries--;
-	leaf->lf_entries = cpu_to_gfs16(entries);
-
-	brelse(bh);
-
-	error = gfs_get_inode_buffer(dip, &dibh);
-	if (error)
-		return error;
-
-	if (!dip->i_di.di_entries)
-		gfs_consist_inode(dip);
-	dip->i_di.di_entries--;
-	dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds();
-
-	gfs_trans_add_bh(dip->i_gl, dibh);
-	gfs_dinode_out(&dip->i_di, dibh->b_data);
-	brelse(dibh);
-
-	return 0;
-}
-
-/**
- * dir_e_read - Reads the entries from a directory into a filldir buffer 
- * @dip: dinode pointer
- * @offset: the hash of the last entry read shifted to the right once
- * @opaque: buffer for the filldir function to fill 
- * @filldir: points to the filldir function to use
- *
- * Returns: errno
- */
-
-static int
-dir_e_read(struct gfs_inode *dip, uint64_t *offset, void *opaque,
-	   gfs_filldir_t filldir)
-{
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct buffer_head *bh;
-	struct gfs_leaf leaf;
-	uint32_t hsize, len;
-	uint32_t ht_offset, lp_offset, ht_offset_cur = -1;
-	uint32_t hash, index;
-	uint64_t *lp;
-	int copied = FALSE;
-	int error = 0;
-
-	hsize = 1 << dip->i_di.di_depth;
-	if (hsize * sizeof(uint64_t) != dip->i_di.di_size) {
-		gfs_consist_inode(dip);
-		return -EIO;
-	}
-
-	hash = gfs_dir_offset2hash(*offset);
-	index = hash >> (32 - dip->i_di.di_depth);
-
-	lp = kmalloc(sdp->sd_hash_bsize, GFP_KERNEL);
-	if (!lp)
-		return -ENOMEM;
-
-	while (index < hsize) {
-		lp_offset = index & (sdp->sd_hash_ptrs - 1);
-		ht_offset = index - lp_offset;
-
-		if (ht_offset_cur != ht_offset) {
-			error = gfs_internal_read(dip, (char *)lp,
-						  ht_offset * sizeof(uint64_t),
-						  sdp->sd_hash_bsize);
-			if (error != sdp->sd_hash_bsize) {
-				if (error >= 0)
-					error = -EIO;
-				goto out;
-			}
-			ht_offset_cur = ht_offset;
-		}
-
-		error = get_leaf(dip, gfs64_to_cpu(lp[lp_offset]), &bh);
-		if (error)
-			goto out;
-
-		gfs_leaf_in(&leaf, bh->b_data);
-
-		if (leaf.lf_next)
-			error = do_filldir_multi(dip, offset,
-						 opaque, filldir,
-						 bh, &copied);
-		else
-			error = do_filldir_single(dip, offset,
-						  opaque, filldir,
-						  bh, leaf.lf_entries,
-						  &copied);
-
-		brelse(bh);
-
-		if (error) {
-			if (error > 0)
-				error = 0;
-			goto out;
-		}
-
-		len = 1 << (dip->i_di.di_depth - leaf.lf_depth);
-		index = (index & ~(len - 1)) + len;
-	}
-
- out:
-	kfree(lp);
-
-	return error;
-}
-
-/**
- * dir_e_mvino -
- * @dip: The GFS inode
- * @filename:
- * @new_inode:
- *
- * Returns:
- */
-
-static int
-dir_e_mvino(struct gfs_inode *dip, struct qstr *filename,
-	    struct gfs_inum *inum, unsigned int new_type)
-{
-	struct buffer_head *bh, *dibh;
-	struct gfs_dirent *dent;
-	int error;
-
-	error = linked_leaf_search(dip, filename, &dent, NULL, &bh);
-	if (error == -ENOENT) {
-		gfs_consist_inode(dip);
-		return -EIO;
-	}
-	if (error)
-		return error;
-
-	gfs_trans_add_bh(dip->i_gl, bh);
-
-	gfs_inum_out(inum, (char *)&dent->de_inum);
-	dent->de_type = cpu_to_gfs16(new_type);
-
-	brelse(bh);
-
-	error = gfs_get_inode_buffer(dip, &dibh);
-	if (error)
-		return error;
-
-	dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds();
-
-	gfs_trans_add_bh(dip->i_gl, dibh);
-	gfs_dinode_out(&dip->i_di, dibh->b_data);
-	brelse(dibh);
-
-	return 0;
-}
-
-/**
- * dir_l_search - Search linear (stuffed dinode) dir for inode matching name
- * @dip: The GFS inode
- * @filename: Filename string
- * @inode: If non-NULL, function fills with formal inode # and block address
- * @type: If non-NULL, function fills with GFS_FILE_... dinode type
- *
- * Returns:
- */
-
-static int
-dir_l_search(struct gfs_inode *dip, struct qstr *filename,
-	     struct gfs_inum *inum, unsigned int *type)
-{
-	struct buffer_head *dibh;
-	struct gfs_dirent *dent;
-	int error;
-
-	if (!gfs_is_stuffed(dip)) {
-		gfs_consist_inode(dip);
-		return -EIO;
-	}
-
-	error = gfs_get_inode_buffer(dip, &dibh);
-	if (error)
-		return error;
-
-	error = leaf_search(dip, dibh, filename, &dent, NULL);
-	if (!error) {
-		if (inum)
-			gfs_inum_in(inum, (char *)&dent->de_inum);
-		if (type)
-			*type = gfs16_to_cpu(dent->de_type);
-	}
-
-	brelse(dibh);
-
-	return error;
-}
-
-/**
- * dir_l_add -
- * @dip: The GFS inode
- * @filename:
- * @inode:
- * @type:
- *
- * Returns:
- */
-
-static int
-dir_l_add(struct gfs_inode *dip, struct qstr *filename,
-	  struct gfs_inum *inum, unsigned int type)
-{
-	struct buffer_head *dibh;
-	struct gfs_dirent *dent;
-	int error;
-
-	if (!gfs_is_stuffed(dip)) {
-		gfs_consist_inode(dip);
-		return -EIO;
-	}
-
-	error = gfs_get_inode_buffer(dip, &dibh);
-	if (error)
-		return error;
-
-	if (gfs_dirent_alloc(dip, dibh, filename->len, &dent)) {
-		brelse(dibh);
-
-		error = dir_make_exhash(dip);
-		if (!error)
-			error = dir_e_add(dip, filename, inum, type);
-
-		return error;
-	}
-
-	/*  gfs_dirent_alloc() pins  */
-
-	gfs_inum_out(inum, (char *)&dent->de_inum);
-	dent->de_hash = gfs_dir_hash(filename->name, filename->len);
-	dent->de_hash = cpu_to_gfs32(dent->de_hash);
-	dent->de_type = cpu_to_gfs16(type);
-	memcpy((char *)(dent + 1), filename->name, filename->len);
-
-	dip->i_di.di_entries++;
-	dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds();
-
-	gfs_dinode_out(&dip->i_di, dibh->b_data);
-	brelse(dibh);
-
-	return 0;
-}
-
-/**
- * dir_l_del - 
- * @dip: The GFS inode
- * @filename:
- *
- * Returns:
- */
-
-static int
-dir_l_del(struct gfs_inode *dip, struct qstr *filename)
-{
-	struct buffer_head *dibh;
-	struct gfs_dirent *dent, *prev;
-	int error;
-
-	if (!gfs_is_stuffed(dip)) {
-		gfs_consist_inode(dip);
-		return -EIO;
-	}
-
-	error = gfs_get_inode_buffer(dip, &dibh);
-	if (error)
-		return error;
-
-	error = leaf_search(dip, dibh, filename, &dent, &prev);
-	if (error == -ENOENT) {
-		gfs_consist_inode(dip);
-		error = -EIO;
-		goto out;
-	}
-	if (error)
-		goto out;
-
-	dirent_del(dip, dibh, prev, dent);
-
-	/*  dirent_del() pins  */
-
-	if (!dip->i_di.di_entries)
-		gfs_consist_inode(dip);
-	dip->i_di.di_entries--;
-
-	dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds();
-
-	gfs_dinode_out(&dip->i_di, dibh->b_data);
-
- out:
-	brelse(dibh);
-
-	return error;
-}
-
-/**
- * dir_l_read -
- * @dip:
- * @offset:
- * @opaque:
- * @filldir:
- *
- * Returns:
- */
-
-static int
-dir_l_read(struct gfs_inode *dip, uint64_t *offset, void *opaque,
-	   gfs_filldir_t filldir)
-{
-	struct buffer_head *dibh;
-	int copied = FALSE;
-	int error;
-
-	if (!gfs_is_stuffed(dip)) {
-		gfs_consist_inode(dip);
-		return -EIO;
-	}
-
-	if (!dip->i_di.di_entries)
-		return 0;
-
-	error = gfs_get_inode_buffer(dip, &dibh);
-	if (error)
-		return error;
-
-	error = do_filldir_single(dip, offset,
-				  opaque, filldir,
-				  dibh, dip->i_di.di_entries,
-				  &copied);
-	if (error > 0)
-		error = 0;
-
-	brelse(dibh);
-
-	return error;
-}
-
-/**
- * dir_l_mvino -
- * @dip:
- * @filename:
- * @new_inode:
- *
- * Returns:
- */
-
-static int
-dir_l_mvino(struct gfs_inode *dip, struct qstr *filename,
-	    struct gfs_inum *inum, unsigned int new_type)
-{
-	struct buffer_head *dibh;
-	struct gfs_dirent *dent;
-	int error;
-
-	if (!gfs_is_stuffed(dip)) {
-		gfs_consist_inode(dip);
-		return -EIO;
-	}
-
-	error = gfs_get_inode_buffer(dip, &dibh);
-	if (error)
-		return error;
-
-	error = leaf_search(dip, dibh, filename, &dent, NULL);
-	if (error == -ENOENT) {
-		gfs_consist_inode(dip);
-		error = -EIO;
-		goto out;
-	}
-	if (error)
-		goto out;
-
-	gfs_trans_add_bh(dip->i_gl, dibh);
-
-	gfs_inum_out(inum, (char *)&dent->de_inum);
-	dent->de_type = cpu_to_gfs16(new_type);
-
-	dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds();
-
-	gfs_dinode_out(&dip->i_di, dibh->b_data);
-
- out:
-	brelse(dibh);
-
-	return error;
-}
-
-/**
- * gfs_dir_search - Search a directory
- * @dip: The GFS inode
- * @filename:
- * @inode:
- *
- * This routine searches a directory for a file or another directory.
- * Assumes a glock is held on dip.
- *
- * Returns: errno
- */
-
-int
-gfs_dir_search(struct gfs_inode *dip, struct qstr *filename,
-	       struct gfs_inum *inum, unsigned int *type)
-{
-	int error;
-
-	if (dip->i_di.di_flags & GFS_DIF_EXHASH)
-		error = dir_e_search(dip, filename, inum, type);
-	else
-		error = dir_l_search(dip, filename, inum, type);
-
-	return error;
-}
-
-/**
- * gfs_dir_add - Add new filename into directory
- * @dip: The GFS inode
- * @filename: The new name
- * @inode: The inode number of the entry
- * @type: The type of the entry
- *
- * Returns: 0 on success, error code on failure
- */
-
-int
-gfs_dir_add(struct gfs_inode *dip, struct qstr *filename,
-	    struct gfs_inum *inum, unsigned int type)
-{
-	int error;
-
-	if (dip->i_di.di_flags & GFS_DIF_EXHASH)
-		error = dir_e_add(dip, filename, inum, type);
-	else
-		error = dir_l_add(dip, filename, inum, type);
-
-	return error;
-}
-
-/**
- * gfs_dir_del - Delete a directory entry
- * @dip: The GFS inode
- * @filename: The filename
- *
- * Returns: 0 on success, error code on failure
- */
-
-int
-gfs_dir_del(struct gfs_inode *dip, struct qstr *filename)
-{
-	int error;
-
-	if (dip->i_di.di_flags & GFS_DIF_EXHASH)
-		error = dir_e_del(dip, filename);
-	else
-		error = dir_l_del(dip, filename);
-
-	return error;
-}
-
-/**
- * gfs_dir_read - Translate a GFS filename
- * @dip: The GFS inode
- * @offset:
- * @opaque:
- * @filldir:
- *
- * Returns: 0 on success, error code otherwise
- */
-
-int
-gfs_dir_read(struct gfs_inode *dip, uint64_t * offset, void *opaque,
-	     gfs_filldir_t filldir)
-{
-	int error;
-
-	if (dip->i_di.di_flags & GFS_DIF_EXHASH)
-		error = dir_e_read(dip, offset, opaque, filldir);
-	else
-		error = dir_l_read(dip, offset, opaque, filldir);
-
-	return error;
-}
-
-/**
- * gfs_dir_mvino - Change inode number of directory entry
- * @dip: The GFS inode
- * @filename:
- * @new_inode:
- *
- * This routine changes the inode number of a directory entry.  It's used
- * by rename to change ".." when a directory is moved.
- * Assumes a glock is held on dvp.
- *
- * Returns: errno
- */
-
-int
-gfs_dir_mvino(struct gfs_inode *dip, struct qstr *filename,
-	      struct gfs_inum *inum, unsigned int new_type)
-{
-	int error;
-
-	if (dip->i_di.di_flags & GFS_DIF_EXHASH)
-		error = dir_e_mvino(dip, filename, inum, new_type);
-	else
-		error = dir_l_mvino(dip, filename, inum, new_type);
-
-	return error;
-}
-
-/**
- * foreach_leaf - call a function for each leaf in a directory
- * @dip: the directory
- * @lc: the function to call for each each
- * @data: private data to pass to it
- *
- * Returns: errno
- */
-
-static int
-foreach_leaf(struct gfs_inode *dip, leaf_call_t lc, void *data)
-{
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct buffer_head *bh;
-	struct gfs_leaf leaf;
-	uint32_t hsize, len;
-	uint32_t ht_offset, lp_offset, ht_offset_cur = -1;
-	uint32_t index = 0;
-	uint64_t *lp;
-	uint64_t leaf_no;
-	int error = 0;
-
-	hsize = 1 << dip->i_di.di_depth;
-	if (hsize * sizeof(uint64_t) != dip->i_di.di_size) {
-		gfs_consist_inode(dip);
-		return -EIO;
-	}
-
-	lp = kmalloc(sdp->sd_hash_bsize, GFP_KERNEL);
-	if (!lp)
-		return -ENOMEM;
-
-	while (index < hsize) {
-		lp_offset = index & (sdp->sd_hash_ptrs - 1);
-		ht_offset = index - lp_offset;
-
-		if (ht_offset_cur != ht_offset) {
-			error = gfs_internal_read(dip, (char *)lp,
-						  ht_offset * sizeof(uint64_t),
-						  sdp->sd_hash_bsize);
-			if (error != sdp->sd_hash_bsize) {
-				if (error >= 0)
-					error = -EIO;
-				goto out;
-			}
-			ht_offset_cur = ht_offset;
-		}
-
-		leaf_no = gfs64_to_cpu(lp[lp_offset]);
-		if (leaf_no) {
-			error = get_leaf(dip, leaf_no, &bh);
-			if (error)
-				goto out;
-			gfs_leaf_in(&leaf, bh->b_data);
-			brelse(bh);
-
-			len = 1 << (dip->i_di.di_depth - leaf.lf_depth);
-
-			error = lc(dip, index, len, leaf_no, data);
-			if (error)
-				goto out;
-
-			index = (index & ~(len - 1)) + len;
-		} else
-			index++;
-	}
-
-	if (index != hsize) {
-		gfs_consist_inode(dip);
-		error = -EIO;
-	}
-
- out:
-	kfree(lp);
-
-	return error;
-}
-
-/**
- * leaf_free - Deallocate a directory leaf
- * @dip: the directory
- * @index: the hash table offset in the directory
- * @len: the number of pointers to this leaf
- * @leaf_no: the leaf number
- * @data: not used
- *
- * Returns: errno
- */
-
-static int
-leaf_free(struct gfs_inode *dip,
-	  uint32_t index, uint32_t len,
-	  uint64_t leaf_no, void *data)
-{
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct gfs_leaf tmp_leaf;
-	struct gfs_rgrp_list rlist;
-	struct buffer_head *bh, *dibh;
-	uint64_t blk;
-	unsigned int rg_blocks = 0;
-	char *ht=0;
-	unsigned int x, size = len * sizeof(uint64_t);
-	int error;
-
-	memset(&rlist, 0, sizeof(struct gfs_rgrp_list));
-
-	gfs_alloc_get(dip);
-
-	error = gfs_quota_hold_m(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
-	if (error)
-		goto out;
-
-	error = gfs_rindex_hold(sdp, &dip->i_alloc->al_ri_gh);
-	if (error)
-		goto out_qs;
-
-	/*  Count the number of leaves  */
-
-	for (blk = leaf_no; blk; blk = tmp_leaf.lf_next) {
-		error = get_leaf(dip, blk, &bh);
-		if (error)
-			goto out_rlist;
-		gfs_leaf_in(&tmp_leaf, (bh)->b_data);
-		brelse(bh);
-
-		gfs_rlist_add(sdp, &rlist, blk);
-	}
-
-	gfs_rlist_alloc(&rlist, LM_ST_EXCLUSIVE, 0);
-
-	for (x = 0; x < rlist.rl_rgrps; x++) {
-		struct gfs_rgrpd *rgd;
-		rgd = get_gl2rgd(rlist.rl_ghs[x].gh_gl);
-		rg_blocks += rgd->rd_ri.ri_length;
-	}
-
-	error = gfs_glock_nq_m(rlist.rl_rgrps, rlist.rl_ghs);
-	if (error)
-		goto out_rlist;
-
-	/* Trans may require:
-	   All the bitmaps that were reserved.
-	   One block for the dinode.
-	   All the hash blocks that will be changed.
-	   One block for a quota change. */
-
-	error = gfs_trans_begin(sdp,
-				rg_blocks + 1 + (DIV_RU(size, sdp->sd_jbsize) + 1),
-				1);
-	if (error)
-		goto out_rg_gunlock;
-
-	for (blk = leaf_no; blk; blk = tmp_leaf.lf_next) {
-		error = get_leaf(dip, blk, &bh);
-		if (error)
-			goto out_end_trans;
-		gfs_leaf_in(&tmp_leaf, bh->b_data);
-		brelse(bh);
-
-		gfs_metafree(dip, blk, 1);
-
-		if (!dip->i_di.di_blocks)
-			gfs_consist_inode(dip);
-		dip->i_di.di_blocks--;
-	}
-
-	error = gfs_writei(dip, ht, index * sizeof (uint64_t), size, gfs_zero_blocks, NULL);
-
-	if (error != size) {
-		if (error >= 0)
-			error = -EIO;
-		goto out_end_trans;
-	}
-
-	error = gfs_get_inode_buffer(dip, &dibh);
-	if (error)
-		goto out_end_trans;
-
-	gfs_trans_add_bh(dip->i_gl, dibh);
-	gfs_dinode_out(&dip->i_di, dibh->b_data);
-	brelse(dibh);
-
- out_end_trans:
-	gfs_trans_end(sdp);
-
- out_rg_gunlock:
-	gfs_glock_dq_m(rlist.rl_rgrps, rlist.rl_ghs);
-
- out_rlist:
-	gfs_rlist_free(&rlist);
-	gfs_glock_dq_uninit(&dip->i_alloc->al_ri_gh);
-
- out_qs:
-	gfs_quota_unhold_m(dip);
-
- out:
-	gfs_alloc_put(dip);
-
-	return error;
-}
-
-/**
- * gfs_dir_exhash_free - free all the leaf blocks in a directory
- * @dip: the directory
- *
- * Dealloc all on-disk directory leaves to FREEMETA state
- * Change on-disk inode type to "regular file"
- *
- * Returns: errno
- */
-
-int
-gfs_dir_exhash_free(struct gfs_inode *dip)
-{
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct buffer_head *bh;
-	int error;
-
-	/* Dealloc on-disk leaves to FREEMETA state */
-	error = foreach_leaf(dip, leaf_free, NULL);
-	if (error)
-		return error;
-
-	/*  Make this a regular file in case we crash.
-	   (We don't want to free these blocks a second time.)  */
-
-	error = gfs_trans_begin(sdp, 1, 0);
-	if (error)
-		return error;
-
-	error = gfs_get_inode_buffer(dip, &bh);
-	if (!error) {
-		gfs_trans_add_bh(dip->i_gl, bh);
-		((struct gfs_dinode *)bh->b_data)->di_type = cpu_to_gfs16(GFS_FILE_REG);
-		brelse(bh);
-	}
-
-	gfs_trans_end(sdp);
-
-	return error;
-}
-
-/**
- * gfs_diradd_alloc_required - figure out if an entry addition is going to require an allocation
- * @ip: the file being written to
- * @filname: the filename that's going to be added
- * @alloc_required: the int is set to TRUE if an alloc is required, FALSE otherwise
- *
- * Returns: errno
- */
-
-int
-gfs_diradd_alloc_required(struct gfs_inode *dip, struct qstr *filename,
-			  int *alloc_required)
-{
-	struct buffer_head *bh = NULL, *bh_next;
-	uint32_t hsize, hash, index;
-	int error = 0;
-
-	*alloc_required = FALSE;
-
-	if (dip->i_di.di_flags & GFS_DIF_EXHASH) {
-		hsize = 1 << dip->i_di.di_depth;
-		if (hsize * sizeof(uint64_t) != dip->i_di.di_size) {
-			gfs_consist_inode(dip);
-			return -EIO;
-		}
-
-		hash = gfs_dir_hash(filename->name, filename->len);
-		index = hash >> (32 - dip->i_di.di_depth);
-
-		error = get_first_leaf(dip, index, &bh_next);
-		if (error)
-			return error;
-
-		do {
-			if (bh)
-				brelse(bh);
-
-			bh = bh_next;
-
-			if (dirent_fits(dip, bh, filename->len))
-				break;
-
-			error = get_next_leaf(dip, bh, &bh_next);
-			if (error == -ENOENT) {
-				*alloc_required = TRUE;
-				error = 0;
-				break;
-			}
-		}
-		while (!error);
-
-		brelse(bh);
-	} else {
-		error = gfs_get_inode_buffer(dip, &bh);
-		if (error)
-			return error;
-
-		if (!dirent_fits(dip, bh, filename->len))
-			*alloc_required = TRUE;
-
-		brelse(bh);
-	}
-
-	return error;
-}
-
-/**
- * do_gdm - copy out one leaf (or list of leaves)
- * @dip: the directory
- * @index: the hash table offset in the directory
- * @len: the number of pointers to this leaf
- * @leaf_no: the leaf number
- * @data: a pointer to a struct gfs_user_buffer structure
- *
- * Returns: errno
- */
-
-static int
-do_gdm(struct gfs_inode *dip,
-       uint32_t index, uint32_t len, uint64_t leaf_no,
-       void *data)
-{
-	struct gfs_user_buffer *ub = (struct gfs_user_buffer *)data;
-	struct gfs_leaf leaf;
-	struct buffer_head *bh;
-	uint64_t blk;
-	int error = 0;
-
-	for (blk = leaf_no; blk; blk = leaf.lf_next) {
-		error = get_leaf(dip, blk, &bh);
-		if (error)
-			break;
-
-		gfs_leaf_in(&leaf, bh->b_data);
-
-		error = gfs_add_bh_to_ub(ub, bh);
-
-		brelse(bh);
-
-		if (error)
-			break;
-	}
-
-	return error;
-}
-
-/**
- * gfs_get_dir_meta - return all the leaf blocks of a directory
- * @dip: the directory
- * @ub: the structure representing the meta
- *
- * Returns: errno
- */
-
-int
-gfs_get_dir_meta(struct gfs_inode *dip, struct gfs_user_buffer *ub)
-{
-	return foreach_leaf(dip, do_gdm, ub);
-}
diff --git a/gfs-kernel/src/gfs/dir.h b/gfs-kernel/src/gfs/dir.h
deleted file mode 100644
index bbde532..0000000
--- a/gfs-kernel/src/gfs/dir.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef __DIR_DOT_H__
-#define __DIR_DOT_H__
-
-/**
- * gfs_filldir_t - Report a directory entry to the caller of gfs_dir_read()
- * @opaque: opaque data used by the function
- * @name: the name of the directory entry
- * @length: the length of the name
- * @offset: the entry's offset in the directory
- * @inum: the inode number the entry points to
- * @type: the type of inode the entry points to
- *
- * Returns: 0 on success, 1 if buffer full
- */
-
-typedef int (*gfs_filldir_t) (void *opaque,
-			      const char *name, unsigned int length,
-			      uint64_t offset,
-			      struct gfs_inum *inum, unsigned int type);
-
-int gfs_filecmp(struct qstr *file1, char *file2, int len_of_file2);
-int gfs_dirent_alloc(struct gfs_inode *dip, struct buffer_head *bh,
-		     int name_len, struct gfs_dirent **dent_out);
-
-int gfs_dir_search(struct gfs_inode *dip, struct qstr *filename,
-		   struct gfs_inum *inum, unsigned int *type);
-int gfs_dir_add(struct gfs_inode *dip, struct qstr *filename,
-		struct gfs_inum *inum, unsigned int type);
-int gfs_dir_del(struct gfs_inode *dip, struct qstr *filename);
-int gfs_dir_read(struct gfs_inode *dip, uint64_t * offset, void *opaque,
-		 gfs_filldir_t filldir);
-int gfs_dir_mvino(struct gfs_inode *dip, struct qstr *filename,
-		  struct gfs_inum *new_inum, unsigned int new_type);
-
-int gfs_dir_exhash_free(struct gfs_inode *dip);
-
-int gfs_diradd_alloc_required(struct gfs_inode *dip, struct qstr *filename,
-			      int *alloc_required);
-
-int gfs_get_dir_meta(struct gfs_inode *ip, struct gfs_user_buffer *ub);
-
-#endif /* __DIR_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/eaops.c b/gfs-kernel/src/gfs/eaops.c
deleted file mode 100644
index dbd0254..0000000
--- a/gfs-kernel/src/gfs/eaops.c
+++ /dev/null
@@ -1,173 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <asm/uaccess.h>
-#include <linux/xattr.h>
-#include <linux/posix_acl.h>
-
-#include "gfs.h"
-#include "acl.h"
-#include "eaops.h"
-#include "eattr.h"
-
-/**
- * gfs_ea_name2type - get the type of the ea, and trucate the type from the name
- * @namep: ea name, possibly with type appended
- *
- * Returns: GFS_EATYPE_XXX
- */
-
-unsigned int
-gfs_ea_name2type(const char *name, char **truncated_name)
-{
-	unsigned int type;
-
-	if (strncmp(name, "system.", 7) == 0) {
-		type = GFS_EATYPE_SYS;
-		if (truncated_name)
-			*truncated_name = strchr(name, '.') + 1;
-	} else if (strncmp(name, "user.", 5) == 0) {
-		type = GFS_EATYPE_USR;
-		if (truncated_name)
-			*truncated_name = strchr(name, '.') + 1;
-	} else if (strncmp(name, "security.", 9) == 0) {
-		type = GFS_EATYPE_SECURITY;
-		if (truncated_name)
-			*truncated_name = strchr(name, '.') + 1;
-	} else {
-		type = GFS_EATYPE_UNUSED;
-		if (truncated_name)
-			*truncated_name = NULL;
-	}
-
-	return type;
-}
-
-/**
- * system_eo_get -
- * @ip:
- * @er:
- *
- * Returns: errno
- */
-
-static int
-system_eo_get(struct gfs_inode *ip, struct gfs_ea_request *er)
-{
-	if (!GFS_ACL_IS_ACCESS(er->er_name, er->er_name_len) &&
-	    !GFS_ACL_IS_DEFAULT(er->er_name, er->er_name_len) &&
-	    !capable(CAP_SYS_ADMIN))
-		return -EPERM;
-
-	if (ip->i_sbd->sd_args.ar_posix_acls == FALSE &&
-	    (GFS_ACL_IS_ACCESS(er->er_name, er->er_name_len) ||
-	     GFS_ACL_IS_DEFAULT(er->er_name, er->er_name_len)))
-		return -EOPNOTSUPP;
-
-	return gfs_ea_get_i(ip, er);	
-}
-
-/**
- * system_eo_set -
- * @ip:
- * @er:
- *
- * Returns: errno
- */
-
-static int
-system_eo_set(struct gfs_inode *ip, struct gfs_ea_request *er)
-{
-	int remove = FALSE;
-	int error;
-
-	if (GFS_ACL_IS_ACCESS(er->er_name, er->er_name_len)) {
-		er->er_mode = ip->i_vnode->i_mode;
-		error = gfs_acl_validate_set(ip, TRUE, er,
-					     &remove, &er->er_mode);
-		if (error)
-			return error;
-		error = gfs_ea_set_i(ip, er);
-		if (error)
-			return error;
-		if (remove)
-			gfs_ea_remove_i(ip, er);
-		return 0;
-
-	} else if (GFS_ACL_IS_DEFAULT(er->er_name, er->er_name_len)) {
-		int error = gfs_acl_validate_set(ip, FALSE, er,
-						 &remove, NULL);
-		if (error)
-			return error;
-		if (!remove)
-			error = gfs_ea_set_i(ip, er);
-		else {
-			error = gfs_ea_remove_i(ip, er);
-			if (error == -ENODATA)
-				error = 0;
-		}
-		return error;
-	}
-
-	return -EPERM;
-}
-
-/**
- * system_eo_remove -
- * @ip:
- * @er:
- *
- * Returns: errno
- */
-
-static int
-system_eo_remove(struct gfs_inode *ip, struct gfs_ea_request *er)
-{
-	if (GFS_ACL_IS_ACCESS(er->er_name, er->er_name_len)) {
-		int error = gfs_acl_validate_remove(ip, TRUE);
-		if (error)
-			return error;
-
-	} else if (GFS_ACL_IS_DEFAULT(er->er_name, er->er_name_len)) {
-		int error = gfs_acl_validate_remove(ip, FALSE);
-		if (error)
-			return error;
-
-	} else
-	        return -EPERM;
-
-	return gfs_ea_remove_i(ip, er);	
-}
-
-struct gfs_eattr_operations gfs_user_eaops = {
-	.eo_get = gfs_ea_get_i,
-	.eo_set = gfs_ea_set_i,
-	.eo_remove = gfs_ea_remove_i,
-	.eo_name = "user",
-};
-
-struct gfs_eattr_operations gfs_system_eaops = {
-	.eo_get = system_eo_get,
-	.eo_set = system_eo_set,
-	.eo_remove = system_eo_remove,
-	.eo_name = "system",
-};
-
-struct gfs_eattr_operations gfs_security_eaops = {
-	.eo_get = gfs_ea_get_i,
-	.eo_set = gfs_ea_set_i,
-	.eo_remove = gfs_ea_remove_i,
-	.eo_name = "security",
-};
-
-struct gfs_eattr_operations *gfs_ea_ops[] = {
-	NULL,
-	&gfs_user_eaops,
-	&gfs_system_eaops,
-	&gfs_security_eaops,
-};
-
diff --git a/gfs-kernel/src/gfs/eaops.h b/gfs-kernel/src/gfs/eaops.h
deleted file mode 100644
index 6ea9123..0000000
--- a/gfs-kernel/src/gfs/eaops.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef __EAOPS_DOT_H__
-#define __EAOPS_DOT_H__
-
-struct gfs_ea_request;
-
-struct gfs_eattr_operations {
-	int (*eo_get) (struct gfs_inode *ip, struct gfs_ea_request *er);
-	int (*eo_set) (struct gfs_inode *ip, struct gfs_ea_request *er);
-	int (*eo_remove) (struct gfs_inode *ip, struct gfs_ea_request *er);
-	char *eo_name;
-};
-
-unsigned int gfs_ea_name2type(const char *name, char **truncated_name);
-
-extern struct gfs_eattr_operations gfs_user_eaops;
-extern struct gfs_eattr_operations gfs_system_eaops;
-
-extern struct gfs_eattr_operations *gfs_ea_ops[];
-
-#endif /* __EAOPS_DOT_H__ */
-
diff --git a/gfs-kernel/src/gfs/eattr.c b/gfs-kernel/src/gfs/eattr.c
deleted file mode 100644
index 062b682..0000000
--- a/gfs-kernel/src/gfs/eattr.c
+++ /dev/null
@@ -1,2008 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <asm/uaccess.h>
-#include <linux/xattr.h>
-#include <linux/posix_acl.h>
-
-#include "gfs.h"
-#include "acl.h"
-#include "dio.h"
-#include "eaops.h"
-#include "eattr.h"
-#include "glock.h"
-#include "inode.h"
-#include "quota.h"
-#include "rgrp.h"
-#include "trans.h"
-
-/**
- * ea_calc_size - returns the acutal number of bytes the request will take up
- *                (not counting any unstuffed data blocks)
- * @sdp:
- * @er:
- * @size:
- *
- * Returns: TRUE if the EA should be stuffed
- */
-
-static int
-ea_calc_size(struct gfs_sbd *sdp,
-	    struct gfs_ea_request *er,
-	    unsigned int *size)
-{
-	*size = GFS_EAREQ_SIZE_STUFFED(er);
-	if (*size <= sdp->sd_jbsize)
-		return TRUE;
-
-	*size = GFS_EAREQ_SIZE_UNSTUFFED(sdp, er);
-	return FALSE;
-}
-
-/**
- * gfs_ea_check_size - 
- * @ip:
- * @er:
- *
- * Returns: errno
- */
-
-int
-gfs_ea_check_size(struct gfs_sbd *sdp, struct gfs_ea_request *er)
-{
-	unsigned int size;
-
-	if (er->er_data_len > GFS_EA_MAX_DATA_LEN)
-		return -ERANGE;
-
-	ea_calc_size(sdp, er, &size);
-	if (size > sdp->sd_jbsize)
-		return -ERANGE; /* This can only happen with 512 byte blocks */
-
-	return 0;
-}
-
-typedef int (*ea_call_t) (struct gfs_inode *ip,
-			  struct buffer_head *bh,
-			  struct gfs_ea_header *ea,
-			  struct gfs_ea_header *prev,
-			  void *private);
-
-/**
- * ea_foreach_i -
- * @ip:
- * @bh:
- * @eabc:
- * @data:
- *
- * Returns: errno
- */
-
-static int
-ea_foreach_i(struct gfs_inode *ip,
-	     struct buffer_head *bh,
-	     ea_call_t ea_call, void *data)
-{
-	struct gfs_ea_header *ea, *prev = NULL;
-	int error = 0;
-
-	if (gfs_metatype_check(ip->i_sbd, bh, GFS_METATYPE_EA))
-		return -EIO;
-
-	for (ea = GFS_EA_BH2FIRST(bh);; prev = ea, ea = GFS_EA2NEXT(ea)) {
-		if (!GFS_EA_REC_LEN(ea))
-			goto fail;
-		if (!(bh->b_data <= (char *)ea &&
-		      (char *)GFS_EA2NEXT(ea) <=
-		      bh->b_data + bh->b_size))
-			goto fail;
-		if (!GFS_EATYPE_VALID(ea->ea_type))
-			goto fail;
-
-		error = ea_call(ip, bh, ea, prev, data);
-		if (error)
-			return error;
-
-		if (GFS_EA_IS_LAST(ea)) {
-			if ((char *)GFS_EA2NEXT(ea) !=
-			    bh->b_data + bh->b_size)
-				goto fail;
-			break;
-		}
-	}
-
-	return error;
-
- fail:
-	gfs_consist_inode(ip);
-	return -EIO;
-}
-
-/**
- * ea_foreach -
- * @ip:
- * @ea_call:
- * @data:
- *
- * Returns: errno
- */
-
-static int
-ea_foreach(struct gfs_inode *ip,
-	   ea_call_t ea_call,
-	   void *data)
-{
-	struct buffer_head *bh;
-	int error;
-
-	error = gfs_dread(ip->i_gl, ip->i_di.di_eattr,
-			  DIO_START | DIO_WAIT, &bh);
-	if (error)
-		return error;
-
-	if (!(ip->i_di.di_flags & GFS_DIF_EA_INDIRECT))
-		error = ea_foreach_i(ip, bh, ea_call, data);
-	else {
-		struct buffer_head *eabh;
-		uint64_t *eablk, *end;
-
-		if (gfs_metatype_check(ip->i_sbd, bh, GFS_METATYPE_IN)) {
-			error = -EIO;
-			goto out;
-		}
-
-		eablk = (uint64_t *)(bh->b_data + sizeof(struct gfs_indirect));
-		end = eablk + ip->i_sbd->sd_inptrs;
-
-		for (; eablk < end; eablk++) {
-			uint64_t bn;
-
-			if (!*eablk)
-				break;
-			bn = gfs64_to_cpu(*eablk);
-
-			error = gfs_dread(ip->i_gl, bn,
-					  DIO_START | DIO_WAIT, &eabh);
-			if (error)
-				break;
-			error = ea_foreach_i(ip, eabh, ea_call, data);
-			brelse(eabh);
-			if (error)
-				break;
-		}
-	}
-
- out:
-	brelse(bh);
-
-	return error;
-}
-
-struct ea_find {
-	struct gfs_ea_request *ef_er;
-	struct gfs_ea_location *ef_el;
-};
-
-/**
- * ea_find_i -
- * @ip:
- * @bh:
- * @ea:
- * @prev:
- * @private:
- *
- * Returns: -errno on error, 1 if search is over,
- *          0 if search should continue
- */
-
-static int
-ea_find_i(struct gfs_inode *ip,
-	  struct buffer_head *bh,
-	  struct gfs_ea_header *ea,
-	  struct gfs_ea_header *prev,
-	  void *private)
-{
-	struct ea_find *ef = (struct ea_find *)private;
-	struct gfs_ea_request *er = ef->ef_er;
-
-	if (ea->ea_type == GFS_EATYPE_UNUSED)
-		return 0;
-
-	if (ea->ea_type == er->er_type) {
-		if (ea->ea_name_len == er->er_name_len &&
-		    !memcmp(GFS_EA2NAME(ea), er->er_name, ea->ea_name_len)) {
-			struct gfs_ea_location *el = ef->ef_el;
-			get_bh(bh);
-			el->el_bh = bh;
-			el->el_ea = ea;
-			el->el_prev = prev;
-			return 1;
-		}
-	}
-
-#if 0
-	else if ((ip->i_di.di_flags & GFS_DIF_EA_PACKED) &&
-		 er->er_type == GFS_EATYPE_SYS)
-		return 1;
-#endif
-
-	return 0;
-}
-
-/**
- * gfs_ea_find - find a matching eattr
- * @ip:
- * @er:
- * @el:
- *
- * Returns: errno
- */
-
-int
-gfs_ea_find(struct gfs_inode *ip,
-	    struct gfs_ea_request *er,
-	    struct gfs_ea_location *el)
-{
-	struct ea_find ef;
-	int error;
-
-	ef.ef_er = er;
-	ef.ef_el = el;
-
-	memset(el, 0, sizeof(struct gfs_ea_location));
-
-	error = ea_foreach(ip, ea_find_i, &ef);
-	if (error > 0)
-		return 0;
-
-	return error;
-}
-
-/**
- * ea_dealloc_unstuffed -
- * @ip:
- * @bh:
- * @ea:
- * @prev:
- * @private:
- *
- * Take advantage of the fact that all unstuffed blocks are
- * allocated from the same RG.  But watch, this may not always
- * be true.
- *
- * Returns: errno
- */
-
-static int
-ea_dealloc_unstuffed(struct gfs_inode *ip,
-		     struct buffer_head *bh,
-		     struct gfs_ea_header *ea,
-		     struct gfs_ea_header *prev,
-		     void *private)
-{
-	int *leave = (int *)private;
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_rgrpd *rgd;
-	struct gfs_holder rg_gh;
-	struct buffer_head *dibh;
-	uint64_t *dataptrs, bn = 0;
-	uint64_t bstart = 0;
-	unsigned int blen = 0;
-	unsigned int x;
-	int error;
-
-	if (GFS_EA_IS_STUFFED(ea))
-		return 0;
-
-	dataptrs = GFS_EA2DATAPTRS(ea);
-	for (x = 0; x < ea->ea_num_ptrs; x++, dataptrs++)
-		if (*dataptrs) {
-			bn = gfs64_to_cpu(*dataptrs);
-			break;
-		}
-	if (!bn)
-		return 0;
-
-	rgd = gfs_blk2rgrpd(sdp, bn);
-	if (!rgd) {
-		gfs_consist_inode(ip);
-		return -EIO;
-	}
-
-	error = gfs_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, &rg_gh);
-	if (error)
-		return error;
-
-	error = gfs_trans_begin(sdp, 2 + rgd->rd_ri.ri_length, 1);
-	if (error)
-		goto out_gunlock;
-
-	gfs_trans_add_bh(ip->i_gl, bh);
-
-	dataptrs = GFS_EA2DATAPTRS(ea);
-	for (x = 0; x < ea->ea_num_ptrs; x++, dataptrs++) {
-		if (!*dataptrs)
-			break;
-		bn = gfs64_to_cpu(*dataptrs);
-
-		if (bstart + blen == bn)
-			blen++;
-		else {
-			if (bstart)
-				gfs_metafree(ip, bstart, blen);
-			bstart = bn;
-			blen = 1;
-		}
-
-		*dataptrs = 0;
-		if (!ip->i_di.di_blocks)
-			gfs_consist_inode(ip);
-		ip->i_di.di_blocks--;
-	}
-	if (bstart)
-		gfs_metafree(ip, bstart, blen);
-
-	if (prev && !leave) {
-		uint32_t len;
-
-		len = GFS_EA_REC_LEN(prev) + GFS_EA_REC_LEN(ea);
-		prev->ea_rec_len = cpu_to_gfs32(len);
-
-		if (GFS_EA_IS_LAST(ea))
-			prev->ea_flags |= GFS_EAFLAG_LAST;
-	} else {
-		ea->ea_type = GFS_EATYPE_UNUSED;
-		ea->ea_num_ptrs = 0;
-	}
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-	if (!error) {
-		ip->i_di.di_ctime = get_seconds();
-		gfs_trans_add_bh(ip->i_gl, dibh);
-		gfs_dinode_out(&ip->i_di, dibh->b_data);
-		brelse(dibh);
-	}
-
-	gfs_trans_end(sdp);
-
- out_gunlock:
-	gfs_glock_dq_uninit(&rg_gh);
-
-	return error;
-}
-
-/**
- * ea_remove_unstuffed -
- * @ip:
- * @bh:
- * @ea:
- * @prev:
- * @leave:
- *
- * Returns: errno
- */
-
-static int
-ea_remove_unstuffed(struct gfs_inode *ip,
-		    struct buffer_head *bh,
-		    struct gfs_ea_header *ea,
-		    struct gfs_ea_header *prev,
-		    int leave)
-{
-	struct gfs_alloc *al;
-	int error;
-
-	al = gfs_alloc_get(ip);
-
-	error = gfs_quota_hold_m(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
-	if (error)
-		goto out_alloc;
-
-	error = gfs_rindex_hold(ip->i_sbd, &al->al_ri_gh);
-	if (error)
-		goto out_quota;
-
-	error = ea_dealloc_unstuffed(ip,
-				     bh, ea, prev,
-				     (leave) ? &error : NULL);
-
-	gfs_glock_dq_uninit(&al->al_ri_gh);
-
- out_quota:
-	gfs_quota_unhold_m(ip);
-
- out_alloc:
-	gfs_alloc_put(ip);
-
-	return error;
-}
-
-/**************************************************************************************************/
-
-/**
- * gfs_ea_repack_i -
- * @ip:
- *
- * Returns: errno
- */
-
-int
-gfs_ea_repack_i(struct gfs_inode *ip)
-{
-	return -ENOSYS;
-}
-
-/**
- * gfs_ea_repack -
- * @ip:
- *
- * Returns: errno
- */
-
-int gfs_ea_repack(struct gfs_inode *ip)
-{
-	struct gfs_holder gh;
-	int error;
-
-	error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
-	if (error)
-		return error;
-
-	/* Some sort of permissions checking would be nice */
-
-	error = gfs_ea_repack_i(ip);
-
-	gfs_glock_dq_uninit(&gh);
-
-	return error;
-}
-
-struct ea_list {
-	struct gfs_ea_request *ei_er;
-	unsigned int ei_size;
-};
-
-/**
- * ea_list_i -
- * @ip:
- * @bh:
- * @ea:
- * @prev:
- * @private:
- *
- * Returns: errno
- */
-
-static int
-ea_list_i(struct gfs_inode *ip,
-	  struct buffer_head *bh,
-	  struct gfs_ea_header *ea,
-	  struct gfs_ea_header *prev,
-	  void *private)
-{
-	struct ea_list *ei = (struct ea_list *)private;
-	struct gfs_ea_request *er = ei->ei_er;
-	unsigned int ea_size = gfs_ea_strlen(ea);
-
-	if (ea->ea_type == GFS_EATYPE_UNUSED)
-		return 0;
-
-	if (er->er_data_len) {
-		char *prefix;
-		unsigned int l;
-		char c = 0;
-
-		if (ei->ei_size + ea_size > er->er_data_len)
-			return -ERANGE;
-
-		switch (ea->ea_type) {
-		case GFS_EATYPE_USR:
-			prefix = "user.";
-			l = 5;
-			break;
-		case GFS_EATYPE_SYS:
-			prefix = "system.";
-			l = 7;
-			break;
-		case GFS_EATYPE_SECURITY:
-			prefix = "security.";
-			l = 9;
-			break;
-		default:
-			prefix = NULL;
-			l = 0;
-			break;
-		}
-
-		if (prefix == NULL || l == 0)
-			return -EIO;
-
-		memcpy(er->er_data + ei->ei_size,
-		       prefix, l);
-		memcpy(er->er_data + ei->ei_size + l,
-		       GFS_EA2NAME(ea),
-		       ea->ea_name_len);
-		memcpy(er->er_data + ei->ei_size +
-		       ea_size - 1,
-		       &c, 1);
-	}
-
-	ei->ei_size += ea_size;
-
-	return 0;
-}
-
-/**
- * gfs_ea_list -
- * @ip:
- * @er:
- *
- * Returns: actual size of data on success, -errno on error
- */
-
-int
-gfs_ea_list(struct gfs_inode *ip, struct gfs_ea_request *er)
-{
-	struct gfs_holder i_gh;
-	int error;
-
-	if (!er->er_data || !er->er_data_len) {
-		er->er_data = NULL;
-		er->er_data_len = 0;
-	}
-
-	error = gfs_glock_nq_init(ip->i_gl,
-				  LM_ST_SHARED, LM_FLAG_ANY,
-				  &i_gh);
-	if (error)
-		return error;
-
-	if (ip->i_di.di_eattr) {
-		struct ea_list ei = { .ei_er = er, .ei_size = 0 };
-
-		error = ea_foreach(ip, ea_list_i, &ei);
-		if (!error)
-			error = ei.ei_size;
-	}
-
-	gfs_glock_dq_uninit(&i_gh);
-
-	return error;
-}
-
-/**
- * ea_get_unstuffed - actually copies the unstuffed data into the
- *                    request buffer
- * @ip:
- * @ea:
- * @data:
- *
- * Returns: errno
- */
-
-static int
-ea_get_unstuffed(struct gfs_inode *ip, struct gfs_ea_header *ea,
-		 char *data)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct buffer_head **bh;
-	unsigned int amount = GFS_EA_DATA_LEN(ea);
-	unsigned int nptrs = DIV_RU(amount, sdp->sd_jbsize);
-	uint64_t *dataptrs = GFS_EA2DATAPTRS(ea);
-	unsigned int x;
-	int error = 0;
-
-	bh = kmalloc(nptrs * sizeof(struct buffer_head *), GFP_KERNEL);
-	if (!bh)
-		return -ENOMEM;
-
-	for (x = 0; x < nptrs; x++) {
-		error = gfs_dread(ip->i_gl, gfs64_to_cpu(*dataptrs),
-				  DIO_START, bh + x);
-		if (error) {
-			while (x--)
-				brelse(bh[x]);
-			goto out;
-		}
-		dataptrs++;
-	}
-
-	for (x = 0; x < nptrs; x++) {
-		error = gfs_dreread(sdp, bh[x], DIO_WAIT);
-		if (error) {
-			for (; x < nptrs; x++)
-				brelse(bh[x]);
-			goto out;
-		}
-		if (gfs_metatype_check2(sdp, bh[x],
-					GFS_METATYPE_ED, GFS_METATYPE_EA)) {
-			for (; x < nptrs; x++)
-				brelse(bh[x]);
-			error = -EIO;
-			goto out;
-		}
-
-		memcpy(data,
-		       bh[x]->b_data + sizeof(struct gfs_meta_header),
-		       (sdp->sd_jbsize > amount) ? amount : sdp->sd_jbsize);
-
-		amount -= sdp->sd_jbsize;
-		data += sdp->sd_jbsize;
-
-		brelse(bh[x]);
-	}
-
- out:
-	kfree(bh);
-
-	return error;
-}
-
-/**
- * gfs_ea_get_copy -
- * @ip:
- * @el:
- * @data:
- *
- * Returns: errno
- */
-
-int
-gfs_ea_get_copy(struct gfs_inode *ip,
-		struct gfs_ea_location *el,
-		char *data)
-{
-	if (GFS_EA_IS_STUFFED(el->el_ea)) {
-		memcpy(data,
-		       GFS_EA2DATA(el->el_ea),
-		       GFS_EA_DATA_LEN(el->el_ea));
-		return 0;
-	} else
-		return ea_get_unstuffed(ip, el->el_ea, data);
-}
-
-/**
- * gfs_ea_get_i -
- * @ip:
- * @er:
- *
- * Returns: actual size of data on success, -errno on error
- */
-
-int
-gfs_ea_get_i(struct gfs_inode *ip, struct gfs_ea_request *er)
-{
-	struct gfs_ea_location el;
-	int error;
-
-	if (!ip->i_di.di_eattr)
-		return -ENODATA;
-
-	error = gfs_ea_find(ip, er, &el);
-	if (error)
-		return error;
-	if (!el.el_ea)
-		return -ENODATA;
-
-	if (er->er_data_len) {
-		if (GFS_EA_DATA_LEN(el.el_ea) > er->er_data_len)
-			error =  -ERANGE;
-		else
-			error = gfs_ea_get_copy(ip, &el, er->er_data);
-	}
-	if (!error)
-		error = GFS_EA_DATA_LEN(el.el_ea);
-
-	brelse(el.el_bh);
-
-	return error;
-}
-
-/**
- * gfs_ea_get -
- * @ip:
- * @er:
- *
- * Returns: actual size of data on success, -errno on error
- */
-
-int
-gfs_ea_get(struct gfs_inode *ip, struct gfs_ea_request *er)
-{
-	struct gfs_holder i_gh;
-	int error;
-
-	if (!er->er_name_len ||
-	    er->er_name_len > GFS_EA_MAX_NAME_LEN)
-		return -EINVAL;
-	if (!er->er_data || !er->er_data_len) {
-		er->er_data = NULL;
-		er->er_data_len = 0;
-	}
-
-	error = gfs_glock_nq_init(ip->i_gl,
-				  LM_ST_SHARED, LM_FLAG_ANY,
-				  &i_gh);
-	if (error)
-		return error;
-
-	error = gfs_ea_ops[er->er_type]->eo_get(ip, er);
-
-	gfs_glock_dq_uninit(&i_gh);
-
-	return error;
-}
-
-/**
- * ea_alloc_blk - allocates a new block for extended attributes.
- * @ip: A pointer to the inode that's getting extended attributes
- * @bhp:
- *
- * Returns: errno
- */
-
-static int
-ea_alloc_blk(struct gfs_inode *ip,
-	     struct buffer_head **bhp)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_ea_header *ea;
-	uint64_t block;
-	int error;
-
-	error = gfs_metaalloc(ip, &block);
-	if (error)
-		return error;
-
-	error = gfs_dread(ip->i_gl, block,
-			  DIO_NEW | DIO_START | DIO_WAIT, bhp);
-	if (error)
-		return error;
-
-	gfs_trans_add_bh(ip->i_gl, *bhp);
-	gfs_metatype_set(*bhp, GFS_METATYPE_EA, GFS_FORMAT_EA);
-
-	ea = GFS_EA_BH2FIRST(*bhp);
-	ea->ea_rec_len = cpu_to_gfs32(sdp->sd_jbsize);
-	ea->ea_type = GFS_EATYPE_UNUSED;
-	ea->ea_flags = GFS_EAFLAG_LAST;
-	ea->ea_num_ptrs = 0;
-
-	ip->i_di.di_blocks++;
-
-	return 0;
-}
-
-/**
- * ea_write - writes the request info to an ea, creating new blocks if
- *            necessary
- * @ip:  inode that is being modified
- * @ea:  the location of the new ea in a block
- * @er: the write request
- *
- * Note: does not update ea_rec_len or the GFS_EAFLAG_LAST bin of ea_flags
- *
- * returns : errno
- */
-
-static int
-ea_write(struct gfs_inode *ip,
-	 struct gfs_ea_header *ea,
-	 struct gfs_ea_request *er)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-
-	ea->ea_data_len = cpu_to_gfs32(er->er_data_len);
-	ea->ea_name_len = er->er_name_len;
-	ea->ea_type = er->er_type;
-	ea->ea_pad = 0;
-
-	memcpy(GFS_EA2NAME(ea), er->er_name, er->er_name_len);
-
-	if (GFS_EAREQ_SIZE_STUFFED(er) <= sdp->sd_jbsize) {
-		ea->ea_num_ptrs = 0;
-		memcpy(GFS_EA2DATA(ea), er->er_data, er->er_data_len);
-	} else {
-		uint64_t *dataptr = GFS_EA2DATAPTRS(ea);
-		const char *data = er->er_data;
-		unsigned int data_len = er->er_data_len;
-		unsigned int copy;
-		unsigned int x;
-
-		ea->ea_num_ptrs = DIV_RU(er->er_data_len, sdp->sd_jbsize);
-		for (x = 0; x < ea->ea_num_ptrs; x++) {
-			struct buffer_head *bh;
-			uint64_t block;
-			int error;
-
-			error = gfs_metaalloc(ip, &block);
-			if (error)
-				return error;
-
-			error = gfs_dread(ip->i_gl, block,
-					  DIO_NEW | DIO_START | DIO_WAIT, &bh);
-			if (error)
-				return error;
-
-			gfs_trans_add_bh(ip->i_gl, bh);
-			gfs_metatype_set(bh, GFS_METATYPE_ED, GFS_FORMAT_ED);
-			ip->i_di.di_blocks++;
-
-			copy = (data_len > sdp->sd_jbsize) ? sdp->sd_jbsize : data_len;
-			memcpy(bh->b_data + sizeof(struct gfs_meta_header),
-			       data,
-			       copy);
-
-			*dataptr++ = cpu_to_gfs64((uint64_t)bh->b_blocknr);
-			data += copy;
-			data_len -= copy;
-
-			brelse(bh);
-		}
-
-		gfs_assert_withdraw(sdp, !data_len);
-	}
-
-	return 0;
-}
-
-typedef int (*ea_skeleton_call_t) (struct gfs_inode *ip,
-				   struct gfs_ea_request *er,
-				   void *private);
-/**
- * ea_alloc_skeleton -
- * @ip:
- * @er:
- * @blks:
- * @skeleton_call:
- * @private:
- *
- * Returns: errno
- */
-
-static int
-ea_alloc_skeleton(struct gfs_inode *ip, struct gfs_ea_request *er,
-		  unsigned int blks,
-		  ea_skeleton_call_t skeleton_call, void *private)
-{
-	struct gfs_alloc *al;
-	struct buffer_head *dibh;
-	int error;
-
-	al = gfs_alloc_get(ip);
-
-	error = gfs_quota_lock_m(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
-	if (error)
-		goto out;
-
-	error = gfs_quota_check(ip, ip->i_di.di_uid, ip->i_di.di_gid);
-	if (error)
-		goto out_gunlock_q;
-
-	al->al_requested_meta = blks;
-
-	error = gfs_inplace_reserve(ip);
-	if (error)
-		goto out_gunlock_q;
-
-	/* Trans may require:
-	   A modified dinode, multiple EA metadata blocks, and all blocks for a RG
-	   bitmap */
-
-	error = gfs_trans_begin(ip->i_sbd,
-				1 + blks + al->al_rgd->rd_ri.ri_length, 1);
-	if (error)
-		goto out_ipres;
-
-	error = skeleton_call(ip, er, private);
-	if (error)
-		goto out_end_trans;
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-	if (!error) {
-		if (er->er_mode) {
-			ip->i_vnode->i_mode = er->er_mode;
-			gfs_inode_attr_out(ip);
-		}
-		ip->i_di.di_ctime = get_seconds();
-		gfs_trans_add_bh(ip->i_gl, dibh);
-		gfs_dinode_out(&ip->i_di, dibh->b_data);
-		brelse(dibh);
-	}
-
- out_end_trans:
-	gfs_trans_end(ip->i_sbd);
-
- out_ipres:
-	gfs_inplace_release(ip);
-
- out_gunlock_q:
-	gfs_quota_unlock_m(ip);
-
- out:
-	gfs_alloc_put(ip);
-
-	return error;
-}
-
-/**
- * ea_init_i - initializes a new eattr block
- * @ip:
- * @er:
- * @private:
- *
- * Returns: errno
- */
-
-static int
-ea_init_i(struct gfs_inode *ip,
-	  struct gfs_ea_request *er,
-	  void *private)
-{
-	struct buffer_head *bh;
-	int error;
-
-	error = ea_alloc_blk(ip, &bh);
-	if (error)
-		return error;
-
-	ip->i_di.di_eattr = bh->b_blocknr;
-	error = ea_write(ip, GFS_EA_BH2FIRST(bh), er);
-
-	brelse(bh);
-
-	return error;
-}
-
-/**
- * ea_init - initializes a new eattr block
- * @ip:
- * @er:
- *
- * Returns: errno
- */
-
-static int
-ea_init(struct gfs_inode *ip, struct gfs_ea_request *er)
-{
-	unsigned int jbsize = ip->i_sbd->sd_jbsize;
-	unsigned int blks = 1;
-
-	if (GFS_EAREQ_SIZE_STUFFED(er) > jbsize)
-		blks += DIV_RU(er->er_data_len, jbsize);
-
-	return ea_alloc_skeleton(ip, er,
-				 blks,
-				 ea_init_i, NULL);
-}
-
-/**
- * ea_split_ea -
- * @ea:
- *
- * Returns: the new ea
- */
-
-static struct gfs_ea_header *
-ea_split_ea(struct gfs_ea_header *ea)
-{
-	uint32_t ea_size = GFS_EA_SIZE(ea);
-	struct gfs_ea_header *new = (struct gfs_ea_header *)((char *)ea + ea_size);
-	uint32_t new_size = GFS_EA_REC_LEN(ea) - ea_size;
-	int last = ea->ea_flags & GFS_EAFLAG_LAST;
-
-	ea->ea_rec_len = cpu_to_gfs32(ea_size);
-	ea->ea_flags ^= last;
-
-	new->ea_rec_len = cpu_to_gfs32(new_size);
-	new->ea_flags = last;
-
-	return new;
-}
-
-/**
- * ea_set_remove_stuffed -
- * @ip:
- * @ea:
- *
- */
-
-static void
-ea_set_remove_stuffed(struct gfs_inode *ip, struct gfs_ea_location *el)
-{
-	struct gfs_ea_header *ea = el->el_ea;
-	struct gfs_ea_header *prev = el->el_prev;
-	uint32_t len;
-
-	gfs_trans_add_bh(ip->i_gl, el->el_bh);
-
-	if (!prev || !GFS_EA_IS_STUFFED(ea)) {
-		ea->ea_type = GFS_EATYPE_UNUSED;
-		return;
-	} else if (GFS_EA2NEXT(prev) != ea) {
-		prev = GFS_EA2NEXT(prev);
-		gfs_assert_withdraw(ip->i_sbd, GFS_EA2NEXT(prev) == ea);
-	}
-
-	len = GFS_EA_REC_LEN(prev) + GFS_EA_REC_LEN(ea);
-	prev->ea_rec_len = cpu_to_gfs32(len);
-
-	if (GFS_EA_IS_LAST(ea))
-		prev->ea_flags |= GFS_EAFLAG_LAST;
-}
-
-struct ea_set {
-	int ea_split;
-
-	struct gfs_ea_request *es_er;
-	struct gfs_ea_location *es_el;
-
-	struct buffer_head *es_bh;
-	struct gfs_ea_header *es_ea;
-};
-
-/**
- * ea_set_simple_noalloc -
- * @ip:
- * @ea:
- * @es:
- *
- * Returns: errno
- */
-
-static int
-ea_set_simple_noalloc(struct gfs_inode *ip,
-		      struct buffer_head *bh,
-		      struct gfs_ea_header *ea,
-		      struct ea_set *es)
-{
-	struct gfs_ea_request *er = es->es_er;
-	int error;
-
-	error = gfs_trans_begin(ip->i_sbd, 3, 0);
-	if (error)
-		return error;
-
-	gfs_trans_add_bh(ip->i_gl, bh);
-
-	if (es->ea_split)
-		ea = ea_split_ea(ea);
-
-	ea_write(ip, ea, er);
-
-	if (es->es_el)
-		ea_set_remove_stuffed(ip, es->es_el);
-
-	{
-		struct buffer_head *dibh;
-		error = gfs_get_inode_buffer(ip, &dibh);
-		if (!error) {
-			if (er->er_mode) {
-				ip->i_vnode->i_mode = er->er_mode;
-				gfs_inode_attr_out(ip);
-			}
-			ip->i_di.di_ctime = get_seconds();
-			gfs_trans_add_bh(ip->i_gl, dibh);
-			gfs_dinode_out(&ip->i_di, dibh->b_data);
-			brelse(dibh);
-		}	
-	}
-
-	gfs_trans_end(ip->i_sbd);
-
-	return error;
-}
-
-/**
- * ea_set_simple_alloc -
- * @ip:
- * @er:
- * @private:
- *
- * Returns: errno
- */
-
-static int
-ea_set_simple_alloc(struct gfs_inode *ip,
-		    struct gfs_ea_request *er,
-		    void *private)
-{
-	struct ea_set *es = (struct ea_set *)private;
-	struct gfs_ea_header *ea = es->es_ea;
-	int error;
-
-	gfs_trans_add_bh(ip->i_gl, es->es_bh);
-
-	if (es->ea_split)
-		ea = ea_split_ea(ea);
-
-	error =  ea_write(ip, ea, er);
-	if (error)
-		return error;
-
-	if (es->es_el)
-		ea_set_remove_stuffed(ip, es->es_el);
-
-	return 0;
-}
-
-/**
- * ea_set_simple -
- * @ip:
- * @el:
- *
- * Returns: errno
- */
-
-static int
-ea_set_simple(struct gfs_inode *ip,
-	      struct buffer_head *bh,
-	      struct gfs_ea_header *ea,
-	      struct gfs_ea_header *prev,
-	      void *private)
-{
-	struct ea_set *es = (struct ea_set *)private;
-	unsigned int size;
-	int stuffed;
-	int error;
-
-	stuffed = ea_calc_size(ip->i_sbd, es->es_er, &size);
-
-	if (ea->ea_type == GFS_EATYPE_UNUSED) {
-		if (GFS_EA_REC_LEN(ea) < size)
-			return 0;
-		if (!GFS_EA_IS_STUFFED(ea)) {
-			error = ea_remove_unstuffed(ip, bh, ea, prev, TRUE);
-			if (error)
-				return error;
-		}
-		es->ea_split = FALSE;
-	} else if (GFS_EA_REC_LEN(ea) - GFS_EA_SIZE(ea) >= size)
-		es->ea_split = TRUE;
-	else
-		return 0;
-
-	if (stuffed) {
-		error = ea_set_simple_noalloc(ip, bh, ea, es);
-		if (error)
-			return error;
-	} else {
-		unsigned int blks;
-
-		es->es_bh = bh;
-		es->es_ea = ea;
-		blks = 2 + DIV_RU(es->es_er->er_data_len,
-				  ip->i_sbd->sd_jbsize);
-
-		error = ea_alloc_skeleton(ip, es->es_er,
-					  blks,
-					  ea_set_simple_alloc, es);
-		if (error)
-			return error;
-	}
-
-	return 1;
-}
-
-/**
- * ea_set_block -
- * @ip:
- * @er:
- * @private:
- *
- * Returns: errno
- */
-
-static int
-ea_set_block(struct gfs_inode *ip,
-	     struct gfs_ea_request *er,
-	     void *private)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct buffer_head *indbh, *newbh;
-	uint64_t *eablk;
-	int error;
-
-	if (ip->i_di.di_flags & GFS_DIF_EA_INDIRECT) {
-		uint64_t *end;
-
-		error = gfs_dread(ip->i_gl, ip->i_di.di_eattr,
-				  DIO_START | DIO_WAIT, &indbh);
-		if (error)
-			return error;
-
-		if (gfs_metatype_check(sdp, indbh, GFS_METATYPE_IN)) {
-			error = -EIO;
-			goto out;
-		}
-
-		eablk = (uint64_t *)(indbh->b_data + sizeof(struct gfs_indirect));
-		end = eablk + sdp->sd_inptrs;
-
-		for (; eablk < end; eablk++)
-			if (!*eablk)
-				break;
-
-		if (eablk == end) {
-			error = -ENOSPC;
-			goto out;
-		}
-
-		gfs_trans_add_bh(ip->i_gl, indbh);
-	} else {
-		uint64_t blk;
-
-		error = gfs_metaalloc(ip, &blk);
-		if (error)
-			return error;
-
-		error = gfs_dread(ip->i_gl, blk,
-				  DIO_NEW | DIO_START | DIO_WAIT, &indbh);
-		if (error)
-			return error;
-
-		gfs_trans_add_bh(ip->i_gl, indbh);
-		gfs_metatype_set(indbh, GFS_METATYPE_IN, GFS_FORMAT_IN);
-		gfs_buffer_clear_tail(indbh, sizeof(struct gfs_meta_header));
-
-		eablk = (uint64_t *)(indbh->b_data + sizeof(struct gfs_indirect));
-		*eablk = cpu_to_gfs64(ip->i_di.di_eattr);
-		ip->i_di.di_eattr = blk;
-		ip->i_di.di_flags |= GFS_DIF_EA_INDIRECT;
-		ip->i_di.di_blocks++;
-
-		eablk++;
-	}
-
-	error = ea_alloc_blk(ip, &newbh);
-	if (error)
-		goto out;
-
-	*eablk = cpu_to_gfs64((uint64_t)newbh->b_blocknr);
-	error = ea_write(ip, GFS_EA_BH2FIRST(newbh), er);
-	brelse(newbh);
-	if (error)
-		goto out;
-
-	if (private)
-		ea_set_remove_stuffed(ip, (struct gfs_ea_location *)private);
-
- out:
-	brelse(indbh);
-
-	return error;
-}
-
-/**
- * ea_set_i -
- * @ip:
- * @el:
- *
- * Returns: errno
- */
-
-static int
-ea_set_i(struct gfs_inode *ip,
-	 struct gfs_ea_request *er,
-	 struct gfs_ea_location *el)
-{
-	{
-		struct ea_set es;
-		int error;
-
-		memset(&es, 0, sizeof(struct ea_set));
-		es.es_er = er;
-		es.es_el = el;
-
-		error = ea_foreach(ip, ea_set_simple, &es);
-		if (error > 0)
-			return 0;
-		if (error)
-			return error;
-	}
-	{
-		unsigned int blks = 2;
-		if (!(ip->i_di.di_flags & GFS_DIF_EA_INDIRECT))
-			blks++;
-		if (GFS_EAREQ_SIZE_STUFFED(er) > ip->i_sbd->sd_jbsize)
-			blks += DIV_RU(er->er_data_len,
-				       ip->i_sbd->sd_jbsize);
-
-		return ea_alloc_skeleton(ip, er, blks, ea_set_block, el);
-	}
-}
-
-/**
- * ea_set_remove_unstuffed -
- * @ip:
- * @el:
- *
- * Returns: errno
- */
-
-static int
-ea_set_remove_unstuffed(struct gfs_inode *ip, struct gfs_ea_location *el)
-{
-	if (el->el_prev && GFS_EA2NEXT(el->el_prev) != el->el_ea) {
-		el->el_prev = GFS_EA2NEXT(el->el_prev);
-		gfs_assert_withdraw(ip->i_sbd,
-				    GFS_EA2NEXT(el->el_prev) == el->el_ea);
-	}
-
-	return ea_remove_unstuffed(ip, el->el_bh, el->el_ea, el->el_prev, FALSE);
-}
-
-/**
- * gfs_ea_set_i -
- * @ip:
- * @er:
- *
- * Returns: errno
- */
-
-int
-gfs_ea_set_i(struct gfs_inode *ip, struct gfs_ea_request *er)
-{
-	struct gfs_ea_location el;
-	int error;
-
-	if (!ip->i_di.di_eattr) {
-		if (er->er_flags & XATTR_REPLACE)
-			return -ENODATA;
-		return ea_init(ip, er);
-	}
-
-	error = gfs_ea_find(ip, er, &el);
-	if (error)
-		return error;
-
-	if (el.el_ea) {
-		if (IS_APPEND(ip->i_vnode)) {
-			brelse(el.el_bh);
-			return -EPERM;
-		}
-
-		error = -EEXIST;
-		if (!(er->er_flags & XATTR_CREATE)) {
-			int unstuffed = !GFS_EA_IS_STUFFED(el.el_ea);
-			error = ea_set_i(ip, er, &el);
-			if (!error && unstuffed)
-				ea_set_remove_unstuffed(ip, &el);
-		}
-
-		brelse(el.el_bh);
-	} else {
-		error = -ENODATA;
-		if (!(er->er_flags & XATTR_REPLACE))
-			error = ea_set_i(ip, er, NULL);
-	}
-
-	return error;
-}
-
-/**
- * gfs_ea_set -
- * @ip:
- * @er:
- *
- * Returns: errno
- */
-
-int
-gfs_ea_set(struct gfs_inode *ip, struct gfs_ea_request *er)
-{
-	struct gfs_holder i_gh;
-	int error;
-
-	if (!er->er_name_len ||
-	    er->er_name_len > GFS_EA_MAX_NAME_LEN)
-		return -EINVAL;
-	if (!er->er_data || !er->er_data_len) {
-		er->er_data = NULL;
-		er->er_data_len = 0;
-	}
-	error = gfs_ea_check_size(ip->i_sbd, er);
-	if (error)
-		return error;
-
-	error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh);
-	if (error)
-		return error;
-
-	if (IS_IMMUTABLE(ip->i_vnode))
-		error = -EPERM;
-	else
-		error = gfs_ea_ops[er->er_type]->eo_set(ip, er);
-
-	gfs_glock_dq_uninit(&i_gh);
-
-	return error;
-}
-
-/**
- * ea_remove_stuffed -
- * @ip:
- * @el:
- * @mode:
- *
- * Returns: errno
- */
-
-static int
-ea_remove_stuffed(struct gfs_inode *ip,
-		  struct gfs_ea_location *el)
-{
-	struct gfs_ea_header *ea = el->el_ea;
-	struct gfs_ea_header *prev = el->el_prev;
-	int error;
-
-	error = gfs_trans_begin(ip->i_sbd, 2, 0);
-	if (error)
-		return error;
-
-	gfs_trans_add_bh(ip->i_gl, el->el_bh);
-
-	if (prev) {
-		uint32_t len;
-
-		len = GFS_EA_REC_LEN(prev) + GFS_EA_REC_LEN(ea);
-		prev->ea_rec_len = cpu_to_gfs32(len);
-
-		if (GFS_EA_IS_LAST(ea))
-			prev->ea_flags |= GFS_EAFLAG_LAST;
-	} else
-		ea->ea_type = GFS_EATYPE_UNUSED;
-
-	{
-		struct buffer_head *dibh;
-		error = gfs_get_inode_buffer(ip, &dibh);
-		if (!error) {
-			ip->i_di.di_ctime = get_seconds();
-			gfs_trans_add_bh(ip->i_gl, dibh);
-			gfs_dinode_out(&ip->i_di, dibh->b_data);
-			brelse(dibh);
-		}	
-	}
-
-	gfs_trans_end(ip->i_sbd);
-
-	return error;
-}
-
-/**
- * gfs_ea_remove_i -
- * @ip:
- * @er:
- *
- * Returns: errno
- */
-
-int
-gfs_ea_remove_i(struct gfs_inode *ip, struct gfs_ea_request *er)
-{
-	struct gfs_ea_location el;
-	int error;
-
-	if (!ip->i_di.di_eattr)
-		return -ENODATA;
-
-	error = gfs_ea_find(ip, er, &el);
-	if (error)
-		return error;
-	if (!el.el_ea)
-		return -ENODATA;
-
-	if (GFS_EA_IS_STUFFED(el.el_ea))
-		error = ea_remove_stuffed(ip, &el);
-	else
-		error = ea_remove_unstuffed(ip, el.el_bh, el.el_ea, el.el_prev, FALSE);
-
-	brelse(el.el_bh);
-
-	return error;
-}
-
-/**
- * gfs_ea_remove - sets (or creates or replaces) an extended attribute
- * @ip: pointer to the inode of the target file
- * @er: request information
- *
- * Returns: errno
- */
-
-int
-gfs_ea_remove(struct gfs_inode *ip, struct gfs_ea_request *er)
-{
-	struct gfs_holder i_gh;
-	int error;
-
-	if (!er->er_name_len ||
-	    er->er_name_len > GFS_EA_MAX_NAME_LEN)
-		return -EINVAL;
-
-	error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh);
-	if (error)
-		return error;
-
-	if (IS_IMMUTABLE(ip->i_vnode) || IS_APPEND(ip->i_vnode))
-		error = -EPERM;
-	else
-		error = gfs_ea_ops[er->er_type]->eo_remove(ip, er);
-
-	gfs_glock_dq_uninit(&i_gh);
-
-	return error;
-}
-
-/**
- * gfs_ea_acl_init -
- * @ip:
- * @er:
- *
- * Returns: errno
- */
-
-int
-gfs_ea_acl_init(struct gfs_inode *ip, struct gfs_ea_request *er)
-{
-	int error;
-
-	if (!ip->i_di.di_eattr)
-		return ea_init_i(ip, er, NULL);
-
-	{
-		struct buffer_head *bh;
-		struct gfs_ea_header *ea;
-		unsigned int size;
-
-		ea_calc_size(ip->i_sbd, er, &size);
-
-		error = gfs_dread(ip->i_gl, ip->i_di.di_eattr,
-				  DIO_START | DIO_WAIT, &bh);
-		if (error)
-			return error;
-
-		if (gfs_metatype_check(ip->i_sbd, bh, GFS_METATYPE_EA)) {
-			brelse(bh);
-			return -EIO;
-		}
-
-		ea = GFS_EA_BH2FIRST(bh);
-		if (GFS_EA_REC_LEN(ea) - GFS_EA_SIZE(ea) >= size) {
-			ea = ea_split_ea(ea);
-			ea_write(ip, ea, er);
-			brelse(bh);
-			return 0;
-		}
-
-		brelse(bh);
-	}
-
-	error = ea_set_block(ip, er, NULL);
-	gfs_assert_withdraw(ip->i_sbd, error != -ENOSPC);
-	if (error)
-		return error;
-
-	{
-		struct buffer_head *dibh;
-		error = gfs_get_inode_buffer(ip, &dibh);
-		if (error)
-			return error;
-		gfs_dinode_out(&ip->i_di, dibh->b_data);
-		brelse(dibh);
-	}
-
-	return error;
-}
-
-/**
- * ea_acl_chmod_unstuffed -
- * @ip:
- * @ea:
- * @data:
- *
- * Returns: errno
- */
-
-static int
-ea_acl_chmod_unstuffed(struct gfs_inode *ip,
-		       struct gfs_ea_header *ea,
-		       char *data)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct buffer_head **bh;
-	unsigned int amount = GFS_EA_DATA_LEN(ea);
-	unsigned int nptrs = DIV_RU(amount, sdp->sd_jbsize);
-	uint64_t *dataptrs = GFS_EA2DATAPTRS(ea);
-	unsigned int x;
-	int error;
-
-	bh = kmalloc(nptrs * sizeof(struct buffer_head *), GFP_KERNEL);
-	if (!bh)
-		return -ENOMEM;
-
-	error = gfs_trans_begin(sdp, 1 + nptrs, 0);
-	if (error)
-		goto out;
-
-	for (x = 0; x < nptrs; x++) {
-		error = gfs_dread(ip->i_gl, gfs64_to_cpu(*dataptrs),
-				  DIO_START, bh + x);
-		if (error) {
-			while (x--)
-				brelse(bh[x]);
-			goto fail;
-		}
-		dataptrs++;
-	}
-
-	for (x = 0; x < nptrs; x++) {
-		error = gfs_dreread(sdp, bh[x], DIO_WAIT);
-		if (error) {
-			for (; x < nptrs; x++)
-				brelse(bh[x]);
-			goto fail;
-		}
-		if (gfs_metatype_check2(sdp, bh[x],
-					GFS_METATYPE_ED, GFS_METATYPE_EA)) {
-			for (; x < nptrs; x++)
-				brelse(bh[x]);
-			error = -EIO;
-			goto fail;
-		}
-
-		gfs_trans_add_bh(ip->i_gl, bh[x]);
-
-		memcpy(bh[x]->b_data + sizeof(struct gfs_meta_header),
-		       data,
-		       (sdp->sd_jbsize > amount) ? amount : sdp->sd_jbsize);
-
-		amount -= sdp->sd_jbsize;
-		data += sdp->sd_jbsize;
-
-		brelse(bh[x]);
-	}
-
- out:
-	kfree(bh);
-
-	return error;
-
- fail:
-	gfs_trans_end(sdp);
-	kfree(bh);
-
-	return error;
-}
-
-/**
- * gfs_ea_acl_chmod -
- * @ip:
- * @el:
- * @attr:
- * @data:
- *
- * Returns: errno
- */
-
-int
-gfs_ea_acl_chmod(struct gfs_inode *ip, struct gfs_ea_location *el,
-		 struct iattr *attr, char *data)
-{
-	struct buffer_head *dibh;
-	int error;
-
-	if (GFS_EA_IS_STUFFED(el->el_ea)) {
-		error = gfs_trans_begin(ip->i_sbd, 2, 0);
-		if (error)
-			return error;
-
-		gfs_trans_add_bh(ip->i_gl, el->el_bh);
-		memcpy(GFS_EA2DATA(el->el_ea),
-		       data,
-		       GFS_EA_DATA_LEN(el->el_ea));
-	} else
-		error = ea_acl_chmod_unstuffed(ip, el->el_ea, data);
-
-	if (error)
-		return error;
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-	if (!error) {
-		error = inode_setattr(ip->i_vnode, attr);
-		gfs_assert_warn(ip->i_sbd, !error);
-		gfs_inode_attr_out(ip);
-		gfs_trans_add_bh(ip->i_gl, dibh);
-		gfs_dinode_out(&ip->i_di, dibh->b_data);
-		brelse(dibh);
-	}
-
-	gfs_trans_end(ip->i_sbd);
-
-	return error;
-}
-
-/**
- * ea_dealloc_indirect -
- * @ip:
- *
- * Returns: errno
- */
-
-static int
-ea_dealloc_indirect(struct gfs_inode *ip)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_rgrp_list rlist;
-	struct buffer_head *indbh, *dibh;
-	uint64_t *eablk, *end;
-	unsigned int rg_blocks = 0;
-	uint64_t bstart = 0;
-	unsigned int blen = 0;
-	unsigned int x;
-	int error;
-
-	memset(&rlist, 0, sizeof(struct gfs_rgrp_list));
-
-	error = gfs_dread(ip->i_gl, ip->i_di.di_eattr,
-			  DIO_START | DIO_WAIT, &indbh);
-	if (error)
-		return error;
-
-	if (gfs_metatype_check(sdp, indbh, GFS_METATYPE_IN)) {
-		error = -EIO;
-		goto out;
-	}
-
-	eablk = (uint64_t *)(indbh->b_data + sizeof(struct gfs_indirect));
-	end = eablk + sdp->sd_inptrs;
-
-	for (; eablk < end; eablk++) {
-		uint64_t bn;
-
-		if (!*eablk)
-			break;
-		bn = gfs64_to_cpu(*eablk);
-
-		if (bstart + blen == bn)
-			blen++;
-		else {
-			if (bstart)
-				gfs_rlist_add(sdp, &rlist, bstart);
-			bstart = bn;
-			blen = 1;
-		}	
-	}
-	if (bstart)
-		gfs_rlist_add(sdp, &rlist, bstart);
-	else
-		goto out;
-
-	gfs_rlist_alloc(&rlist, LM_ST_EXCLUSIVE, 0);
-
-	for (x = 0; x < rlist.rl_rgrps; x++) {
-		struct gfs_rgrpd *rgd;
-		rgd = get_gl2rgd(rlist.rl_ghs[x].gh_gl);
-		rg_blocks += rgd->rd_ri.ri_length;
-	}
-
-	error = gfs_glock_nq_m(rlist.rl_rgrps, rlist.rl_ghs);
-	if (error)
-		goto out_rlist_free;
-
-	error = gfs_trans_begin(sdp, 2 + rg_blocks, 1);
-	if (error)
-		goto out_gunlock;
-
-	gfs_trans_add_bh(ip->i_gl, indbh);
-
-	eablk = (uint64_t *)(indbh->b_data + sizeof(struct gfs_indirect));
-	bstart = 0;
-	blen = 0;
-
-	for (; eablk < end; eablk++) {
-		uint64_t bn;
-
-		if (!*eablk)
-			break;
-		bn = gfs64_to_cpu(*eablk);
-
-		if (bstart + blen == bn)
-			blen++;
-		else {
-			if (bstart)
-				gfs_metafree(ip, bstart, blen);
-			bstart = bn;
-			blen = 1;
-		}
-
-		*eablk = 0;
-		if (!ip->i_di.di_blocks)
-			gfs_consist_inode(ip);
-		ip->i_di.di_blocks--;
-	}
-	if (bstart)
-		gfs_metafree(ip, bstart, blen);
-
-	ip->i_di.di_flags &= ~GFS_DIF_EA_INDIRECT;
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-	if (!error) {
-		gfs_trans_add_bh(ip->i_gl, dibh);
-		gfs_dinode_out(&ip->i_di, dibh->b_data);
-		brelse(dibh);
-	}
-
-	gfs_trans_end(sdp);
-
- out_gunlock:
-	gfs_glock_dq_m(rlist.rl_rgrps, rlist.rl_ghs);
-
- out_rlist_free:
-	gfs_rlist_free(&rlist);
-
- out:
-	brelse(indbh);
-
-	return error;
-}
-
-/**
- * ea_dealloc_block -
- * @ip:
- *
- * Returns: errno
- */
-
-static int
-ea_dealloc_block(struct gfs_inode *ip)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_alloc *al = ip->i_alloc;
-	struct gfs_rgrpd *rgd;
-	struct buffer_head *dibh;
-	int error;
-
-	rgd = gfs_blk2rgrpd(sdp, ip->i_di.di_eattr);
-	if (!rgd) {
-		gfs_consist_inode(ip);
-		return -EIO;
-	}
-
-	error = gfs_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, &al->al_rgd_gh);
-	if (error)
-		return error;
-
-	error = gfs_trans_begin(sdp, 1 + rgd->rd_ri.ri_length, 1);
-	if (error)
-		goto out_gunlock;
-
-	gfs_metafree(ip, ip->i_di.di_eattr, 1);
-
-	ip->i_di.di_eattr = 0;
-	if (!ip->i_di.di_blocks)
-		gfs_consist_inode(ip);
-	ip->i_di.di_blocks--;
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-	if (!error) {
-		gfs_trans_add_bh(ip->i_gl, dibh);
-		gfs_dinode_out(&ip->i_di, dibh->b_data);
-		brelse(dibh);
-	}
-
-	gfs_trans_end(sdp);
-
- out_gunlock:
-	gfs_glock_dq_uninit(&al->al_rgd_gh);
-
-	return error;
-}
-
-/**
- * gfs_ea_dealloc - deallocate the extended attribute fork
- * @ip: the inode
- *
- * Returns: errno
- */
-
-int
-gfs_ea_dealloc(struct gfs_inode *ip)
-{
-	struct gfs_alloc *al;
-	int error;
-
-	al = gfs_alloc_get(ip);
-
-	error = gfs_quota_hold_m(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
-	if (error)
-		goto out_alloc;
-
-	error = gfs_rindex_hold(ip->i_sbd, &al->al_ri_gh);
-	if (error)
-		goto out_quota;
-
-	error = ea_foreach(ip, ea_dealloc_unstuffed, NULL);
-	if (error)
-		goto out_rindex;
-
-	if (ip->i_di.di_flags & GFS_DIF_EA_INDIRECT) {
-		error = ea_dealloc_indirect(ip);
-		if (error)
-			goto out_rindex;
-	}
-
-	error = ea_dealloc_block(ip);
-
- out_rindex:
-	gfs_glock_dq_uninit(&al->al_ri_gh);
-
- out_quota:
-	gfs_quota_unhold_m(ip);
-
- out_alloc:
-	gfs_alloc_put(ip);
-
-	return error;
-}
-
-/**
- * gfs_get_eattr_meta - return all the eattr blocks of a file
- * @dip: the directory
- * @ub: the structure representing the user buffer to copy to
- *
- * Returns: errno
- */
-
-int
-gfs_get_eattr_meta(struct gfs_inode *ip, struct gfs_user_buffer *ub)
-{
-	struct buffer_head *bh;
-	int error;
-
-	error = gfs_dread(ip->i_gl, ip->i_di.di_eattr,
-			  DIO_START | DIO_WAIT, &bh);
-	if (error)
-		return error;
-
-	gfs_add_bh_to_ub(ub, bh);
-
-	if (ip->i_di.di_flags & GFS_DIF_EA_INDIRECT) {
-		struct buffer_head *eabh;
-		uint64_t *eablk, *end;
-
-		if (gfs_metatype_check(ip->i_sbd, bh, GFS_METATYPE_IN)) {
-			error = -EIO;
-			goto out;
-		}
-
-		eablk = (uint64_t *)(bh->b_data + sizeof(struct gfs_indirect));
-		end = eablk + ip->i_sbd->sd_inptrs;
-
-		for (; eablk < end; eablk++) {
-			uint64_t bn;
-
-			if (!*eablk)
-				break;
-			bn = gfs64_to_cpu(*eablk);
-
-			error = gfs_dread(ip->i_gl, bn,
-					  DIO_START | DIO_WAIT, &eabh);
-			if (error)
-				break;
-			gfs_add_bh_to_ub(ub, eabh);
-			brelse(eabh);
-			if (error)
-				break;
-		}
-	}
-
- out:
-	brelse(bh);
-
-	return error;
-}
diff --git a/gfs-kernel/src/gfs/eattr.h b/gfs-kernel/src/gfs/eattr.h
deleted file mode 100644
index b370c2a..0000000
--- a/gfs-kernel/src/gfs/eattr.h
+++ /dev/null
@@ -1,97 +0,0 @@
-#ifndef __EATTR_DOT_H__
-#define __EATTR_DOT_H__
-
-#define GFS_EA_REC_LEN(ea) gfs32_to_cpu((ea)->ea_rec_len)
-#define GFS_EA_DATA_LEN(ea) gfs32_to_cpu((ea)->ea_data_len)
-
-#define GFS_EA_SIZE(ea) \
-MAKE_MULT8(sizeof(struct gfs_ea_header) + \
-	   (ea)->ea_name_len + \
-	   ((GFS_EA_IS_STUFFED(ea)) ? \
-	    GFS_EA_DATA_LEN(ea) : \
-	    (sizeof(uint64_t) * (ea)->ea_num_ptrs)))
-#define GFS_EA_STRLEN(ea) \
-((((ea)->ea_type == GFS_EATYPE_USR) ? 5 : 7) + \
- (ea)->ea_name_len + 1)
-
-#define GFS_EA_IS_STUFFED(ea) (!(ea)->ea_num_ptrs)
-#define GFS_EA_IS_LAST(ea) ((ea)->ea_flags & GFS_EAFLAG_LAST)
-
-#define GFS_EAREQ_SIZE_STUFFED(er) \
-MAKE_MULT8(sizeof(struct gfs_ea_header) + \
-	   (er)->er_name_len + (er)->er_data_len)
-#define GFS_EAREQ_SIZE_UNSTUFFED(sdp, er) \
-MAKE_MULT8(sizeof(struct gfs_ea_header) + \
-	   (er)->er_name_len + \
-	   sizeof(uint64_t) * DIV_RU((er)->er_data_len, (sdp)->sd_jbsize))
-
-#define GFS_EA2NAME(ea) ((char *)((struct gfs_ea_header *)(ea) + 1))
-#define GFS_EA2DATA(ea) (GFS_EA2NAME(ea) + (ea)->ea_name_len)
-#define GFS_EA2DATAPTRS(ea) \
-((uint64_t *)(GFS_EA2NAME(ea) + MAKE_MULT8((ea)->ea_name_len)))
-#define GFS_EA2NEXT(ea) \
-((struct gfs_ea_header *)((char *)(ea) + GFS_EA_REC_LEN(ea)))
-#define GFS_EA_BH2FIRST(bh) \
-((struct gfs_ea_header *)((bh)->b_data + \
-			  sizeof(struct gfs_meta_header)))
-
-struct gfs_ea_request {
-	char *er_name;
-	char *er_data;
-	unsigned int er_name_len;
-	unsigned int er_data_len;
-	unsigned int er_type; /* GFS_EATYPE_... */
-	int er_flags;
-	mode_t er_mode;
-};
-
-struct gfs_ea_location {
-	struct buffer_head *el_bh;
-	struct gfs_ea_header *el_ea;
-	struct gfs_ea_header *el_prev;
-};
-
-static inline unsigned int
-gfs_ea_strlen(struct gfs_ea_header *ea)
-{
-	switch (ea->ea_type) {
-	case GFS_EATYPE_USR:
-		return (5 + (ea->ea_name_len + 1));
-	case GFS_EATYPE_SYS:
-		return (7 + (ea->ea_name_len + 1));
-	case GFS_EATYPE_SECURITY:
-		return (9 + (ea->ea_name_len + 1));
-	default:
-		return (0);
-	}
-}
-
-int gfs_ea_repack(struct gfs_inode *ip);
-
-int gfs_ea_get_i(struct gfs_inode *ip, struct gfs_ea_request *er);
-int gfs_ea_set_i(struct gfs_inode *ip, struct gfs_ea_request *er);
-int gfs_ea_remove_i(struct gfs_inode *ip, struct gfs_ea_request *er);
-
-int gfs_ea_list(struct gfs_inode *ip, struct gfs_ea_request *er);
-int gfs_ea_get(struct gfs_inode *ip, struct gfs_ea_request *er);
-int gfs_ea_set(struct gfs_inode *ip, struct gfs_ea_request *er);
-int gfs_ea_remove(struct gfs_inode *ip, struct gfs_ea_request *er);
-
-int gfs_ea_dealloc(struct gfs_inode *ip);
-
-int gfs_get_eattr_meta(struct gfs_inode *ip, struct gfs_user_buffer *ub);
-
-/* Exported to acl.c */
-
-int gfs_ea_check_size(struct gfs_sbd *sdp, struct gfs_ea_request *er);
-int gfs_ea_find(struct gfs_inode *ip,
-		struct gfs_ea_request *er,
-		struct gfs_ea_location *el);
-int gfs_ea_get_copy(struct gfs_inode *ip,
-		    struct gfs_ea_location *el,
-		    char *data);
-int gfs_ea_acl_init(struct gfs_inode *ip, struct gfs_ea_request *er);
-int gfs_ea_acl_chmod(struct gfs_inode *ip, struct gfs_ea_location *el,
-		     struct iattr *attr, char *data);
-
-#endif /* __EATTR_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/file.c b/gfs-kernel/src/gfs/file.c
deleted file mode 100644
index 3f8e5b9..0000000
--- a/gfs-kernel/src/gfs/file.c
+++ /dev/null
@@ -1,437 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <asm/uaccess.h>
-
-#include "gfs.h"
-#include "bmap.h"
-#include "dio.h"
-#include "file.h"
-#include "inode.h"
-#include "trans.h"
-
-/**
- * gfs_copy2mem - Trivial copy function for gfs_readi()
- * @bh: The buffer to copy from, or NULL meaning zero the buffer
- * @buf: The buffer to copy/zero
- * @offset: The offset in the buffer to copy from
- * @size: The amount of data to copy/zero
- *
- * Returns: errno
- */
-
-int
-gfs_copy2mem(struct 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;
-
-	return 0;
-}
-
-/**
- * gfs_copy2user - Copy data to user space
- * @bh: The buffer
- * @buf: The destination of the data
- * @offset: The offset into the buffer
- * @size: The amount of data to copy
- *
- * Returns: errno
- */
-
-int
-gfs_copy2user(struct buffer_head *bh, void **buf,
-	      unsigned int offset, unsigned int size)
-{
-	char **p = (char **)buf;
-	int error;
-
-	if (bh)
-		error = copy_to_user(*p, bh->b_data + offset, size);
-	else
-		error = clear_user(*p, size);
-
-	if (error)
-		error = -EFAULT;
-	else
-		*p += size;
-
-	return error;
-}
-
-/**
- * gfs_readi - Read a file
- * @ip: The GFS Inode
- * @buf: The buffer to place result into
- * @offset: File offset to begin reading from
- * @size: Amount of data to transfer
- * @copy_fn: Function to actually perform the copy
- *
- * The @copy_fn only copies a maximum of a single block at once so
- * we are safe calling it with int arguments. It is done so that
- * we don't needlessly put 64bit arguments on the stack and it
- * also makes the code in the @copy_fn nicer too.
- *
- * Returns: The amount of data actually copied or the error
- */
-
-int
-gfs_readi(struct gfs_inode *ip, void *buf,
-	  uint64_t offset, unsigned int size,
-	  read_copy_fn_t copy_fn)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct buffer_head *bh;
-	uint64_t lblock, dblock;
-	unsigned int o;
-	uint32_t extlen = 0;
-	unsigned int amount;
-	int not_new = 0;
-	int journaled = gfs_is_jdata(ip);
-	int copied = 0;
-	int error = 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;
-		o = do_div(lblock, sdp->sd_jbsize);
-	} else {
-		lblock = offset >> sdp->sd_sb.sb_bsize_shift;
-		o = offset & (sdp->sd_sb.sb_bsize - 1);
-	}
-
-	if (gfs_is_stuffed(ip))
-		o += sizeof(struct gfs_dinode);
-	else if (journaled)
-		o += sizeof(struct gfs_meta_header);
-
-	while (copied < size) {
-		amount = size - copied;
-		if (amount > sdp->sd_sb.sb_bsize - o)
-			amount = sdp->sd_sb.sb_bsize - o;
-
-		if (!extlen) {
-			if (!gfs_is_stuffed(ip)) {
-				error = gfs_block_map(ip, lblock, &not_new,
-						      &dblock, &extlen);
-				if (error)
-					goto fail;
-			} else if (!lblock) {
-				dblock = ip->i_num.no_addr;
-				extlen = 1;
-			} else
-				dblock = 0;
-		}
-
-		if (extlen > 1)
-			gfs_start_ra(ip->i_gl, dblock, extlen);
-
-		if (dblock) {
-			error = gfs_get_data_buffer(ip, dblock, not_new, &bh);
-			if (error)
-				goto fail;
-
-			dblock++;
-			extlen--;
-		} else
-			bh = NULL;
-
-		error = copy_fn(bh, &buf, o, amount);
-		if (bh)
-			brelse(bh);
-		if (error)
-			goto fail;
-
-		copied += amount;
-		lblock++;
-
-		o = (journaled) ? sizeof(struct gfs_meta_header) : 0;
-	}
-
-	return copied;
-
- fail:
-	return (copied) ? copied : error;
-}
-
-/**
- * gfs_copy_from_mem - Trivial copy function for gfs_writei()
- * @ip: The file to write to
- * @bh: The buffer to copy to or clear
- * @buf: The buffer to copy from
- * @offset: The offset in the buffer to write to
- * @size: The amount of data to write
- * @new: Flag indicating that remaining space in the buffer should be zeroed
- *
- * Returns: errno
- */
-
-int
-gfs_copy_from_mem(struct gfs_inode *ip, struct buffer_head *bh, void **buf,
-		  unsigned int offset, unsigned int size, int new)
-{
-	char **p = (char **)buf;
-	int error = 0;
-
-	/* The dinode block always gets journaled */
-	if (bh->b_blocknr == ip->i_num.no_addr) {
-		if (gfs_assert_warn(ip->i_sbd, !new))
-			return -EIO;
-		gfs_trans_add_bh(ip->i_gl, bh);
-		memcpy(bh->b_data + offset, *p, size);
-
-	/* Data blocks for journaled files get written added to the journal */
-	} else if (gfs_is_jdata(ip)) {
-		gfs_trans_add_bh(ip->i_gl, bh);
-		memcpy(bh->b_data + offset, *p, size);
-		if (new)
-			gfs_buffer_clear_ends(bh, offset, size, TRUE);
-
-	/* Non-journaled data blocks get written to in-place disk blocks */
-	} else {
-		memcpy(bh->b_data + offset, *p, size);
-		if (new)
-			gfs_buffer_clear_ends(bh, offset, size, FALSE);
-		error = gfs_dwrite(ip->i_sbd, bh, DIO_DIRTY);
-	}
-
-	if (!error)
-		*p += size;
-
-	return error;
-}
-
-/**
- * gfs_copy_from_user - Copy bytes from user space for gfs_writei()
- * @ip: The file to write to
- * @bh: The buffer to copy to or clear
- * @buf: The buffer to copy from
- * @offset: The offset in the buffer to write to
- * @size: The amount of data to write
- * @new: Flag indicating that remaining space in the buffer should be zeroed
- *
- * Returns: errno
- */
-
-int
-gfs_copy_from_user(struct gfs_inode *ip, struct buffer_head *bh, void **buf,
-		   unsigned int offset, unsigned int size, int new)
-{
-	char **p = (char **)buf;
-	int error = 0;
-
-	/* the dinode block always gets journaled */
-	if (bh->b_blocknr == ip->i_num.no_addr) {
-		if (gfs_assert_warn(ip->i_sbd, !new))
-			return -EIO;
-		gfs_trans_add_bh(ip->i_gl, bh);
-		if (copy_from_user(bh->b_data + offset, *p, size))
-			error = -EFAULT;
-
-	/* Data blocks for journaled files get written added to the journal */
-	} else if (gfs_is_jdata(ip)) {
-		gfs_trans_add_bh(ip->i_gl, bh);
-		if (copy_from_user(bh->b_data + offset, *p, size))
-			error = -EFAULT;
-		if (new) {
-			gfs_buffer_clear_ends(bh, offset, size, TRUE);
-			if (error)
-				memset(bh->b_data + offset, 0, size);
-		}
-
-	/* non-journaled data blocks get written to in-place disk blocks */
-	} else {
-		if (copy_from_user(bh->b_data + offset, *p, size))
-			error = -EFAULT;
-		if (error) {
-			if (new)
-				gfs_buffer_clear(bh);
-			gfs_dwrite(ip->i_sbd, bh, DIO_DIRTY);
-		} else {
-			if (new)
-				gfs_buffer_clear_ends(bh, offset, size, FALSE);
-			error = gfs_dwrite(ip->i_sbd, bh, DIO_DIRTY);
-		}
-	}
-
-	if (!error)
-		*p += size;
-
-	return error;
-}
-
-/**
- * gfs_writei - Write bytes to a file
- * @ip: The GFS inode
- * @buf: The buffer containing information to be written
- * @offset: The file offset to start writing at
- * @size: The amount of data to write
- * @copy_fn: Function to do the actual copying
- *
- * Returns: The number of bytes correctly written or error code
- */
-
-int
-gfs_writei(struct gfs_inode *ip, void *buf,
-	   uint64_t offset, unsigned int size,
-	   write_copy_fn_t copy_fn,
-           struct kiocb *iocb)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct buffer_head *dibh, *bh;
-	uint64_t lblock, dblock;
-	unsigned int o;
-	uint32_t extlen = 0;
-	unsigned int amount;
-	int new;
-	int journaled = gfs_is_jdata(ip);
-	const uint64_t start = offset;
-	int copied = 0;
-	int error = 0;
-
-	if (!size)
-		return 0;
-
-	if (gfs_is_stuffed(ip) &&
-	    ((start + size) > (sdp->sd_sb.sb_bsize - sizeof(struct gfs_dinode)))) {
-		error = gfs_unstuff_dinode(ip, gfs_unstuffer_async, NULL);
-		if (error)
-			return error;
-	}
-
-	if (journaled) {
-		lblock = offset;
-		o = do_div(lblock, sdp->sd_jbsize);
-	} else {
-		lblock = offset >> sdp->sd_sb.sb_bsize_shift;
-		o = offset & (sdp->sd_sb.sb_bsize - 1);
-	}
-
-	if (gfs_is_stuffed(ip))
-		o += sizeof(struct gfs_dinode);
-	else if (journaled)
-		o += sizeof(struct gfs_meta_header);
-
-	while (copied < size) {
-		amount = size - copied;
-		if (amount > sdp->sd_sb.sb_bsize - o)
-			amount = sdp->sd_sb.sb_bsize - o;
-
-		if (!extlen) {
-			if (!gfs_is_stuffed(ip)) {
-				new = TRUE;
-				error = gfs_block_map(ip, lblock, &new, &dblock, &extlen);
-				if (error)
-					goto fail;
-			} else {
-				new = FALSE;
-				dblock = ip->i_num.no_addr;
-				extlen = 1;
-			}
-		}
-
-		if (journaled && extlen > 1)
-			gfs_start_ra(ip->i_gl, dblock, extlen);
-
-		error = gfs_get_data_buffer(ip, dblock,
-					    (amount == sdp->sd_sb.sb_bsize) ? TRUE : new,
-					    &bh);
-		if (error)
-			goto fail;
-
-		error = copy_fn(ip, bh, &buf, o, amount, new);
-		brelse(bh);
-		if (error)
-			goto fail;
-
-		copied += amount;
-		lblock++;
-		dblock++;
-		extlen--;
-
-		o = (journaled) ? sizeof(struct gfs_meta_header) : 0;
-	}
-
- out:
-	error = gfs_get_inode_buffer(ip, &dibh);
-	if (error)
-		return error;
-
-	if (ip->i_di.di_size < start + copied)
-		ip->i_di.di_size = start + copied;
-	ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds();
-
-	gfs_trans_add_bh(ip->i_gl, dibh);
-	gfs_dinode_out(&ip->i_di, dibh->b_data);
-	brelse(dibh);
-
-	return copied;
-
- fail:
-	if (copied)
-		goto out;
-	return error;
-}
-
-/*
- * gfs_zero_blocks - zero out disk blocks via gfs_writei()
- * @ip: The file to write to
- * @bh: The buffer to clear
- * @buf: The pseudo buffer (not used but added to keep interface unchanged)
- * @offset: The offset in the buffer to write to
- * @size: The size to zero out
- * @new: Flag indicating that remaining space in the buffer should be zeroed
- *
- * Returns: 0 on success, -EXXX on failure
- */
-
-int
-gfs_zero_blocks(struct gfs_inode *ip, struct buffer_head *bh, void **buf,
-                unsigned int offset, unsigned int size, int new)
-{
-	int error = 0;
-
-	/* The dinode block always gets journaled */
-	if (bh->b_blocknr == ip->i_num.no_addr) {
-		if (gfs_assert_warn(ip->i_sbd, !new))
-			return -EIO;
-		gfs_trans_add_bh(ip->i_gl, bh);
-		memset((bh)->b_data + offset, 0, size);
-
-	/* Data blocks for journaled files get written added to the journal */
-	} else if (gfs_is_jdata(ip)) {
-		gfs_trans_add_bh(ip->i_gl, bh);
-		memset((bh)->b_data + offset, 0, size);
-		if (new)
-			gfs_buffer_clear_ends(bh, offset, size, TRUE);
-
-	/* Non-journaled data blocks get written to in-place disk blocks */
-	} else {
-		memset((bh)->b_data + offset, 0, size);
-		if (new)
-			gfs_buffer_clear_ends(bh, offset, size, FALSE);
-		error = gfs_dwrite(ip->i_sbd, bh, DIO_DIRTY);
-	}
-
-	return error;
-}
-
diff --git a/gfs-kernel/src/gfs/file.h b/gfs-kernel/src/gfs/file.h
deleted file mode 100644
index ef19dc1..0000000
--- a/gfs-kernel/src/gfs/file.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef __FILE_DOT_H__
-#define __FILE_DOT_H__
-
-typedef int (*read_copy_fn_t) (struct buffer_head *bh, void **buf,
-			       unsigned int offset, unsigned int size);
-typedef int (*write_copy_fn_t) (struct gfs_inode *ip, struct buffer_head *bh,
-				void **buf, unsigned int offset,
-				unsigned int size, int new);
-
-int gfs_copy2mem(struct buffer_head *bh, void **buf,
-		 unsigned int offset, unsigned int size);
-int gfs_copy2user(struct buffer_head *bh, void **buf,
-		  unsigned int offset, unsigned int size);
-int gfs_readi(struct gfs_inode *ip, void *buf, uint64_t offset,
-	      unsigned int size, read_copy_fn_t copy_fn);
-
-int gfs_copy_from_mem(struct gfs_inode *ip, struct buffer_head *bh, void **buf,
-		      unsigned int offset, unsigned int size, int new);
-int gfs_copy_from_user(struct gfs_inode *ip, struct buffer_head *bh, void **buf,
-		       unsigned int offset, unsigned int size, int new);
-int gfs_writei(struct gfs_inode *ip, void *buf, uint64_t offset,
-               unsigned int size, write_copy_fn_t copy_fn,
-               struct kiocb *iocb);
-
-int gfs_zero_blocks(struct gfs_inode *ip, struct buffer_head *bh, void **buf,
-		    unsigned int offset, unsigned int size, int new);
-
-static __inline__ int
-gfs_internal_read(struct gfs_inode *ip, char *buf, uint64_t offset,
-		  unsigned int size)
-{
-	return gfs_readi(ip, buf, offset, size, gfs_copy2mem);
-}
-
-static __inline__ int
-gfs_internal_write(struct gfs_inode *ip, char *buf, uint64_t offset,
-		   unsigned int size)
-{
-	return gfs_writei(ip, buf, offset, size, gfs_copy_from_mem, NULL);
-}
-
-#endif /* __FILE_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/fixed_div64.h b/gfs-kernel/src/gfs/fixed_div64.h
deleted file mode 100644
index 7cc9e71..0000000
--- a/gfs-kernel/src/gfs/fixed_div64.h
+++ /dev/null
@@ -1,107 +0,0 @@
-#ifndef __FIXED_DIV64_DOT_H__
-#define __FIXED_DIV64_DOT_H__
-
-#include <asm/div64.h>
-
-#if defined __i386__
-/* For ia32 we need to pull some tricks to get past various versions
- * of the compiler which do not like us using do_div in the middle
- * of large functions.
- */
-static inline __u32 fixed_div64_do_div(void *a, __u32 b, int n)
-{
-	__u32	mod;
-
-	switch (n) {
-		case 4:
-			mod = *(__u32 *)a % b;
-			*(__u32 *)a = *(__u32 *)a / b;
-			return mod;
-		case 8:
-			{
-			unsigned long __upper, __low, __high, __mod;
-			__u64	c = *(__u64 *)a;
-			__upper = __high = c >> 32;
-			__low = c;
-			if (__high) {
-				__upper = __high % (b);
-				__high = __high / (b);
-			}
-			asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (b), "0" (__low), "1" (__upper));
-			asm("":"=A" (c):"a" (__low),"d" (__high));
-			*(__u64 *)a = c;
-			return __mod;
-			}
-	}
-
-	/* NOTREACHED */
-	return 0;
-}
-
-/* Side effect free 64 bit mod operation */
-static inline __u32 fixed_div64_do_mod(void *a, __u32 b, int n)
-{
-	switch (n) {
-		case 4:
-			return *(__u32 *)a % b;
-		case 8:
-			{
-			unsigned long __upper, __low, __high, __mod;
-			__u64	c = *(__u64 *)a;
-			__upper = __high = c >> 32;
-			__low = c;
-			if (__high) {
-				__upper = __high % (b);
-				__high = __high / (b);
-			}
-			asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (b), "0" (__low), "1" (__upper));
-			asm("":"=A" (c):"a" (__low),"d" (__high));
-			return __mod;
-			}
-	}
-
-	/* NOTREACHED */
-	return 0;
-}
-#else
-static inline __u32 fixed_div64_do_div(void *a, __u32 b, int n)
-{
-	__u32	mod;
-
-	switch (n) {
-		case 4:
-			mod = *(__u32 *)a % b;
-			*(__u32 *)a = *(__u32 *)a / b;
-			return mod;
-		case 8:
-			mod = do_div(*(__u64 *)a, b);
-			return mod;
-	}
-
-	/* NOTREACHED */
-	return 0;
-}
-
-/* Side effect free 64 bit mod operation */
-static inline __u32 fixed_div64_do_mod(void *a, __u32 b, int n)
-{
-	switch (n) {
-		case 4:
-			return *(__u32 *)a % b;
-		case 8:
-			{
-			__u64	c = *(__u64 *)a;
-			return do_div(c, b);
-			}
-	}
-
-	/* NOTREACHED */
-	return 0;
-}
-#endif
-
-#undef do_div
-#define do_div(a, b)	fixed_div64_do_div(&(a), (b), sizeof(a))
-#define do_mod(a, b)	fixed_div64_do_mod(&(a), (b), sizeof(a))
-
-#endif /* __FIXED_DIV64_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/format.h b/gfs-kernel/src/gfs/format.h
deleted file mode 100644
index 578ca2d..0000000
--- a/gfs-kernel/src/gfs/format.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef __FORMAT_DOT_H__
-#define __FORMAT_DOT_H__
-
-static const uint32_t gfs_old_fs_formats[] = {
-	1308,
-	1307,
-	1306,
-	1305,
-	0
-};
-
-static const uint32_t gfs_old_multihost_formats[] = {
-	1400,
-	0
-};
-
-#endif /* __FORMAT_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/gfs.h b/gfs-kernel/src/gfs/gfs.h
deleted file mode 100644
index 7cec09c..0000000
--- a/gfs-kernel/src/gfs/gfs.h
+++ /dev/null
@@ -1,89 +0,0 @@
-#ifndef __GFS_DOT_H__
-#define __GFS_DOT_H__
-
-#define RELEASE_VERSION "<CVS>"
-
-#include "lm_interface.h"
-
-#include "gfs_ondisk.h"
-#include "fixed_div64.h"
-#include "lvb.h"
-#include "incore.h"
-#include "util.h"
-
-#ifndef TRUE
-#define TRUE (1)
-#endif
-
-#ifndef FALSE
-#define FALSE (0)
-#endif
-
-#define NO_CREATE (0)
-#define CREATE (1)
-
-#if (BITS_PER_LONG == 64)
-#define PRIu64 "lu"
-#define PRId64 "ld"
-#define PRIo64 "lo"
-#define PRIx64 "lx"
-#define PRIX64 "lX"
-#define SCNu64 "lu"
-#define SCNd64 "ld"
-#define SCNo64 "lo"
-#define SCNx64 "lx"
-#define SCNX64 "lX"
-#else
-#define PRIu64 "Lu"
-#define PRId64 "Ld"
-#define PRIo64 "Lo"
-#define PRIx64 "Lx"
-#define PRIX64 "LX"
-#define SCNu64 "Lu"
-#define SCNd64 "Ld"
-#define SCNo64 "Lo"
-#define SCNx64 "Lx"
-#define SCNX64 "LX"
-#endif
-
-/*  Divide num by den.  Round up if there is a remainder.  */
-#define DIV_RU(num, den) (((num) + (den) - 1) / (den))
-#define MAKE_MULT8(x) (((x) + 7) & ~7)
-
-#define GFS_FAST_NAME_SIZE (8)
-
-#define get_v2sdp(sb) ((struct gfs_sbd *)(sb)->s_fs_info)
-#define set_v2sdp(sb, sdp) (sb)->s_fs_info = (sdp)
-#define get_v2ip(inode) ((struct gfs_inode *)(inode)->i_private)
-#define set_v2ip(inode, ip) (inode)->i_private = (ip)
-#define get_v2fp(file) ((struct gfs_file *)(file)->private_data)
-#define set_v2fp(file, fp) (file)->private_data = (fp)
-#define get_v2bd(bh) ((struct gfs_bufdata *)(bh)->b_private)
-#define set_v2bd(bh, bd) (bh)->b_private = (bd)
-
-#define get_transaction ((struct gfs_trans *)(current->journal_info))
-#define set_transaction(tr) (current->journal_info) = (tr)
-
-#define get_gl2ip(gl) ((struct gfs_inode *)(gl)->gl_object)
-#define set_gl2ip(gl, ip) (gl)->gl_object = (ip)
-#define get_gl2rgd(gl) ((struct gfs_rgrpd *)(gl)->gl_object)
-#define set_gl2rgd(gl, rgd) (gl)->gl_object = (rgd)
-#define get_gl2gl(gl) ((struct gfs_glock *)(gl)->gl_object)
-#define set_gl2gl(gl, gl2) (gl)->gl_object = (gl2)
-
-#define gfs_printf(fmt, args...) \
-do { \
-	if (buf) { \
-		int gspf_left = size - *count, gspf_out; \
-		if (gspf_left <= 0) \
-			goto out; \
-		gspf_out = snprintf(buf + *count, gspf_left, fmt, ##args); \
-		if (gspf_out < gspf_left) \
-			*count += gspf_out; \
-		else \
-			goto out; \
-	} else \
-		printk(fmt, ##args); \
-} while (0)
-
-#endif /* __GFS_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/gfs_ioctl.h b/gfs-kernel/src/gfs/gfs_ioctl.h
deleted file mode 100644
index e090cec..0000000
--- a/gfs-kernel/src/gfs/gfs_ioctl.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef __GFS_IOCTL_DOT_H__
-#define __GFS_IOCTL_DOT_H__
-
-#define _GFSC_(x)               (('G' << 8) | (x))
-
-/* Ioctls implemented */
-
-#define GFS_IOCTL_IDENTIFY      _GFSC_(35)
-#define GFS_IOCTL_SUPER         _GFSC_(45)
-
-struct gfs_ioctl {
-        unsigned int gi_argc;
-        char **gi_argv;
-
-        char __user *gi_data;
-        unsigned int gi_size;
-        uint64_t gi_offset;
-};
-
-#ifdef CONFIG_COMPAT
-struct gfs_ioctl_compat {
-	unsigned int gi_argc;
-	uint32_t gi_argv;
-
-	uint32_t gi_data;
-	unsigned int gi_size;
-	uint64_t gi_offset;
-};
-#endif
-
-#endif /* ___GFS_IOCTL_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/gfs_ondisk.h b/gfs-kernel/src/gfs/gfs_ondisk.h
deleted file mode 100644
index 0648d28..0000000
--- a/gfs-kernel/src/gfs/gfs_ondisk.h
+++ /dev/null
@@ -1,1904 +0,0 @@
-/*
- * On-disk structures.
- *
- * THE BIG PICTURE of on-disk layout:
- *
- * GFS filesystem code views the entire filesystem, including journals, as
- * one contiguous group of blocks on one (perhaps virtual) storage device.
- * The filesystem space is shared, not distributed; each node in the cluster
- * must see the entire filesystem space.
- *
- * If the filesystem is spread across multiple physical storage devices,
- * volume management (device mapping) must be used to present the fileystem
- * space to GFS as one (virtual) device, with contiguous blocks.
- *
- * The superblock contains basic information about the filesytem, and appears
- * at a location 64 KBytes into the filesystem.  The first 64 KBytes of the
- * filesystem are empty, providing a safety buffer against wayward volume
- * management software (that sometimes write data into the first few bytes of
- * a device) or administrators.
- *
- * After the superblock, the rest of the filesystem is divided into multiple
- * Resource Groups and several journals.
- *
- * The Resource Groups (RGs or rgrps) contain the allocatable blocks that are
- * used for storing files, directories, etc., and all of the associated
- * metadata.  Each RG has its own set of block allocation statistics (within
- * the RG header), a number of blocks containing the block allocation bitmap,
- * and a large number of allocatable blocks for file data and metadata.
- * Multiple RGs allow multiple nodes to simultaneously allocate blocks from the 
- * filesystem (using different RGs), enhancing parallel access.  RG size and
- * number of RGs are determined by gfs_mkfs when creating the filesystem.
- * An administrator can specify RG size (see man gfs_mkfs).
- *
- * The journals contain temporary copies of metadata blocks, along with
- * other data, that allow GFS to recover the filesystem to a consistent state
- * (at least as far as metadata is concerned) if a node fails in the midst
- * of performing a write transaction.  There must be one journal for each node
- * in the cluster.  Since access to the entire filesystem space is shared,
- * if a node crashes, another node will be able to read the crashed node's
- * journal, and perform recovery.
- *
- * Currently, gfs_mkfs places the journals right in the middle of a freshly
- * created filesystem space, between 2 large groups of RGs.  From a filesystem
- * layout perspective, this placement is not a requirement; the journals
- * could be placed anywhere within the filesystem space.
- *
- * New Resource Groups and Journals may be added to the filesystem after the
- * filesystem has been created, if the filesystem's (virtual) device is made
- * larger.  See man gfs_grow and gfs_jadd.
- *
- * A few special hidden inodes are contained in a GFS filesystem.  They do
- * not appear in any directories; instead, the superblock points to them
- * using block numbers for their location.  The special inodes are:
- *
- *   Root inode:  Root directory of the filesystem
- *   Resource Group Index:  A file containing block numbers and sizes of all RGs
- *   Journal Index:  A file containing block numbers and sizes of all journals
- *   Quota:  A file containing all quota information for the filesystem
- *   License:  A file containing license information
- *
- * Note that there is NOTHING RELATED TO INTER-NODE LOCK MANAGEMENT ON-DISK.
- * Locking is handled completely off-disk, typically via LAN.
- *
- * NOTE:
- * If you add 8 byte fields to these structures, they must be 8 byte
- * aligned.  4 byte field must be 4 byte aligned, etc...
- *
- * All structures must be a multiple of 8 bytes long.
- *
- * GRIPES:
- * We should have forgetten about supporting 512B FS block sizes 
- * and made the di_reserved field in the struct gfs_dinode structure
- * much bigger.
- *
- * de_rec_len in struct gfs_dirent should really have been a 32-bit value
- * as it now limits us to a 64k FS block size (with the current code
- * in dir.c).
- */
-
-#ifndef __GFS_ONDISK_DOT_H__
-#define __GFS_ONDISK_DOT_H__
-
-#define GFS_MAGIC               (0x01161970) /* for all on-disk headers */
-#define GFS_BASIC_BLOCK         (512)  /* "basic block" = "sector" = 512B */
-#define GFS_BASIC_BLOCK_SHIFT   (9)
-
-/*  Controls how much data can be logged in-core before dumping log to disk */
-
-#define GFS_DUMPS_PER_LOG       (4)    /* 1/4 of on-disk journal size*/
-
-/*  Lock numbers of the LM_TYPE_NONDISK type.  These protect certain
- *  cluster-wide operations (rather than on-disk entities).
- *  Currently, the LIVE lock is not used for any real purpose.  */
-
-#define GFS_MOUNT_LOCK          (0)    /* only one node can Mount at a time */
-#define GFS_LIVE_LOCK           (1)    /* shared by all mounted nodes */
-#define GFS_TRANS_LOCK          (2)    /* Transaction, protects jrnl recovery */
-#define GFS_RENAME_LOCK         (3)    /* only one node can Rename at a time */
-
-/*  On-disk format (version) numbers for various metadata types,
- *  used in gfs_meta_header  */
-
-#define GFS_FORMAT_SB           (100)  /* Super-Block */
-#define GFS_FORMAT_RG           (200)  /* Resource Group Header */
-#define GFS_FORMAT_RB           (300)  /* Resource Group Block Alloc BitBlock */
-#define GFS_FORMAT_DI           (400)  /* "Disk" inode (dinode) */
-#define GFS_FORMAT_IN           (500)  /* Indirect dinode block list */
-#define GFS_FORMAT_LF           (600)  /* Leaf dinode block list */
-#define GFS_FORMAT_JD           (700)  /* Journal Data */
-#define GFS_FORMAT_LH           (800)  /* Log Header */
-#define GFS_FORMAT_LD           (900)  /* Log Descriptor */
-/*  These don't have actual struct gfs_meta_header structures to go with them */
-#define GFS_FORMAT_JI           (1000) /* Journal Index */
-#define GFS_FORMAT_RI           (1100) /* Resource Group Index */
-#define GFS_FORMAT_DE           (1200) /* Directory Entry */
-#define GFS_FORMAT_QU           (1500) /* Quota */
-#define GFS_FORMAT_EA           (1600) /* Extended Attribute */
-#define GFS_FORMAT_ED           (1700) /* Extended Attribute data */
-/*  These version #s are embedded in the superblock  */
-#define GFS_FORMAT_FS           (1309) /* Filesystem (all-encompassing) */
-#define GFS_FORMAT_MULTI        (1401) /* Multi-Host */
-
-/*
- *  An on-disk inode number
- *  Initially, the on-disk block address of the inode block is assigned as the
- *  formal (permanent) ID as well.  Block address can change (to move inode
- *  on-disk), but formal ID must stay unchanged once assigned.
- */
-
-#define gfs_inum_equal(ino1, ino2) \
-(((ino1)->no_formal_ino == (ino2)->no_formal_ino) && \
- ((ino1)->no_addr == (ino2)->no_addr))
-
-struct gfs_inum {
-	uint64_t no_formal_ino;        /* inode identifier */
-	uint64_t no_addr;              /* block # of dinode block */
-};
-
-/*
- *  Generic metadata head structure
- *
- *  Every inplace buffer logged in the journal must start
- *  with a struct gfs_meta_header.
- *
- *  In addition to telling what kind of metadata is in the block,
- *  the metaheader contains the important generation and incarnation
- *  numbers.
- *
- *  The generation number is used during journal recovery to determine
- *  whether an in-place block on-disk is older than an on-disk journaled copy
- *  of the block.  If so, GFS overwrites the in-place block with the journaled
- *  version of the block.
- *
- *  A meta block's generation number must increment monotonically across the
- *  cluster, each time new contents are committed to the block.  This means
- *  that whenever GFS allocates a pre-existing metadata block, GFS must read
- *  that block from disk (in case another node has incremented it).  It also
- *  means that GFS must sync the block (with incremented generation number)
- *  to disk (both log and in-place blocks), not only after changing contents
- *  of the block, but also after de-allocating the block (GFS can't just throw
- *  away incore metadata for a file that it's just erased).
- *
- *  The incarnation number is used only for on-disk (d)inodes.  GFS increments
- *  it each time it de-allocates a dinode block (i.e. each time the dinode
- *  loses its identity with a particular file, directory, etc.).  When the
- *  dinode is later allocated (i.e. to be identified with a new file, etc.),
- *  GFS copies the incarnation number into the VFS inode's i_generation member.
- *  If GFS is used as the backing store for an NFS server, GFS uses this
- *  i_generation number as part of the NFS filehandle, which differentiates
- *  it from the previous identity of the dinode, and helps protect against
- *  filesystem corruption that could happen with the use of outdated,
- *  invalid, or malicious filehandles.  See ops_export.c.
- *
- *  GFS caches de-allocated meta-headers, to minimize disk reads.
- *  See struct gfs_meta_header_cache.
- */
-
-#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 */
-
-#define GFS_META_CLUMP          (64)   /* # blocks to convert fm data to meta */
-
-struct gfs_meta_header {
-	uint32_t mh_magic;      /* GFS_MAGIC sanity check magic number */
-	uint32_t mh_type;       /* GFS_METATYPE_XX type of metadata block */
-	uint64_t mh_generation; /* increment before writing to journal */
-	uint32_t mh_format;     /* GFS_FORMAT_XX (version # for this type) */
-	uint32_t mh_incarn;     /* increment when marking dinode "unused" */
-};
-
-/*
- *  super-block structure
- *
- *  One of these is at beginning of filesystem.
- *  It's probably good if SIZEOF_SB <= GFS_BASIC_BLOCK (512 bytes)
- */
-
-/*  Address of SuperBlock in GFS basic blocks.  1st 64K of filesystem is empty
-    for safety against getting clobbered by wayward volume managers, etc.
-    64k was chosen because it's the largest GFS-supported fs block size.  */
-#define GFS_SB_ADDR             (128)
-
-/*  The lock number for the superblock (must be zero)  */
-#define GFS_SB_LOCK             (0)
-#define GFS_CRAP_LOCK           (1)
-
-/*  Requirement:  GFS_LOCKNAME_LEN % 8 == 0
-    Includes: the fencing zero at the end  */
-#define GFS_LOCKNAME_LEN        (64)
-
-struct gfs_sb {
-	/*  Order is important; need to be able to read old superblocks
-	    in order to support on-disk version upgrades */
-	struct gfs_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 gfs_inum sb_jindex_di;  /* journal index inode */
-	struct gfs_inum sb_rindex_di;  /* resource group index inode */
-	struct gfs_inum sb_root_di;    /* root directory inode */
-
-	/* Default inter-node locking protocol (lock module) and namespace */
-	char sb_lockproto[GFS_LOCKNAME_LEN]; /* lock protocol name */
-	char sb_locktable[GFS_LOCKNAME_LEN]; /* unique name for this FS */
-
-	/* More special inodes */
-	struct gfs_inum sb_quota_di;   /* quota inode */
-	struct gfs_inum sb_license_di; /* license inode */
-
-	char sb_reserved[96];
-};
-
-/*
- *  journal index structure 
- *
- *  One for each journal used by the filesystem.
- *  These descriptors are packed contiguously within the jindex inode (file).
- */
-
-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];
-};
-
-/*
- *  resource index structure 
- *
- *  One of these for each resource group in the filesystem.
- *  These descriptors are packed contiguously within the rindex inode (file).
- *  Also see struct gfs_rgrp.
- */
-
-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];
-};
-
-/*
- *  resource group header structure
- *
- *  One of these at beginning of the first block of an rgrp,
- *     followed by block alloc bitmap data in remainder of first block.
- *  Each resource group contains:
- *    Header block, including block allocation statistics (struct gfs_rgrp)
- *       and first part of block alloc bitmap.
- *    Bitmap block(s), continuing block alloc bitmap started in header block.
- *    Data/meta blocks, allocatable blocks containing file data and metadata.
- *  
- *  In older versions, now-unused (but previously allocated) dinodes were
- *  saved for re-use in an on-disk linked list (chain).  This is no longer
- *  done, but support still exists for reclaiming dinodes from this list,
- *  to support upgrades from older on-disk formats.
- */
-
-/* Each data block within rgrp is represented by 2 bits in the alloc bitmap */
-#define GFS_NBBY                (4)  /* # blocks represented by 1 bitmap byte */
-#define GFS_BIT_SIZE            (2)
-#define GFS_BIT_MASK            (0x00000003)
-
-/*
- * 4 possible block allocation states:
- *   bit 0 = alloc(1)/free(0)
- *   bit 1 = metadata(1)/data(0)
- */
-#define GFS_BLKST_FREE          (0)
-#define GFS_BLKST_USED          (1)
-#define GFS_BLKST_FREEMETA      (2)
-#define GFS_BLKST_USEDMETA      (3)
-
-struct gfs_rgrp {
-	struct gfs_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 gfs_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];
-};
-
-/*
- *  quota structure
- */
-
-struct gfs_quota {
-	uint64_t qu_limit;
-	uint64_t qu_warn;
-	int64_t qu_value;
-
-	char qu_reserved[64];
-};
-
-/*
- *  dinode (disk inode) structure
- *  The ondisk representation of inodes
- *  One for each file, directory, etc.
- *  GFS does not put more than one inode in a single block.
- *  The inode may be "stuffed", carrying file data along with metadata,
- *    if the file data is small enough.
- *  Otherwise, the inode block contains pointers to other blocks that contain
- *    either file data or other pointers to other blocks (indirect addressing
- *    via a metadata tree).
- */
-
-#define GFS_MAX_META_HEIGHT     (10)
-#define GFS_DIR_MAX_DEPTH       (17)
-
-/*  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 */
-
-/*  Dinode flags  */
-#define GFS_DIF_JDATA             (0x00000001) /* jrnl all data for this file */
-#define GFS_DIF_EXHASH            (0x00000002) /* hashed directory (leaves) */
-#define GFS_DIF_UNUSED            (0x00000004) /* unused dinode */
-#define GFS_DIF_EA_INDIRECT       (0x00000008) /* extended attribute, indirect*/
-#define GFS_DIF_DIRECTIO          (0x00000010)
-#define GFS_DIF_IMMUTABLE         (0x00000020) /* Can't change file */
-#define GFS_DIF_APPENDONLY        (0x00000040) /* Can only add to end of file */
-#define GFS_DIF_NOATIME           (0x00000080) /* Don't update access time
-						  (currently unused/ignored) */
-#define GFS_DIF_SYNC              (0x00000100) /* Flush to disk, don't cache
-						  (currently unused/ignored) */
-#define GFS_DIF_INHERIT_DIRECTIO  (0x40000000) /* new files get DIRECTIO flag */
-#define GFS_DIF_INHERIT_JDATA     (0x80000000) /* new files get JDATA flag */
-
-struct gfs_dinode {
-	struct gfs_meta_header di_header;
-
-	struct gfs_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 gfs_inum di_next_unused;  /* used in old versions only */
-
-	uint64_t di_eattr;	/* extended attribute block number */
-
-	char di_reserved[56];
-};
-
-/*
- *  indirect block header
- *
- *  A component of a dinode's indirect addressing metadata tree.
- *  These are pointed to by pointers in dinodes or other indirect blocks.
- */
-
-struct gfs_indirect {
-	struct gfs_meta_header in_header;
-
-	char in_reserved[64];
-};
-
-/*
- *  directory structure - many of these per directory file
- *
- * See comments at beginning of dir.c
- */
-
-#define GFS_FNAMESIZE               (255)
-#define GFS_DIRENT_SIZE(name_len) ((sizeof(struct gfs_dirent) + (name_len) + 7) & ~7)
-#define IS_LEAF     (1) /* Hashed (leaf) directory */
-#define IS_DINODE   (2) /* Linear (stuffed dinode block) directory */
-
-struct gfs_dirent {
-	struct gfs_inum de_inum;    /* formal inode number and block address */
-	uint32_t de_hash;           /* hash of the filename */
-	uint16_t de_rec_len;        /* the length of the dirent */
-	uint16_t de_name_len;       /* the length of the name */
-	uint16_t de_type;           /* GFS_FILE_... type of dinode this points to */
-
-	char de_reserved[14];
-};
-
-/*
- *  Header of leaf directory nodes
- *
- * See comments at beginning of dir.c
- */
-
-struct gfs_leaf {
-	struct gfs_meta_header lf_header;
-
-	uint16_t lf_depth;          /* Depth of leaf */
-	uint16_t lf_entries;        /* Number of dirents in leaf */
-	uint32_t lf_dirent_format;  /* GFS_FORMAT_DE (version #) */
-	uint64_t lf_next;           /* Next leaf, if overflow */
-
-	char lf_reserved[64];
-};
-
-/*
- *  Log header structure
- *
- *  Two of these are in the first block of a transaction log:
- *    1)  at beginning of block
- *    2)  at end of first 512-byte sector within block
- */
-
-#define GFS_LOG_HEAD_UNMOUNT    (0x00000001)  /* log is clean, can unmount fs */
-
-struct gfs_log_header {
-	struct gfs_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];
-};
-
-/*
- *  Log type descriptor
- *
- *  One of these for each chunk in a transaction
- */
-
-#define GFS_LOG_DESC_METADATA   (300)    /* metadata */
-/*  ld_data1 is the number (quantity) of metadata blocks in the descriptor.
-    ld_data2 is unused.
-    */
-
-#define GFS_LOG_DESC_IUL        (400)    /* unlinked inode */
-/*  ld_data1 is TRUE if this is a dump.
-    ld_data2 is unused.
-    FixMe!!!  ld_data1 should be the number (quantity) of entries.
-              ld_data2 should be "TRUE if this is a dump".
-    */
-
-#define GFS_LOG_DESC_IDA        (401)    /* de-allocated inode */
-/*  ld_data1 is unused.
-    ld_data2 is unused.
-    FixMe!!!  ld_data1 should be the number (quantity) of entries.
-    */
-
-#define GFS_LOG_DESC_Q          (402)    /* quota */
-/*  ld_data1 is the number of quota changes in the descriptor.
-    ld_data2 is TRUE if this is a dump.
-    */
-
-#define GFS_LOG_DESC_LAST       (500)    /* final in a logged transaction */
-/*  ld_data1 is unused.
-    ld_data2 is unused.
-    */
-
-struct gfs_log_descriptor {
-	struct gfs_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];
-};
-
-/*
- *  Metadata block tags
- *
- *  One for each logged block.  Tells where block really belongs on-disk.
- *  These descriptor tags are packed contiguously after a gfs_log_descriptor.
- */
-
-struct gfs_block_tag {
-	uint64_t bt_blkno;	/* inplace block number */
-	uint32_t bt_flags;	/* ?? */
-	uint32_t bt_pad;
-};
-
-/*
- *  Quota Journal Tag
- */
-
-#define GFS_QTF_USER            (0x00000001)
-
-struct gfs_quota_tag {
-	int64_t qt_change;
-	uint32_t qt_flags;      /* GFS_QTF_... */
-	uint32_t qt_id;
-};
-
-/*
- *  Extended attribute header format
- */
-
-#define GFS_EA_MAX_NAME_LEN     (255)
-#define GFS_EA_MAX_DATA_LEN     (65536)
-
-#define GFS_EATYPE_UNUSED       (0)
-#define GFS_EATYPE_USR          (1)     /* user attribute */
-#define GFS_EATYPE_SYS          (2)     /* system attribute */
-#define GFS_EATYPE_SECURITY	(3)	/* security attribute */
-
-#define GFS_EATYPE_LAST         (3)
-#define GFS_EATYPE_VALID(x)     ((x) <= GFS_EATYPE_LAST)
-
-#define GFS_EAFLAG_LAST         (0x01)	/* last ea in block */
-
-struct gfs_ea_header {
-	uint32_t ea_rec_len;    /* total record length: hdr + name + data */
-	uint32_t ea_data_len;   /* data length, in bytes */
-	uint8_t ea_name_len;    /* no NULL pointer after the string */
-	uint8_t ea_type;        /* GFS_EATYPE_... */
-	uint8_t ea_flags;       /* GFS_EAFLAG_... */
-	uint8_t ea_num_ptrs;    /* # fs blocks needed for EA */
-	uint32_t ea_pad;
-};
-
-/*
- * Statfs change
- * Describes an change to the pool of free and allocated
- * blocks.
- */
-
-struct gfs_statfs_change {
-	uint64_t sc_total;
-	uint64_t sc_free;
-	uint64_t sc_dinodes;
-};
-
-struct gfs_statfs_change_host {
-	int64_t sc_total;
-	int64_t sc_free;
-	int64_t sc_dinodes;
-};
-
-/*  Endian functions  */
-
-#define GFS_ENDIAN_BIG
-
-#ifdef GFS_ENDIAN_BIG
-
-#define gfs16_to_cpu be16_to_cpu
-#define gfs32_to_cpu be32_to_cpu
-#define gfs64_to_cpu be64_to_cpu
-
-#define cpu_to_gfs16 cpu_to_be16
-#define cpu_to_gfs32 cpu_to_be32
-#define cpu_to_gfs64 cpu_to_be64
-
-#else				/*  GFS_ENDIAN_BIG  */
-
-#define gfs16_to_cpu le16_to_cpu
-#define gfs32_to_cpu le32_to_cpu
-#define gfs64_to_cpu le64_to_cpu
-
-#define cpu_to_gfs16 cpu_to_le16
-#define cpu_to_gfs32 cpu_to_le32
-#define cpu_to_gfs64 cpu_to_le64
-
-#endif				/*  GFS_ENDIAN_BIG  */
-
-/*  Translation functions  */
-
-void gfs_inum_in(struct gfs_inum *no, char *buf);
-void gfs_inum_out(struct gfs_inum *no, char *buf);
-void gfs_meta_header_in(struct gfs_meta_header *mh, char *buf);
-void gfs_meta_header_out(struct gfs_meta_header *mh, char *buf);
-void gfs_sb_in(struct gfs_sb *sb, char *buf);
-void gfs_sb_out(struct gfs_sb *sb, char *buf);
-void gfs_jindex_in(struct gfs_jindex *jindex, char *buf);
-void gfs_jindex_out(struct gfs_jindex *jindex, char *buf);
-void gfs_rindex_in(struct gfs_rindex *rindex, char *buf);
-void gfs_rindex_out(struct gfs_rindex *rindex, char *buf);
-void gfs_rgrp_in(struct gfs_rgrp *rgrp, char *buf);
-void gfs_rgrp_out(struct gfs_rgrp *rgrp, char *buf);
-void gfs_quota_in(struct gfs_quota *quota, char *buf);
-void gfs_quota_out(struct gfs_quota *quota, char *buf);
-void gfs_dinode_in(struct gfs_dinode *dinode, char *buf);
-void gfs_dinode_out(struct gfs_dinode *dinode, char *buf);
-void gfs_indirect_in(struct gfs_indirect *indirect, char *buf);
-void gfs_indirect_out(struct gfs_indirect *indirect, char *buf);
-void gfs_dirent_in(struct gfs_dirent *dirent, char *buf);
-void gfs_dirent_out(struct gfs_dirent *dirent, char *buf);
-void gfs_leaf_in(struct gfs_leaf *leaf, char *buf);
-void gfs_leaf_out(struct gfs_leaf *leaf, char *buf);
-void gfs_log_header_in(struct gfs_log_header *head, char *buf);
-void gfs_log_header_out(struct gfs_log_header *head, char *buf);
-void gfs_desc_in(struct gfs_log_descriptor *desc, char *buf);
-void gfs_desc_out(struct gfs_log_descriptor *desc, char *buf);
-void gfs_block_tag_in(struct gfs_block_tag *btag, char *buf);
-void gfs_block_tag_out(struct gfs_block_tag *btag, char *buf);
-void gfs_quota_tag_in(struct gfs_quota_tag *qtag, char *buf);
-void gfs_quota_tag_out(struct gfs_quota_tag *qtag, char *buf);
-void gfs_ea_header_in(struct gfs_ea_header *qtag, char *buf);
-void gfs_ea_header_out(struct gfs_ea_header *qtag, char *buf);
-
-/*  Printing functions  */
-
-void gfs_inum_print(struct gfs_inum *no);
-void gfs_meta_header_print(struct gfs_meta_header *mh);
-void gfs_sb_print(struct gfs_sb *sb);
-void gfs_jindex_print(struct gfs_jindex *jindex);
-void gfs_rindex_print(struct gfs_rindex *rindex);
-void gfs_rgrp_print(struct gfs_rgrp *rgrp);
-void gfs_quota_print(struct gfs_quota *quota);
-void gfs_dinode_print(struct gfs_dinode *dinode);
-void gfs_indirect_print(struct gfs_indirect *indirect);
-void gfs_dirent_print(struct gfs_dirent *dirent, char *name);
-void gfs_leaf_print(struct gfs_leaf *leaf);
-void gfs_log_header_print(struct gfs_log_header *head);
-void gfs_desc_print(struct gfs_log_descriptor *desc);
-void gfs_block_tag_print(struct gfs_block_tag *tag);
-void gfs_quota_tag_print(struct gfs_quota_tag *tag);
-void gfs_ea_header_print(struct gfs_ea_header *ea, char *name);
-
-/*  The hash function for ExHash directories  */
-
-uint32_t gfs_dir_hash(const char *data, int len);
-
-#endif /* __GFS_ONDISK_DOT_H__ */
-
-
-
-#ifdef WANT_GFS_CONVERSION_FUNCTIONS
-
-#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) = gfs16_to_cpu((s2->member));}
-#define CPOUT_16(s1, s2, member) {(s2->member) = cpu_to_gfs16((s1->member));}
-#define CPIN_32(s1, s2, member) {(s1->member) = gfs32_to_cpu((s2->member));}
-#define CPOUT_32(s1, s2, member) {(s2->member) = cpu_to_gfs32((s1->member));}
-#define CPIN_64(s1, s2, member) {(s1->member) = gfs64_to_cpu((s2->member));}
-#define CPOUT_64(s1, s2, member) {(s2->member) = cpu_to_gfs64((s1->member));}
-
-#define pa(struct, member, count) print_array(#member, struct->member, count);
-
-/**
- * print_array - Print out an array of bytes
- * @title: what to print before the array
- * @buf: the array
- * @count: the number of bytes
- *
- */
-
-static void
-print_array(char *title, char *buf, int count)
-{
-	int x;
-
-	printk("  %s =\n", title);
-	for (x = 0; x < count; x++) {
-		printk("%.2X ", (unsigned char)buf[x]);
-		if (x % 16 == 15)
-			printk("\n");
-	}
-	if (x % 16)
-		printk("\n");
-}
-
-/**
- * gfs_inum_in - Read in an inode number
- * @no: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_inum_in(struct gfs_inum *no, char *buf)
-{
-	struct gfs_inum *str = (struct gfs_inum *)buf;
-
-	CPIN_64(no, str, no_formal_ino);
-	CPIN_64(no, str, no_addr);
-}
-
-/**
- * gfs_inum_out - Write out an inode number
- * @no: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_inum_out(struct gfs_inum *no, char *buf)
-{
-	struct gfs_inum *str = (struct gfs_inum *)buf;
-
-	CPOUT_64(no, str, no_formal_ino);
-	CPOUT_64(no, str, no_addr);
-}
-
-/**
- * gfs_inum_print - Print out a inode number
- * @no: the cpu-order buffer
- *
- */
-
-void
-gfs_inum_print(struct gfs_inum *no)
-{
-	pv(no, no_formal_ino, "%"PRIu64);
-	pv(no, no_addr, "%"PRIu64);
-}
-
-/**
- * gfs_meta_header_in - Read in a metadata header
- * @mh: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_meta_header_in(struct gfs_meta_header *mh, char *buf)
-{
-	struct gfs_meta_header *str = (struct gfs_meta_header *)buf;
-
-	CPIN_32(mh, str, mh_magic);
-	CPIN_32(mh, str, mh_type);
-	CPIN_64(mh, str, mh_generation);
-	CPIN_32(mh, str, mh_format);
-	CPIN_32(mh, str, mh_incarn);
-}
-
-/**
- * gfs_meta_header_in - Write out a metadata header
- * @mh: the cpu-order structure
- * @buf: the disk-order buffer
- *
- * Don't ever change the generation number in this routine.
- * It's done manually in increment_generation().
- */
-
-void
-gfs_meta_header_out(struct gfs_meta_header *mh, char *buf)
-{
-	struct gfs_meta_header *str = (struct gfs_meta_header *)buf;
-
-	CPOUT_32(mh, str, mh_magic);
-	CPOUT_32(mh, str, mh_type);
-#if 0
-	/* Don't do this!
-	   Mh_generation should only be change manually. */
-	CPOUT_64(mh, str, mh_generation);
-#endif
-	CPOUT_32(mh, str, mh_format);
-	CPOUT_32(mh, str, mh_incarn);
-}
-
-/**
- * gfs_meta_header_print - Print out a metadata header
- * @mh: the cpu-order buffer
- *
- */
-
-void
-gfs_meta_header_print(struct gfs_meta_header *mh)
-{
-	pv(mh, mh_magic, "0x%.8X");
-	pv(mh, mh_type, "%u");
-	pv(mh, mh_generation, "%"PRIu64);
-	pv(mh, mh_format, "%u");
-	pv(mh, mh_incarn, "%u");
-}
-
-/**
- * gfs_sb_in - Read in a superblock
- * @sb: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_sb_in(struct gfs_sb *sb, char *buf)
-{
-	struct gfs_sb *str = (struct gfs_sb *)buf;
-
-	gfs_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_flags);
-
-	CPIN_32(sb, str, sb_bsize);
-	CPIN_32(sb, str, sb_bsize_shift);
-	CPIN_32(sb, str, sb_seg_size);
-
-	gfs_inum_in(&sb->sb_jindex_di, (char *)&str->sb_jindex_di);
-	gfs_inum_in(&sb->sb_rindex_di, (char *)&str->sb_rindex_di);
-	gfs_inum_in(&sb->sb_root_di, (char *)&str->sb_root_di);
-
-	CPIN_08(sb, str, sb_lockproto, GFS_LOCKNAME_LEN);
-	CPIN_08(sb, str, sb_locktable, GFS_LOCKNAME_LEN);
-
-	gfs_inum_in(&sb->sb_quota_di, (char *)&str->sb_quota_di);
-	gfs_inum_in(&sb->sb_license_di, (char *)&str->sb_license_di);
-
-	CPIN_08(sb, str, sb_reserved, 96);
-}
-
-/**
- * gfs_sb_out - Write out a superblock
- * @sb: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_sb_out(struct gfs_sb *sb, char *buf)
-{
-	struct gfs_sb *str = (struct gfs_sb *)buf;
-
-	gfs_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_flags);
-
-	CPOUT_32(sb, str, sb_bsize);
-	CPOUT_32(sb, str, sb_bsize_shift);
-	CPOUT_32(sb, str, sb_seg_size);
-
-	gfs_inum_out(&sb->sb_jindex_di, (char *)&str->sb_jindex_di);
-	gfs_inum_out(&sb->sb_rindex_di, (char *)&str->sb_rindex_di);
-	gfs_inum_out(&sb->sb_root_di, (char *)&str->sb_root_di);
-
-	CPOUT_08(sb, str, sb_lockproto, GFS_LOCKNAME_LEN);
-	CPOUT_08(sb, str, sb_locktable, GFS_LOCKNAME_LEN);
-
-	gfs_inum_out(&sb->sb_quota_di, (char *)&str->sb_quota_di);
-	gfs_inum_out(&sb->sb_license_di, (char *)&str->sb_license_di);
-
-	CPOUT_08(sb, str, sb_reserved, 96);
-}
-
-/**
- * gfs_sb_print - Print out a superblock
- * @sb: the cpu-order buffer
- *
- */
-
-void
-gfs_sb_print(struct gfs_sb *sb)
-{
-	gfs_meta_header_print(&sb->sb_header);
-
-	pv(sb, sb_fs_format, "%u");
-	pv(sb, sb_multihost_format, "%u");
-	pv(sb, sb_flags, "%u");
-
-	pv(sb, sb_bsize, "%u");
-	pv(sb, sb_bsize_shift, "%u");
-	pv(sb, sb_seg_size, "%u");
-
-	gfs_inum_print(&sb->sb_jindex_di);
-	gfs_inum_print(&sb->sb_rindex_di);
-	gfs_inum_print(&sb->sb_root_di);
-
-	pv(sb, sb_lockproto, "%s");
-	pv(sb, sb_locktable, "%s");
-
-	gfs_inum_print(&sb->sb_quota_di);
-	gfs_inum_print(&sb->sb_license_di);
-
-	pa(sb, sb_reserved, 96);
-}
-
-/**
- * gfs_jindex_in - Read in a journal index structure
- * @jindex: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_jindex_in(struct gfs_jindex *jindex, char *buf)
-{
-	struct gfs_jindex *str = (struct gfs_jindex *)buf;
-
-	CPIN_64(jindex, str, ji_addr);
-	CPIN_32(jindex, str, ji_nsegment);
-	CPIN_32(jindex, str, ji_pad);
-
-	CPIN_08(jindex, str, ji_reserved, 64);
-}
-
-/**
- * gfs_jindex_out - Write out a journal index structure
- * @jindex: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_jindex_out(struct gfs_jindex *jindex, char *buf)
-{
-	struct gfs_jindex *str = (struct gfs_jindex *)buf;
-
-	CPOUT_64(jindex, str, ji_addr);
-	CPOUT_32(jindex, str, ji_nsegment);
-	CPOUT_32(jindex, str, ji_pad);
-
-	CPOUT_08(jindex, str, ji_reserved, 64);
-}
-
-/**
- * gfs_jindex_print - Print out a journal index structure
- * @ji: the cpu-order buffer
- *
- */
-
-void
-gfs_jindex_print(struct gfs_jindex *ji)
-{
-	pv(ji, ji_addr, "%"PRIu64);
-	pv(ji, ji_nsegment, "%u");
-	pv(ji, ji_pad, "%u");
-
-	pa(ji, ji_reserved, 64);
-}
-
-/**
- * gfs_rindex_in - Read in a resource index structure
- * @rindex: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_rindex_in(struct gfs_rindex *rindex, char *buf)
-{
-	struct gfs_rindex *str = (struct gfs_rindex *)buf;
-
-	CPIN_64(rindex, str, ri_addr);
-	CPIN_32(rindex, str, ri_length);
-	CPIN_32(rindex, str, ri_pad);
-
-	CPIN_64(rindex, str, ri_data1);
-	CPIN_32(rindex, str, ri_data);
-
-	CPIN_32(rindex, str, ri_bitbytes);
-
-	CPIN_08(rindex, str, ri_reserved, 64);
-}
-
-/**
- * gfs_rindex_out - Write out a resource index structure
- * @rindex: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_rindex_out(struct gfs_rindex *rindex, char *buf)
-{
-	struct gfs_rindex *str = (struct gfs_rindex *)buf;
-
-	CPOUT_64(rindex, str, ri_addr);
-	CPOUT_32(rindex, str, ri_length);
-	CPOUT_32(rindex, str, ri_pad);
-
-	CPOUT_64(rindex, str, ri_data1);
-	CPOUT_32(rindex, str, ri_data);
-
-	CPOUT_32(rindex, str, ri_bitbytes);
-
-	CPOUT_08(rindex, str, ri_reserved, 64);
-}
-
-/**
- * gfs_rindex_print - Print out a resource index structure
- * @ri: the cpu-order buffer
- *
- */
-
-void
-gfs_rindex_print(struct gfs_rindex *ri)
-{
-	pv(ri, ri_addr, "%"PRIu64);
-	pv(ri, ri_length, "%u");
-	pv(ri, ri_pad, "%u");
-
-	pv(ri, ri_data1, "%"PRIu64);
-	pv(ri, ri_data, "%u");
-
-	pv(ri, ri_bitbytes, "%u");
-
-	pa(ri, ri_reserved, 64);
-}
-
-/**
- * gfs_rgrp_in - Read in a resource group header
- * @rgrp: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_rgrp_in(struct gfs_rgrp *rgrp, char *buf)
-{
-	struct gfs_rgrp *str = (struct gfs_rgrp *)buf;
-
-	gfs_meta_header_in(&rgrp->rg_header, buf);
-
-	CPIN_32(rgrp, str, rg_flags);
-
-	CPIN_32(rgrp, str, rg_free);
-
-	CPIN_32(rgrp, str, rg_useddi);
-	CPIN_32(rgrp, str, rg_freedi);
-	gfs_inum_in(&rgrp->rg_freedi_list, (char *)&str->rg_freedi_list);
-
-	CPIN_32(rgrp, str, rg_usedmeta);
-	CPIN_32(rgrp, str, rg_freemeta);
-
-	CPIN_08(rgrp, str, rg_reserved, 64);
-}
-
-/**
- * gfs_rgrp_out - Write out a resource group header
- * @rgrp: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_rgrp_out(struct gfs_rgrp *rgrp, char *buf)
-{
-	struct gfs_rgrp *str = (struct gfs_rgrp *)buf;
-
-	gfs_meta_header_out(&rgrp->rg_header, buf);
-
-	CPOUT_32(rgrp, str, rg_flags);
-
-	CPOUT_32(rgrp, str, rg_free);
-
-	CPOUT_32(rgrp, str, rg_useddi);
-	CPOUT_32(rgrp, str, rg_freedi);
-	gfs_inum_out(&rgrp->rg_freedi_list, (char *)&str->rg_freedi_list);
-
-	CPOUT_32(rgrp, str, rg_usedmeta);
-	CPOUT_32(rgrp, str, rg_freemeta);
-
-	CPOUT_08(rgrp, str, rg_reserved, 64);
-}
-
-/**
- * gfs_rgrp_print - Print out a resource group header
- * @rg: the cpu-order buffer
- *
- */
-
-void
-gfs_rgrp_print(struct gfs_rgrp *rg)
-{
-	gfs_meta_header_print(&rg->rg_header);
-
-	pv(rg, rg_flags, "%u");
-
-	pv(rg, rg_free, "%u");
-
-	pv(rg, rg_useddi, "%u");
-	pv(rg, rg_freedi, "%u");
-	gfs_inum_print(&rg->rg_freedi_list);
-
-	pv(rg, rg_usedmeta, "%u");
-	pv(rg, rg_freemeta, "%u");
-
-	pa(rg, rg_reserved, 64);
-}
-
-/**
- * gfs_quota_in - Read in a quota structures
- * @quota: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_quota_in(struct gfs_quota *quota, char *buf)
-{
-	struct gfs_quota *str = (struct gfs_quota *)buf;
-
-	CPIN_64(quota, str, qu_limit);
-	CPIN_64(quota, str, qu_warn);
-	CPIN_64(quota, str, qu_value);
-
-	CPIN_08(quota, str, qu_reserved, 64);
-}
-
-/**
- * gfs_quota_out - Write out a quota structure
- * @quota: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_quota_out(struct gfs_quota *quota, char *buf)
-{
-	struct gfs_quota *str = (struct gfs_quota *)buf;
-
-	CPOUT_64(quota, str, qu_limit);
-	CPOUT_64(quota, str, qu_warn);
-	CPOUT_64(quota, str, qu_value);
-
-	CPOUT_08(quota, str, qu_reserved, 64);
-}
-
-/**
- * gfs_quota_print - Print out a quota structure
- * @quota: the cpu-order buffer
- *
- */
-
-void
-gfs_quota_print(struct gfs_quota *quota)
-{
-	pv(quota, qu_limit, "%"PRIu64);
-	pv(quota, qu_warn, "%"PRIu64);
-	pv(quota, qu_value, "%"PRId64);
-
-	pa(quota, qu_reserved, 64);
-}
-
-/**
- * gfs_dinode_in - Read in a dinode
- * @dinode: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_dinode_in(struct gfs_dinode *dinode, char *buf)
-{
-	struct gfs_dinode *str = (struct gfs_dinode *)buf;
-
-	gfs_meta_header_in(&dinode->di_header, buf);
-
-	gfs_inum_in(&dinode->di_num, (char *)&str->di_num);
-
-	CPIN_32(dinode, str, di_mode);
-	CPIN_32(dinode, str, di_uid);
-	CPIN_32(dinode, str, di_gid);
-	CPIN_32(dinode, str, di_nlink);
-	CPIN_64(dinode, str, di_size);
-	CPIN_64(dinode, str, di_blocks);
-	CPIN_64(dinode, str, di_atime);
-	CPIN_64(dinode, str, di_mtime);
-	CPIN_64(dinode, str, di_ctime);
-	CPIN_32(dinode, str, di_major);
-	CPIN_32(dinode, str, di_minor);
-
-	CPIN_64(dinode, str, di_rgrp);
-	CPIN_64(dinode, str, di_goal_rgrp);
-	CPIN_32(dinode, str, di_goal_dblk);
-	CPIN_32(dinode, str, di_goal_mblk);
-	CPIN_32(dinode, str, di_flags);
-	CPIN_32(dinode, str, di_payload_format);
-	CPIN_16(dinode, str, di_type);
-	CPIN_16(dinode, str, di_height);
-	CPIN_32(dinode, str, di_incarn);
-	CPIN_16(dinode, str, di_pad);
-
-	CPIN_16(dinode, str, di_depth);
-	CPIN_32(dinode, str, di_entries);
-
-	gfs_inum_in(&dinode->di_next_unused, (char *)&str->di_next_unused);
-
-	CPIN_64(dinode, str, di_eattr);
-
-	CPIN_08(dinode, str, di_reserved, 56);
-}
-
-/**
- * gfs_dinode_out - Write out a dinode
- * @dinode: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_dinode_out(struct gfs_dinode *dinode, char *buf)
-{
-	struct gfs_dinode *str = (struct gfs_dinode *)buf;
-
-	gfs_meta_header_out(&dinode->di_header, buf);
-
-	gfs_inum_out(&dinode->di_num, (char *)&str->di_num);
-
-	CPOUT_32(dinode, str, di_mode);
-	CPOUT_32(dinode, str, di_uid);
-	CPOUT_32(dinode, str, di_gid);
-	CPOUT_32(dinode, str, di_nlink);
-	CPOUT_64(dinode, str, di_size);
-	CPOUT_64(dinode, str, di_blocks);
-	CPOUT_64(dinode, str, di_atime);
-	CPOUT_64(dinode, str, di_mtime);
-	CPOUT_64(dinode, str, di_ctime);
-	CPOUT_32(dinode, str, di_major);
-	CPOUT_32(dinode, str, di_minor);
-
-	CPOUT_64(dinode, str, di_rgrp);
-	CPOUT_64(dinode, str, di_goal_rgrp);
-	CPOUT_32(dinode, str, di_goal_dblk);
-	CPOUT_32(dinode, str, di_goal_mblk);
-	CPOUT_32(dinode, str, di_flags);
-	CPOUT_32(dinode, str, di_payload_format);
-	CPOUT_16(dinode, str, di_type);
-	CPOUT_16(dinode, str, di_height);
-	CPOUT_32(dinode, str, di_incarn);
-	CPOUT_16(dinode, str, di_pad);
-
-	CPOUT_16(dinode, str, di_depth);
-	CPOUT_32(dinode, str, di_entries);
-
-	gfs_inum_out(&dinode->di_next_unused, (char *)&str->di_next_unused);
-
-	CPOUT_64(dinode, str, di_eattr);
-
-	CPOUT_08(dinode, str, di_reserved, 56);
-}
-
-/**
- * gfs_dinode_print - Print out a dinode
- * @di: the cpu-order buffer
- *
- */
-
-void
-gfs_dinode_print(struct gfs_dinode *di)
-{
-	gfs_meta_header_print(&di->di_header);
-
-	gfs_inum_print(&di->di_num);
-
-	pv(di, di_mode, "0%o");
-	pv(di, di_uid, "%u");
-	pv(di, di_gid, "%u");
-	pv(di, di_nlink, "%u");
-	pv(di, di_size, "%"PRIu64);
-	pv(di, di_blocks, "%"PRIu64);
-	pv(di, di_atime, "%"PRId64);
-	pv(di, di_mtime, "%"PRId64);
-	pv(di, di_ctime, "%"PRId64);
-	pv(di, di_major, "%u");
-	pv(di, di_minor, "%u");
-
-	pv(di, di_rgrp, "%"PRIu64);
-	pv(di, di_goal_rgrp, "%"PRIu64);
-	pv(di, di_goal_dblk, "%u");
-	pv(di, di_goal_mblk, "%u");
-	pv(di, di_flags, "0x%.8X");
-	pv(di, di_payload_format, "%u");
-	pv(di, di_type, "%u");
-	pv(di, di_height, "%u");
-	pv(di, di_incarn, "%u");
-	pv(di, di_pad, "%u");
-
-	pv(di, di_depth, "%u");
-	pv(di, di_entries, "%u");
-
-	gfs_inum_print(&di->di_next_unused);
-
-	pv(di, di_eattr, "%"PRIu64);
-
-	pa(di, di_reserved, 56);
-}
-
-/**
- * gfs_indirect_in - copy in the header of an indirect block
- * @indirect: the in memory copy
- * @buf: the buffer copy
- *
- */
-
-void
-gfs_indirect_in(struct gfs_indirect *indirect, char *buf)
-{
-	struct gfs_indirect *str = (struct gfs_indirect *)buf;
-
-	gfs_meta_header_in(&indirect->in_header, buf);
-
-	CPIN_08(indirect, str, in_reserved, 64);
-}
-
-/**
- * gfs_indirect_out - copy out the header of an indirect block
- * @indirect: the in memory copy
- * @buf: the buffer copy
- *
- */
-
-void
-gfs_indirect_out(struct gfs_indirect *indirect, char *buf)
-{
-	struct gfs_indirect *str = (struct gfs_indirect *)buf;
-
-	gfs_meta_header_out(&indirect->in_header, buf);
-
-	CPOUT_08(indirect, str, in_reserved, 64);
-}
-
-/**
- * gfs_indirect_print - Print out a indirect block header
- * @indirect: the cpu-order buffer
- *
- */
-
-void
-gfs_indirect_print(struct gfs_indirect *indirect)
-{
-	gfs_meta_header_print(&indirect->in_header);
-
-	pa(indirect, in_reserved, 64);
-}
-
-/**
- * gfs_dirent_in - Read in a directory entry
- * @dirent: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_dirent_in(struct gfs_dirent *dirent, char *buf)
-{
-	struct gfs_dirent *str = (struct gfs_dirent *)buf;
-
-	gfs_inum_in(&dirent->de_inum, (char *)&str->de_inum);
-	CPIN_32(dirent, str, de_hash);
-	CPIN_16(dirent, str, de_rec_len);
-	CPIN_16(dirent, str, de_name_len);
-	CPIN_16(dirent, str, de_type);
-
-	CPIN_08(dirent, str, de_reserved, 14);
-}
-
-/**
- * gfs_dirent_out - Write out a directory entry
- * @dirent: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_dirent_out(struct gfs_dirent *dirent, char *buf)
-{
-	struct gfs_dirent *str = (struct gfs_dirent *)buf;
-
-	gfs_inum_out(&dirent->de_inum, (char *)&str->de_inum);
-	CPOUT_32(dirent, str, de_hash);
-	CPOUT_16(dirent, str, de_rec_len);
-	CPOUT_16(dirent, str, de_name_len);
-	CPOUT_16(dirent, str, de_type);
-
-	CPOUT_08(dirent, str, de_reserved, 14);
-}
-
-/**
- * gfs_dirent_print - Print out a directory entry
- * @de: the cpu-order buffer
- * @name: the filename
- *
- */
-
-void
-gfs_dirent_print(struct gfs_dirent *de, char *name)
-{
-	char buf[GFS_FNAMESIZE + 1];
-
-	gfs_inum_print(&de->de_inum);
-	pv(de, de_hash, "0x%.8X");
-	pv(de, de_rec_len, "%u");
-	pv(de, de_name_len, "%u");
-	pv(de, de_type, "%u");
-
-	pa(de, de_reserved, 14);
-
-	memset(buf, 0, GFS_FNAMESIZE + 1);
-	memcpy(buf, name, de->de_name_len);
-	printk("  name = %s\n", buf);
-}
-
-/**
- * gfs_leaf_in - Read in a directory leaf header
- * @leaf: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_leaf_in(struct gfs_leaf *leaf, char *buf)
-{
-	struct gfs_leaf *str = (struct gfs_leaf *)buf;
-
-	gfs_meta_header_in(&leaf->lf_header, buf);
-
-	CPIN_16(leaf, str, lf_depth);
-	CPIN_16(leaf, str, lf_entries);
-	CPIN_32(leaf, str, lf_dirent_format);
-	CPIN_64(leaf, str, lf_next);
-
-	CPIN_08(leaf, str, lf_reserved, 64);
-}
-
-/**
- * gfs_leaf_out - Write out a directory leaf header
- * @leaf: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_leaf_out(struct gfs_leaf *leaf, char *buf)
-{
-	struct gfs_leaf *str = (struct gfs_leaf *)buf;
-
-	gfs_meta_header_out(&leaf->lf_header, buf);
-
-	CPOUT_16(leaf, str, lf_depth);
-	CPOUT_16(leaf, str, lf_entries);
-	CPOUT_32(leaf, str, lf_dirent_format);
-	CPOUT_64(leaf, str, lf_next);
-
-	CPOUT_08(leaf, str, lf_reserved, 64);
-}
-
-/**
- * gfs_leaf_print - Print out a directory leaf header
- * @lf: the cpu-order buffer
- *
- */
-
-void
-gfs_leaf_print(struct gfs_leaf *lf)
-{
-	gfs_meta_header_print(&lf->lf_header);
-
-	pv(lf, lf_depth, "%u");
-	pv(lf, lf_entries, "%u");
-	pv(lf, lf_dirent_format, "%u");
-	pv(lf, lf_next, "%"PRIu64);
-
-	pa(lf, lf_reserved, 64);
-}
-
-/**
- * gfs_log_header_in - Read in a log header
- * @head: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_log_header_in(struct gfs_log_header *head, char *buf)
-{
-	struct gfs_log_header *str = (struct gfs_log_header *)buf;
-
-	gfs_meta_header_in(&head->lh_header, buf);
-
-	CPIN_32(head, str, lh_flags);
-	CPIN_32(head, str, lh_pad);
-
-	CPIN_64(head, str, lh_first);
-	CPIN_64(head, str, lh_sequence);
-
-	CPIN_64(head, str, lh_tail);
-	CPIN_64(head, str, lh_last_dump);
-
-	CPIN_08(head, str, lh_reserved, 64);
-}
-
-/**
- * gfs_log_header_out - Write out a log header
- * @head: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_log_header_out(struct gfs_log_header *head, char *buf)
-{
-	struct gfs_log_header *str = (struct gfs_log_header *)buf;
-
-	gfs_meta_header_out(&head->lh_header, buf);
-
-	CPOUT_32(head, str, lh_flags);
-	CPOUT_32(head, str, lh_pad);
-
-	CPOUT_64(head, str, lh_first);
-	CPOUT_64(head, str, lh_sequence);
-
-	CPOUT_64(head, str, lh_tail);
-	CPOUT_64(head, str, lh_last_dump);
-
-	CPOUT_08(head, str, lh_reserved, 64);
-}
-
-/**
- * gfs_log_header_print - Print out a log header
- * @head: the cpu-order buffer
- *
- */
-
-void
-gfs_log_header_print(struct gfs_log_header *lh)
-{
-	gfs_meta_header_print(&lh->lh_header);
-
-	pv(lh, lh_flags, "0x%.8X");
-	pv(lh, lh_pad, "%u");
-
-	pv(lh, lh_first, "%"PRIu64);
-	pv(lh, lh_sequence, "%"PRIu64);
-
-	pv(lh, lh_tail, "%"PRIu64);
-	pv(lh, lh_last_dump, "%"PRIu64);
-
-	pa(lh, lh_reserved, 64);
-}
-
-/**
- * gfs_desc_in - Read in a log descriptor
- * @desc: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_desc_in(struct gfs_log_descriptor *desc, char *buf)
-{
-	struct gfs_log_descriptor *str = (struct gfs_log_descriptor *)buf;
-
-	gfs_meta_header_in(&desc->ld_header, buf);
-
-	CPIN_32(desc, str, ld_type);
-	CPIN_32(desc, str, ld_length);
-	CPIN_32(desc, str, ld_data1);
-	CPIN_32(desc, str, ld_data2);
-
-	CPIN_08(desc, str, ld_reserved, 64);
-}
-
-/**
- * gfs_desc_out - Write out a log descriptor
- * @desc: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_desc_out(struct gfs_log_descriptor *desc, char *buf)
-{
-	struct gfs_log_descriptor *str = (struct gfs_log_descriptor *)buf;
-
-	gfs_meta_header_out(&desc->ld_header, buf);
-
-	CPOUT_32(desc, str, ld_type);
-	CPOUT_32(desc, str, ld_length);
-	CPOUT_32(desc, str, ld_data1);
-	CPOUT_32(desc, str, ld_data2);
-
-	CPOUT_08(desc, str, ld_reserved, 64);
-}
-
-/**
- * gfs_desc_print - Print out a log descriptor
- * @ld: the cpu-order buffer
- *
- */
-
-void
-gfs_desc_print(struct gfs_log_descriptor *ld)
-{
-	gfs_meta_header_print(&ld->ld_header);
-
-	pv(ld, ld_type, "%u");
-	pv(ld, ld_length, "%u");
-	pv(ld, ld_data1, "%u");
-	pv(ld, ld_data2, "%u");
-
-	pa(ld, ld_reserved, 64);
-}
-
-/**
- * gfs_block_tag_in - Read in a block tag
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_block_tag_in(struct gfs_block_tag *tag, char *buf)
-{
-	struct gfs_block_tag *str = (struct gfs_block_tag *)buf;
-
-	CPIN_64(tag, str, bt_blkno);
-	CPIN_32(tag, str, bt_flags);
-	CPIN_32(tag, str, bt_pad);
-}
-
-/**
- * gfs_block_tag_out - Write out a block tag
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_block_tag_out(struct gfs_block_tag *tag, char *buf)
-{
-	struct gfs_block_tag *str = (struct gfs_block_tag *)buf;
-
-	CPOUT_64(tag, str, bt_blkno);
-	CPOUT_32(tag, str, bt_flags);
-	CPOUT_32(tag, str, bt_pad);
-}
-
-/**
- * gfs_block_tag_print - Print out a block tag
- * @tag: the cpu-order buffer
- *
- */
-
-void
-gfs_block_tag_print(struct gfs_block_tag *tag)
-{
-	pv(tag, bt_blkno, "%"PRIu64);
-	pv(tag, bt_flags, "%u");
-	pv(tag, bt_pad, "%u");
-}
-
-/**
- * gfs_quota_tag_in - Read in a quota tag
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_quota_tag_in(struct gfs_quota_tag *tag, char *buf)
-{
-	struct gfs_quota_tag *str = (struct gfs_quota_tag *)buf;
-
-	CPIN_64(tag, str, qt_change);
-	CPIN_32(tag, str, qt_flags);
-	CPIN_32(tag, str, qt_id);
-}
-
-/**
- * gfs_quota_tag_out - Write out a quota tag
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_quota_tag_out(struct gfs_quota_tag *tag, char *buf)
-{
-	struct gfs_quota_tag *str = (struct gfs_quota_tag *)buf;
-
-	CPOUT_64(tag, str, qt_change);
-	CPOUT_32(tag, str, qt_flags);
-	CPOUT_32(tag, str, qt_id);
-}
-
-/**
- * gfs_quota_tag_print - Print out a quota tag
- * @tag: the cpu-order buffer
- *
- */
-
-void
-gfs_quota_tag_print(struct gfs_quota_tag *tag)
-{
-	pv(tag, qt_change, "%"PRId64);
-	pv(tag, qt_flags, "0x%.8X");
-	pv(tag, qt_id, "%u");
-}
-
-/**
- * gfs_ea_header_in - Read in a Extended Attribute header
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_ea_header_in(struct gfs_ea_header *ea, char *buf)
-{
-	struct gfs_ea_header *str = (struct gfs_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;
-	CPIN_32(ea, str, ea_pad);
-}
-
-/**
- * gfs_ea_header_out - Write out a Extended Attribute header
- * @ea: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_ea_header_out(struct gfs_ea_header *ea, char *buf)
-{
-	struct gfs_ea_header *str = (struct gfs_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;
-	CPOUT_32(ea, str, ea_pad);
-}
-
-/**
- * gfs_ea_header_printt - Print out a Extended Attribute header
- * @ea: the cpu-order buffer
- *
- */
-
-void
-gfs_ea_header_print(struct gfs_ea_header *ea, char *name)
-{
-	char buf[GFS_EA_MAX_NAME_LEN + 1];
-
-	pv(ea, ea_rec_len, "%u");
-	pv(ea, ea_data_len, "%u");
-	pv(ea, ea_name_len, "%u");
-	pv(ea, ea_type, "%u");
-	pv(ea, ea_flags, "%u");
-	pv(ea, ea_num_ptrs, "%u");
-	pv(ea, ea_pad, "%u");
-
-	memset(buf, 0, GFS_EA_MAX_NAME_LEN + 1);
-	memcpy(buf, name, ea->ea_name_len);
-	printk("  name = %s\n", buf);
-}
-
-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
-};
-
-/**
- * gfs_dir_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.
- *
- * 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
-gfs_dir_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  /* WANT_GFS_CONVERSION_FUNCTIONS */
-
diff --git a/gfs-kernel/src/gfs/glock.c b/gfs-kernel/src/gfs/glock.c
deleted file mode 100644
index 57a829d..0000000
--- a/gfs-kernel/src/gfs/glock.c
+++ /dev/null
@@ -1,2996 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <asm/uaccess.h>
-
-#include "gfs.h"
-#include "dio.h"
-#include "glock.h"
-#include "glops.h"
-#include "inode.h"
-#include "lm.h"
-#include "lops.h"
-#include "quota.h"
-#include "recovery.h"
-
-/*  Must be kept in sync with the beginning of struct gfs_glock  */
-struct glock_plug {
-	struct list_head gl_list;
-	unsigned long gl_flags;
-};
-
-struct greedy {
-	struct gfs_holder gr_gh;
-	struct delayed_work gr_work;
-};
-
-typedef void (*glock_examiner) (struct gfs_glock * gl, unsigned int *cnt);
-
-/**
- * relaxed_state_ok - is a requested lock compatible with the current lock mode?
- * @actual: the current state of the lock
- * @requested: the lock state that was requested by the caller
- * @flags: the modifier flags passed in by the caller
- *
- * Returns: TRUE if the locks are compatible, FALSE otherwise
- *
- * It's often possible that a holder B may request the lock in SHARED mode,
- * while another holder A (on this same node) has the lock in EXCLUSIVE mode
- * (node must hold the glock in EXCLUSIVE mode for this situation, of course).
- * This is okay to grant, in some cases, since both holders would have access
- * to the in-core up-to-date cached data that the EX holder would write to disk.
- * This is the default behavior.
- *
- * The EXACT flag disallows this behavior, though.  A SHARED request would
- * compatible only with a SHARED lock with this flag.
- *
- * The ANY flag provides broader permission to grant the lock to a holder,
- * whatever the requested state is, as long as the lock is locked in any mode.
- */
-
-static __inline__ int
-relaxed_state_ok(unsigned int actual, unsigned requested, int flags)
-{
-	if (actual == requested)
-		return TRUE;
-
-	if (flags & GL_EXACT)
-		return FALSE;
-
-	if (actual == LM_ST_EXCLUSIVE && requested == LM_ST_SHARED)
-		return TRUE;
-
-	if (actual != LM_ST_UNLOCKED && (flags & LM_FLAG_ANY))
-		return TRUE;
-
-	return FALSE;
-}
-
-/**
- * gl_hash() - Turn glock number into hash bucket number
- * @lock: The glock number
- *
- * Returns: The number of the corresponding hash bucket
- */
-
-static unsigned int
-gl_hash(struct lm_lockname *name)
-{
-	unsigned int h;
-
-	h = gfs_hash(&name->ln_number, sizeof(uint64_t));
-	h = gfs_hash_more(&name->ln_type, sizeof(unsigned int), h);
-	h &= GFS_GL_HASH_MASK;
-
-	return h;
-}
-
-/**
- * glock_hold() - increment reference count on glock
- * @gl: The glock to hold
- *
- */
-
-static __inline__ void
-glock_hold(struct gfs_glock *gl)
-{
-	gfs_assert(gl->gl_sbd, atomic_read(&gl->gl_count) > 0,);
-	atomic_inc(&gl->gl_count);
-}
-
-/**
- * glock_put() - Decrement reference count on glock
- * @gl: The glock to put
- *
- */
-
-static __inline__ void
-glock_put(struct gfs_glock *gl)
-{
-	if (atomic_read(&gl->gl_count) == 1)
-		gfs_glock_schedule_for_reclaim(gl);
-	gfs_assert(gl->gl_sbd, atomic_read(&gl->gl_count) > 0,);
-	atomic_dec(&gl->gl_count);
-}
-
-/**
- * queue_empty - check to see if a glock's queue is empty
- * @gl: the glock
- * @head: the head of the queue to check
- *
- * Returns: TRUE if the queue is empty
- */
-
-static __inline__ int
-queue_empty(struct gfs_glock *gl, struct list_head *head)
-{
-	int empty;
-	spin_lock(&gl->gl_spin);
-	empty = list_empty(head);
-	spin_unlock(&gl->gl_spin);
-	return empty;
-}
-
-/**
- * search_bucket() - Find struct gfs_glock by lock number
- * @bucket: the bucket to search
- * @name: The lock name
- *
- * Returns: NULL, or the struct gfs_glock with the requested number
- */
-
-static struct gfs_glock *
-search_bucket(struct gfs_gl_hash_bucket *bucket, struct lm_lockname *name)
-{
-	struct list_head *tmp, *head;
-	struct gfs_glock *gl;
-
-	for (head = &bucket->hb_list, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		gl = list_entry(tmp, struct gfs_glock, gl_list);
-
-		if (test_bit(GLF_PLUG, &gl->gl_flags))
-			continue;
-		if (!lm_name_equal(&gl->gl_name, name))
-			continue;
-
-		atomic_inc(&gl->gl_count);
-
-		return gl;
-	}
-
-	return NULL;
-}
-
-/**
- * gfs_glock_find() - Find glock by lock number
- * @sdp: The GFS superblock
- * @name: The lock name
- *
- * Figure out what bucket the lock is in, acquire the read lock on
- * it and call search_bucket().
- *
- * Returns: NULL, or the struct gfs_glock with the requested number
- */
-
-struct gfs_glock *
-gfs_glock_find(struct gfs_sbd *sdp, struct lm_lockname *name)
-{
-	struct gfs_gl_hash_bucket *bucket = &sdp->sd_gl_hash[gl_hash(name)];
-	struct gfs_glock *gl;
-
-	read_lock(&bucket->hb_lock);
-	gl = search_bucket(bucket, name);
-	read_unlock(&bucket->hb_lock);
-
-	return gl;
-}
-
-/**
- * glock_free() - Perform a few checks and then release struct gfs_glock
- * @gl: The glock to release
- *
- * Also calls lock module to release its internal structure for this glock.
- *
- */
-
-static void
-glock_free(struct gfs_glock *gl)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct inode *aspace = gl->gl_aspace;
-
-	gfs_assert_warn(sdp, list_empty(&gl->gl_list));
-	gfs_assert_warn(sdp, atomic_read(&gl->gl_count) == 1);
-	gfs_assert_warn(sdp, list_empty(&gl->gl_holders));
-	gfs_assert_warn(sdp, list_empty(&gl->gl_waiters1));
-        gfs_assert_warn(sdp, list_empty(&gl->gl_waiters2));
-	gfs_assert_warn(sdp, list_empty(&gl->gl_waiters3));
-	gfs_assert_warn(sdp, gl->gl_state == LM_ST_UNLOCKED);
-	gfs_assert_warn(sdp, !gl->gl_object);
-	gfs_assert_warn(sdp, !gl->gl_lvb);
-	gfs_assert_warn(sdp, list_empty(&gl->gl_reclaim));
-
-	gfs_lm_put_lock(sdp, gl->gl_lock);
-
-	if (aspace)
-		gfs_aspace_put(aspace);
-
-	kmem_cache_free(gfs_glock_cachep, gl);
-
-	atomic_dec(&sdp->sd_glock_count);
-}
-
-/**
- * gfs_glock_get() - Get a glock, or create one if one doesn't exist
- * @sdp: The GFS superblock
- * @number: the lock number
- * @glops: The glock_operations to use
- * @create: If FALSE, don't create the glock if it doesn't exist
- * @glp: the glock is returned here
- *
- * This does not lock a glock, just finds/creates structures for one.
- * 
- * Returns: errno
- */
-
-int
-gfs_glock_get(struct gfs_sbd *sdp,
-	      uint64_t number, struct gfs_glock_operations *glops,
-	      int create, struct gfs_glock **glp)
-{
-	struct lm_lockname name;
-	struct gfs_glock *gl, *tmp;
-	struct gfs_gl_hash_bucket *bucket;
-	int error;
-
-	/* Look for pre-existing glock in hash table */
-	name.ln_number = number;
-	name.ln_type = glops->go_type;
-	bucket = &sdp->sd_gl_hash[gl_hash(&name)];
-
-	read_lock(&bucket->hb_lock);
-	gl = search_bucket(bucket, &name);
-	read_unlock(&bucket->hb_lock);
-
-	if (gl || !create) {
-		*glp = gl;
-		return 0;
-	}
-
-	/* None found; create a new one */
-	gl = kmem_cache_alloc(gfs_glock_cachep, GFP_KERNEL);
-	if (!gl)
-		return -ENOMEM;
-
-	memset(gl, 0, sizeof(struct gfs_glock));
-
-	INIT_LIST_HEAD(&gl->gl_list);
-	gl->gl_name = name;
-	atomic_set(&gl->gl_count, 1);
-
-	spin_lock_init(&gl->gl_spin);
-
-	gl->gl_state = LM_ST_UNLOCKED;
-	INIT_LIST_HEAD(&gl->gl_holders);
-	INIT_LIST_HEAD(&gl->gl_waiters1);
-	INIT_LIST_HEAD(&gl->gl_waiters2);
-	INIT_LIST_HEAD(&gl->gl_waiters3);
-
-	gl->gl_ops = glops;
-
-	INIT_LE(&gl->gl_new_le, &gfs_glock_lops);
-	INIT_LE(&gl->gl_incore_le, &gfs_glock_lops);
-
-	gl->gl_bucket = bucket;
-	INIT_LIST_HEAD(&gl->gl_reclaim);
-
-	gl->gl_sbd = sdp;
-
-	INIT_LIST_HEAD(&gl->gl_ail_bufs);
-
-	/* If this glock protects actual on-disk data or metadata blocks,
-	   create a VFS inode to manage the pages/buffers holding them. */
-	if (glops == &gfs_inode_glops ||
-	    glops == &gfs_rgrp_glops ||
-	    glops == &gfs_meta_glops) {
-		gl->gl_aspace = gfs_aspace_get(sdp);
-		if (!gl->gl_aspace) {
-			error = -ENOMEM;
-			goto fail;
-		}
-	}
-
-	/* Ask lock module to find/create its structure for this lock
-	   (but this doesn't lock the inter-node lock yet) */
-	error = gfs_lm_get_lock(sdp, &name, &gl->gl_lock);
-	if (error)
-		goto fail_aspace;
-
-	atomic_inc(&sdp->sd_glock_count);
-
-	/* Double-check, in case another process created the glock, and has
-	   put it in the hash table while we were preparing this one */
-	write_lock(&bucket->hb_lock);
-	tmp = search_bucket(bucket, &name);
-	if (tmp) {
-		/* Somebody beat us to it; forget the one we prepared */
-		write_unlock(&bucket->hb_lock);
-		glock_free(gl);
-		gl = tmp;
-	} else {
-		/* Add our glock to hash table */
-		list_add_tail(&gl->gl_list, &bucket->hb_list);
-		write_unlock(&bucket->hb_lock);
-	}
-
-	*glp = gl;
-
-	return 0;
-
- fail_aspace:
-	if (gl->gl_aspace)
-		gfs_aspace_put(gl->gl_aspace);
-
- fail:
-	kmem_cache_free(gfs_glock_cachep, gl);	
-
-	return error;
-}
-
-/**
- * gfs_glock_hold() - As glock_hold(), but suitable for exporting
- * @gl: The glock to hold
- *
- */
-
-void
-gfs_glock_hold(struct gfs_glock *gl)
-{
-	glock_hold(gl);
-}
-
-/**
- * gfs_glock_put() - As glock_put(), but suitable for exporting
- * @gl: The glock to put
- *
- */
-
-void
-gfs_glock_put(struct gfs_glock *gl)
-{
-	glock_put(gl);
-}
-
-/**
- * gfs_holder_init - initialize a struct gfs_holder in the default way
- * @gl: the glock 
- * @state: the state we're requesting
- * @flags: the modifier flags
- * @gh: the holder structure
- *
- */
-
-void
-gfs_holder_init(struct gfs_glock *gl, unsigned int state, int flags,
-		struct gfs_holder *gh)
-{
-	memset(gh, 0, sizeof(struct gfs_holder));
-
-	INIT_LIST_HEAD(&gh->gh_list);
-	gh->gh_gl = gl;
-	gh->gh_owner = current;
-	gh->gh_state = state;
-	gh->gh_flags = flags;
-
-	if (gh->gh_state == LM_ST_EXCLUSIVE)
-		gh->gh_flags |= GL_LOCAL_EXCL;
-
-	init_completion(&gh->gh_wait);
-
-	glock_hold(gl);
-}
-
-/**
- * gfs_holder_reinit - reinitialize a struct gfs_holder so we can requeue it
- * @state: the state we're requesting
- * @flags: the modifier flags
- * @gh: the holder structure
- *
- * Preserve holder's associated glock and owning process.
- * Reset all holder state flags (we're starting a new request from scratch),
- *   except for HIF_ALLOCED.
- * Don't do glock_hold() again (it was done in gfs_holder_init()).
- * Don't mess with the glock.
- *
- * Rules:
- *   Holder must have been gfs_holder_init()d already
- *   Holder must *not* be in glock's holder list or wait queues now
- */
-
-void
-gfs_holder_reinit(unsigned int state, int flags, struct gfs_holder *gh)
-{
-	int alloced;
-
-	gfs_assert_warn(gh->gh_gl->gl_sbd,
-			list_empty(&gh->gh_list));
-
-	gh->gh_state = state;
-	gh->gh_flags = flags;
-
-	if (gh->gh_state == LM_ST_EXCLUSIVE)
-		gh->gh_flags |= GL_LOCAL_EXCL;
-
-	alloced = test_bit(HIF_ALLOCED, &gh->gh_iflags);
-	memset(&gh->gh_iflags, 0, sizeof(unsigned long));
-	if (alloced)
-		set_bit(HIF_ALLOCED, &gh->gh_iflags);
-}
-
-/**
- * gfs_holder_uninit - uninitialize a holder structure (drop reference on glock)
- * @gh: the holder structure
- *
- */
-
-void
-gfs_holder_uninit(struct gfs_holder *gh)
-{
-	struct gfs_glock *gl = gh->gh_gl;
-
-	gfs_assert_warn(gl->gl_sbd, list_empty(&gh->gh_list));
-	gh->gh_gl = NULL;
-
-	glock_put(gl);
-}
-
-/**
- * gfs_holder_get - get a struct gfs_holder structure
- * @gl: the glock 
- * @state: the state we're requesting
- * @flags: the modifier flags
- *
- * Figure out how big an impact this function has.  Either:
- * 1) Replace it with a cache of structures hanging off the struct gfs_sbd
- * 2) Leave it like it is
- *
- * Returns: the holder structure, NULL on ENOMEM
- */
-
-struct gfs_holder *
-gfs_holder_get(struct gfs_glock *gl, unsigned int state, int flags)
-{
-	struct gfs_holder *gh;
-
-	gh = kmalloc(sizeof(struct gfs_holder), GFP_KERNEL);
-	if (!gh)
-		return NULL;
-
-	gfs_holder_init(gl, state, flags, gh);
-	set_bit(HIF_ALLOCED, &gh->gh_iflags);
-
-	return gh;
-}
-
-/**
- * gfs_holder_put - get rid of a struct gfs_holder structure
- * @gh: the holder structure
- *
- */
-
-void
-gfs_holder_put(struct gfs_holder *gh)
-{
-	if (gfs_assert_warn(gh->gh_gl->gl_sbd,
-			    test_bit(HIF_ALLOCED, &gh->gh_iflags)))
-		return;
-	gfs_holder_uninit(gh);
-	kfree(gh);
-}
-
-/**
- * handle_recurse - put other holder structures (marked recursive) into the holders list
- * @gh: the holder structure
- *
- */
-
-static void
-handle_recurse(struct gfs_holder *gh)
-{
-	struct gfs_glock *gl = gh->gh_gl;
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct list_head *tmp, *head, *next;
-	struct gfs_holder *tmp_gh;
-	int found = FALSE;
-
-	if (gfs_assert_warn(sdp, gh->gh_owner))
-		return;
-
-	for (head = &gl->gl_waiters3, tmp = head->next, next = tmp->next;
-	     tmp != head;
-	     tmp = next, next = tmp->next) {
-		tmp_gh = list_entry(tmp, struct gfs_holder, gh_list);
-		if (tmp_gh->gh_owner != gh->gh_owner)
-			continue;
-
-		gfs_assert_warn(sdp, test_bit(HIF_RECURSE, &tmp_gh->gh_iflags));
-
-		list_move_tail(&tmp_gh->gh_list, &gl->gl_holders);
-		tmp_gh->gh_error = 0;
-		set_bit(HIF_HOLDER, &tmp_gh->gh_iflags);
-
-		complete(&tmp_gh->gh_wait);
-
-		found = TRUE;
-	}
-
-	gfs_assert_warn(sdp, found);
-}
-
-/**
- * do_unrecurse - a recursive holder was just dropped of the waiters3 list
- * @gh: the holder
- *
- * If there is only one other recursive holder, clear its HIF_RECURSE bit
- *   (it's no longer a recursive request).
- * If there is more than one, leave them alone (they're recursive!).
- *
- */
-
-static void
-do_unrecurse(struct gfs_holder *gh)
-{
-	struct gfs_glock *gl = gh->gh_gl;
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct list_head *tmp, *head;
-	struct gfs_holder *tmp_gh, *last_gh = NULL;
-	int found = FALSE;
-
-	if (gfs_assert_warn(sdp, gh->gh_owner))
-		return;
-
-	for (head = &gl->gl_waiters3, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		tmp_gh = list_entry(tmp, struct gfs_holder, gh_list);
-		if (tmp_gh->gh_owner != gh->gh_owner)
-			continue;
-
-		gfs_assert_warn(sdp, test_bit(HIF_RECURSE, &tmp_gh->gh_iflags));
-
-		/* found more than one */
-		if (found)
-			return;
-
-		found = TRUE;
-		last_gh = tmp_gh;
-	}
-
-	/* found just one */
-	if (!gfs_assert_warn(sdp, found))
-		clear_bit(HIF_RECURSE, &last_gh->gh_iflags);
-}
-
-/**
- * rq_mutex - process a mutex request in the queue
- * @gh: the glock holder
- *
- * Returns: TRUE if the queue is blocked (always, since there can be only one
- *      holder of the mutex).
- *
- * See lock_on_glock()
- */
-
-static int
-rq_mutex(struct gfs_holder *gh)
-{
-	struct gfs_glock *gl = gh->gh_gl;
-
-	list_del_init(&gh->gh_list);
-	/*  gh->gh_error never examined.  */
-	set_bit(GLF_LOCK, &gl->gl_flags);
-	complete(&gh->gh_wait);
-
-	return TRUE;
-}
-
-/**
- * rq_promote - process a promote request in the queue
- * @gh: the glock holder
- *
- * Acquire a new inter-node lock, or change a lock state to more restrictive.
- *
- * Returns: TRUE if the queue is blocked
- */
-
-static int
-rq_promote(struct gfs_holder *gh)
-{
-	struct gfs_glock *gl = gh->gh_gl;
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct gfs_glock_operations *glops = gl->gl_ops;
-	int recurse;
-
-	if (!relaxed_state_ok(gl->gl_state, gh->gh_state, gh->gh_flags)) {
-		if (list_empty(&gl->gl_holders)) {
-			gl->gl_req_gh = gh;
-			set_bit(GLF_LOCK, &gl->gl_flags);
-			spin_unlock(&gl->gl_spin);
-
-			/* If we notice a lot of glocks in reclaim list, free
-			   up memory for 2 of them before locking a new one */
-			if (atomic_read(&sdp->sd_reclaim_count) >
-			    gfs_tune_get(sdp, gt_reclaim_limit) &&
-			    !(gh->gh_flags & LM_FLAG_PRIORITY)) {
-				gfs_reclaim_glock(sdp);
-				gfs_reclaim_glock(sdp);
-			}
-
-			glops->go_xmote_th(gl, gh->gh_state,
-					   gh->gh_flags);
-
-			spin_lock(&gl->gl_spin);
-		}
-		return TRUE;
-	}
-
-	if (list_empty(&gl->gl_holders)) {
-		set_bit(HIF_FIRST, &gh->gh_iflags);
-		set_bit(GLF_LOCK, &gl->gl_flags);
-		recurse = FALSE;
-	} else {
-		struct gfs_holder *next_gh;
-		if (gh->gh_flags & GL_LOCAL_EXCL)
-			return TRUE;
-		next_gh = list_entry(gl->gl_holders.next, struct gfs_holder, gh_list);
-		if (next_gh->gh_flags & GL_LOCAL_EXCL)
-			 return TRUE;
-		recurse = test_bit(HIF_RECURSE, &gh->gh_iflags);
-	}
-
-	list_move_tail(&gh->gh_list, &gl->gl_holders);
-	gh->gh_error = 0;
-	set_bit(HIF_HOLDER, &gh->gh_iflags);
-
-	if (recurse)
-		handle_recurse(gh);
-
-	complete(&gh->gh_wait);
-
-	return FALSE;
-}
-
-/**
- * rq_demote - process a demote request in the queue
- * @gh: the glock holder
- *
- * Returns: TRUE if the queue is blocked
- *
- * Unlock an inter-node lock, or change a lock state to less restrictive.
- * If the glock is already the same as the holder's requested state, or is
- *   UNLOCKED, no lock module request is required.
- * Otherwise, we need to ask lock module to unlock or change locked state
- *   of the glock.
- * If requested state is UNLOCKED, or current glock state is SHARED or
- *   DEFERRED (neither of which have a less restrictive state other than
- *   UNLOCK), we call go_drop_th() to unlock the lock.
- * Otherwise (i.e. requested is SHARED or DEFERRED, and current is EXCLUSIVE),
- *   we can continue to hold the lock, and just ask for a new state;
- *   we call go_xmote_th() to change state.
- *
- * Must be called with glock's gl->gl_spin locked.
- */
-
-static int
-rq_demote(struct gfs_holder *gh)
-{
-	struct gfs_glock *gl = gh->gh_gl;
-	struct gfs_glock_operations *glops = gl->gl_ops;
-
-	if (!list_empty(&gl->gl_holders))
-		return TRUE;
-
-	if (gl->gl_state == gh->gh_state || gl->gl_state == LM_ST_UNLOCKED) {
-		list_del_init(&gh->gh_list);
-		gh->gh_error = 0;
-		spin_unlock(&gl->gl_spin);
-		if (test_bit(HIF_DEALLOC, &gh->gh_iflags))
-			gfs_holder_put(gh);
-		else
-			complete(&gh->gh_wait);
-		spin_lock(&gl->gl_spin);
-	} else {
-		gl->gl_req_gh = gh;
-		set_bit(GLF_LOCK, &gl->gl_flags);
-		spin_unlock(&gl->gl_spin);
-
-		if (gh->gh_state == LM_ST_UNLOCKED ||
-		    gl->gl_state != LM_ST_EXCLUSIVE)
-			/* Unlock */
-			glops->go_drop_th(gl);
-		else
-			/* Change state while holding lock */
-			glops->go_xmote_th(gl, gh->gh_state, gh->gh_flags);
-
-		spin_lock(&gl->gl_spin);
-	}
-
-	return FALSE;
-}
-
-/**
- * rq_greedy - process a queued request to drop greedy status
- * @gh: the glock holder
- *
- * Returns: TRUE if the queue is blocked
- */
-
-static int
-rq_greedy(struct gfs_holder *gh)
-{
-	struct gfs_glock *gl = gh->gh_gl;
-
-	list_del_init(&gh->gh_list);
-	/*  gh->gh_error never examined.  */
-	clear_bit(GLF_GREEDY, &gl->gl_flags);
-	spin_unlock(&gl->gl_spin);
-
-	gfs_holder_uninit(gh);
-	kfree(container_of(gh, struct greedy, gr_gh));
-
-	spin_lock(&gl->gl_spin);		
-
-	return FALSE;
-}
-
-/**
- * run_queue - process holder structures on the glock's wait queues
- * @gl: the glock
- *
- * Rules:
- *   Caller must hold gl->gl_spin.
- */
-
-static void
-run_queue(struct gfs_glock *gl)
-{
-	struct gfs_holder *gh;
-	int blocked = TRUE;
-
-	for (;;) {
-		/* Another process is manipulating the glock structure;
-		   we can't do anything now */
-		if (test_bit(GLF_LOCK, &gl->gl_flags))
-			break;
-
-		/* Waiting to manipulate the glock structure */
-		if (!list_empty(&gl->gl_waiters1)) {
-			gh = list_entry(gl->gl_waiters1.next,
-					struct gfs_holder, gh_list);
-
-			if (test_bit(HIF_MUTEX, &gh->gh_iflags))
-				blocked = rq_mutex(gh);
-			else
-				gfs_assert_warn(gl->gl_sbd, FALSE);
-
-		/* Waiting to demote the lock, or drop greedy status */
-		} else if (!list_empty(&gl->gl_waiters2) &&
-			   !test_bit(GLF_SKIP_WAITERS2, &gl->gl_flags)) {
-			gh = list_entry(gl->gl_waiters2.next,
-					struct gfs_holder, gh_list);
-
-			if (test_bit(HIF_DEMOTE, &gh->gh_iflags))
-				blocked = rq_demote(gh);
-			else if (test_bit(HIF_GREEDY, &gh->gh_iflags))
-				blocked = rq_greedy(gh);
-			else
-				gfs_assert_warn(gl->gl_sbd, FALSE);
-
-		/* Waiting to promote the lock */
-		} else if (!list_empty(&gl->gl_waiters3)) {
-			gh = list_entry(gl->gl_waiters3.next,
-					struct gfs_holder, gh_list);
-
-			if (test_bit(HIF_PROMOTE, &gh->gh_iflags))
-				blocked = rq_promote(gh);
-			else
-				gfs_assert_warn(gl->gl_sbd, FALSE);
-
-		} else
-			break;
-
-		if (blocked)
-			break;
-	}
-}
-
-/**
- * lock_on_glock - acquire a local lock on a glock (structure)
- * @gl: the glock
- *
- * Gives caller exclusive access to manipulate a glock structure.
- * Has nothing to do with inter-node lock state or GL_LOCAL_EXCL!
- *
- * If structure already locked, places temporary holder structure on glock's
- * wait-for-exclusive-access queue, and blocks until exclusive access granted.
- */
-
-static void
-lock_on_glock(struct gfs_glock *gl)
-{
-	struct gfs_holder gh;
-
-	gfs_holder_init(gl, 0, 0, &gh);
-	set_bit(HIF_MUTEX, &gh.gh_iflags);
-
-	spin_lock(&gl->gl_spin);
-	if (test_and_set_bit(GLF_LOCK, &gl->gl_flags))
-		list_add_tail(&gh.gh_list, &gl->gl_waiters1);
-	else
-		complete(&gh.gh_wait);
-	spin_unlock(&gl->gl_spin);
-
-	wait_for_completion(&gh.gh_wait);
-	gfs_holder_uninit(&gh);
-}
-
-/**
- * trylock_on_glock - try to acquire a local lock on a glock (structure)
- * @gl: the glock
- *
- * Returns: TRUE if the glock is acquired
- *
- * Tries to give caller exclusive access to manipulate a glock structure.
- * Has nothing to do with inter-node lock state or LOCAL_EXCL!
- *
- * If structure already locked, does not block to wait; returns FALSE.
- */
-
-static int
-trylock_on_glock(struct gfs_glock *gl)
-{
-	int acquired = TRUE;
-
-	spin_lock(&gl->gl_spin);
-	if (test_and_set_bit(GLF_LOCK, &gl->gl_flags))
-		acquired = FALSE;
-	spin_unlock(&gl->gl_spin);
-
-	return acquired;
-}
-
-/**
- * unlock_on_glock - release a local lock on a glock (structure)
- * @gl: the glock
- *
- * Caller is done manipulating glock structure.
- * Service any others waiting for exclusive access.
- */
-
-static void
-unlock_on_glock(struct gfs_glock *gl)
-{
-	spin_lock(&gl->gl_spin);
-	clear_bit(GLF_LOCK, &gl->gl_flags);
-	run_queue(gl);
-	spin_unlock(&gl->gl_spin);
-}
-
-/**
- * handle_callback - add a demote request to a lock's queue
- * @gl: the glock
- * @state: the state the caller wants us to change to
- *
- * Called when we learn that another node needs a lock held by this node,
- *   or when this node simply wants to drop a lock as soon as it's done with
- *   it (NOCACHE flag), or dump a glock out of glock cache (reclaim it).
- *
- * We are told the @state that will satisfy the needs of the caller, so
- *   we can ask for a demote to that state.
- *
- * If another demote request is already on the queue for a different state, just
- *   set its request to UNLOCK (and don't bother queueing a request for us).
- *   This consolidates LM requests and moves the lock to the least restrictive
- *   state, so it will be compatible with whatever reason we were called.
- *   No need to be too smart here.  Demotes between the shared and deferred
- *   states will often fail, so don't even try.
- *
- * Otherwise, queue a demote request to the requested state.
- */
-
-static void
-handle_callback(struct gfs_glock *gl, unsigned int state)
-{
-	struct list_head *tmp, *head;
-	struct gfs_holder *gh, *new_gh = NULL;
-
-	if (gfs_assert_warn(gl->gl_sbd, state != LM_ST_EXCLUSIVE))
-		return;
-
- restart:
-	spin_lock(&gl->gl_spin);
-
-	/* If another queued demote request is for a different state,
-	   set its request to UNLOCKED */
-	for (head = &gl->gl_waiters2, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		gh = list_entry(tmp, struct gfs_holder, gh_list);
-		if (test_bit(HIF_DEMOTE, &gh->gh_iflags) &&
-		    gl->gl_req_gh != gh) {
-			if (gh->gh_state != state)
-				gh->gh_state = LM_ST_UNLOCKED;
-			goto out;
-		}
-	}
-
-	/* pass 2; add new holder to glock's demote request queue */
-	if (new_gh) {
-		list_add_tail(&new_gh->gh_list, &gl->gl_waiters2);
-		new_gh = NULL;
-
-	/* pass 1; set up a new holder struct for a demote request, then
-	   check again to see if another process added a demote request
-	   while we were preparing this one. */
-	} else {
-		spin_unlock(&gl->gl_spin);
-
-		RETRY_MALLOC(new_gh = gfs_holder_get(gl, state, LM_FLAG_TRY),
-			     new_gh);
-		set_bit(HIF_DEMOTE, &new_gh->gh_iflags);
-		set_bit(HIF_DEALLOC, &new_gh->gh_iflags);
-		new_gh->gh_owner = NULL;
-
-		goto restart;
-	}
-
- out:
-	spin_unlock(&gl->gl_spin);
-
-	if (new_gh)
-		gfs_holder_put(new_gh);
-}
-
-/**
- * state_change - record that the glock is now in a different state
- * @gl: the glock
- * @new_state the new state
- *
- */
-
-static void
-state_change(struct gfs_glock *gl, unsigned int new_state)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	int held1, held2;
-
-	held1 = (gl->gl_state != LM_ST_UNLOCKED);
-	held2 = (new_state != LM_ST_UNLOCKED);
-
-	if (held1 != held2) {
-		if (held2) {
-			atomic_inc(&sdp->sd_glock_held_count);
-			glock_hold(gl);
-		} else {
-			atomic_dec(&sdp->sd_glock_held_count);
-			glock_put(gl);
-		}
-	}
-
-	gl->gl_state = new_state;
-}
-
-/**
- * xmote_bh - Called after the lock module is done acquiring a lock
- * @gl: The glock in question
- * @ret: the int returned from the lock module
- *
- */
-
-static void
-xmote_bh(struct gfs_glock *gl, unsigned int ret)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct gfs_glock_operations *glops = gl->gl_ops;
-	struct gfs_holder *gh = gl->gl_req_gh;
-	int prev_state = gl->gl_state;
-	int op_done = TRUE;
-
-	gfs_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags));
-	gfs_assert_warn(sdp, queue_empty(gl, &gl->gl_holders));
-	gfs_assert_warn(sdp, !(ret & LM_OUT_ASYNC));
-
-	state_change(gl, ret & LM_OUT_ST_MASK);
-
-	if (prev_state != LM_ST_UNLOCKED && !(ret & LM_OUT_CACHEABLE)) {
-		if (glops->go_inval)
-			glops->go_inval(gl, DIO_METADATA | DIO_DATA);
-	} else if (gl->gl_state == LM_ST_DEFERRED) {
-		/* We might not want to do this here.
-		   Look at moving to the inode glops. */
-		if (glops->go_inval)
-			glops->go_inval(gl, DIO_DATA);
-	}
-
-	/*  Deal with each possible exit condition  */
-
-	if (!gh)
-		gl->gl_stamp = jiffies;
-
-	else if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) {
-		spin_lock(&gl->gl_spin);
-		list_del_init(&gh->gh_list);
-		gh->gh_error = -EIO;
-		if (test_bit(HIF_RECURSE, &gh->gh_iflags))
-			do_unrecurse(gh);
-		spin_unlock(&gl->gl_spin);
-
-	} else if (test_bit(HIF_DEMOTE, &gh->gh_iflags)) {
-		spin_lock(&gl->gl_spin);
-		list_del_init(&gh->gh_list);
-		if (gl->gl_state == gh->gh_state ||
-		    gl->gl_state == LM_ST_UNLOCKED)
-			gh->gh_error = 0;
-		else {
-			if (gfs_assert_warn(sdp, gh->gh_flags &
-					    (LM_FLAG_TRY | LM_FLAG_TRY_1CB)) == -1)
-				printk("GFS: fsid=%s: ret = 0x%.8X\n",
-				       sdp->sd_fsname, ret);
-			gh->gh_error = GLR_TRYFAILED;
-		}
-		spin_unlock(&gl->gl_spin);
-
-		if (ret & LM_OUT_CANCELED)
-			handle_callback(gl, LM_ST_UNLOCKED); /* Lame */
-
-	} else if (ret & LM_OUT_CANCELED) {
-		spin_lock(&gl->gl_spin);
-		list_del_init(&gh->gh_list);
-		gh->gh_error = GLR_CANCELED;
-		if (test_bit(HIF_RECURSE, &gh->gh_iflags))
-			do_unrecurse(gh);
-		spin_unlock(&gl->gl_spin);
-
-	} else if (relaxed_state_ok(gl->gl_state, gh->gh_state, gh->gh_flags)) {
-		spin_lock(&gl->gl_spin);
-		list_move_tail(&gh->gh_list, &gl->gl_holders);
-		gh->gh_error = 0;
-		set_bit(HIF_HOLDER, &gh->gh_iflags);
-		spin_unlock(&gl->gl_spin);
-
-		set_bit(HIF_FIRST, &gh->gh_iflags);
-
-		op_done = FALSE;
-
-	} else if (gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB)) {
-		spin_lock(&gl->gl_spin);
-		list_del_init(&gh->gh_list);
-		gh->gh_error = GLR_TRYFAILED;
-		if (test_bit(HIF_RECURSE, &gh->gh_iflags))
-			do_unrecurse(gh);
-		spin_unlock(&gl->gl_spin);
-
-	} else {
-		if (gfs_assert_withdraw(sdp, FALSE) == -1)
-			printk("GFS: fsid=%s: ret = 0x%.8X\n",
-			       sdp->sd_fsname, ret);
-	}
-
-	if (glops->go_xmote_bh)
-		glops->go_xmote_bh(gl);
-
-	if (op_done) {
-		spin_lock(&gl->gl_spin);
-		gl->gl_req_gh = NULL;
-		gl->gl_req_bh = NULL;
-		clear_bit(GLF_LOCK, &gl->gl_flags);
-		run_queue(gl);
-		spin_unlock(&gl->gl_spin);
-	}
-
-	glock_put(gl);
-
-	if (gh) {
-		if (test_bit(HIF_DEALLOC, &gh->gh_iflags))
-			gfs_holder_put(gh);
-		else
-			complete(&gh->gh_wait);
-	}
-}
-
-/**
- * gfs_glock_xmote_th - Call into the lock module to acquire or change a glock
- * @gl: The glock in question
- * @state: the requested state
- * @flags: modifier flags to the lock call
- *
- * Used to acquire a new glock, or to change an already-acquired glock to
- *   more/less restrictive state (other than LM_ST_UNLOCKED).
- *
- * *Not* used to unlock a glock; use gfs_glock_drop_th() for that.
- */
-
-void
-gfs_glock_xmote_th(struct gfs_glock *gl, unsigned int state, int flags)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct gfs_glock_operations *glops = gl->gl_ops;
-	int lck_flags = flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB |
-				 LM_FLAG_NOEXP | LM_FLAG_ANY |
-				 LM_FLAG_PRIORITY);
-	unsigned int lck_ret;
-
-	gfs_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags));
-	gfs_assert_warn(sdp, queue_empty(gl, &gl->gl_holders));
-	gfs_assert_warn(sdp, state != LM_ST_UNLOCKED);
-	gfs_assert_warn(sdp, state != gl->gl_state);
-
-	/* Current state EX, may need to sync log/data/metadata to disk */
-	if (gl->gl_state == LM_ST_EXCLUSIVE) {
-		if (glops->go_sync)
-			glops->go_sync(gl, DIO_METADATA | DIO_DATA);
-	}
-
-	glock_hold(gl);
-	gl->gl_req_bh = xmote_bh;
-
-	atomic_inc(&sdp->sd_lm_lock_calls);
-
-	lck_ret = gfs_lm_lock(sdp, gl->gl_lock,
-			      gl->gl_state, state,
-			      lck_flags);
-
-	if (gfs_assert_withdraw(sdp, !(lck_ret & LM_OUT_ERROR)))
-		goto out;
-
-	if (lck_ret & LM_OUT_ASYNC)
-		gfs_assert_warn(sdp, lck_ret == LM_OUT_ASYNC);
-	else
-		xmote_bh(gl, lck_ret);
- out:
-	return;
-}
-
-/**
- * drop_bh - Called after a lock module unlock completes
- * @gl: the glock
- * @ret: the return status
- *
- * Doesn't wake up the process waiting on the struct gfs_holder (if any)
- * Doesn't drop the reference on the glock the top half took out
- *
- */
-
-static void
-drop_bh(struct gfs_glock *gl, unsigned int ret)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct gfs_glock_operations *glops = gl->gl_ops;
-	struct gfs_holder *gh = gl->gl_req_gh;
-
-	clear_bit(GLF_PREFETCH, &gl->gl_flags);
-
-	gfs_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags));
-	gfs_assert_warn(sdp, queue_empty(gl, &gl->gl_holders));
-	gfs_assert_warn(sdp, !ret);
-
-	state_change(gl, LM_ST_UNLOCKED);
-
-	if (glops->go_inval)
-		glops->go_inval(gl, DIO_METADATA | DIO_DATA);
-
-	if (gh) {
-		spin_lock(&gl->gl_spin);
-		list_del_init(&gh->gh_list);
-		gh->gh_error = 0;
-		spin_unlock(&gl->gl_spin);
-	}
-
-	if (glops->go_drop_bh)
-		glops->go_drop_bh(gl);
-
-	spin_lock(&gl->gl_spin);
-	gl->gl_req_gh = NULL;
-	gl->gl_req_bh = NULL;
-	clear_bit(GLF_LOCK, &gl->gl_flags);
-	run_queue(gl);
-	spin_unlock(&gl->gl_spin);
-
-	glock_put(gl);
-
-	if (gh) {
-		if (test_bit(HIF_DEALLOC, &gh->gh_iflags))
-			gfs_holder_put(gh);
-		else
-			complete(&gh->gh_wait);
-	}
-}
-
-/**
- * gfs_glock_drop_th - call into the lock module to unlock a lock 
- * @gl: the glock
- *
- */
-
-void
-gfs_glock_drop_th(struct gfs_glock *gl)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct gfs_glock_operations *glops = gl->gl_ops;
-	unsigned int ret;
-
-	gfs_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags));
-	gfs_assert_warn(sdp, queue_empty(gl, &gl->gl_holders));
-	gfs_assert_warn(sdp, gl->gl_state != LM_ST_UNLOCKED);
-
-	/* Leaving state EX, may need to sync log/data/metadata to disk */
-	if (gl->gl_state == LM_ST_EXCLUSIVE) {
-		if (glops->go_sync)
-			glops->go_sync(gl, DIO_METADATA | DIO_DATA);
-	}
-
-	glock_hold(gl);
-	gl->gl_req_bh = drop_bh;
-
-	atomic_inc(&sdp->sd_lm_unlock_calls);
-
-	ret = gfs_lm_unlock(sdp, gl->gl_lock, gl->gl_state);
-
-	if (gfs_assert_withdraw(sdp, !(ret & LM_OUT_ERROR)))
-		goto out;
-
-	if (!ret)
-		drop_bh(gl, ret);
-	else
-		gfs_assert_warn(sdp, ret == LM_OUT_ASYNC);
- out:
-	return;
-}
-
-/**
- * do_cancels - cancel requests for locks stuck waiting on an expire flag
- * @gh: the LM_FLAG_PRIORITY holder waiting to acquire the lock
- *
- * Don't cancel GL_NOCANCEL requests.
- */
-
-static void
-do_cancels(struct gfs_holder *gh)
-{
-	struct gfs_glock *gl = gh->gh_gl;
-
-	spin_lock(&gl->gl_spin);
-
-	while (gl->gl_req_gh != gh &&
-	       !test_bit(HIF_HOLDER, &gh->gh_iflags) &&
-	       !list_empty(&gh->gh_list)) {
-		if (gl->gl_req_bh &&
-		    !(gl->gl_req_gh &&
-		      (gl->gl_req_gh->gh_flags & GL_NOCANCEL))) {
-			spin_unlock(&gl->gl_spin);
-			gfs_lm_cancel(gl->gl_sbd, gl->gl_lock);
-			set_current_state(TASK_UNINTERRUPTIBLE);
-			schedule_timeout(HZ / 10);
-			spin_lock(&gl->gl_spin);
-		} else {
-			spin_unlock(&gl->gl_spin);
-			set_current_state(TASK_UNINTERRUPTIBLE);
-			schedule_timeout(HZ / 10);
-			spin_lock(&gl->gl_spin);
-		}
-	}
-
-	spin_unlock(&gl->gl_spin);
-}
-
-/**
- * glock_wait_internal - wait on a glock acquisition
- * @gh: the glock holder
- *
- * Returns: 0 on success
- */
-
-static int
-glock_wait_internal(struct gfs_holder *gh)
-{
-	struct gfs_glock *gl = gh->gh_gl;
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct gfs_glock_operations *glops = gl->gl_ops;
-	int error = 0;
-
-	if (test_bit(HIF_ABORTED, &gh->gh_iflags))
-		return -EIO;
-
-	if (gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB)) {
-		spin_lock(&gl->gl_spin);
-		if (gl->gl_req_gh != gh &&
-		    !test_bit(HIF_HOLDER, &gh->gh_iflags) &&
-		    !list_empty(&gh->gh_list)) {
-			list_del_init(&gh->gh_list);
-			gh->gh_error = GLR_TRYFAILED;
-			if (test_bit(HIF_RECURSE, &gh->gh_iflags))
-				do_unrecurse(gh);
-			run_queue(gl);
-			spin_unlock(&gl->gl_spin);
-			return GLR_TRYFAILED;
-		}
-		spin_unlock(&gl->gl_spin);
-	}
-
-	if ((gh->gh_flags & LM_FLAG_PRIORITY) &&
-	    !(gh->gh_flags & GL_NOCANCEL_OTHER))
-		do_cancels(gh);
-
-	wait_for_completion(&gh->gh_wait);
-
-	if (gh->gh_error)
-		return gh->gh_error;
-
-	gfs_assert_withdraw(sdp, test_bit(HIF_HOLDER, &gh->gh_iflags));
-	gfs_assert_withdraw(sdp, relaxed_state_ok(gl->gl_state,
-						  gh->gh_state,
-						  gh->gh_flags));
-
-	if (test_bit(HIF_FIRST, &gh->gh_iflags)) {
-		gfs_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags));
-
-		if (glops->go_lock) {
-			error = glops->go_lock(gl, gh->gh_flags);
-			if (error) {
-				spin_lock(&gl->gl_spin);
-				list_del_init(&gh->gh_list);
-				gh->gh_error = error;
-				if (test_and_clear_bit(HIF_RECURSE, &gh->gh_iflags))
-					do_unrecurse(gh);
-				spin_unlock(&gl->gl_spin);
-			}
-		}
-
-		spin_lock(&gl->gl_spin);
-		gl->gl_req_gh = NULL;
-		gl->gl_req_bh = NULL;
-		clear_bit(GLF_LOCK, &gl->gl_flags);
-		if (test_bit(HIF_RECURSE, &gh->gh_iflags))
-			handle_recurse(gh);
-		run_queue(gl);
-		spin_unlock(&gl->gl_spin);
-	}
-
-	return error;
-}
-
-/**
- * add_to_queue - Add a holder to the wait-for-promotion queue or holder list
- *       (according to recursion)
- * @gh: the holder structure to add
- *
- * If the hold requestor's process already has a granted lock (on holder list),
- *   and this new request is compatible, go ahead and grant it, adding this
- *   new holder to the glock's holder list. 
- *
- * If the hold requestor's process has earlier requested a lock, and is still
- *   waiting for it to be granted, and this new request is compatible with
- *   the earlier one, they can be handled at the same time when the request
- *   is finally granted.  Mark both (all) with RECURSE flags, and add new
- *   holder to wait-for-promotion queue.
- *
- * If there is no previous holder from this process (on holder list or wait-
- *   for-promotion queue), simply add new holder to wait-for-promotion queue.
- */
-
-static void
-add_to_queue(struct gfs_holder *gh)
-{
-	struct gfs_glock *gl = gh->gh_gl;
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct list_head *tmp, *head;
-	struct gfs_holder *tmp_gh;
-
-	if (gh->gh_owner) {
-		/* Search through glock's holders list to see if this process
-		     already holds a granted lock. */
-		for (head = &gl->gl_holders, tmp = head->next;
-		     tmp != head;
-		     tmp = tmp->next) {
-			tmp_gh = list_entry(tmp, struct gfs_holder, gh_list);
-			if (tmp_gh->gh_owner == gh->gh_owner) {
-				/* Make sure pre-existing holder is compatible
-				   with this new one. */
-				if (gfs_assert_warn(sdp, (gh->gh_flags & LM_FLAG_ANY) ||
-						    !(tmp_gh->gh_flags & LM_FLAG_ANY)) ||
-				    gfs_assert_warn(sdp, (tmp_gh->gh_flags & GL_LOCAL_EXCL) ||
-						    !(gh->gh_flags & GL_LOCAL_EXCL)) ||
-				    gfs_assert_warn(sdp, relaxed_state_ok(gl->gl_state,
-									  gh->gh_state,
-									  gh->gh_flags)))
-					goto fail;
-
-				/* We're good!  Grant the hold. */
-				list_add_tail(&gh->gh_list, &gl->gl_holders);
-				set_bit(HIF_HOLDER, &gh->gh_iflags);
-
-				gh->gh_error = 0;
-				complete(&gh->gh_wait);
-
-				return;
-			}
-		}
-
-		/* If not, Search through glock's wait-for-promotion list to
-		   see if this process already is waiting for a grant. */
-		for (head = &gl->gl_waiters3, tmp = head->next;
-		     tmp != head;
-		     tmp = tmp->next) {
-			tmp_gh = list_entry(tmp, struct gfs_holder, gh_list);
-			if (tmp_gh->gh_owner == gh->gh_owner) {
-				/* Yes, make sure it is compatible with new */
-				if (gfs_assert_warn(sdp, test_bit(HIF_PROMOTE,
-								  &tmp_gh->gh_iflags)) ||
-				    gfs_assert_warn(sdp, (gh->gh_flags & LM_FLAG_ANY) ||
-						    !(tmp_gh->gh_flags & LM_FLAG_ANY)) ||
-				    gfs_assert_warn(sdp, (tmp_gh->gh_flags & GL_LOCAL_EXCL) ||
-						    !(gh->gh_flags & GL_LOCAL_EXCL)) ||
-				    gfs_assert_warn(sdp, relaxed_state_ok(tmp_gh->gh_state,
-									  gh->gh_state,
-									  gh->gh_flags)))
-					goto fail;
-
-				/* OK, make sure they're marked, so
-				 * when one gets granted, the other will too. */
-				set_bit(HIF_RECURSE, &gh->gh_iflags);
-				set_bit(HIF_RECURSE, &tmp_gh->gh_iflags);
-
-				list_add_tail(&gh->gh_list, &gl->gl_waiters3);
-
-				return;
-			}
-		}
-	}
-
-	/* Else, no recursion ...
-	   If high priority request, add to head of promote queue, else tail */
-	if (gh->gh_flags & LM_FLAG_PRIORITY)
-		list_add(&gh->gh_list, &gl->gl_waiters3);
-	else
-		list_add_tail(&gh->gh_list, &gl->gl_waiters3);
-
-	return;
-
- fail:
-	set_bit(HIF_ABORTED, &gh->gh_iflags);
-}
-
-/**
- * gfs_glock_nq - enqueue a struct gfs_holder onto a glock (acquire a glock)
- * @gh: the holder structure
- *
- * if (gh->gh_flags & GL_ASYNC), this never returns an error
- *
- * Returns: 0, GLR_TRYFAILED, or errno on failure
- *
- * Rules:
- *   @gh must not be already attached to a glock.
- *   Don't ask for UNLOCKED state (use gfs_glock_dq() for that).
- *   LM_FLAG_ANY (liberal) and GL_EXACT (restrictive) are mutually exclusive.
- */
-
-int
-gfs_glock_nq(struct gfs_holder *gh)
-{
-	struct gfs_glock *gl = gh->gh_gl;
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	int error = 0;
-
-	atomic_inc(&sdp->sd_glock_nq_calls);
-
- restart:
-	if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) ||
-	    gfs_assert_warn(sdp, list_empty(&gh->gh_list)) ||
-	    gfs_assert_warn(sdp, gh->gh_state != LM_ST_UNLOCKED) ||
-	    gfs_assert_warn(sdp, (gh->gh_flags & (LM_FLAG_ANY | GL_EXACT)) !=
-			    (LM_FLAG_ANY | GL_EXACT))) {
-		set_bit(HIF_ABORTED, &gh->gh_iflags);
-		return -EIO;
-	}
-
-	set_bit(HIF_PROMOTE, &gh->gh_iflags);
-
-	spin_lock(&gl->gl_spin);
-	add_to_queue(gh);
-	run_queue(gl);
-	spin_unlock(&gl->gl_spin);
-
-	if (!(gh->gh_flags & GL_ASYNC)) {
-		error = glock_wait_internal(gh);
-		if (error == GLR_CANCELED) {
-			set_current_state(TASK_UNINTERRUPTIBLE);
-			schedule_timeout(HZ);
-			goto restart;
-		}
-	}
-
-	clear_bit(GLF_PREFETCH, &gl->gl_flags);
-
-	return error;
-}
-
-/**
- * gfs_glock_poll - poll to see if an async request has been completed
- * @gh: the holder
- *
- * Returns: TRUE if the request is ready to be gfs_glock_wait()ed on
- */
-
-int
-gfs_glock_poll(struct gfs_holder *gh)
-{
-	struct gfs_glock *gl = gh->gh_gl;
-	int ready = FALSE;
-
-	gfs_assert_warn(gl->gl_sbd, gh->gh_flags & GL_ASYNC);
-
-	spin_lock(&gl->gl_spin);
-
-	if (test_bit(HIF_HOLDER, &gh->gh_iflags))
-		ready = TRUE;
-	else if (list_empty(&gh->gh_list)) {
-		if (gh->gh_error == GLR_CANCELED) {
-			spin_unlock(&gl->gl_spin);
-			set_current_state(TASK_UNINTERRUPTIBLE);
-			schedule_timeout(HZ);
-			if (gfs_glock_nq(gh))
-				return TRUE;
-			return FALSE;
-		} else
-			ready = TRUE;
-	}
-
-	spin_unlock(&gl->gl_spin);
-
-	return ready;
-}
-
-/**
- * gfs_glock_wait - wait for a lock acquisition that ended in a GLR_ASYNC
- * @gh: the holder structure
- *
- * Returns: 0, GLR_TRYFAILED, or errno on failure
- */
-
-int
-gfs_glock_wait(struct gfs_holder *gh)
-{
-	struct gfs_glock *gl = gh->gh_gl;
-	int error;
-
-        gfs_assert_warn(gl->gl_sbd, gh->gh_flags & GL_ASYNC);
-
-	error = glock_wait_internal(gh);
-	if (error == GLR_CANCELED) {
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(HZ);
-		gh->gh_flags &= ~GL_ASYNC;
-		error = gfs_glock_nq(gh);
-	}
-
-	return error;
-}
-
-/**
- * gfs_glock_dq - dequeue a struct gfs_holder from a glock (release a glock)
- * @gh: the glock holder
- *
- * This releases a local process' hold on a glock, and services other waiters.
- * If this is the last holder on this node, calls glock operation go_unlock(),
- *    and go_sync() if requested by glock's GL_SYNC flag.
- * If glock's GL_NOCACHE flag is set, requests demotion to unlock the inter-
- *    node lock now, rather than caching the glock for later use.
- * Otherwise, this function does *not* release the glock at inter-node scope.
- *   The glock will stay in glock cache until:
- *   --  This node uses it again (extending residence in glock cache), or
- *   --  Another node asks (via callback) for the lock, or
- *   --  The glock sits unused in glock cache for a while, and the cleanup
- *         daemons (gfs_scand and gfs_glockd) reclaim it.
- */
-
-void
-gfs_glock_dq(struct gfs_holder *gh)
-{
-	struct gfs_glock *gl = gh->gh_gl;
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct gfs_glock_operations *glops = gl->gl_ops;
-
-	atomic_inc(&gl->gl_sbd->sd_glock_dq_calls);
-
-	gfs_assert_withdraw(sdp, !queue_empty(gl, &gh->gh_list));
-	gfs_assert_withdraw(sdp, test_bit(HIF_HOLDER, &gh->gh_iflags));
-
-	if (gh->gh_flags & GL_SYNC)
-		set_bit(GLF_SYNC, &gl->gl_flags);
-
-	/* Don't cache glock; request demote to unlock at inter-node scope */
-	if (gh->gh_flags & GL_NOCACHE && gl->gl_holders.next == &gh->gh_list &&
-	    gl->gl_holders.prev == &gh->gh_list)
-		/* There's a race here.  If there are two holders, and both
- 		 * are dq'ed at almost the same time, you can't guarantee that
- 		 * you will call handle_callback. Fixing this will require
- 		 * some refactoring */
-		handle_callback(gl, LM_ST_UNLOCKED);
-
-	lock_on_glock(gl);
-
-	spin_lock(&gl->gl_spin);
-	list_del_init(&gh->gh_list);
-
-	/* If last holder, do appropriate glock operations, set cache timer */
-	if (list_empty(&gl->gl_holders)) {
-		spin_unlock(&gl->gl_spin);
-
-		if (glops->go_unlock)
-			glops->go_unlock(gl, gh->gh_flags);
-
-		/* Do "early" sync, if requested by holder */
-		if (test_bit(GLF_SYNC, &gl->gl_flags)) {
-			if (glops->go_sync)
-				glops->go_sync(gl,
-					       DIO_METADATA |
-					       DIO_DATA |
-					       DIO_INVISIBLE);
-		}
-
-		gl->gl_stamp = jiffies;
-
-		spin_lock(&gl->gl_spin);
-	}
-
-	clear_bit(GLF_LOCK, &gl->gl_flags);
-	run_queue(gl);
-	spin_unlock(&gl->gl_spin);
-}
-
-/**
- * gfs_glock_prefetch - Try to prefetch a glock
- * @gl: the glock
- * @state: the state to prefetch in 
- * @flags: flags passed to go_xmote_th()
- *
- * Bypass request queues of glock (i.e. no holder involved), and directly call
- *   go_xmote_th() to ask lock module for lock, to put in glock cache for
- *   later use.
- *
- * Will not prefetch the lock (no need to) if a process on this node is already
- *   interested in the lock, or if it's sitting in glock cache in a compatible
- *   state.
- *
- * Rules:
- *   Don't ask for UNLOCKED state (use gfs_glock_dq() for that).
- *   LM_FLAG_ANY (liberal) and GL_EXACT (restrictive) are mutually exclusive.
- */
-
-void
-gfs_glock_prefetch(struct gfs_glock *gl, unsigned int state, int flags)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct gfs_glock_operations *glops = gl->gl_ops;
-
-	if (gfs_assert_warn(sdp, state != LM_ST_UNLOCKED) ||
-	    gfs_assert_warn(sdp, (flags & (LM_FLAG_ANY | GL_EXACT)) !=
-			    (LM_FLAG_ANY | GL_EXACT)))
-		return;
-
-	spin_lock(&gl->gl_spin);
-
-	/* Should we prefetch? */
-	if (test_bit(GLF_LOCK, &gl->gl_flags) ||
-	    !list_empty(&gl->gl_holders) ||
-	    !list_empty(&gl->gl_waiters1) ||
-	    !list_empty(&gl->gl_waiters2) ||
-	    !list_empty(&gl->gl_waiters3) ||
-	    relaxed_state_ok(gl->gl_state, state, flags)) {
-		spin_unlock(&gl->gl_spin);
-		return;
-	}
-
-	/* Let bottom half know we're prefetching, ask lock module for lock */
-	set_bit(GLF_PREFETCH, &gl->gl_flags);
-
-	if (gfs_assert_warn(sdp, !gl->gl_req_gh))
-		gl->gl_req_gh = NULL;
-	set_bit(GLF_LOCK, &gl->gl_flags);
-	spin_unlock(&gl->gl_spin);
-
-	glops->go_xmote_th(gl, state, flags);
-
-	atomic_inc(&gl->gl_sbd->sd_glock_prefetch_calls);
-}
-
-/**
- * gfs_glock_force_drop - Force a glock to be uncached
- * @gl: the glock
- *
- */
-
-void
-gfs_glock_force_drop(struct gfs_glock *gl)
-{
-	struct gfs_holder gh;
-
-	gfs_holder_init(gl, LM_ST_UNLOCKED, 0, &gh);
-	set_bit(HIF_DEMOTE, &gh.gh_iflags);
-	gh.gh_owner = NULL;
-
-	spin_lock(&gl->gl_spin);
-	list_add_tail(&gh.gh_list, &gl->gl_waiters2);
-	run_queue(gl);
-	spin_unlock(&gl->gl_spin);
-
-	wait_for_completion(&gh.gh_wait);
-	gfs_holder_uninit(&gh);
-}
-
-/**
- * greedy_work -
- * @data:
- *
- */
-
-static void
-greedy_work(struct work_struct *work)
-{
-	struct greedy *gr = container_of(work, struct greedy, gr_work.work);
-	struct gfs_holder *gh = &gr->gr_gh;
-	struct gfs_glock *gl = gh->gh_gl;
-	struct gfs_glock_operations *glops = gl->gl_ops;
-
-	clear_bit(GLF_SKIP_WAITERS2, &gl->gl_flags);
-
-	if (glops->go_greedy)
-		glops->go_greedy(gl);
-
-	spin_lock(&gl->gl_spin);
-
-	if (list_empty(&gl->gl_waiters2)) {
-		clear_bit(GLF_GREEDY, &gl->gl_flags);
-		spin_unlock(&gl->gl_spin);
-		gfs_holder_uninit(gh);
-		kfree(gr);
-	} else {
-		glock_hold(gl);
-		list_add_tail(&gh->gh_list, &gl->gl_waiters2);
-		run_queue(gl);
-		spin_unlock(&gl->gl_spin);
-		glock_put(gl);
-	}
-}
-
-/**
- * gfs_glock_be_greedy -
- * @gl:
- * @time:
- *
- * Returns: 0 if go_greedy will be called, 1 otherwise
- */
-
-int
-gfs_glock_be_greedy(struct gfs_glock *gl, unsigned int time)
-{
-	struct greedy *gr;
-	struct gfs_holder *gh;
-
-	if (!time ||
-	    gl->gl_sbd->sd_args.ar_localcaching ||
-	    test_and_set_bit(GLF_GREEDY, &gl->gl_flags))
-		return 1;
-
-	gr = kmalloc(sizeof(struct greedy), GFP_KERNEL);
-	if (!gr) {
-		clear_bit(GLF_GREEDY, &gl->gl_flags);
-		return 1;
-	}
-	gh = &gr->gr_gh;
-
-	gfs_holder_init(gl, 0, 0, gh);
-	set_bit(HIF_GREEDY, &gh->gh_iflags);
-	gh->gh_owner = NULL;
-	INIT_DELAYED_WORK(&gr->gr_work, greedy_work);
-
-	set_bit(GLF_SKIP_WAITERS2, &gl->gl_flags);
-	schedule_delayed_work(&gr->gr_work, time);
-
-	return 0;
-}
-
-/**
- * gfs_glock_nq_init - intialize a holder and enqueue it on a glock
- * @gl: the glock 
- * @state: the state we're requesting
- * @flags: the modifier flags
- * @gh: the holder structure
- *
- * Returns: 0, GLR_*, or errno
- */
-
-int
-gfs_glock_nq_init(struct gfs_glock *gl, unsigned int state, int flags,
-		  struct gfs_holder *gh)
-{
-	int error;
-
-	gfs_holder_init(gl, state, flags, gh);
-
-	error = gfs_glock_nq(gh);
-	if (error)
-		gfs_holder_uninit(gh);
-
-	return error;
-}
-
-/**
- * gfs_glock_dq_uninit - dequeue a holder from a glock and initialize it
- * @gh: the holder structure
- *
- */
-
-void
-gfs_glock_dq_uninit(struct gfs_holder *gh)
-{
-	gfs_glock_dq(gh);
-	gfs_holder_uninit(gh);
-}
-
-/**
- * gfs_glock_nq_num - acquire a glock based on lock number
- * @sdp: the filesystem
- * @number: the lock number
- * @glops: the glock operations for the type of glock
- * @state: the state to acquire the glock in
- * @flags: modifier flags for the aquisition
- * @gh: the struct gfs_holder
- *
- * Returns: errno
- */
-
-int
-gfs_glock_nq_num(struct gfs_sbd *sdp,
-		 uint64_t number, struct gfs_glock_operations *glops,
-		 unsigned int state, int flags, struct gfs_holder *gh)
-{
-	struct gfs_glock *gl;
-	int error;
-
-	error = gfs_glock_get(sdp, number, glops, CREATE, &gl);
-	if (!error) {
-		error = gfs_glock_nq_init(gl, state, flags, gh);
-		glock_put(gl);
-	}
-
-	return error;
-}
-
-/**
- * glock_compare - Compare two struct gfs_glock structures for sorting
- * @arg_a: the first structure
- * @arg_b: the second structure
- *
- */
-
-static int
-glock_compare(const void *arg_a, const void *arg_b)
-{
-	struct gfs_holder *gh_a = *(struct gfs_holder **)arg_a;
-	struct gfs_holder *gh_b = *(struct gfs_holder **)arg_b;
-	struct lm_lockname *a = &gh_a->gh_gl->gl_name;
-	struct lm_lockname *b = &gh_b->gh_gl->gl_name;
-	int ret = 0;
-
-	if (a->ln_number > b->ln_number)
-		ret = 1;
-	else if (a->ln_number < b->ln_number)
-		ret = -1;
-	else {
-		if (gh_a->gh_state == LM_ST_SHARED &&
-		    gh_b->gh_state == LM_ST_EXCLUSIVE)
-			ret = 1;
-		else if (!(gh_a->gh_flags & GL_LOCAL_EXCL) &&
-			 (gh_b->gh_flags & GL_LOCAL_EXCL))
-			ret = 1;
-	}
-
-	return ret;
-}
-
-/**
- * nq_m_sync - synchonously acquire more than one glock in deadlock free order
- * @num_gh: the number of structures
- * @ghs: an array of struct gfs_holder structures
- *
- * Returns: 0 on success (all glocks acquired), errno on failure (no glocks acquired)
- */
-
-static int
-nq_m_sync(unsigned int num_gh, struct gfs_holder *ghs, struct gfs_holder **p)
-{
-	unsigned int x;
-	int error = 0;
-
-	for (x = 0; x < num_gh; x++)
-		p[x] = &ghs[x];
-
-	gfs_sort(p, num_gh, sizeof(struct gfs_holder *), glock_compare);
-
-	for (x = 0; x < num_gh; x++) {
-		p[x]->gh_flags &= ~(LM_FLAG_TRY | GL_ASYNC);
-
-		error = gfs_glock_nq(p[x]);
-		if (error) {
-			while (x--)
-				gfs_glock_dq(p[x]);
-			break;
-		}
-	}
-
-	return error;
-}
-
-/**
- * gfs_glock_nq_m - acquire multiple glocks
- * @num_gh: the number of structures
- * @ghs: an array of struct gfs_holder structures
- *
- * Figure out how big an impact this function has.  Either:
- * 1) Replace this code with code that calls gfs_glock_prefetch()
- * 2) Forget async stuff and just call nq_m_sync()
- * 3) Leave it like it is
- *
- * Returns: 0 on success (all glocks acquired), errno on failure (no glocks acquired)
- */
-
-int
-gfs_glock_nq_m(unsigned int num_gh, struct gfs_holder *ghs)
-{
-	int *e;
-	unsigned int x;
-	int borked = FALSE, serious = 0;
-	int error = 0;
-
-	if (!num_gh)
-		return 0;
-
-	/* For just one gh, do request synchronously */
-	if (num_gh == 1) {
-		ghs->gh_flags &= ~(LM_FLAG_TRY | GL_ASYNC);
-		return gfs_glock_nq(ghs);
-	}
-
-	/* using sizeof(struct gfs_holder *) instead of sizeof(int), because
-	 * we're also using this memory for nq_m_sync and ints should never be
-	 * larger than pointers.... I hope
-	 */
-	e = kmalloc(num_gh * sizeof(struct gfs_holder *), GFP_KERNEL);
-	if (!e)
-		return -ENOMEM;
-
-	/* Send off asynchronous requests */
-	for (x = 0; x < num_gh; x++) {
-		ghs[x].gh_flags |= LM_FLAG_TRY | GL_ASYNC;
-		error = gfs_glock_nq(&ghs[x]);
-		if (error) {
-			borked = TRUE;
-			serious = error;
-			num_gh = x;
-			break;
-		}
-	}
-
-	/* Wait for all to complete */
-	for (x = 0; x < num_gh; x++) {
-		error = e[x] = glock_wait_internal(&ghs[x]);
-		if (error) {
-			borked = TRUE;
-			if (error != GLR_TRYFAILED && error != GLR_CANCELED)
-				serious = error;
-		}
-	}
-
-	/* If all good, done! */
-	if (!borked) {
-		kfree(e);
-		return 0;
-	}
-
-	for (x = 0; x < num_gh; x++)
-		if (!e[x])
-			gfs_glock_dq(&ghs[x]);
-
-	if (serious)
-		error = serious;
-	else {
-		for (x = 0; x < num_gh; x++)
-			gfs_holder_reinit(ghs[x].gh_state, ghs[x].gh_flags,
-					  &ghs[x]);
-		error = nq_m_sync(num_gh, ghs, (struct gfs_holder **)e);
-	}
-
-	kfree(e);
-	return error;
-}
-
-/**
- * gfs_glock_dq_m - release multiple glocks
- * @num_gh: the number of structures
- * @ghs: an array of struct gfs_holder structures
- *
- */
-
-void
-gfs_glock_dq_m(unsigned int num_gh, struct gfs_holder *ghs)
-{
-	unsigned int x;
-
-	for (x = 0; x < num_gh; x++)
-		gfs_glock_dq(&ghs[x]);
-}
-
-/**
- * gfs_glock_prefetch_num - prefetch a glock based on lock number
- * @sdp: the filesystem
- * @number: the lock number
- * @glops: the glock operations for the type of glock
- * @state: the state to acquire the glock in
- * @flags: modifier flags for the aquisition
- *
- * Returns: errno
- */
-
-void
-gfs_glock_prefetch_num(struct gfs_sbd *sdp,
-		       uint64_t number, struct gfs_glock_operations *glops,
-		       unsigned int state, int flags)
-{
-	struct gfs_glock *gl;
-	int error;
-
-	if (atomic_read(&sdp->sd_reclaim_count) < gfs_tune_get(sdp, gt_reclaim_limit)) {
-		error = gfs_glock_get(sdp, number, glops, CREATE, &gl);
-		if (!error) {
-			gfs_glock_prefetch(gl, state, flags);
-			glock_put(gl);
-		}
-	}
-}
-
-/**
- * gfs_lvb_hold - attach a LVB from a glock
- * @gl: The glock in question
- *
- */
-
-int
-gfs_lvb_hold(struct gfs_glock *gl)
-{
-	int error;
-
-	lock_on_glock(gl);
-
-	if (!atomic_read(&gl->gl_lvb_count)) {
-		gfs_assert_warn(gl->gl_sbd, !gl->gl_lvb);
-		error = gfs_lm_hold_lvb(gl->gl_sbd, gl->gl_lock, &gl->gl_lvb);
-		if (error) {
-			unlock_on_glock(gl);
-			return error;
-		}
-		glock_hold(gl);
-	}
-	atomic_inc(&gl->gl_lvb_count);
-
-	unlock_on_glock(gl);
-
-	return 0;
-}
-
-/**
- * gfs_lvb_unhold - detach a LVB from a glock
- * @gl: The glock in question
- * 
- */
-
-void
-gfs_lvb_unhold(struct gfs_glock *gl)
-{
-	glock_hold(gl);
-
-	lock_on_glock(gl);
-
-	if (!gfs_assert_warn(gl->gl_sbd, atomic_read(&gl->gl_lvb_count) > 0) &&
-	    atomic_dec_and_test(&gl->gl_lvb_count)) {
-		gfs_assert_warn(gl->gl_sbd, gl->gl_lvb);
-		gfs_lm_unhold_lvb(gl->gl_sbd, gl->gl_lock, gl->gl_lvb);
-		gl->gl_lvb = NULL;
-		glock_put(gl);
-	}
-
-	unlock_on_glock(gl);
-
-	glock_put(gl);
-}
-
-#if 0
-/**
- * gfs_lvb_sync - sync a LVB
- * @gl: The glock in question
- * 
- */
-
-void
-gfs_lvb_sync(struct gfs_glock *gl)
-{
-	if (gfs_assert_warn(gl->gl_sbd, atomic_read(&gl->gl_lvb_count)))
-		return;
-
-	lock_on_glock(gl);
-
-	if (!gfs_assert_warn(gl->gl_sbd, gfs_glock_is_held_excl(gl)))
-		gfs_lm_sync_lvb(gl->gl_sbd, gl->gl_lock, gl->gl_lvb);
-
-	unlock_on_glock(gl);
-}
-#endif
-
-/**
- * blocking_cb -
- * @sdp:
- * @name:
- * @state:
- *
- */
-
-void
-blocking_cb(struct gfs_sbd *sdp, struct lm_lockname *name, unsigned int state)
-{
-	struct gfs_glock *gl;
-
-	gl = gfs_glock_find(sdp, name);
-	if (!gl)
-		return;
-
-	if (gl->gl_ops->go_callback)
-		gl->gl_ops->go_callback(gl, state);
-	handle_callback(gl, state);
-
-	spin_lock(&gl->gl_spin);
-	run_queue(gl);
-	spin_unlock(&gl->gl_spin);
-
-	glock_put(gl);
-}
-
-/**
- * gfs_glock_cb - Callback used by locking module
- * @fsdata: Pointer to the superblock
- * @type: Type of callback
- * @data: Type dependent data pointer
- *
- * Called by the locking module when it wants to tell us something.
- * Either we need to drop a lock, one of our ASYNC requests completed, or
- *   another client expired (crashed/died) and we need to recover its journal.
- * If another node needs a lock held by this node, we queue a request to demote
- *   our lock to a state compatible with that needed by the other node.  
- *   For example, if the other node needs EXCLUSIVE, we request UNLOCKED.
- *   SHARED and DEFERRED modes can be shared with other nodes, so we request
- *   accordingly.
- * Once all incompatible holders on this node are done with the lock, the
- *   queued request will cause run_queue() to call the lock module to demote
- *   our lock to a compatible state, allowing the other node to grab the lock.
- */
-
-void
-gfs_glock_cb(void *fsdata, unsigned int type, void *data)
-{
-	struct gfs_sbd *sdp = fsdata;
-
-	atomic_inc(&sdp->sd_lm_callbacks);
-
-	switch (type) {
-	case LM_CB_NEED_E:
-		blocking_cb(sdp, (struct lm_lockname *)data, LM_ST_UNLOCKED);
-		return;
-
-	case LM_CB_NEED_D:
-		blocking_cb(sdp, (struct lm_lockname *)data, LM_ST_DEFERRED);
-		return;
-
-	case LM_CB_NEED_S:
-		blocking_cb(sdp, (struct lm_lockname *)data, LM_ST_SHARED);
-		return;
-
-	case LM_CB_ASYNC: {
-		struct lm_async_cb *async = (struct lm_async_cb *)data;
-		struct gfs_glock *gl;
-
-		gl = gfs_glock_find(sdp, &async->lc_name);
-		if (gfs_assert_warn(sdp, gl))
-			return;
-		if (!gfs_assert_warn(sdp, gl->gl_req_bh))
-			gl->gl_req_bh(gl, async->lc_ret);
-		glock_put(gl);
-
-		return;
-	}
-
-	case LM_CB_NEED_RECOVERY:
-		gfs_add_dirty_j(sdp, *(unsigned int *)data);
-		if (sdp->sd_recoverd_process)
-			wake_up_process(sdp->sd_recoverd_process);
-		return;
-
-	case LM_CB_DROPLOCKS:
-		gfs_gl_hash_clear(sdp, FALSE);
-		gfs_quota_scan(sdp);
-		return;
-
-	default:
-		gfs_assert_warn(sdp, FALSE);
-		return;
-	}
-}
-
-/**
- * gfs_try_toss_inode - try to remove a particular GFS inode struct from cache
- * sdp: the filesystem
- * inum: the inode number
- *
- * Look for the glock protecting the inode of interest.
- * If no process is manipulating or holding the glock, see if the glock
- *   has a gfs_inode attached.
- * If gfs_inode has no references, unhold its iopen glock, release any
- *   indirect addressing buffers, and destroy the gfs_inode.
- */
-
-void
-gfs_try_toss_inode(struct gfs_sbd *sdp, struct gfs_inum *inum)
-{
-	struct gfs_glock *gl;
-	struct gfs_inode *ip;
-	int error;
-
-	error = gfs_glock_get(sdp,
-			      inum->no_formal_ino, &gfs_inode_glops,
-			      NO_CREATE, &gl);
-	if (error || !gl)
-		return;
-
-	if (!trylock_on_glock(gl))
-		goto out;
-
-	if (!queue_empty(gl, &gl->gl_holders))
-		goto out_unlock;
-
-	ip = get_gl2ip(gl);
-	if (!ip)
-		goto out_unlock;
-
-	if (atomic_read(&ip->i_count))
-		goto out_unlock;
-
-	gfs_inode_destroy(ip);
-
- out_unlock:
-	unlock_on_glock(gl);
-
- out:
-	glock_put(gl);
-}
-
-/**
- * gfs_iopen_go_callback - Try to kick the inode/vnode associated with an iopen glock from memory
- * @io_gl: the iopen glock
- * @state: the state into which the glock should be put
- *
- */
-
-void
-gfs_iopen_go_callback(struct gfs_glock *io_gl, unsigned int state)
-{
-	struct gfs_glock *i_gl;
-	struct gfs_inode *ip;
-
-	if (state != LM_ST_UNLOCKED)
-		return;
-
-	spin_lock(&io_gl->gl_spin);
-	i_gl = get_gl2gl(io_gl);
-	if (i_gl) {
-		glock_hold(i_gl);
-		spin_unlock(&io_gl->gl_spin);
-	} else {
-		spin_unlock(&io_gl->gl_spin);
-		return;
-	}
-
-	if (trylock_on_glock(i_gl)) {
-		if (queue_empty(i_gl, &i_gl->gl_holders)) {
-			ip = get_gl2ip(i_gl);
-			if (ip) {
-				gfs_try_toss_vnode(ip);
-				unlock_on_glock(i_gl);
-				gfs_glock_schedule_for_reclaim(i_gl);
-				goto out;
-			}
-		}
-		unlock_on_glock(i_gl);
-	}
-
- out:
-	glock_put(i_gl);
-}
-
-/**
- * demote_ok - Check to see if it's ok to unlock a glock (to remove it
- *       from glock cache)
- * @gl: the glock
- *
- * Called when trying to reclaim glocks, once it's determined that the glock
- *   has no holders on this node.
- *
- * Returns: TRUE if it's ok
- *
- * It's not okay if:
- * --  glock is STICKY
- * --  PREFETCHed glock has not been given enough chance to be used
- * --  glock-type-specific test says "no"
- */
-
-static int
-demote_ok(struct gfs_glock *gl)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct gfs_glock_operations *glops = gl->gl_ops;
-	int demote = TRUE;
-
-	if (test_bit(GLF_STICKY, &gl->gl_flags))
-		demote = FALSE;
-	else if (test_bit(GLF_PREFETCH, &gl->gl_flags))
-		demote = time_after_eq(jiffies,
-				       gl->gl_stamp +
-				       gfs_tune_get(sdp, gt_prefetch_secs) * HZ);
-	else if (glops->go_demote_ok)
-		demote = glops->go_demote_ok(gl);
-
-	return demote;
-}
-
-/**
- * gfs_glock_schedule_for_reclaim - Add a glock to the reclaim list
- * @gl: the glock
- *
- */
-
-void
-gfs_glock_schedule_for_reclaim(struct gfs_glock *gl)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-
-	spin_lock(&sdp->sd_reclaim_lock);
-	if (list_empty(&gl->gl_reclaim)) {
-		glock_hold(gl);
-		list_add(&gl->gl_reclaim, &sdp->sd_reclaim_list);
-		atomic_inc(&sdp->sd_reclaim_count);
-	}
-	spin_unlock(&sdp->sd_reclaim_lock);
-
-	wake_up(&sdp->sd_reclaim_wchan);
-}
-
-/**
- * gfs_reclaim_glock - process the next glock on the filesystem's reclaim list
- * @sdp: the filesystem
- *
- * Called from gfs_glockd() glock reclaim daemon, or when promoting a
- *   (different) glock and we notice that there are a lot of glocks in the
- *   reclaim list.
- *
- * Remove glock from filesystem's reclaim list, update reclaim statistics.
- * If no holders (might have gotten added since glock was placed on reclaim
- *   list):
- *   --  Destroy any now-unused inode protected by glock
- *         (and release hold on iopen glock).
- *   --  Ask for demote to UNLOCKED to enable removal of glock from glock cache.
- *
- * If no further interest in glock struct, remove it from glock cache, and
- *   free it from memory.  (During normal operation, this is the only place
- *   that this is done).
- *
- * Glock-type-specific considerations for permission to demote are handled
- *   in demote_ok().  This includes how long to retain a glock in cache after it
- *   is no longer held by any process.
- */
-
-void
-gfs_reclaim_glock(struct gfs_sbd *sdp)
-{
-	struct gfs_glock *gl;
-	struct gfs_gl_hash_bucket *bucket;
-
-	spin_lock(&sdp->sd_reclaim_lock);
-
-	/* Nothing to reclaim?  Done! */
-	if (list_empty(&sdp->sd_reclaim_list)) {
-		spin_unlock(&sdp->sd_reclaim_lock);
-		return;
-	}
-
-	/* Remove next victim from reclaim list */
-	gl = list_entry(sdp->sd_reclaim_list.next,
-			struct gfs_glock, gl_reclaim);
-	list_del_init(&gl->gl_reclaim);
-
-	spin_unlock(&sdp->sd_reclaim_lock);
-
-	atomic_dec(&sdp->sd_reclaim_count);
-	atomic_inc(&sdp->sd_reclaimed);
-
-	if (trylock_on_glock(gl)) {
-		if (queue_empty(gl, &gl->gl_holders)) {
-			/* Inode glock-type-specific; free unused gfs inode,
-			   and release hold on iopen glock */
-			if (gl->gl_ops == &gfs_inode_glops) {
-				struct gfs_inode *ip = get_gl2ip(gl);
-				if (ip && !atomic_read(&ip->i_count))
-					gfs_inode_destroy(ip);
-			}
-			/* Generic (including inodes); try to unlock glock */
-			if (gl->gl_state != LM_ST_UNLOCKED &&
-			    demote_ok(gl))
-				handle_callback(gl, LM_ST_UNLOCKED);
-		}
-		unlock_on_glock(gl);
-	}
-
-	bucket = gl->gl_bucket;
-
-	/* If glock struct's only remaining reference is from being put on
-	   the reclaim list, remove glock from hash table (sd_gl_hash),
-	   and free the glock's memory */
-	write_lock(&bucket->hb_lock);
-	if (atomic_read(&gl->gl_count) == 1) {
-		list_del_init(&gl->gl_list);
-		write_unlock(&bucket->hb_lock);
-		glock_free(gl);
-	} else {
-		write_unlock(&bucket->hb_lock);
-		glock_put(gl);  /* see gfs_glock_schedule_for_reclaim() */
-	}
-}
-
-/**
- * examine_bucket - Call a function for glock in a hash bucket
- * @examiner: the function 
- * @sdp: the filesystem
- * @bucket: the bucket
- *
- * Returns: TRUE if the bucket has entries
- */
-
-static int
-examine_bucket(glock_examiner examiner,
-		struct gfs_sbd *sdp, struct gfs_gl_hash_bucket *bucket,
-		unsigned int *purge_nr)
-{
-	struct glock_plug plug;
-	struct list_head *tmp;
-	struct gfs_glock *gl;
-	int entries;
-
-	/* Add "plug" to end of bucket list, work back up list from there */
-	memset(&plug.gl_flags, 0, sizeof(unsigned long));
-	set_bit(GLF_PLUG, &plug.gl_flags);
-
-	write_lock(&bucket->hb_lock);
-	list_add(&plug.gl_list, &bucket->hb_list);
-	write_unlock(&bucket->hb_lock);
-
-	/* Look at each bucket entry */
-	for (;;) {
-		write_lock(&bucket->hb_lock);
-
-		/* Work back up list from plug */
-		for (;;) {
-			tmp = plug.gl_list.next;
-
-			/* Top of list; we're done */
-			if (tmp == &bucket->hb_list) {
-				list_del(&plug.gl_list);
-				entries = !list_empty(&bucket->hb_list);
-				write_unlock(&bucket->hb_lock);
-				return entries;
-			}
-			gl = list_entry(tmp, struct gfs_glock, gl_list);
-
-			/* Move plug up list */
-			list_move(&plug.gl_list, &gl->gl_list);
-
-			if (test_bit(GLF_PLUG, &gl->gl_flags))
-				continue;
-
-			/* glock_hold; examiner must glock_put() */
-			atomic_inc(&gl->gl_count);
-
-			break;
-		}
-
-		write_unlock(&bucket->hb_lock);
-
-		examiner(gl, purge_nr);
-	}
-}
-
-static void
-try_purge_iopen(struct gfs_glock *gl, unsigned int *p_count)
-{
-	struct gfs_glock *i_gl;
-
-	if (*p_count == 0)
-		return;
-
-	/* find the associated inode glock */
-	i_gl = get_gl2gl(gl);
-	if (!i_gl) 
-		return;
-
-	/* 
-	 * If the associated inode glock has been in unlocked 
-	 * state, try to purge it.
-	 */
-	if (trylock_on_glock(i_gl)) {
-		if (i_gl->gl_state == LM_ST_UNLOCKED) {
-			*p_count = *p_count - 1;
-			unlock_on_glock(i_gl);
-			atomic_inc(&gl->gl_count);
-			gfs_iopen_go_callback(gl, LM_ST_UNLOCKED);
-			handle_callback(gl, LM_ST_UNLOCKED);
-			spin_lock(&gl->gl_spin);
-			run_queue(gl);
-			spin_unlock(&gl->gl_spin);
-			glock_put(gl);
-		} else 
-			unlock_on_glock(i_gl);
-	}
-
-	return;
-}
-
-/**
- * scan_glock - look at a glock and see if we can reclaim it
- * @gl: the glock to look at
- *
- * Called via examine_bucket() when trying to release glocks from glock cache,
- *   during normal operation (i.e. not unmount time).
- * 
- * Place glock on filesystem's reclaim list if, on this node:
- * --  No process is manipulating glock struct, and
- * --  No current holders, and either:
- *     --  GFS incore inode, protected by glock, is no longer in use, or
- *     --  Glock-type-specific demote_ok glops gives permission
- */
-
-static void
-scan_glock(struct gfs_glock *gl,  unsigned int *p_count)
-{
-	if (trylock_on_glock(gl)) {
-		if (queue_empty(gl, &gl->gl_holders)) {
-			/* Inode glock-type-specific; reclaim glock if gfs inode
-			   no longer in use. */
-			if (gl->gl_ops == &gfs_inode_glops) {
-				struct gfs_inode *ip = get_gl2ip(gl);
-				if (ip && !atomic_read(&ip->i_count)) {
-					unlock_on_glock(gl);
-					gfs_glock_schedule_for_reclaim(gl);
-					goto out;
-				}
-			}
-			/* Generic (including inodes not scheduled above) */
-			if (gl->gl_state != LM_ST_UNLOCKED &&
-			    demote_ok(gl)) {
-				unlock_on_glock(gl);
-				gfs_glock_schedule_for_reclaim(gl);
-				goto out;
-			}
-		}
-		/* iopen always has holder(s) */
-		if (gl->gl_name.ln_type == LM_TYPE_IOPEN) {
-			unlock_on_glock(gl);
-			try_purge_iopen(gl, p_count);
-			goto out;
-		}
-		unlock_on_glock(gl);
-	}
-
- out:
-	glock_put(gl);  /* see examine_bucket() */
-}
-
-/**
- * gfs_scand_internal - Look for glocks and inodes to toss from memory
- * @sdp: the filesystem
- *
- * Invokes scan_glock() for each glock in each cache bucket.
- *
- * Steps of reclaiming a glock:
- * --  scan_glock() places eligible glocks on filesystem's reclaim list.
- * --  gfs_reclaim_glock() processes list members, attaches demotion requests
- *     to wait queues of glocks still locked at inter-node scope.
- * --  Demote to UNLOCKED state (if not already unlocked).
- * --  gfs_reclaim_lock() cleans up glock structure.
- */
-
-void
-gfs_scand_internal(struct gfs_sbd *sdp)
-{
-	unsigned int x, purge_nr;
-
-	if (!sdp->sd_tune.gt_glock_purge)
-		purge_nr = 0;
-	else
-		purge_nr = atomic_read(&sdp->sd_glock_count) *
-			sdp->sd_tune.gt_glock_purge / 100;
-
-	for (x = 0; x < GFS_GL_HASH_SIZE; x++) {
-		examine_bucket(scan_glock, sdp, &sdp->sd_gl_hash[x], &purge_nr);
-		cond_resched();
-	}
-}
-
-/**
- * clear_glock - look at a glock and see if we can free it from glock cache
- * @gl: the glock to look at
- *
- * Called via examine_bucket() when unmounting the filesystem, or
- *   when inter-node lock manager requests DROPLOCKS because it is running
- *   out of capacity.
- *
- * Similar to gfs_reclaim_glock(), except does *not*:
- *   --  Consult demote_ok() for permission
- *   --  Increment sdp->sd_reclaimed statistic
- *
- */
-
-static void
-clear_glock(struct gfs_glock *gl, unsigned int *unused)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct gfs_gl_hash_bucket *bucket = gl->gl_bucket;
-
-	spin_lock(&sdp->sd_reclaim_lock);
-	if (!list_empty(&gl->gl_reclaim)) {
-		list_del_init(&gl->gl_reclaim);
-		atomic_dec(&sdp->sd_reclaim_count);
-		glock_put(gl);  /* see gfs_glock_schedule_for_reclaim() */
-	}
-	spin_unlock(&sdp->sd_reclaim_lock);
-
-	if (trylock_on_glock(gl)) {
-		if (queue_empty(gl, &gl->gl_holders)) {
-			/* Inode glock-type-specific; free unused gfs inode,
-			   and release hold on iopen glock */
-			if (gl->gl_ops == &gfs_inode_glops) {
-				struct gfs_inode *ip = get_gl2ip(gl);
-				if (ip && !atomic_read(&ip->i_count))
-					gfs_inode_destroy(ip);
-			}
-			/* Generic (including inodes); unlock glock */
-			if (gl->gl_state != LM_ST_UNLOCKED)
-				handle_callback(gl, LM_ST_UNLOCKED);
-		}
-
-		unlock_on_glock(gl);
-	}
-
-	/* If glock struct's only remaining reference is from examine_bucket(),
-	   remove glock from hash table (sd_gl_hash), and free glock's memory */
-	write_lock(&bucket->hb_lock);
-	if (atomic_read(&gl->gl_count) == 1) {
-		list_del_init(&gl->gl_list);
-		write_unlock(&bucket->hb_lock);
-		glock_free(gl);
-	} else {
-		write_unlock(&bucket->hb_lock);
-		glock_put(gl);   /* see examine_bucket() */
-	}
-}
-
-/**
- * gfs_gl_hash_clear - Empty out the glock hash table
- * @sdp: the filesystem
- * @wait: wait until it's all gone
- *
- * Called when unmounting the filesystem, or when inter-node lock manager
- *   requests DROPLOCKS because it is running out of capacity.
- */
-
-void
-gfs_gl_hash_clear(struct gfs_sbd *sdp, int wait)
-{
-	unsigned long t;
-	unsigned int x;
-	int cont;
-
-	t = jiffies;
-
-	for (;;) {
-		cont = FALSE;
-
-		for (x = 0; x < GFS_GL_HASH_SIZE; x++)
-			if (examine_bucket(clear_glock, sdp, &sdp->sd_gl_hash[x], 0))
-				cont = TRUE;
-
-		if (!wait || !cont)
-			break;
-
-		if (time_after_eq(jiffies, t + gfs_tune_get(sdp, gt_stall_secs) * HZ)) {
-			printk("GFS: fsid=%s: Unmount seems to be stalled. Dumping lock state...\n",
-			       sdp->sd_fsname);
-			gfs_dump_lockstate(sdp, NULL);
-			t = jiffies;
-		}
-
-		invalidate_inodes(sdp->sd_vfs);
-		schedule_timeout_interruptible(HZ / 10);
-	}
-}
-
-/*
- *  Diagnostic routines to help debug distributed deadlock
- */
-
-/**
- * dump_holder - print information about a glock holder
- * @str: a string naming the type of holder
- * @gh: the glock holder
- * @buf: the buffer
- * @size: the size of the buffer
- * @count: where we are in the buffer
- *
- * Returns: 0 on success, -ENOBUFS when we run out of space
- */
-
-static int
-dump_holder(char *str, struct gfs_holder *gh,
-	    char *buf, unsigned int size, unsigned int *count)
-{
-	unsigned int x;
-	int error = -ENOBUFS;
-
-	gfs_printf("  %s\n", str);
-	gfs_printf("    owner = %ld\n",
-		   (gh->gh_owner) ? (long)gh->gh_owner->pid : -1);
-	gfs_printf("    gh_state = %u\n", gh->gh_state);
-	gfs_printf("    gh_flags =");
-	for (x = 0; x < 32; x++)
-		if (gh->gh_flags & (1 << x))
-			gfs_printf(" %u", x);
-	gfs_printf(" \n");
-	gfs_printf("    error = %d\n", gh->gh_error);
-	gfs_printf("    gh_iflags =");
-	for (x = 0; x < 32; x++)
-		if (test_bit(x, &gh->gh_iflags))
-			gfs_printf(" %u", x);
-	gfs_printf(" \n");
-
-	error = 0;
-
- out:
-	return error;
-}
-
-/**
- * dump_inode - print information about an inode
- * @ip: the inode
- * @buf: the buffer
- * @size: the size of the buffer
- * @count: where we are in the buffer
- *
- * Returns: 0 on success, -ENOBUFS when we run out of space
- */
-
-static int
-dump_inode(struct gfs_inode *ip,
-	   char *buf, unsigned int size, unsigned int *count)
-{
-	unsigned int x;
-	int error = -ENOBUFS;
-
-	gfs_printf("  Inode:\n");
-	gfs_printf("    num = %" PRIu64 "/%" PRIu64 "\n",
-		    ip->i_num.no_formal_ino, ip->i_num.no_addr);
-	gfs_printf("    type = %u\n", ip->i_di.di_type);
-	gfs_printf("    i_count = %d\n", atomic_read(&ip->i_count));
-	gfs_printf("    i_flags =");
-	for (x = 0; x < 32; x++)
-		if (test_bit(x, &ip->i_flags))
-			gfs_printf(" %u", x);
-	gfs_printf(" \n");
-	gfs_printf("    vnode = %s\n", (ip->i_vnode) ? "yes" : "no");
-
-	error = 0;
-
- out:
-	return error;
-}
-
-/**
- * dump_glock - print information about a glock
- * @gl: the glock
- * @buf: the buffer
- * @size: the size of the buffer
- * @count: where we are in the buffer
- *
- * Returns: 0 on success, -ENOBUFS when we run out of space
- */
-
-static int
-dump_glock(struct gfs_glock *gl,
-	   char *buf, unsigned int size, unsigned int *count)
-{
-	struct list_head *head, *tmp;
-	struct gfs_holder *gh;
-	unsigned int x;
-	int error = -ENOBUFS;
-
-	spin_lock(&gl->gl_spin);
-
-	gfs_printf("Glock (%u, %" PRIu64 ")\n",
-		    gl->gl_name.ln_type,
-		    gl->gl_name.ln_number);
-	gfs_printf("  gl_flags =");
-	for (x = 0; x < 32; x++)
-		if (test_bit(x, &gl->gl_flags))
-			gfs_printf(" %u", x);
-	gfs_printf(" \n");
-	gfs_printf("  gl_count = %d\n", atomic_read(&gl->gl_count));
-	gfs_printf("  gl_state = %u\n", gl->gl_state);
-	gfs_printf("  req_gh = %s\n", (gl->gl_req_gh) ? "yes" : "no");
-	gfs_printf("  req_bh = %s\n", (gl->gl_req_bh) ? "yes" : "no");
-	gfs_printf("  lvb_count = %d\n", atomic_read(&gl->gl_lvb_count));
-	gfs_printf("  object = %s\n", (gl->gl_object) ? "yes" : "no");
-	gfs_printf("  new_le = %s\n", (gl->gl_new_le.le_trans) ? "yes" : "no");
-	gfs_printf("  incore_le = %s\n", (gl->gl_incore_le.le_trans) ? "yes" : "no");
-	gfs_printf("  reclaim = %s\n",
-		    (list_empty(&gl->gl_reclaim)) ? "no" : "yes");
-	if (gl->gl_aspace)
-		gfs_printf("  aspace = %lu\n",
-			    gl->gl_aspace->i_mapping->nrpages);
-	else
-		gfs_printf("  aspace = no\n");
-	gfs_printf("  ail_bufs = %s\n",
-		   (list_empty(&gl->gl_ail_bufs)) ? "no" : "yes");
-	if (gl->gl_req_gh) {
-		error = dump_holder("Request", gl->gl_req_gh, buf, size, count);
-		if (error)
-			goto out;
-	}
-	for (head = &gl->gl_holders, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		gh = list_entry(tmp, struct gfs_holder, gh_list);
-		error = dump_holder("Holder", gh, buf, size, count);
-		if (error)
-			goto out;
-	}
-	for (head = &gl->gl_waiters1, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		gh = list_entry(tmp, struct gfs_holder, gh_list);
-		error = dump_holder("Waiter1", gh, buf, size, count);
-		if (error)
-			goto out;
-	}
-	for (head = &gl->gl_waiters2, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		gh = list_entry(tmp, struct gfs_holder, gh_list);
-		error = dump_holder("Waiter2", gh, buf, size, count);
-		if (error)
-			goto out;
-	}
-	for (head = &gl->gl_waiters3, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		gh = list_entry(tmp, struct gfs_holder, gh_list);
-		error = dump_holder("Waiter3", gh, buf, size, count);
-		if (error)
-			goto out;
-	}
-	if (gl->gl_ops == &gfs_inode_glops && get_gl2ip(gl)) {
-		if (!test_bit(GLF_LOCK, &gl->gl_flags) &&
-		    list_empty(&gl->gl_holders)) {
-			error = dump_inode(get_gl2ip(gl), buf, size, count);
-			if (error)
-				goto out;
-		} else {
-			error = -ENOBUFS;
-			gfs_printf("  Inode: busy\n");
-		}
-	}
-
-	error = 0;
-
- out:
-	spin_unlock(&gl->gl_spin);
-
-	return error;
-}
-
-/**
- * gfs_dump_lockstate - print out the current lockstate
- * @sdp: the filesystem
- * @ub: the buffer to copy the information into
- *
- * If @ub is NULL, dump the lockstate to the console.
- *
- */
-
-int
-gfs_dump_lockstate(struct gfs_sbd *sdp, struct gfs_user_buffer *ub)
-{
-	struct gfs_gl_hash_bucket *bucket;
-	struct list_head *tmp, *head;
-	struct gfs_glock *gl;
-	char *buf = NULL;
-	unsigned int size = gfs_tune_get(sdp, gt_lockdump_size);
-	unsigned int x, count;
-	int error = 0;
-
-	if (ub) {
-		buf = kmalloc(size, GFP_KERNEL);
-		if (!buf)
-			return -ENOMEM;
-	}
-
-	for (x = 0; x < GFS_GL_HASH_SIZE; x++) {
-		bucket = &sdp->sd_gl_hash[x];
-		count = 0;
-
-		read_lock(&bucket->hb_lock);
-
-		for (head = &bucket->hb_list, tmp = head->next;
-		     tmp != head;
-		     tmp = tmp->next) {
-			gl = list_entry(tmp, struct gfs_glock, gl_list);
-
-			if (test_bit(GLF_PLUG, &gl->gl_flags))
-				continue;
-
-			error = dump_glock(gl, buf, size, &count);
-			if (error)
-				break;
-		}
-
-		read_unlock(&bucket->hb_lock);
-
-		if (error)
-			break;
-
-		if (ub) {
-			if (ub->ub_count + count > ub->ub_size) {
-				error = -ENOMEM;
-				break;
-			}
-			if (copy_to_user(ub->ub_data + ub->ub_count, buf, count)) {
-				error = -EFAULT;
-				break;
-			}
-			ub->ub_count += count;
-		}
-	}
-
-	if (ub)
-		kfree(buf);
-
-	return error;
-}
diff --git a/gfs-kernel/src/gfs/glock.h b/gfs-kernel/src/gfs/glock.h
deleted file mode 100644
index a0342b1..0000000
--- a/gfs-kernel/src/gfs/glock.h
+++ /dev/null
@@ -1,138 +0,0 @@
-#ifndef __GFS_GLOCK_DOT_H__
-#define __GFS_GLOCK_DOT_H__
-
-/* Flags for lock requests; used in gfs_holder gh_flag field. */
-/*	These are defined in lm_interface.h, commented out here.
-#define LM_FLAG_TRY       (0x00000001)
-#define LM_FLAG_TRY_1CB   (0x00000002)
-#define LM_FLAG_NOEXP     (0x00000004)
-#define LM_FLAG_ANY       (0x00000008)
-#define LM_FLAG_PRIORITY  (0x00000010)
-	These are defined here. */
-#define GL_LOCAL_EXCL     (0x00000020) /* Only one holder may be granted the
-                                        * lock on this node, even if SHARED */
-#define GL_ASYNC          (0x00000040) /* Don't block waiting for lock ...
-                                        * must poll to wait for grant */
-#define GL_EXACT          (0x00000080) /* Requested state must == current state
-                                        * for lock to be granted */
-#define GL_SKIP           (0x00000100) /* Don't read from disk after grant */
-#define GL_ATIME          (0x00000200) /* Update inode's ATIME after grant */
-#define GL_NOCACHE        (0x00000400) /* Release glock when done, don't cache */
-#define GL_SYNC           (0x00000800) /* Sync to disk when no more holders */
-#define GL_NOCANCEL       (0x00001000) /* Don't ever cancel this request */
-#define GL_NOCANCEL_OTHER (0x00004000) /* Don't cancel other locks for this */
-
-#define GLR_TRYFAILED     (13)
-#define GLR_CANCELED      (14)
-
-static __inline__ int
-gfs_glock_is_locked_by_me(struct gfs_glock *gl)
-{
-	struct list_head *tmp, *head;
-	struct gfs_holder *gh;
-	int locked = FALSE;
-
-	/* Look in glock's list of holders for one with current task as owner */
-	spin_lock(&gl->gl_spin);
-	for (head = &gl->gl_holders, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		gh = list_entry(tmp, struct gfs_holder, gh_list);
-		if (gh->gh_owner == current) {
-			locked = TRUE;
-			break;
-		}
-	}
-	spin_unlock(&gl->gl_spin);
-
-	return locked;
-}
-static __inline__ int
-gfs_glock_is_held_excl(struct gfs_glock *gl)
-{
-	return (gl->gl_state == LM_ST_EXCLUSIVE);
-}
-static __inline__ int
-gfs_glock_is_held_dfrd(struct gfs_glock *gl)
-{
-	return (gl->gl_state == LM_ST_DEFERRED);
-}
-static __inline__ int
-gfs_glock_is_held_shrd(struct gfs_glock *gl)
-{
-	return (gl->gl_state == LM_ST_SHARED);
-}
-
-static __inline__ int
-gfs_glock_is_blocking(struct gfs_glock *gl)
-{
-	int ret;
-	spin_lock(&gl->gl_spin);
-	ret = !list_empty(&gl->gl_waiters2) || !list_empty(&gl->gl_waiters3);
-	spin_unlock(&gl->gl_spin);
-	return ret;
-}
-
-struct gfs_glock *gfs_glock_find(struct gfs_sbd *sdp,
-				 struct lm_lockname *name);
-int gfs_glock_get(struct gfs_sbd *sdp,
-		  uint64_t number, struct gfs_glock_operations *glops,
-		  int create, struct gfs_glock **glp);
-void gfs_glock_hold(struct gfs_glock *gl);
-void gfs_glock_put(struct gfs_glock *gl);
-
-void gfs_holder_init(struct gfs_glock *gl, unsigned int state, int flags,
-		     struct gfs_holder *gh);
-void gfs_holder_reinit(unsigned int state, int flags, struct gfs_holder *gh);
-void gfs_holder_uninit(struct gfs_holder *gh);
-struct gfs_holder *gfs_holder_get(struct gfs_glock *gl, unsigned int state,
-				  int flags);
-void gfs_holder_put(struct gfs_holder *gh);
-
-void gfs_glock_xmote_th(struct gfs_glock *gl, unsigned int state, int flags);
-void gfs_glock_drop_th(struct gfs_glock *gl);
-
-int gfs_glock_nq(struct gfs_holder *gh);
-int gfs_glock_poll(struct gfs_holder *gh);
-int gfs_glock_wait(struct gfs_holder *gh);
-void gfs_glock_dq(struct gfs_holder *gh);
-
-void gfs_glock_prefetch(struct gfs_glock *gl, unsigned int state, int flags);
-void gfs_glock_force_drop(struct gfs_glock *gl);
-
-int gfs_glock_be_greedy(struct gfs_glock *gl, unsigned int time);
-
-int gfs_glock_nq_init(struct gfs_glock *gl, unsigned int state, int flags,
-		      struct gfs_holder *gh);
-void gfs_glock_dq_uninit(struct gfs_holder *gh);
-int gfs_glock_nq_num(struct gfs_sbd *sdp,
-		     uint64_t number, struct gfs_glock_operations *glops,
-		     unsigned int state, int flags, struct gfs_holder *gh);
-
-int gfs_glock_nq_m(unsigned int num_gh, struct gfs_holder *ghs);
-void gfs_glock_dq_m(unsigned int num_gh, struct gfs_holder *ghs);
-
-void gfs_glock_prefetch_num(struct gfs_sbd *sdp,
-			    uint64_t number, struct gfs_glock_operations *glops,
-			    unsigned int state, int flags);
-
-/*  Lock Value Block functions  */
-
-int gfs_lvb_hold(struct gfs_glock *gl);
-void gfs_lvb_unhold(struct gfs_glock *gl);
-void gfs_lvb_sync(struct gfs_glock *gl);
-
-void gfs_glock_cb(void *fsdata, unsigned int type, void *data);
-
-void gfs_try_toss_inode(struct gfs_sbd *sdp, struct gfs_inum *inum);
-void gfs_iopen_go_callback(struct gfs_glock *gl, unsigned int state);
-
-void gfs_glock_schedule_for_reclaim(struct gfs_glock *gl);
-void gfs_reclaim_glock(struct gfs_sbd *sdp);
-
-void gfs_scand_internal(struct gfs_sbd *sdp);
-void gfs_gl_hash_clear(struct gfs_sbd *sdp, int wait);
-
-int gfs_dump_lockstate(struct gfs_sbd *sdp, struct gfs_user_buffer *ub);
-
-#endif /* __GFS_GLOCK_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/glops.c b/gfs-kernel/src/gfs/glops.c
deleted file mode 100644
index 708291d..0000000
--- a/gfs-kernel/src/gfs/glops.c
+++ /dev/null
@@ -1,664 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-
-#include "gfs.h"
-#include "dio.h"
-#include "glock.h"
-#include "glops.h"
-#include "inode.h"
-#include "log.h"
-#include "page.h"
-#include "recovery.h"
-#include "rgrp.h"
-
-/**
- * meta_go_sync - sync out the metadata for this glock
- * @gl: the glock
- * @flags: DIO_*
- *
- * Used for meta and rgrp glocks.
- *
- * Called when demoting (gfs_glock_xmote_th()) or unlocking
- * (gfs_glock_drop_th() an EX glock at inter-node scope.  We must flush
- * to disk all dirty buffers/pages relating to this glock, and must not
- * not return to caller to demote/unlock the glock until I/O is complete.
- *
- * This is *not* called from gfs_glock_dq(), because GL_SYNC flag is not
- * currently used for anything but inode glocks.
- */
-
-static void
-meta_go_sync(struct gfs_glock *gl, int flags)
-{
-	if (!(flags & DIO_METADATA))
-		return;
-
-	if (test_bit(GLF_DIRTY, &gl->gl_flags)) {
-		gfs_log_flush_glock(gl);
-		gfs_sync_buf(gl, flags | DIO_START | DIO_WAIT | DIO_CHECK);
-	}
-
-	/* We've synced everything, clear SYNC request and DIRTY flags */
-	clear_bit(GLF_DIRTY, &gl->gl_flags);
-	clear_bit(GLF_SYNC, &gl->gl_flags);
-}
-
-/**
- * meta_go_inval - invalidate the metadata for this glock
- * @gl: the glock
- * @flags: 
- *
- */
-
-static void
-meta_go_inval(struct gfs_glock *gl, int flags)
-{
-	if (!(flags & DIO_METADATA))
-		return;
-
-	gfs_inval_buf(gl);
-	gl->gl_vn++;
-}
-
-/**
- * meta_go_demote_ok - Check to see if it's ok to unlock a meta glock
- * @gl: the glock
- *
- * Returns: TRUE if we have no cached data; ok to demote meta glock
- *
- * Called when trying to dump (reclaim) a glock from the glock cache, after
- *   determining that there is currently no holder on this node for this glock,
- *   and before placing LM_ST_UNLOCKED request on glock's wait-for-demote queue.
- * Note that callbacks from other nodes that need a lock do *not*
- *   seek permission from this function before requesting a demote.
- *   Nor do glocks obtained with the following flags (see demote_ok()):
- *   --  GL_NOCACHE:  gets unlocked (and not cached) immediately after use
- *   --  GLF_STICKY:  equivalent to always getting "FALSE" from this function
- *   --  GLF_PREFETCH:  uses its own timeout
- *
- * For glocks that protect on-disk data (meta, inode, and rgrp glocks), disk
- *   accesses are slow, while lock manipulation is usually fast.  Releasing
- *   a lock means that we:
- *   --  Must sync memory-cached write data to disk immediately, before another
- *       node can be granted the lock (at which point that node must read the
- *       data from disk).
- *   --  Must invalidate memory-cached data that we had read from or written
- *       to disk.  Another node can change it if we don't have a lock, so it's
- *       now useless to us.
- *
- * Then, if we re-acquire the lock again in the future, we:
- *   --  Must (re-)read (perhaps unchanged) data from disk into memory.
- *
- * All of these are painful, so it pays to retain a glock in our glock cache
- *   as long as we have cached data (even though we have no active holders
- *   for this lock on this node currently), unless/until another node needs
- *   to change it.  This allows Linux block I/O to sync write data to disk in
- *   a "lazy" way, rather than forcing an immediate sync (and resultant WAIT),
- *   and retains current data in memory as long as possible.
- *
- * This also helps GFS respond to memory pressure.  There is no mechanism for
- *   the Linux virtual memory manager to directly call into GFS to ask it to
- *   drop locks.  So, we take a hint from what the VM does to the page cache.
- *   When that cache is trimmed (and we see no more pages relating to this
- *   glock), we trim the glock cache as well, by releasing this lock.
- */
-
-static int
-meta_go_demote_ok(struct gfs_glock *gl)
-{
-	return (gl->gl_aspace->i_mapping->nrpages) ? FALSE : TRUE;
-}
-
-/**
- * inode_go_xmote_th - promote/demote (but don't unlock) an inode glock
- * @gl: the glock
- * @state: the requested state
- * @flags: the flags passed into gfs_glock()
- *
- * Acquire a new glock, or change an already-acquired glock to
- *   more/less restrictive state (other than LM_ST_UNLOCKED).
- */
-
-static void
-inode_go_xmote_th(struct gfs_glock *gl, unsigned int state, int flags)
-{
-	if (gl->gl_state != LM_ST_UNLOCKED)
-		gfs_inval_pte(gl);
-	gfs_glock_xmote_th(gl, state, flags);
-}
-
-/**
- * inode_go_xmote_bh - After promoting/demoting (but not unlocking)
- *      an inode glock
- * @gl: the glock
- *
- * FIXME: This will be really broken when (no_formal_ino != no_addr)
- *        and gl_name.ln_number no longer refers to the dinode block #.
- *
- * If we've just acquired the inter-node lock for an inode,
- *   read the dinode block from disk (but don't wait for I/O completion).
- * Exceptions (don't read if):
- *    Glock state is UNLOCKED.
- *    Glock's requesting holder's GL_SKIP flag is set.
- */
-
-static void
-inode_go_xmote_bh(struct gfs_glock *gl)
-{
-	struct gfs_holder *gh = gl->gl_req_gh;
-	struct buffer_head *bh;
-	int error;
-
-	if (gl->gl_state != LM_ST_UNLOCKED &&
-	    (!gh || !(gh->gh_flags & GL_SKIP))) {
-		error = gfs_dread(gl, gl->gl_name.ln_number, DIO_START, &bh);
-		if (!error)
-			brelse(bh);
-	}
-}
-
-/**
- * inode_go_drop_th - unlock an inode glock
- * @gl: the glock
- *
- * Invoked from rq_demote().
- * Another node needs the lock in EXCLUSIVE mode, or lock (unused for too long)
- *   is being purged from our node's glock cache; we're dropping lock.
- */
-
-static void
-inode_go_drop_th(struct gfs_glock *gl)
-{
-	gfs_inval_pte(gl);
-	gfs_glock_drop_th(gl);
-}
-
-/**
- * inode_go_sync - Sync the dirty data and/or metadata for an inode glock
- * @gl: the glock protecting the inode
- * @flags: DIO_METADATA -- sync inode's metadata
- *         DIO_DATA     -- sync inode's data
- *         DIO_INVISIBLE --  don't clear glock's DIRTY flag when done
- *
- * If DIO_INVISIBLE:
- *   1) Called from gfs_glock_dq(), when releasing the last holder for an EX
- *   glock (but glock is still in our glock cache in EX state, and might
- *   stay there for a few minutes).  Holder had GL_SYNC flag set, asking
- *   for early sync (i.e. now, instead of later when we release the EX at
- *   inter-node scope).  GL_SYNC is currently used only for inodes in
- *   special cases, so inode is the only type of glock for which
- *   DIO_INVISIBLE would apply.
- *   2) Called from depend_sync_one() to sync deallocated inode metadata
- *   before it can be reallocated by another process or machine.  Since
- *   this call can happen at any time during the lifetime of the
- *   glock, don't clear the sync bit (more data might be dirtied
- *   momentarily).
- * Else (later):
- *   Called when demoting (gfs_glock_xmote_th()) or unlocking
- *   (gfs_glock_drop_th() an EX glock at inter-node scope.  We must flush
- *   to disk all dirty buffers/pages relating to this glock, and must not
- *   return to caller to demote/unlock the glock until I/O is complete.
- *
- * Syncs go in following order:
- *   Start data page writes
- *   Sync metadata to log (wait to complete I/O)
- *   Sync metadata to in-place location (wait to complete I/O)
- *   Wait for data page I/O to complete
- * 
- */
-
-static void
-inode_go_sync(struct gfs_glock *gl, int flags)
-{
-	int meta = (flags & DIO_METADATA);
-	int data = (flags & DIO_DATA);
-
-	if (test_bit(GLF_DIRTY, &gl->gl_flags)) {
-		if (meta && data) {
-			gfs_sync_page(gl, flags | DIO_START);
-			gfs_log_flush_glock(gl);
-			gfs_sync_buf(gl, flags | DIO_START | DIO_WAIT | DIO_CHECK);
-			gfs_sync_page(gl, flags | DIO_WAIT | DIO_CHECK);
-		} else if (meta) {
-			gfs_log_flush_glock(gl);
-			gfs_sync_buf(gl, flags | DIO_START | DIO_WAIT | DIO_CHECK);
-		} else if (data)
-			gfs_sync_page(gl, flags | DIO_START | DIO_WAIT | DIO_CHECK);
-	}
-
-	/* If we've synced everything, clear the SYNC request.
-	   If we're doing the final (not early) sync, clear DIRTY */
-	if (meta && data) {
-		if (!(flags & DIO_INVISIBLE))
-			clear_bit(GLF_DIRTY, &gl->gl_flags);
-		clear_bit(GLF_SYNC, &gl->gl_flags);
-	}
-}
-
-/**
- * inode_go_inval - prepare a inode glock to be released
- * @gl: the glock
- * @flags: 
- *
- */
-
-static void
-inode_go_inval(struct gfs_glock *gl, int flags)
-{
-	int meta = (flags & DIO_METADATA);
-	int data = (flags & DIO_DATA);
-
-	if (meta) {
-		gfs_inval_buf(gl);
-		gl->gl_vn++;
-	}
-	if (data)
-		gfs_inval_page(gl);
-}
-
-/**
- * inode_go_demote_ok - Check to see if it's ok to unlock an inode glock
- * @gl: the glock
- *
- * See comments for meta_go_demote_ok().
- *
- * While other glock types (meta, rgrp) that protect disk data can be retained
- *   indefinitely, GFS imposes a timeout (overridden when using no_lock lock
- *   module) for inode glocks, even if there is still data in page cache for
- *   this inode.
- *
- * Returns: TRUE if it's ok
- */
-
-static int
-inode_go_demote_ok(struct gfs_glock *gl)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	int demote = FALSE;
-
-	if (!get_gl2ip(gl) && !gl->gl_aspace->i_mapping->nrpages)
-		demote = TRUE;
-	else if (!sdp->sd_args.ar_localcaching &&
-		 time_after_eq(jiffies, gl->gl_stamp + gfs_tune_get(sdp, gt_demote_secs) * HZ))
-		demote = TRUE;
-
-	return demote;
-}
-
-/**
- * inode_go_lock - operation done after an inode lock is locked by
- *      a first holder on this node
- * @gl: the glock
- * @flags: the flags passed into gfs_glock()
- *
- * Returns: errno
- */
-
-static int
-inode_go_lock(struct gfs_glock *gl, int flags)
-{
-	struct gfs_inode *ip = get_gl2ip(gl);
-	int error = 0;
-
-	if (ip && ip->i_vn != gl->gl_vn) {
-		error = gfs_copyin_dinode(ip);
-		if (!error)
-			gfs_inode_attr_in(ip);
-	}
-
-	return error;
-}
-
-/**
- * inode_go_unlock - operation done when an inode lock is unlocked by
- *     a last holder on this node
- * @gl: the glock
- * @flags: the flags passed into gfs_gunlock()
- *
- */
-
-static void
-inode_go_unlock(struct gfs_glock *gl, int flags)
-{
-	struct gfs_inode *ip = get_gl2ip(gl);
-
-	if (ip && test_bit(GLF_DIRTY, &gl->gl_flags))
-		gfs_inode_attr_in(ip);
-
-	if (ip)
-		gfs_flush_meta_cache(ip);
-}
-
-/**
- * inode_greedy -
- * @gl: the glock
- *
- */
-
-static void
-inode_greedy(struct gfs_glock *gl)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct gfs_inode *ip = get_gl2ip(gl);
-	unsigned int quantum = gfs_tune_get(sdp, gt_greedy_quantum);
-	unsigned int max = gfs_tune_get(sdp, gt_greedy_max);
-	unsigned int new_time;
-
-	spin_lock(&ip->i_spin);
-
-	if (time_after(ip->i_last_pfault + quantum, jiffies)) {
-		new_time = ip->i_greedy + quantum;
-		if (new_time > max)
-			new_time = max;
-	} else {
-		new_time = ip->i_greedy - quantum;
-		if (!new_time || new_time > max)
-			new_time = 1;
-	}
-
-	ip->i_greedy = new_time;
-
-	spin_unlock(&ip->i_spin);
-
-	gfs_inode_put(ip);
-}
-
-/**
- * rgrp_go_xmote_th - promote/demote (but don't unlock) a resource group glock
- * @gl: the glock
- * @state: the requested state
- * @flags: the flags passed into gfs_glock()
- *
- * Acquire a new glock, or change an already-acquired glock to
- *   more/less restrictive state (other than LM_ST_UNLOCKED).
- *
- * We're going to lock the lock in SHARED or EXCLUSIVE state, or
- *   demote it from EXCLUSIVE to SHARED (because another node needs it SHARED).
- * When locking, gfs_mhc_zap() and gfs_depend_sync() are basically no-ops;
- *   meta-header cache and dependency lists should be empty.
- *
- */
-
-static void
-rgrp_go_xmote_th(struct gfs_glock *gl, unsigned int state, int flags)
-{
-	struct gfs_rgrpd *rgd = get_gl2rgd(gl);
-
-	gfs_mhc_zap(rgd);
-	gfs_depend_sync(rgd);
-	gfs_glock_xmote_th(gl, state, flags);
-}
-
-/**
- * rgrp_go_drop_th - unlock a resource group glock
- * @gl: the glock
- *
- * Invoked from rq_demote().
- * Another node needs the lock in EXCLUSIVE mode, or lock (unused for too long)
- *   is being purged from our node's glock cache; we're dropping lock.
- */
-
-static void
-rgrp_go_drop_th(struct gfs_glock *gl)
-{
-	struct gfs_rgrpd *rgd = get_gl2rgd(gl);
-
-	gfs_mhc_zap(rgd);
-	gfs_depend_sync(rgd);
-	gfs_glock_drop_th(gl);
-}
-
-/**
- * rgrp_go_demote_ok - Check to see if it's ok to unlock a RG's glock
- * @gl: the glock
- *
- * See comments for meta_go_demote_ok().
- *
- * In addition to Linux page cache, we also check GFS meta-header-cache.
- *
- * Returns: TRUE if it's ok
- */
-
-static int
-rgrp_go_demote_ok(struct gfs_glock *gl)
-{
-	struct gfs_rgrpd *rgd = get_gl2rgd(gl);
-	int demote = TRUE;
-
-	if (gl->gl_aspace->i_mapping->nrpages)
-		demote = FALSE;
-	else if (rgd && !list_empty(&rgd->rd_mhc)) /* Don't bother with lock here */
-		demote = FALSE;
-
-	return demote;
-}
-
-/**
- * rgrp_go_lock - operation done after an rgrp lock is locked by
- *    a first holder on this node.
- * @gl: the glock
- * @flags: the flags passed into gfs_glock()
- *
- * Returns: errno
- *
- * Read rgrp's header and block allocation bitmaps from disk.
- */
-
-static int
-rgrp_go_lock(struct gfs_glock *gl, int flags)
-{
-	if (flags & GL_SKIP)
-		return 0;
-	return gfs_rgrp_read(get_gl2rgd(gl));
-}
-
-/**
- * rgrp_go_unlock - operation done when an rgrp lock is unlocked by
- *    a last holder on this node.
- * @gl: the glock
- * @flags: the flags passed into gfs_gunlock()
- *
- * Release rgrp's bitmap buffers (read in when lock was first obtained).
- * Make sure rgrp's glock's Lock Value Block has up-to-date block usage stats,
- *   so other nodes can see them.
- */
-
-static void
-rgrp_go_unlock(struct gfs_glock *gl, int flags)
-{
-	struct gfs_rgrpd *rgd = get_gl2rgd(gl);
-	if (flags & GL_SKIP)
-		return;
-	gfs_rgrp_relse(rgd);
-	if (test_bit(GLF_DIRTY, &gl->gl_flags))
-		gfs_rgrp_lvb_fill(rgd);
-}
-
-/**
- * trans_go_xmote_th - promote/demote (but don't unlock) the transaction glock
- * @gl: the glock
- * @state: the requested state
- * @flags: the flags passed into gfs_glock()
- *
- * Acquire a new glock, or change an already-acquired glock to
- *   more/less restrictive state (other than LM_ST_UNLOCKED).
- */
-
-static void
-trans_go_xmote_th(struct gfs_glock *gl, unsigned int state, int flags)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-
-	if (gl->gl_state != LM_ST_UNLOCKED &&
-	    test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) {
-		gfs_sync_meta(sdp);
-		gfs_log_shutdown(sdp);
-	}
-
-	gfs_glock_xmote_th(gl, state, flags);
-}
-
-/**
- * trans_go_xmote_bh - After promoting/demoting (but not unlocking)
- *       the transaction glock
- * @gl: the glock
- *
- */
-
-static void
-trans_go_xmote_bh(struct gfs_glock *gl)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct gfs_glock *j_gl = sdp->sd_journal_gh.gh_gl;
-	struct gfs_log_header head;
-	int error;
-
-	if (gl->gl_state != LM_ST_UNLOCKED &&
-	    test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) {
-		j_gl->gl_ops->go_inval(j_gl, DIO_METADATA | DIO_DATA);
-
-		error = gfs_find_jhead(sdp, &sdp->sd_jdesc, j_gl, &head);
-		if (error)
-			gfs_consist(sdp);
-		if (!(head.lh_flags & GFS_LOG_HEAD_UNMOUNT))
-			gfs_consist(sdp);
-
-		/*  Initialize some head of the log stuff  */
-		if (!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) {
-			sdp->sd_sequence = head.lh_sequence;
-			sdp->sd_log_head = head.lh_first + 1;
-		}
-	}
-}
-
-/**
- * trans_go_drop_th - unlock the transaction glock
- * @gl: the glock
- *
- * Invoked from rq_demote().
- * Another node needs the lock in EXCLUSIVE mode to quiesce the filesystem
- *   (for journal replay, etc.).
- *
- * We want to sync the device even with localcaching.  Remember
- * that localcaching journal replay only marks buffers dirty.
- */
-
-static void
-trans_go_drop_th(struct gfs_glock *gl)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-
-	if (test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) {
-		gfs_sync_meta(sdp);
-		gfs_log_shutdown(sdp);
-	}
-
-	gfs_glock_drop_th(gl);
-}
-
-/**
- * nondisk_go_demote_ok - Check to see if it's ok to unlock a non-disk glock
- * @gl: the glock
- *
- * See comments for meta_go_demote_ok().
- *
- * We never give up a non-disk glock (unless another node needs it).
- * Non-disk type used for GFS_MOUNT_LOCK, GFS_LIVE_LOCK, GFS_RENAME_LOCK.
- * GFS_MOUNT_LOCK is always requested GL_NOCACHE, however, so it never uses
- *   this function.
- *
- * Returns: TRUE if it's ok
- */
-
-static int
-nondisk_go_demote_ok(struct gfs_glock *gl)
-{
-	return FALSE;
-}
-
-/**
- * quota_go_demote_ok - Check to see if it's ok to unlock a quota glock
- * @gl: the glock
- *
- * See comments for meta_go_demote_ok().
- *
- * Returns: TRUE if it's ok
- */
-
-static int
-quota_go_demote_ok(struct gfs_glock *gl)
-{
-	return !atomic_read(&gl->gl_lvb_count);
-}
-
-struct gfs_glock_operations gfs_meta_glops = {
-      .go_xmote_th = gfs_glock_xmote_th,
-      .go_drop_th = gfs_glock_drop_th,
-      .go_sync = meta_go_sync,
-      .go_inval = meta_go_inval,
-      .go_demote_ok = meta_go_demote_ok,
-      .go_type = LM_TYPE_META
-};
-
-struct gfs_glock_operations gfs_inode_glops = {
-      .go_xmote_th = inode_go_xmote_th,
-      .go_xmote_bh = inode_go_xmote_bh,
-      .go_drop_th = inode_go_drop_th,
-      .go_sync = inode_go_sync,
-      .go_inval = inode_go_inval,
-      .go_demote_ok = inode_go_demote_ok,
-      .go_lock = inode_go_lock,
-      .go_unlock = inode_go_unlock,
-      .go_greedy = inode_greedy,
-      .go_type = LM_TYPE_INODE
-};
-
-struct gfs_glock_operations gfs_rgrp_glops = {
-      .go_xmote_th = rgrp_go_xmote_th,
-      .go_drop_th = rgrp_go_drop_th,
-      .go_sync = meta_go_sync,
-      .go_inval = meta_go_inval,
-      .go_demote_ok = rgrp_go_demote_ok,
-      .go_lock = rgrp_go_lock,
-      .go_unlock = rgrp_go_unlock,
-      .go_type = LM_TYPE_RGRP
-};
-
-struct gfs_glock_operations gfs_trans_glops = {
-      .go_xmote_th = trans_go_xmote_th,
-      .go_xmote_bh = trans_go_xmote_bh,
-      .go_drop_th = trans_go_drop_th,
-      .go_type = LM_TYPE_NONDISK
-};
-
-struct gfs_glock_operations gfs_iopen_glops = {
-      .go_xmote_th = gfs_glock_xmote_th,
-      .go_drop_th = gfs_glock_drop_th,
-      .go_callback = gfs_iopen_go_callback,
-      .go_type = LM_TYPE_IOPEN
-};
-
-struct gfs_glock_operations gfs_flock_glops = {
-      .go_xmote_th = gfs_glock_xmote_th,
-      .go_drop_th = gfs_glock_drop_th,
-      .go_type = LM_TYPE_FLOCK
-};
-
-struct gfs_glock_operations gfs_nondisk_glops = {
-      .go_xmote_th = gfs_glock_xmote_th,
-      .go_drop_th = gfs_glock_drop_th,
-      .go_demote_ok = nondisk_go_demote_ok,
-      .go_type = LM_TYPE_NONDISK
-};
-
-struct gfs_glock_operations gfs_quota_glops = {
-      .go_xmote_th = gfs_glock_xmote_th,
-      .go_drop_th = gfs_glock_drop_th,
-      .go_demote_ok = quota_go_demote_ok,
-      .go_type = LM_TYPE_QUOTA
-};
diff --git a/gfs-kernel/src/gfs/glops.h b/gfs-kernel/src/gfs/glops.h
deleted file mode 100644
index 4d897c8..0000000
--- a/gfs-kernel/src/gfs/glops.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef __GLOPS_DOT_H__
-#define __GLOPS_DOT_H__
-
-extern struct gfs_glock_operations gfs_meta_glops;
-extern struct gfs_glock_operations gfs_inode_glops;
-extern struct gfs_glock_operations gfs_rgrp_glops;
-extern struct gfs_glock_operations gfs_trans_glops;
-extern struct gfs_glock_operations gfs_iopen_glops;
-extern struct gfs_glock_operations gfs_flock_glops;
-extern struct gfs_glock_operations gfs_nondisk_glops;
-extern struct gfs_glock_operations gfs_quota_glops;
-
-#endif /* __GLOPS_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/incore.h b/gfs-kernel/src/gfs/incore.h
deleted file mode 100644
index a0a3b8f..0000000
--- a/gfs-kernel/src/gfs/incore.h
+++ /dev/null
@@ -1,1211 +0,0 @@
-/*
- *  In-core (memory/RAM) structures.
- *  These do not appear on-disk.  See gfs_ondisk.h for on-disk structures.
- */
-
-#ifndef __INCORE_DOT_H__
-#define __INCORE_DOT_H__
-
-/*  flags used in function call parameters  */
-
-#define DIO_NEW           (0x00000001)  /* Newly allocated metadata */
-#define DIO_FORCE         (0x00000002)  /* Force read of block from disk */
-#define DIO_CLEAN         (0x00000004)  /* Don't write to disk */
-#define DIO_DIRTY         (0x00000008)  /* Data changed, must write to disk */
-#define DIO_START         (0x00000010)  /* Start disk read or write */
-#define DIO_WAIT          (0x00000020)  /* Wait for disk r/w to complete */
-
-#define DIO_METADATA      (0x00000040)  /* Process glock's protected metadata */
-#define DIO_DATA          (0x00000080)  /* Process glock's protected filedata */
-#define DIO_INVISIBLE     (0x00000100)  /* Don't monkey with glock's dirty bit */
-#define DIO_CHECK         (0x00000200)  /* Make sure all metadata has been synced */
-#define DIO_ALL           (0x00000400)  /* Flush all AIL transactions to disk */
-
-/*  Structure prototypes  */
-
-struct gfs_log_operations;
-struct gfs_log_element;
-struct gfs_meta_header_cache;
-struct gfs_depend;
-struct gfs_bitmap;
-struct gfs_rgrpd;
-struct gfs_bufdata;
-struct gfs_glock_operations;
-struct gfs_holder;
-struct gfs_glock;
-struct gfs_alloc;
-struct gfs_inode;
-struct gfs_file;
-struct gfs_unlinked;
-struct gfs_quota_le;
-struct gfs_quota_data;
-struct gfs_log_buf;
-struct gfs_trans;
-struct gfs_gl_hash_bucket;
-struct gfs_sbd;
-
-typedef void (*gfs_glop_bh_t) (struct gfs_glock * gl, unsigned int ret);
-
-/*
- *  Structure of operations that are associated with each
- *  type of element in the log.
- */
-struct gfs_log_operations {
-	/*
-	 * Operations specific to a given log element (LE).
-	 * These are typically executed individually via macros such as LO_ADD.
-	 */
-
-	/* Add new LE to transaction */
-	void (*lo_add) (struct gfs_sbd * sdp, struct gfs_log_element * le);
-
-	/* Do any cleanup, etc., needed just before commit to incore log */
-	void (*lo_trans_end) (struct gfs_sbd * sdp,
-			      struct gfs_log_element * le);
-
-	/* Print LE-specific info via printk() */
-	void (*lo_print) (struct gfs_sbd * sdp, struct gfs_log_element * le,
-			  unsigned int where);
-
-	/* Find any incore transactions that overlap through this LE (e.g.
-	 * share glocks), to determine if any transactions can be combined. */
-	struct gfs_trans *(*lo_overlap_trans) (struct gfs_sbd * sdp,
-					       struct gfs_log_element * le);
-
-	/* Change LE from "new" to "incore" status, before write to log */
-	void (*lo_incore_commit) (struct gfs_sbd * sdp, struct gfs_trans * tr,
-				  struct gfs_log_element * le);
-
-	/* Allow writes to in-place locations, after log is on-disk */
-	void (*lo_add_to_ail) (struct gfs_sbd * sdp,
-			       struct gfs_log_element * le);
-
-	/* Clean up LE after log dump */
-	void (*lo_clean_dump) (struct gfs_sbd * sdp,
-			       struct gfs_log_element * le);
-
-	/*
-	 * Operations specific to a class of log elements.
-	 * These are typically executed over a whole transaction by
-	 * macros such as LO_TRANS_SIZE.  Each LE-type-specific operation
-	 * for each LE contributes its part to the overall result.
-	 */
-
-	/* Determine LE-type-specific quantities of blocks of various types
-	 * required for writing the log */
-	void (*lo_trans_size) (struct gfs_sbd * sdp, struct gfs_trans * tr,
-			       unsigned int *mblks, unsigned int *eblks,
-			       unsigned int *blocks, unsigned int *bmem);
-
-	/* Combine LE-type-specific values in new_tr and tr, result is in tr */
-	void (*lo_trans_combine) (struct gfs_sbd * sdp, struct gfs_trans * tr,
-				  struct gfs_trans * new_tr);
-
-	/* Create control and metadata buffers that will make up the log */
-	void (*lo_build_bhlist) (struct gfs_sbd * sdp, struct gfs_trans * tr);
-
-	/* Calculate log space needed for this LE in a log dump */
-	void (*lo_dump_size) (struct gfs_sbd * sdp, unsigned int *elements,
-			      unsigned int *blocks, unsigned int *bmem);
-
-	/* Add LE to log dump */
-	void (*lo_build_dump) (struct gfs_sbd * sdp, struct gfs_trans * tr);
-
-	/*
-	 * Operations that happen at recovery time
-	 */
-
-	/* Reset/init whatever before doing recovery */
-	void (*lo_before_scan) (struct gfs_sbd * sdp, unsigned int jid,
-				struct gfs_log_header * head,
-				unsigned int pass);
-
-	/* LE-specific recovery procedure */
-	int (*lo_scan_elements) (struct gfs_sbd * sdp,
-				 struct gfs_jindex * jdesc,
-				 struct gfs_glock * gl, uint64_t start,
-				 struct gfs_log_descriptor * desc,
-				 unsigned int pass);
-
-	/* Verify and report recovery results/statistics */
-	void (*lo_after_scan) (struct gfs_sbd * sdp, unsigned int jid,
-			       unsigned int pass);
-
-
-	/* 
-	 * Type of element (glock/buf/unlinked/quota)
-	 */
-	char *lo_name;
-};
-
-/*
- *  Structure that gets added to struct gfs_trans->tr_elements.  They
- *  make up the "stuff" in each transaction.
- */
-struct gfs_log_element {
-	struct gfs_log_operations *le_ops; /* Vector of functions */
-
-	struct gfs_trans *le_trans;     /* We're part of this transaction */
-	struct list_head le_list;       /* Link to transaction's element list */
-};
-
-/*
- * Meta-header cache structure.
- * One for each metadata block that we've de-allocated.
- * Used to temporarily store gfs_meta_header structs for meta blocks that
- *   have been freshly turned into FREEMETA (alloc'd or de-alloc'd).  Storing
- *   these (small) structures in-core allows us to release the (large) buffers,
- *   and not need to re-read the header from disk if/when we re-allocate the
- *   blocks to USEDMETA, as long as this node holds the EXCLUSIVE lock for the
- *   resource group containing the blocks.  If we release the EX lock, we must
- *   throw away the rgrp's cached meta headers, since another node could change
- *   the blocks' contents.
- * In-core superblock structure hosts the hashed cache, as well as a
- *   linear list of all cached, in most-recently-added order.
- * Also, each resource group keeps a list of cached blocks within its scope.
- */
-struct gfs_meta_header_cache {
-	/* Links to various lists */
-	struct list_head mc_list_hash;   /* Superblock's hashed list */
-	struct list_head mc_list_single; /* Superblock's list, MRU order */
-	struct list_head mc_list_rgd;    /* Resource group's list */
-
-	uint64_t mc_block;               /* Block # (in-place address) */
-	struct gfs_meta_header mc_mh;    /* Payload: the block's meta-header */
-};
-
-/*
- * Dependency cache structure.
- * In-core superblock structure hosts the actual cache.
- * Also, each resource group keeps a list of dependency blocks within its scope.
- */
-struct gfs_depend {
-	/* Links to various lists */
-	struct list_head gd_list_hash;  /* Superblock's hashed list */
-	struct list_head gd_list_rgd;   /* Resource group's list */
-
-	struct gfs_rgrpd *gd_rgd;       /* Resource group descriptor */
-	uint64_t gd_formal_ino;         /* Inode ID */
-	unsigned long gd_time;          /* Time (jiffies) when put on list */
-};
-
-/*
- *  Block allocation bitmap descriptor structure.
- *  One of these for each FS block that contains bitmap data
- *    (i.e. the resource group header blocks and their following bitmap blocks).
- *  Each allocatable FS data block is represented by 2 bits (4 alloc states).
- */
-struct gfs_bitmap {
-	uint32_t bi_offset;  /* Byte offset of bitmap within this bit block
-	                        (non-zero only for an rgrp header block) */
-	uint32_t bi_start;   /* Data block (rgrp scope, 32-bit) represented
-	                        by the first bit-pair in this bit block */
-	uint32_t bi_len;     /* The number of bitmap bytes in this bit block */
-};
-
-/*
- *  Resource Group (Rgrp) descriptor structure.
- *  There is one of these for each resource (block) group in the FS.
- *  The filesystem is divided into a number of resource groups to allow
- *    simultaneous block alloc operations by a number of nodes.
- */
-struct gfs_rgrpd {
-	/* Links to superblock lists */
-	struct list_head rd_list;       /* On-disk-order list of all rgrps */
-	struct list_head rd_list_mru;   /* Most Recently Used list of all rgs */
-	struct list_head rd_recent;     /* recently used rgrps */
-	uint32_t rd_try_counter;        /* # of times we fail a try lock */
-
-	struct gfs_glock *rd_gl;        /* Glock for this rgrp */
-
-	struct gfs_rindex rd_ri;        /* Resource Index (on-disk) structure */
-	struct gfs_rgrp rd_rg;          /* Resource Group (on-disk) structure */
-	uint64_t rd_rg_vn;              /* Version #: if != glock's gl_vn,
-	                                   we need to read rgrp fm disk */
-
-	/* Block alloc bitmap cache */
-	struct gfs_bitmap *rd_bits;     /* Array of block bitmap descriptors */
-	struct buffer_head **rd_bh;     /* Array of ptrs to block bitmap bh's */
-
-	/* Block allocation strategy, rgrp scope. Start at these blocks when
-	   searching for next data/meta block to alloc */
-	uint32_t rd_last_alloc_data;    /* Most recent data block allocated */
-	uint32_t rd_last_alloc_meta;    /* Most recent meta block allocated */
-
-	struct list_head rd_mhc;        /* Cached meta-headers for this rgrp */
-	struct list_head rd_depend;     /* Dependent inodes (MRU order) */
-
-	struct gfs_sbd *rd_sbd;		/* FS incore superblock (fs instance) */
-};
-
-/*
- *  Per-buffer data
- *  One of these is attached as GFS private data to each FS block's buffer_head.
- *  These keep track of a buffer's progress through the transaction pipeline,
- *    using the "new" embedded log element to attach it to a being-built
- *    transaction, and moving the attachment point to the "incore" LE once
- *    the transaction completes (at which time the buffer becomes a candidate
- *    to be written to the on-disk log).
- *  A buffer may be attached simultaneously to a new and an incore transaction,
- *    but no more than one of each:  Only one new trans may be built at a time
- *    for a given buffer, obviously, since the buffer's contents are protected
- *    by an EXclusive glock when writing.  And, when a transaction is completely
- *    built, GFS combines incore transactions that share glocks (see
- *    incore_commit()), i.e. the glock that protects the buffer, so a buffer
- *    never needs to be attached to more than one (combined) incore trans.
- *  Note that multiple transactions can modify the buffer since its most
- *    recent writes to disk.  This principle applies to both in-place and
- *    journal block locations on-disk, allowing this node to keep modifying the
- *    cached data without writing it to disk, unless/until another node needs
- *    to access the data, or the Linux OS tells us to sync to disk.
- *  If a transaction follows another transaction before the first transaction's
- *    log completes (indicated by the in-place buffer head still being pinned
- *    in RAM), GFS copies the first transaction's results to a "frozen"
- *    image of the buffer, so the first transaction results (an atomic
- *    snapshot) can be logged properly, while the second transaction is
- *    modifying the "real" buffer.  This frozen copy lives only until the new
- *    transaction is complete, at which point one of two things has occurred:
- *    1).  Buffer was logged successfully; frozen copy's job is done.
- *    2).  Buffer was not yet logged; frozen copy no longer needed, newer
- *         buffer becomes the log candidate.
- *
- *  gfs_bufdata structs also link into the Active Items Lists (AIL) (buffers
- *    flushed to on-disk log, but not yet flushed to on-disk in-place locations)
- *    attached to:
- *    1).  The latest transaction to modify and log (on-disk) the buffer, and
- *    2).  The glock that protects the buffer's contents.
- *  The buffer is attached to only the most recent transaction's AIL
- *    list for a couple of reasons.  One is that only the most up-to-date
- *    buffer content needs to be written to the in-place block on-disk.  The
- *    other is that since there is a more recent copy of the block in
- *    the log, we don't need to keep the older copies in the log.  We can
- *    remove them from the AIL and let the log space be reused for new
- *    transactions (GFS advances the log tail when removing buffers from AIL).
- */
-struct gfs_bufdata {
-	struct buffer_head *bd_bh;  /* We belong to this Linux buffer_head */
-	struct gfs_glock *bd_gl;    /* This glock protects buffer's payload */
-
-	/* Log elements map us to a particular set of log operations functions,
-	   and to a particular transaction */
-	struct gfs_log_element bd_new_le;     /* New, incomplete transaction */
-	struct gfs_log_element bd_incore_le;  /* Complete (committed) trans */
-
-	char *bd_frozen;            /* "Frozen" copy of buffer's data */
-	struct semaphore bd_lock;   /* Protects access to this structure */
-
-	/* "Pin" means keep buffer in RAM, don't write to disk (yet) */
-	unsigned int bd_pinned;	         /* Recursive pin count */
-
-	/* Links to Active Items Lists */
-	struct list_head bd_ail_tr_list; /* This buf's most recent trans' AIL */
-	struct list_head bd_ail_gl_list; /* This buf's glock's AIL */
-};
-
-/*
- *  Glock operations
- *  One set of operations for each glock, the set selected by type of glock.
- *  These functions get called at various points in a glock's lifetime.
- *  "xmote" = promote or demote (change lock state) a glock at inter-node scope.
- *  "th" = top half, "bh" = bottom half
- *  Some operations/fields are required (GFS assumes they are there):
- *     go_xmote_th
- *     go_drop_th
- *     go_type
- *  Other operations are optional (GFS checks for presence before calling).
- */
-struct gfs_glock_operations {
-
-	/* Acquire lock or change lock state at inter-node scope:
-	     Does type-specific preparation (if any)
-	     Uses gfs_glock_xmote_th to call lock module. */
-	void (*go_xmote_th) (struct gfs_glock * gl, unsigned int state,
-			     int flags);
-
-	/* After acquiring or changing a lock at inter-node scope */
-	void (*go_xmote_bh) (struct gfs_glock * gl);
-
-	/* Release (unlock) a lock at inter-node scope:
-	     Does type-specific preparation (if any)
-	     Uses gfs_glock_drop_th to call lock module. */
-	void (*go_drop_th) (struct gfs_glock * gl);
-
-	/* After releasing a lock at inter-node scope */
-	void (*go_drop_bh) (struct gfs_glock * gl);
-
-	/* Sync dirty data to disk (e.g. before demoting an EX inter-node lock)
-	   (another node needs to read the updated data from disk) */
-	void (*go_sync) (struct gfs_glock * gl, int flags);
-
-	/* Invalidate local cached data just after releasing an inter-node lock
-	   (another node may change the on-disk data, so it's no good to us) */
-	void (*go_inval) (struct gfs_glock * gl, int flags);
-
-	/* Lock-type-specific check to see if it's okay to unlock a glock
-	   at inter-node scope (and remove it from our glock cache) */
-	int (*go_demote_ok) (struct gfs_glock * gl);
-
-	/* After getting lock for first holder (within this node) */
-	int (*go_lock) (struct gfs_glock * gl, int flags);
-
-	/* After last holder (within this node) gives up lock (glock may
-	   remain in glock cache, though) */
-	void (*go_unlock) (struct gfs_glock * gl, int flags);
-
-	/* After receiving a callback: another node needs the lock */
-	void (*go_callback) (struct gfs_glock * gl, unsigned int state);
-
-        /* Called when the glock layer marks a lock as being not greedy
-	   anymore */
-	void (*go_greedy) (struct gfs_glock * gl);
-
-	/* Lock type: locks with same lock # (often an FS block #),
-	   but different types, are different locks */
-	int go_type;
-};
-
-/*
- *  Glock holder structure
- *  One for each holder of a glock.
- *  These coordinate the use, within this node, of an acquired inter-node glock.
- *  Once a node has acquired a glock, it may be shared within that node by
- *    several processes, or even by several recursive requests from the same
- *    process.  Each is a separate "holder".  Different holders may co-exist
- *    having requested different lock states, as long as the node holds the
- *    glock in a state that is compatible.  A hold requestor may select, via
- *    flags, the rules by which sharing within the node is granted:
- *      LM_FLAG_ANY:  Grant if glock state is any other than UNLOCKED.
- *      GL_EXACT:     Grant only if glock state is exactly the requested state.
- *      GL_LOCAL_EXCL:  Grant only one holder at a time within this node.
- *    With no flags, a hold will be granted to a SHARED request even if the
- *    node holds the glock in EXCLUSIVE mode.  See relaxed_state_ok().
- *  When a process needs to manipulate a lock, it requests it via one of
- *    these holder structures.  If the request cannot be satisfied immediately,
- *    the holder structure gets queued on one of these lists in gfs_glock:
- *    1) waiters1, for gaining exclusive access to the (local) glock structure.
- *    2) waiters2, for demoting a lock (unlocking a glock, or changing its state
- *       to be less restrictive) or relenquishing "greedy" status.
- *    3) waiters3, for promoting (locking a new glock, or changing a glock state
- *       to be more restrictive).
- *  When holding a lock, gfs_holder struct stays on glock's holder list.
- *  See gfs-kernel/src/harness/lm_interface.h for gh_state (LM_ST_...)
- *    and gh_flags (LM_FLAG...) fields.
- *  Also see glock.h for gh_flags field (GL_...) flags.
- */
-
-/*  Action requests  */
-#define HIF_MUTEX       (0)  /* Exclusive (local) access to glock struct */
-#define HIF_PROMOTE     (1)  /* Change lock to more restrictive state */
-#define HIF_DEMOTE      (2)  /* Change lock to less restrictive state */
-#define HIF_GREEDY      (3)  /* Wait for the glock to be unlocked */
-
-/*  States  */
-#define HIF_ALLOCED     (4)  /* Holder structure is or was in use */
-#define HIF_DEALLOC     (5)  /* Toss holder struct as soon as queued request
-                              *   is satisfied */
-#define HIF_HOLDER      (6)  /* We have been granted a hold on the lock */
-#define HIF_FIRST       (7)  /* We are first holder to get the lock */
-#define HIF_RECURSE     (8)  /* >1 hold requests on same glock by same process*/
-#define HIF_ABORTED     (9) /* Aborted before being submitted */
-
-struct gfs_holder {
-	struct list_head gh_list;      /* Link to one of glock's holder lists */
-
-	struct gfs_glock *gh_gl;       /* Glock that we're holding */
-	struct task_struct *gh_owner;  /* Linux process that is the holder */
-
-	/* request to change lock state */
-	unsigned int gh_state;         /* LM_ST_... requested lock state */
-	int gh_flags;                  /* GL_... or LM_FLAG_... req modifiers */
-
-	int gh_error;                  /* GLR_... CANCELLED/TRYFAILED/-errno */
-	unsigned long gh_iflags;       /* HIF_... holder state, see above */
-	struct completion gh_wait;     /* Wait for completion of ... */
-};
-
-/*
- *  Glock Structure
- *  One for each inter-node lock held by this node.
- *  A glock is a local representation/abstraction of an inter-node lock.
- *    Inter-node locks are managed by a "lock module" (LM) which plugs in to
- *    the lock harness / glock interface (see gfs-kernel/harness).  Different
- *    lock modules support different lock protocols (e.g. GULM, GDLM, no_lock).
- *  A glock may have one or more holders within a node.  See gfs_holder above.
- *  Glocks are managed within a hash table hosted by the in-core superblock.
- *  After all holders have released a glock, it will stay in the hash table
- *    cache for a time (depending on lock type), during which the inter-node
- *    lock will not be released unless another node needs the lock (lock
- *    manager requests this via callback to GFS through LM on this node).  This
- *    provides better performance in case this node needs the glock again soon.
- *    See comments for meta_go_demote_ok(), glops.c.
- *  Each glock has an associated vector of lock-type-specific "glops" functions
- *    which are called at important times during the life of a glock, and
- *    which define the type of lock (e.g. dinode, rgrp, non-disk, etc).
- *    See gfs_glock_operations above.
- *  A glock, at inter-node scope, is identified by the following dimensions:
- *    1)  lock number (usually a block # for on-disk protected entities,
- *           or a fixed assigned number for non-disk locks, e.g. MOUNT).
- *    2)  lock type (actually, the type of entity protected by the lock).
- *    3)  lock namespace, to support multiple GFS filesystems simultaneously.
- *           Namespace (usually cluster:filesystem) is specified when mounting.
- *           See man page for gfs_mount.
- *  Glocks require support of Lock Value Blocks (LVBs) by the inter-node lock
- *    manager.  LVBs are small (32-byte) chunks of data associated with a given
- *    lock, that can be quickly shared between cluster nodes.  Used for certain
- *    purposes such as sharing an rgroup's block usage statistics without
- *    requiring the overhead of:
- *      -- sync-to-disk by one node, then a
- *      -- read from disk by another node.
- *  
- */
-
-#define GLF_PLUG                (0)  /* Dummy */
-#define GLF_LOCK                (1)  /* Exclusive (local) access to glock
-                                      *   structure */
-#define GLF_STICKY              (2)  /* Don't release this inter-node lock
-                                      *   unless another node explicitly asks */
-#define GLF_PREFETCH            (3)  /* This lock has been (speculatively)
-                                      *   prefetched, demote if not used soon */
-#define GLF_SYNC                (4)  /* Sync lock's protected data as soon as
-                                      *   there are no more holders */
-#define GLF_DIRTY               (5)  /* There is dirty data for this lock,
-                                      *   sync before releasing inter-node */
-#define GLF_SKIP_WAITERS2       (6)  /* Make run_queue() ignore gl_waiters2
-                                      *   (demote/greedy) holders */
-#define GLF_GREEDY              (7)  /* This lock is ignoring callbacks
-                                      *   (requests from other nodes) for now */
-
-struct gfs_glock {
-	struct list_head gl_list;    /* Link to hb_list in one of superblock's
-	                              * sd_gl_hash glock hash table buckets */
-	unsigned long gl_flags;      /* GLF_... see above */
-	struct lm_lockname gl_name;  /* Lock number and lock type */
-	atomic_t gl_count;           /* Usage count */
-
-	spinlock_t gl_spin;          /* Protects some members of this struct */
-
-	/* Lock state reflects inter-node manager's lock state */
-	unsigned int gl_state;       /* LM_ST_... see harness/lm_interface.h */
-
-	/* Lists of gfs_holders */
-	struct list_head gl_holders;  /* all current holders of the glock */
-	struct list_head gl_waiters1; /* HIF_MUTEX */
-	struct list_head gl_waiters2; /* HIF_DEMOTE, HIF_GREEDY */
-	struct list_head gl_waiters3; /* HIF_PROMOTE */
-
-	struct gfs_glock_operations *gl_ops; /* function vector, defines type */
-
-	/* State to remember for async lock requests */
-	struct gfs_holder *gl_req_gh; /* Holder for request being serviced */
-	gfs_glop_bh_t gl_req_bh;  /* The bottom half to execute */
-
-	void *gl_lock;            /* Lock module's private lock data */
-	char *gl_lvb;             /* Lock Value Block */
-	atomic_t gl_lvb_count;    /* LVB recursive usage (hold/unhold) count */
-
-	uint64_t gl_vn;           /* Incremented when protected data changes */
-	unsigned long gl_stamp;   /* Glock cache retention timer */
-	void *gl_object;          /* The protected entity (e.g. a dinode) */
-
-	/* Incore transaction stuff */
-	/* Log elements map us to a particular set of log operations functions,
-	   and to a particular transaction */
-	struct gfs_log_element gl_new_le;     /* New, incomplete transaction */
-	struct gfs_log_element gl_incore_le;  /* Complete (committed) trans */ 
-
-	struct gfs_gl_hash_bucket *gl_bucket; /* Our bucket in sd_gl_hash */
-	struct list_head gl_reclaim;          /* Link to sd_reclaim_list */
-
-	struct gfs_sbd *gl_sbd;               /* Superblock (FS instance) */
-
-	struct inode *gl_aspace;              /* The buffers protected by this lock */
-	struct list_head gl_ail_bufs;         /* AIL buffers protected by us */
-};
-
-/*
- *  In-Place Reservation structure
- *  Coordinates allocation of "in-place" (as opposed to journal) FS blocks,
- *     which contain persistent inode/file/directory data and metadata.
- *     These blocks are the allocatable blocks within resource groups (i.e.
- *     not including rgrp header and block alloc bitmap blocks).
- *  gfs_inplace_reserve() calculates a fulfillment plan for allocating blocks,
- *     based on block statistics in the resource group headers.
- *  Then, gfs_blkalloc() or gfs_metaalloc() walks the block alloc bitmaps
- *     to do the actual allocation.
- */
-struct gfs_alloc {
-	/* Up to 4 quotas (including an inode's user and group quotas)
-	   can track changes in block allocation */
-
-	unsigned int al_qd_num;          /* # of quotas tracking changes */
-	struct gfs_quota_data *al_qd[4]; /* Ptrs to quota structures */
-	struct gfs_holder al_qd_ghs[4];  /* Holders for quota glocks */
-
-	/* Request, filled in by the caller to gfs_inplace_reserve() */
-
-	uint32_t al_requested_di;     /* Number of dinodes to reserve */
-	uint32_t al_requested_meta;   /* Number of metadata blocks to reserve */
-	uint32_t al_requested_data;   /* Number of data blocks to reserve */
-
-	/* Fulfillment plan, filled in by gfs_inplace_reserve() */
-
-	char *al_file;                /* Debug info, .c file making request */
-	unsigned int al_line;         /* Debug info, line of code making req */
-	struct gfs_holder al_ri_gh;   /* Glock holder for resource grp index */
-	struct gfs_holder al_rgd_gh;  /* Glock holder for al_rgd rgrp */
-	struct gfs_rgrpd *al_rgd;     /* Resource group from which to alloc */
-	uint32_t al_reserved_meta;    /* Alloc up to this # meta blocks from al_rgd */
-	uint32_t al_reserved_data;    /* Alloc up to this # data blocks from al_rgd */
-
-	/* Actual alloc, filled in by gfs_blkalloc()/gfs_metaalloc(), etc. */
-
-	uint32_t al_alloced_di;       /* # dinode blocks allocated */
-	uint32_t al_alloced_meta;     /* # meta blocks allocated */
-	uint32_t al_alloced_data;     /* # data blocks allocated */
-
-	/* Dinode allocation crap */
-
-	struct gfs_unlinked *al_ul;   /* Unlinked dinode log entry */
-};
-
-/*
- *  Incore inode structure
- */
-
-#define GIF_QD_LOCKED           (0)
-#define GIF_PAGED               (1)
-#define GIF_SW_PAGED            (2)
-
-struct gfs_inode {
-	struct gfs_inum i_num;   /* Formal inode # and block address */
-
-	atomic_t i_count;        /* Usage count */
-	unsigned long i_flags;   /* GIF_...  see above */
-
-	uint64_t i_vn;           /* Version #: if different from glock's vn,
-	                            we need to read inode from disk */
-	struct gfs_dinode i_di;  /* Dinode (on-disk) structure */
-
-	struct gfs_glock *i_gl;  /* This glock protects this inode */
-	struct gfs_sbd *i_sbd;   /* Superblock (fs instance structure) */
-	struct inode *i_vnode;   /* Linux VFS inode structure */
-
-	struct gfs_holder i_iopen_gh;  /* Glock holder for Inode Open lock */
-
-	/* Block allocation strategy, inode scope */
-	struct gfs_alloc *i_alloc; /* In-place block reservation structure */
-	uint64_t i_last_rg_alloc;  /* Most recent blk alloc was fm this rgrp */
-
-	spinlock_t i_spin;
-	struct rw_semaphore i_rw_mutex;
-
-	/* Cache of most-recently used buffers in indirect addressing chain */
-	struct buffer_head *i_cache[GFS_MAX_META_HEIGHT];
-
-	unsigned int i_greedy; /* The amount of time to be greedy */
-	unsigned long i_last_pfault; /* The time of the last page fault */
-
-	struct timeval i_dir_stat_st; /* Start time of stat counter */
-	unsigned long i_dir_stats; /* stat counter for this directory */
-	struct address_space_operations gfs_file_aops;
-};
-
-/*
- *  GFS per-fd structure
- */
-
-#define GFF_DID_DIRECT_ALLOC    (0)
-
-struct gfs_file {
-	unsigned long f_flags; /* GFF_...  see above */
-
-	struct semaphore f_fl_lock; /* Lock to protect flock operations */
-	struct gfs_holder f_fl_gh; /* Holder for this f_vfile's flock */
-
-	struct gfs_inode *f_inode;        /* Incore GFS inode */
-	struct file *f_vfile;             /* Linux file struct */
-};
-
-/*
- *  Unlinked inode log entry incore structure
- */
-
-#define ULF_NEW_UL              (0)  /* Part of new (being built) trans */
-#define ULF_INCORE_UL           (1)  /* Part of incore-committed trans */
-#define ULF_IC_LIST             (2)
-#define ULF_OD_LIST             (3)
-#define ULF_LOCK                (4)  /* Protects access to this structure */
-
-struct gfs_unlinked {
-	struct list_head ul_list;    /* Link to superblock's sd_unlinked_list */
-	unsigned int ul_count;       /* Usage count */
-
-	struct gfs_inum ul_inum;     /* Formal inode #, block addr */
-	unsigned long ul_flags;      /* ULF_... */
-
-	/* Log elements map us to a particular set of log operations functions,
-	   and to a particular transaction */
-	struct gfs_log_element ul_new_le;    /* New, not yet committed */
-	struct gfs_log_element ul_incore_le; /* Committed to incore log */
-	struct gfs_log_element ul_ondisk_le; /* Committed to ondisk log */
-};
-
-/*
- *  Quota log element
- *  One for each logged change in a block alloc value affecting a given quota.
- *  Only one of these for a given quota within a given transaction;
- *    multiple changes, within one transaction, for a given quota will be
- *    combined into one log element.
- */
-struct gfs_quota_le {
-	/* Log element maps us to a particular set of log operations functions,
-	   and to a particular transaction */
-	struct gfs_log_element ql_le;    /* Generic log element structure */
-
-	struct gfs_quota_data *ql_data;  /* The quota we're changing */
-	struct list_head ql_data_list;   /* Link to quota's log element list */
-
-	int64_t ql_change;           /* # of blocks alloc'd (+) or freed (-) */
-};
-
-/*
- *  Quota structure
- *  One for each user or group quota.
- *  Summarizes all block allocation activity for a given quota, and supports
- *    recording updates of current block alloc values in GFS' special quota
- *    file, including the journaling of these updates, encompassing
- *    multiple transactions and log dumps.
- */
-
-#define QDF_USER                (0)   /* User (1) vs. group (0) quota */
-#define QDF_OD_LIST             (1)   /* Waiting for sync to quota file */
-#define QDF_LOCK                (2)   /* Protects access to this structure */
-
-struct gfs_quota_data {
-	struct list_head qd_list;     /* Link to superblock's sd_quota_list */
-	unsigned int qd_count;        /* Usage count */
-
-	uint32_t qd_id;               /* User or group ID number */
-	unsigned long qd_flags;       /* QDF_... */
-
-	/* This list is for non-log-dump transactions */
-	struct list_head qd_le_list;  /* List of gfs_quota_le log elements */
-
-	/* Summary of block alloc changes affecting this quota, in various
-	   stages of logging & syncing changes to the special quota file */
-	int64_t qd_change_new;  /* New, not yet committed to in-core log*/
-	int64_t qd_change_ic;   /* Committed to in-core log */
-	int64_t qd_change_od;   /* Committed to on-disk log */
-	int64_t qd_change_sync; /* Being synced to the in-place quota file */
-
-	struct gfs_quota_le qd_ondisk_ql; /* Log element for log dump */
-	uint64_t qd_sync_gen;         /* Sync-to-quota-file generation # */
-
-	/* Glock provides protection for quota, *and* provides
-	   lock value block (LVB) communication, between nodes, of current
-	   quota values.  Shared lock -> LVB read.  EX lock -> LVB write. */
-	struct gfs_glock *qd_gl;      /* glock for this quota */
-	struct gfs_quota_lvb qd_qb;   /* LVB (limit/warn/value) */
-
-	unsigned long qd_last_warn;   /* Jiffies of last warning to user */
-};
-
-/*
- * Log Buffer descriptor structure.
- * One for each block buffer recorded in the log.
- * When beginning a new transaction, GFS pre-allocates a number of these,
- *   and puts them on transaction's tr_free_bufs list.
- * Logged buffers are of two types:
- *   1).  Exact copies of buffers to be written to in-place location in FS.
- *   2).  Log-only buffers such as log headers and control blocks (e.g. tags).
- * A gfs_log_buf is required for both types; the ones for log-only buffers
- *   contain NULL in lb_unlock, and get cleaned up after the log write.
- * lb_bh is a "fake" buffer head that directs Linux block I/O to write the buf
- *   to the on-disk log location, rather than the on-disk in-place location.
- *   Used for both types.
- * lb_unlock points to the "real" buffer head that directs Linux to write the
- *   buf to its regular on-disk in-place filesystem location.  Once the commit
- *   to the on-disk log is finished, GFS unlocks the "real" buffer so it can be
- *   written to in-place block, or modified by another transaction.
- *   Used only for type 1).
- */
-struct gfs_log_buf {
-	/* Link to one of the transaction structure's lists */
-	struct list_head lb_list;      /* Link to tr_free_bufs or tr_list */
-
-	struct buffer_head lb_bh;      /* "Fake" bh; for the log block */
-	struct buffer_head *lb_unlock; /* "Real" bh; for the in-place block */
-};
-
-/*
- *  Transaction structure
- *  One for each transaction
- *  This coordinates the logging and flushing of written metadata.
- */
-
-#define TRF_LOG_DUMP            (0x00000001)
-#define TRF_DUMMY               (0x00000002)
-
-struct gfs_trans {
-
-	/* Link to various lists */
-	struct list_head tr_list;      /* Superblk's incore trans or AIL list*/
-
-	/* Initial creation stuff */
-
-	char *tr_file;                 /* Debug info: .c file creating trans */
-	unsigned int tr_line;          /* Debug info: codeline creating trans */
-
-	/* Reservations for on-disk space in journal.
-	   Meta blocks are copies of in-place filesystem blocks.  
-	   Extra blocks are log-only (log header and control blocks) */
-	unsigned int tr_mblks_asked;   /* # of meta log blocks requested */
-	unsigned int tr_eblks_asked;   /* # of extra log blocks requested */
-	unsigned int tr_seg_reserved;  /* # of segments actually reserved */
-
-	struct gfs_holder *tr_t_gh;    /* Glock holder for this transaction */
-
-	/* Stuff filled in during creation */
-
-	unsigned int tr_flags;         /* TRF_... */
-	struct list_head tr_elements;  /* List of this trans' log elements */
-
-	/* Stuff modified during the commit */
-
-	/* When creating a new transaction, GFS pre-allocates as many of
-	   these buffers and descriptor structures as it might need for
-	   all loggable filesystem (meta)data, and log-control (log-only, not
-	   going to filesystem in-place location) data going to on-disk log.
-	   It keeps them on these "free" lists until they get used (and linked
-	   into tr_bufs list, below) or "refunded" if not needed. */
-	unsigned int tr_num_free_bufs; /* List of free gfs_log_buf structs */
-	struct list_head tr_free_bufs; /* .. 1 for each log block */
-	unsigned int tr_num_free_bmem; /* List of free fs-block-size buffers */
-	struct list_head tr_free_bmem; /* .. for log-only (e.g. tag) blocks */
-
-	/* Logged transaction starts with a (first) log header at a segment
-	   boundary, and fills contiguous blocks after that.  Each segment
-	   boundary block gets another log header. */
-	uint64_t tr_log_head;          /* The next log block # to fill */
-	uint64_t tr_first_head;	       /* Trans' first log header's block # */
-
-	/* gfs_log_buf structs move from tr_free_bufs to here when being used */
-	struct list_head tr_bufs;      /* List of buffers going to the log */
-
-	/* Stuff that's part of the Active Items List (AIL) */
-
-	struct list_head tr_ail_bufs;  /* List of buffers on AIL list */
-
-	/* # log elements of various types on tr_elements list */
-
-	unsigned int tr_num_gl;        /* Glocks */
-	unsigned int tr_num_buf;       /* Buffers */
-	unsigned int tr_num_iul;       /* Unlinked inodes */
-	unsigned int tr_num_ida;       /* De-allocated inodes */
-	unsigned int tr_num_q;         /* Quotas */
-};
-
-#define GFS_GLOCKD_DEFAULT (1)
-#define GFS_GLOCKD_MAX (32)
-
-#define GFS_QUOTA_DEFAULT      GFS_QUOTA_OFF
-#define GFS_QUOTA_OFF          0
-#define GFS_QUOTA_ACCOUNT      1
-#define GFS_QUOTA_ON           2
-
-#define GFS_DATA_DEFAULT       GFS_DATA_ORDERED
-#define GFS_DATA_WRITEBACK     1
-#define GFS_DATA_ORDERED       2
-
-
-struct gfs_args {
-	char ar_lockproto[GFS_LOCKNAME_LEN]; /* The name of the Lock Protocol */
-	char ar_locktable[GFS_LOCKNAME_LEN]; /* The name of the Lock Table */
-	char ar_hostdata[GFS_LOCKNAME_LEN]; /* The host specific data */
-
-	int ar_spectator; /* Don't get a journal because we're always RO. */
-	/*
-	 * GFS can invoke some flock and disk caching optimizations if it is
-	 * not in a cluster, i.e. is a local filesystem.  The chosen lock
-	 * module tells GFS, at mount time, if it supports clustering.
-	 * The nolock module is the only one that does not support clustering;
-	 * it sets to TRUE the local_fs field in the struct lm_lockops.
-	 * GFS can either optimize, or ignore the opportunity.
-	 * The user controls behavior via the following mount options.
-	 */
-	int ar_ignore_local_fs; /* Don't optimize even if local_fs is TRUE */
-	int ar_localflocks; /* Let the VFS do flock|fcntl locks for us */
-	int ar_localcaching; /* Local-style caching (dangerous on multihost) */
-	int ar_oopses_ok; /* Allow oopses */
-
-	int ar_debug; /* Oops on errors instead of trying to be graceful */
-	int ar_upgrade; /* Upgrade ondisk/multihost format */
-
-	unsigned int ar_num_glockd; /* # of glock cleanup daemons to run
-				       (more daemons => faster cleanup)  */
-	int ar_posix_acls; /* Enable posix acls */
-	int ar_suiddir; /* suiddir support */
-	int ar_noquota; /* Turn off quota support */
-	int ar_noatime; /* Turn off atime updates */
-};
-
-struct gfs_tune {
-	spinlock_t gt_spin;
-
-	unsigned int gt_ilimit1;
-	unsigned int gt_ilimit1_tries;
-	unsigned int gt_ilimit1_min;
-	unsigned int gt_ilimit2;
-	unsigned int gt_ilimit2_tries;
-	unsigned int gt_ilimit2_min;
-	unsigned int gt_demote_secs; /* Cache retention for unheld glock */
-	unsigned int gt_incore_log_blocks;
-	unsigned int gt_jindex_refresh_secs; /* Check for new journal index */
-	unsigned int gt_depend_secs;
-
-	/* How often various daemons run (seconds) */
-	unsigned int gt_scand_secs; /* Find unused glocks and inodes */
-	unsigned int gt_recoverd_secs; /* Recover journal of crashed node */
-	unsigned int gt_logd_secs; /* Update log tail as AIL flushes */
-	unsigned int gt_quotad_secs; /* Sync changes to quota file, clean*/
-	unsigned int gt_inoded_secs; /* Toss unused inodes */
-	unsigned int gt_glock_purge; /* Purge glock */
-
-	unsigned int gt_quota_simul_sync; /* Max # quotavals to sync at once */
-	unsigned int gt_quota_warn_period; /* Secs between quota warn msgs */
-	unsigned int gt_atime_quantum; /* Min secs between atime updates */
-	unsigned int gt_quota_quantum; /* Secs between syncs to quota file */
-	unsigned int gt_quota_scale_num; /* Numerator */
-	unsigned int gt_quota_scale_den; /* Denominator */
-	unsigned int gt_quota_enforce;
-	unsigned int gt_quota_account;
-	unsigned int gt_new_files_jdata;
-	unsigned int gt_new_files_directio;
-	unsigned int gt_max_atomic_write; /* Split large writes into this size*/
-	unsigned int gt_max_readahead; /* Max bytes to read-ahead from disk */
-	unsigned int gt_lockdump_size;
-	unsigned int gt_stall_secs; /* Detects trouble! */
-	unsigned int gt_complain_secs;
-	unsigned int gt_reclaim_limit; /* Max # glocks in reclaim list */
-	unsigned int gt_entries_per_readdir;
-	unsigned int gt_prefetch_secs; /* Usage window for prefetched glocks */
-	unsigned int gt_statfs_slots;
-	unsigned int gt_max_mhc; /* Max # of meta headers in mhc cache */
-	unsigned int gt_greedy_default;
-	unsigned int gt_greedy_quantum;
-	unsigned int gt_greedy_max;
-	unsigned int gt_rgrp_try_threshold;
-	unsigned int gt_statfs_fast;
-};
-
-/*
- *  One bucket of the filesystem's sd_gl_hash glock hash table.
- *
- *  A gfs_glock links into a bucket's list via glock's gl_list member.
- *
- */
-struct gfs_gl_hash_bucket {
-	rwlock_t hb_lock;              /* Protects list */
-	struct list_head hb_list;      /* List of glocks in this bucket */
-};
-
-/*
- *  "Super Block" Data Structure
- *  One per mounted filesystem.
- *  This is the big instance structure that ties everything together for
- *    a given mounted filesystem.  Each GFS mount has its own, supporting
- *    mounts of multiple GFS filesystems on each node.
- *  Pointer to this is usually seen as "sdp" throughout code.
- *  This is a very large structure, as structures go, in part because it
- *    contains arrays of hash buckets for various in-core caches.
- */
-
-#define SDF_JOURNAL_LIVE        (0)  /* Journaling is active (journal is writeable)*/
-#define SDF_SHUTDOWN            (1)  /* FS abnormaly shutdown */
-
-/* (Re)mount options from Linux VFS */
-#define SDF_NOATIME             (8)  /* Don't change access time */
-#define SDF_ROFS                (9)  /* Read-only mode */
-
-/* Journal log dump support */
-#define SDF_NEED_LOG_DUMP       (10) /* Need to rewrite unlink and quota tags */
-#define SDF_FOUND_UL_DUMP       (11) /* Recovery found unlinked tags */
-#define SDF_FOUND_Q_DUMP        (12) /* Recovery found qutoa tags */
-#define SDF_IN_LOG_DUMP         (13) /* Serializes log dumps */
-
-/* Glock cache */
-#define GFS_GL_HASH_SHIFT       (13)    /* # hash buckets = 8K */
-#define GFS_GL_HASH_SIZE        (1 << GFS_GL_HASH_SHIFT)
-#define GFS_GL_HASH_MASK        (GFS_GL_HASH_SIZE - 1)
-
-/* Meta header cache */
-#define GFS_MHC_HASH_SHIFT      (10)    /* # hash buckets = 1K */
-#define GFS_MHC_HASH_SIZE       (1 << GFS_MHC_HASH_SHIFT)
-#define GFS_MHC_HASH_MASK       (GFS_MHC_HASH_SIZE - 1)
-
-/* Dependency cache */
-#define GFS_DEPEND_HASH_SHIFT   (10)    /* # hash buckets = 1K */
-#define GFS_DEPEND_HASH_SIZE    (1 << GFS_DEPEND_HASH_SHIFT)
-#define GFS_DEPEND_HASH_MASK    (GFS_DEPEND_HASH_SIZE - 1)
-
-struct gfs_sbd {
-	struct gfs_sb sd_sb;            /* GFS on-disk Super Block image */
-
-	struct super_block *sd_vfs;     /* Linux VFS device independent sb */
-
-	struct gfs_args sd_args;        /* Mount arguments */
-	unsigned long sd_flags;         /* SDF_... see above */
-
-	struct gfs_tune sd_tune;	/* Filesystem tuning structure */
-
-	/* statfs */
-	struct inode *sd_statfs_inode;
-	spinlock_t sd_statfs_spin;
-	struct gfs_statfs_change_host sd_statfs_master;
-	struct gfs_statfs_change_host sd_statfs_local;
-	unsigned long sd_statfs_sync_time;
-
-	/* Resource group stuff */
-
-	struct gfs_inode *sd_riinode;	/* Resource Index (rindex) inode */
-	uint64_t sd_riinode_vn;	        /* Resource Index version # (detects
-	                                   whether new rgrps have been added) */
-
-	struct list_head sd_rglist;	/* List of all resource groups,
-					   on-disk order */
-	struct semaphore sd_rindex_lock;/* Serializes RIndex rereads */
-	struct list_head sd_rg_mru_list;/* List of all resource groups,
-					   most-recently-used (MRU) order */
-	spinlock_t sd_rg_mru_lock;      /* Protect mru list */
-	struct list_head sd_rg_recent;	/* List of rgrps from which blocks
-					   were recently allocated */
-	spinlock_t sd_rg_recent_lock;   /* Protect recent list */
-	struct gfs_rgrpd *sd_rg_forward;/* Next rgrp from which to attempt
-					   a block alloc */
-	spinlock_t sd_rg_forward_lock;  /* Protect forward pointer */
-
-	unsigned int sd_rgcount;	/* Total # of resource groups */
-
-	/*  Constants computed on mount  */
-
-	/* "bb" == "basic block" == 512Byte sector */
-	uint32_t sd_fsb2bb;             /* # 512B basic blocks in a FS block */
-	uint32_t sd_fsb2bb_shift;       /* Shift sector # to the right by 
-	                                   this to get FileSystem block addr */
-	uint32_t sd_diptrs;     /* Max # of block pointers in a dinode */
-	uint32_t sd_inptrs;     /* Max # of block pointers in an indirect blk */
-	uint32_t sd_jbsize;     /* Payload size (bytes) of a journaled metadata
-	                               block (GFS journals all meta blocks) */
-	uint32_t sd_hash_bsize; /* sizeof(exhash hash block) */
-	uint32_t sd_hash_bsize_shift;
-	uint32_t sd_hash_ptrs;  /* Number of points in a hash block */
-	uint32_t sd_max_dirres; /* Max blocks needed to add a directory entry */
-	uint32_t sd_max_height;	/* Max height of a file's tree */
-	uint64_t sd_heightsize[GFS_MAX_META_HEIGHT];
-	uint32_t sd_max_jheight; /* Max height, journaled file's tree */
-	uint64_t sd_jheightsize[GFS_MAX_META_HEIGHT];
-
-	/*  Lock Stuff  */
-
-	/* Glock cache (all glocks currently held by this node for this FS) */
-	struct gfs_gl_hash_bucket sd_gl_hash[GFS_GL_HASH_SIZE];
-
-	/* Glock reclaim support for scand and glockd */
-	struct list_head sd_reclaim_list;   /* List of glocks to reclaim */
-	spinlock_t sd_reclaim_lock;
-	wait_queue_head_t sd_reclaim_wchan;
-	atomic_t sd_reclaim_count;          /* # glocks on reclaim list */
-
-	/* Lock module tells us if we're first-to-mount, 
-	   which journal to use, etc. */
-	struct lm_lockstruct sd_lockstruct; /* Info provided by lock module */
-
-	/*  Other caches */
-
-	/* Meta-header cache (incore copies of on-disk meta headers) */
-	struct list_head sd_mhc[GFS_MHC_HASH_SIZE]; /* hash buckets */
-	struct list_head sd_mhc_single;     /* Non-hashed list of all MHCs */
-	spinlock_t sd_mhc_lock;
-	atomic_t sd_mhc_count;              /* # MHCs in cache */
-
-	/* Dependency cache */
-	struct list_head sd_depend[GFS_DEPEND_HASH_SIZE];  /* Hash buckets */
-	spinlock_t sd_depend_lock;
-	atomic_t sd_depend_count;           /* # dependencies in cache */
-
-	/* LIVE inter-node lock indicates that FS is mounted on at least
-	   one node */
-	struct gfs_holder sd_live_gh;       /* Glock holder for LIVE lock */
-
-	/* For quiescing the filesystem */
-	struct gfs_holder sd_freeze_gh;
-	struct semaphore sd_freeze_lock;
-	unsigned int sd_freeze_count;
-
-	/*  Inode Stuff  */
-
-	struct gfs_inode *sd_rooti;         /* FS's root inode */
-
-	/* Only 1 node at a time may rename (e.g. mv) directory from
-	   one directory to another. */
-	struct gfs_glock *sd_rename_gl;     /* Rename glock */
-
-	/*  Daemon stuff  */
-
-	/* Scan for glocks and inodes to toss from memory */
-	struct task_struct *sd_scand_process; /* Scand places on reclaim list*/
-	struct task_struct *sd_glockd_process[GFS_GLOCKD_MAX];
-	unsigned int sd_glockd_num;    /* # of glockd procs to do reclaiming*/
-
-	/* Recover journal of a crashed node */
-	struct task_struct *sd_recoverd_process;
-
-	/* Update log tail as AIL gets flushed to in-place on-disk blocks */
-	struct task_struct *sd_logd_process;
-
-	/* Sync quota updates to disk, and clean up unused quota structs */
-	struct task_struct *sd_quotad_process;
-
-	/* Clean up unused inode structures */
-	struct task_struct *sd_inoded_process;
-
-	/*  Log stuff  */
-
-	/* Transaction lock protects the following from one another:
-	   normal write transaction, journal replay (recovery), fs upgrade,
-	   fs read-only => read/write and read/write => read-only conversions.
-	   Also, acquiring the transaction lock in a state other than shared
-	   causes all other machines in the cluster to sync out their dirty
-	   data, mark their journal as being clean, and prevent any new FS
-	   modifications from occuring (i.e. quiesces the FS). */
-	struct gfs_glock *sd_trans_gl;	/* Transaction glock structure */
-
-	struct gfs_inode *sd_jiinode;	/* Journal index inode */
-	uint64_t sd_jiinode_vn;         /* Journal index version # (detects
-	                                   if new journals have been added) */
-
-	unsigned int sd_journals;	/* Number of journals in the FS */
-	struct gfs_jindex *sd_jindex;	/* Array of journal descriptors */
-	struct semaphore sd_jindex_lock;
-	unsigned long sd_jindex_refresh_time; /* Poll for new journals (secs) */
-
-	struct gfs_jindex sd_jdesc;	 /* This machine's journal descriptor */
-	struct gfs_holder sd_journal_gh; /* This machine's jrnl glock holder */
-
-	uint64_t sd_sequence;	/* Assigned to xactions in order they commit */
-	uint64_t sd_log_head;	/* Block number of next journal write */
-	uint64_t sd_log_wrap;
-
-	spinlock_t sd_log_seg_lock;
-	unsigned int sd_log_seg_free;	/* # of free segments in the log */
-	unsigned int sd_log_seg_ail2; /* # of freeable segments in the log */
-	struct list_head sd_log_seg_list;
-	wait_queue_head_t sd_log_seg_wait;
-
-	/* "Active Items List" of transactions that have been flushed to
-	   on-disk log, and are waiting for flush to in-place on-disk blocks */
-	struct list_head sd_log_ail;	/* "next" is head, "prev" is tail */
-
-	/* Transactions committed incore, but not yet flushed to on-disk log */
-	struct list_head sd_log_incore;	/* "Next" is newest, "prev" is oldest */
-	unsigned int sd_log_buffers;	/* # of buffers in the incore log */
-
-	struct rw_semaphore sd_log_lock;	/* Lock for access to log values */
-
-	uint64_t sd_log_dump_last;
-	uint64_t sd_log_dump_last_wrap;
-
-	/*
-	 * Unlinked inode crap.
-	 * List includes newly created, not-yet-linked inodes,
-	 *   as well as inodes that have been unlinked and are waiting
-         *   to be de-allocated.
-	 */
-	struct list_head sd_unlinked_list; /* List of unlinked inodes */
-	spinlock_t sd_unlinked_lock;       /* Protects list and members */
-
-	atomic_t sd_unlinked_ic_count;
-	atomic_t sd_unlinked_od_count;
-
-	/* Quota crap */
-
-	struct list_head sd_quota_list; /* List of all gfs_quota_data structs */
-	spinlock_t sd_quota_lock;
-
-	atomic_t sd_quota_count;        /* # quotas on sd_quota_list */
-	atomic_t sd_quota_od_count;     /* # quotas waiting for sync to
-	                                   special on-disk quota file */
-
-	struct gfs_inode *sd_qinode;    /* Special on-disk quota file */
-
-	uint64_t sd_quota_sync_gen;     /* Generation, incr when sync to file */
-	unsigned long sd_quota_sync_time; /* Jiffies, last sync to quota file */
-
-	/* License crap */
-
-	struct gfs_inode *sd_linode;    /* Special on-disk license file */
-
-	/* Recovery stuff */
-
-	/* Lock module tells GFS, via callback, when a journal needs recovery.
-	   It stays on this list until recovery daemon performs recovery. */
-	struct list_head sd_dirty_j;    /* List of dirty journals */
-	spinlock_t sd_dirty_j_lock;     /* Protects list */
-
-	/* Statistics for 3 possible recovery actions for each buffer in log,
-	     determined by comparing generation #s of logged block and
-	     in-place block.  Scope of stats is for one journal. */
-	unsigned int sd_recovery_replays; /* newer than in-place; copy it */
-	unsigned int sd_recovery_skips;   /* older than in-place; ignore it */
-	unsigned int sd_recovery_sames;   /* same as in-place; ignore it */
-
-	/* Counters */
-
-	/* current quantities of various things */
-	atomic_t sd_glock_count;      /* # of gfs_glock structs alloc'd */
-	atomic_t sd_glock_held_count; /* # of glocks locked by this node */
-	atomic_t sd_inode_count;      /* # of gfs_inode structs alloc'd */
-	atomic_t sd_bufdata_count;    /* # of gfs_bufdata structs alloc'd */
-
-	atomic_t sd_fh2dentry_misses; /* total # get_dentry misses */
-	atomic_t sd_reclaimed;        /* total # glocks reclaimed since mount */
-
-	/* total lock-related calls handled since mount */
-	atomic_t sd_glock_nq_calls;
-	atomic_t sd_glock_dq_calls;
-	atomic_t sd_glock_prefetch_calls;
-	atomic_t sd_lm_lock_calls;
-	atomic_t sd_lm_unlock_calls;
-	atomic_t sd_lm_callbacks;
-
-	atomic_t sd_lm_outstanding;
-	atomic_t sd_bio_reads;
-	atomic_t sd_bio_writes;
-	atomic_t sd_bio_outstanding;
-
-	/* total calls from Linux VFS handled since mount */
-	atomic_t sd_ops_address;
-	atomic_t sd_ops_dentry;
-	atomic_t sd_ops_export;
-	atomic_t sd_ops_file;
-	atomic_t sd_ops_inode;
-	atomic_t sd_ops_super;
-	atomic_t sd_ops_vm;
-
-	char sd_fsname[256];
-	char sd_table_name[256];
-	char sd_proto_name[256];
-
-	struct kobject sd_kobj;
-
-	/* Debugging crud */
-
-	unsigned long sd_last_warning;
-
-	spinlock_t sd_ail_lock;
-	struct list_head sd_recovery_bufs;
-
-	struct list_head sd_list;
-};
-
-#endif /* __INCORE_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/inode.c b/gfs-kernel/src/gfs/inode.c
deleted file mode 100644
index 9de4741..0000000
--- a/gfs-kernel/src/gfs/inode.c
+++ /dev/null
@@ -1,2223 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <linux/posix_acl.h>
-
-#include "gfs.h"
-#include "acl.h"
-#include "bmap.h"
-#include "dio.h"
-#include "dir.h"
-#include "eattr.h"
-#include "glock.h"
-#include "glops.h"
-#include "inode.h"
-#include "log.h"
-#include "ops_address.h"
-#include "ops_file.h"
-#include "ops_inode.h"
-#include "quota.h"
-#include "rgrp.h"
-#include "trans.h"
-#include "unlinked.h"
-
-/**
- * inode_attr_in - Copy attributes from the dinode into the VFS inode
- * @ip: The GFS inode (with embedded disk inode data)
- * @inode:  The Linux VFS inode
- *
- */
-
-static void
-inode_attr_in(struct gfs_inode *ip, struct inode *inode)
-{
-	unsigned int mode;
-
-	inode->i_ino = ip->i_num.no_formal_ino;
-
-	switch (ip->i_di.di_type) {
-	case GFS_FILE_REG:
-		mode = S_IFREG;
-		inode->i_rdev = 0;
-		break;
-	case GFS_FILE_DIR:
-		mode = S_IFDIR;
-		inode->i_rdev = 0;
-		break;
-	case GFS_FILE_LNK:
-		mode = S_IFLNK;
-		inode->i_rdev = 0;
-		break;
-	case GFS_FILE_BLK:
-		mode = S_IFBLK;
-		inode->i_rdev = MKDEV(ip->i_di.di_major, ip->i_di.di_minor);
-		break;
-	case GFS_FILE_CHR:
-		mode = S_IFCHR;
-		inode->i_rdev = MKDEV(ip->i_di.di_major, ip->i_di.di_minor);
-		break;
-	case GFS_FILE_FIFO:
-		mode = S_IFIFO;
-		inode->i_rdev = 0;
-		break;
-	case GFS_FILE_SOCK:
-		mode = S_IFSOCK;
-		inode->i_rdev = 0;
-		break;
-	default:
-		if (gfs_consist_inode(ip))
-			printk("GFS: fsid=%s: type = %u\n",
-			       ip->i_sbd->sd_fsname, ip->i_di.di_type);
-		return;
-	};
-
-	inode->i_mode = mode | (ip->i_di.di_mode & S_IALLUGO);
-	inode->i_nlink = ip->i_di.di_nlink;
-	inode->i_uid = ip->i_di.di_uid;
-	inode->i_gid = ip->i_di.di_gid;
-	i_size_write(inode, ip->i_di.di_size);
-	inode->i_atime.tv_sec = ip->i_di.di_atime;
-	inode->i_mtime.tv_sec = ip->i_di.di_mtime;
-	inode->i_ctime.tv_sec = ip->i_di.di_ctime;
-	inode->i_atime.tv_nsec = inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = 0;
-	inode->i_blocks = ip->i_di.di_blocks <<
-		(ip->i_sbd->sd_sb.sb_bsize_shift - GFS_BASIC_BLOCK_SHIFT);
-	inode->i_generation = ip->i_di.di_header.mh_incarn;
-
-	if (ip->i_di.di_flags & GFS_DIF_IMMUTABLE)
-		inode->i_flags |= S_IMMUTABLE;
-	else
-		inode->i_flags &= ~S_IMMUTABLE;
-
-	if (ip->i_di.di_flags & GFS_DIF_APPENDONLY)
-		inode->i_flags |= S_APPEND;
-	else
-		inode->i_flags &= ~S_APPEND;
-}
-
-/**
- * gfs_inode_attr_in - Copy attributes from the dinode into the VFS inode
- * @ip: The GFS inode (with embedded disk inode data)
- *
- */
-
-void
-gfs_inode_attr_in(struct gfs_inode *ip)
-{
-	struct inode *inode;
-
-	inode = gfs_iget(ip, NO_CREATE);
-	if (inode) {
-		inode_attr_in(ip, inode);
-		iput(inode);
-	}
-
-}
-
-/**
- * gfs_inode_attr_out - Copy attributes from VFS inode into the dinode
- * @ip: The GFS inode
- *
- * Only copy out the attributes that we want the VFS layer
- * to be able to modify.
- */
-
-void
-gfs_inode_attr_out(struct gfs_inode *ip)
-{
-	struct inode *inode = ip->i_vnode;
-
-	ip->i_di.di_mode = inode->i_mode & S_IALLUGO;
-	ip->i_di.di_uid = inode->i_uid;
-	ip->i_di.di_gid = inode->i_gid;
-	ip->i_di.di_atime = inode->i_atime.tv_sec;
-	ip->i_di.di_mtime = inode->i_mtime.tv_sec;
-	ip->i_di.di_ctime = inode->i_ctime.tv_sec;
-}
-
-/**
- * gfs_iget - Get/Create a struct inode for a struct gfs_inode
- * @ip: the struct gfs_inode to get the struct inode for
- * @create: CREATE -- create a new struct inode if one does not already exist
- *          NO_CREATE -- return NULL if inode doesn't exist
- *
- * Returns: A VFS inode, or NULL if NO_CREATE and none in existance
- *
- * If this function creates a new inode, it:
- *   Copies fields from the GFS on-disk (d)inode to the VFS inode
- *   Attaches the appropriate ops vectors to the VFS inode and address_space
- *   Attaches the VFS inode to the gfs_inode
- *   Inserts the new inode in the VFS inode hash, while avoiding races
- */
-
-struct inode *
-gfs_iget(struct gfs_inode *ip, int create)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct inode *inode = NULL, *tmp;
-
-	spin_lock(&ip->i_spin);
-	if (ip->i_vnode)
-		inode = igrab(ip->i_vnode);
-	spin_unlock(&ip->i_spin);
-
-	if (inode || !create)
-		return inode;
-
-	tmp = new_inode(ip->i_sbd->sd_vfs);
-	if (!tmp)
-		return NULL;
-
-	inode_attr_in(ip, tmp);
-
-	/* Attach GFS-specific ops vectors */
-	if (ip->i_di.di_type == GFS_FILE_REG) {
-		tmp->i_op = &gfs_file_iops;
-		memcpy(&ip->gfs_file_aops, &gfs_file_aops,
-			   sizeof(struct address_space_operations));
-		tmp->i_mapping->a_ops = &ip->gfs_file_aops;
-		if (sdp->sd_args.ar_localflocks) {
-			if (gfs_is_jdata(ip))
-				tmp->i_fop = &gfs_file_fops_nolock_jdata;
-			else
-				tmp->i_fop = &gfs_file_fops_nolock;
-		} else {
-			if (gfs_is_jdata(ip))
-				tmp->i_fop = &gfs_file_fops_jdata;
-			else
-				tmp->i_fop = &gfs_file_fops;
-		}
-	} else if (ip->i_di.di_type == GFS_FILE_DIR) {
-		tmp->i_op = &gfs_dir_iops;
-		if (sdp->sd_args.ar_localflocks)
-			tmp->i_fop = &gfs_dir_fops_nolock;
-		else
-			tmp->i_fop = &gfs_dir_fops;
-	} else if (ip->i_di.di_type == GFS_FILE_LNK) {
-		tmp->i_op = &gfs_symlink_iops;
-	} else {
-		tmp->i_op = &gfs_dev_iops;
-		init_special_inode(tmp, tmp->i_mode, tmp->i_rdev);
-	}
-
-	set_v2ip(tmp, NULL);
-
-	/* Did another process successfully create an inode while we were
-	   preparing this (tmp) one?  If so, we can use that other one, and
-	   trash the one we were preparing. 
-	   The other process might not be done inserting the inode in the
-	   VFS hash table.  If so, we need to wait until it is done, then
-	   we can use it.  */
-	for (;;) {
-		spin_lock(&ip->i_spin);
-		if (!ip->i_vnode)
-			break;
-		inode = igrab(ip->i_vnode);
-		spin_unlock(&ip->i_spin);
-
-		if (inode) {
-			iput(tmp);
-			return inode;
-		}
-		yield();
-	}
-
-	inode = tmp;
-
-	gfs_inode_hold(ip);
-	ip->i_vnode = inode;
-	set_v2ip(inode, ip);
-
-	spin_unlock(&ip->i_spin);
-
-	insert_inode_hash(inode);
-
-	return inode;
-}
-
-/**
- * gfs_copyin_dinode - Refresh the incore copy of the dinode
- * @ip: The GFS inode
- *
- * Returns: errno
- */
-
-int
-gfs_copyin_dinode(struct gfs_inode *ip)
-{
-	struct buffer_head *dibh;
-	int error;
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-	if (error)
-		return error;
-
-	if (gfs_metatype_check(ip->i_sbd, dibh, GFS_METATYPE_DI)) {
-		brelse(dibh);
-		return -EIO;
-	}
-
-	gfs_dinode_in(&ip->i_di, dibh->b_data);
-	brelse(dibh);
-
-	if (ip->i_num.no_formal_ino != ip->i_di.di_num.no_formal_ino) {
-		if (gfs_consist_inode(ip))
-			gfs_dinode_print(&ip->i_di);
-		return -EIO;
-	}
-
-	/* Handle a moved inode (not implemented yet) */
-	if (ip->i_num.no_addr != ip->i_di.di_num.no_addr) {
-		if (gfs_consist_inode(ip))
-			gfs_dinode_print(&ip->i_di);
-		return -EIO;
-	}
-
-	ip->i_vn = ip->i_gl->gl_vn;
-
-	return 0;
-}
-
-/**
- * inode_create - create a struct gfs_inode, acquire Inode-Open (iopen) glock,
- *      read dinode from disk
- * @i_gl: The (already held) glock covering the inode
- * @inum: The inode number
- * @io_gl: the iopen glock to acquire/hold (using holder in new gfs_inode)
- * @io_state: the state the iopen glock should be acquired in
- * @ipp: pointer to put the returned inode in
- *
- * Returns: errno
- */
-
-static int
-inode_create(struct gfs_glock *i_gl, struct gfs_inum *inum,
-	     struct gfs_glock *io_gl, unsigned int io_state,
-	     struct gfs_inode **ipp)
-{
-	struct gfs_sbd *sdp = i_gl->gl_sbd;
-	struct gfs_inode *ip;
-	int error = 0;
-
-	RETRY_MALLOC(ip = kmem_cache_alloc(gfs_inode_cachep, GFP_KERNEL), ip);
-	memset(ip, 0, sizeof(struct gfs_inode));
-
-	ip->i_num = *inum;
-
-	atomic_set(&ip->i_count, 1);
-
-	ip->i_gl = i_gl;
-	ip->i_sbd = sdp;
-
-	spin_lock_init(&ip->i_spin);
-	init_rwsem(&ip->i_rw_mutex);
-
-	ip->i_greedy = gfs_tune_get(sdp, gt_greedy_default);
-
-	/* Lock the iopen glock (may be recursive) */
-	error = gfs_glock_nq_init(io_gl,
-				  io_state, GL_LOCAL_EXCL | GL_EXACT,
-				  &ip->i_iopen_gh);
-	if (error)
-		goto fail;
-
-	ip->i_iopen_gh.gh_owner = NULL;
-
-	/* Assign the inode's glock as this iopen glock's protected object */
-	spin_lock(&io_gl->gl_spin);
-	gfs_glock_hold(i_gl);
-	set_gl2gl(io_gl, i_gl);
-	spin_unlock(&io_gl->gl_spin);
-
-	/* Read dinode from disk */
-	error = gfs_copyin_dinode(ip);
-	if (error)
-		goto fail_iopen;
-
-	gfs_glock_hold(i_gl);
-	set_gl2ip(i_gl, ip);
-
-	/* initialize stat counter and timestamp */
-	ip->i_dir_stats = 0;
-	do_gettimeofday(&ip->i_dir_stat_st);
-
-	atomic_inc(&sdp->sd_inode_count);
-
-	*ipp = ip;
-
-	return 0;
-
- fail_iopen:
-	spin_lock(&io_gl->gl_spin);
-	set_gl2gl(io_gl, NULL);
-	gfs_glock_put(i_gl);
-	spin_unlock(&io_gl->gl_spin);
-
-	gfs_glock_dq_uninit(&ip->i_iopen_gh);
-
- fail:
-	gfs_flush_meta_cache(ip);
-	kmem_cache_free(gfs_inode_cachep, ip);
-	*ipp = NULL;
-
-	return error;
-}
-
-/**
- * gfs_inode_get - Get an inode given its number
- * @i_gl: The glock covering the inode
- * @inum: The inode number
- * @create: Flag to say if we are allowed to create a new struct gfs_inode
- * @ipp: pointer to put the returned inode in
- *
- * Returns: errno
- *
- * If creating a new gfs_inode structure, reads dinode from disk.
- */
-
-int
-gfs_inode_get(struct gfs_glock *i_gl, struct gfs_inum *inum, int create,
-		struct gfs_inode **ipp)
-{
-	struct gfs_glock *io_gl;
-	int error = 0;
-
-	*ipp = get_gl2ip(i_gl);
-	if (*ipp) {
-		atomic_inc(&(*ipp)->i_count);
-		gfs_assert_warn(i_gl->gl_sbd, 
-				(*ipp)->i_num.no_formal_ino ==
-				inum->no_formal_ino);
-	} else if (create) {
-		error = gfs_glock_get(i_gl->gl_sbd,
-				      inum->no_addr, &gfs_iopen_glops,
-				      CREATE, &io_gl);
-		if (!error) {
-			error = inode_create(i_gl, inum, io_gl,
-					     LM_ST_SHARED, ipp);
-			gfs_glock_put(io_gl);
-		}
-	}
-
-	return error;
-}
-
-/**
- * gfs_inode_hold - hold a struct gfs_inode structure
- * @ip: The GFS inode
- *
- */
-
-void
-gfs_inode_hold(struct gfs_inode *ip)
-{
-	gfs_assert(ip->i_sbd, atomic_read(&ip->i_count) > 0,);
-	atomic_inc(&ip->i_count);
-}
-
-/**
- * gfs_inode_put - put a struct gfs_inode structure
- * @ip: The GFS inode
- *
- */
-
-void
-gfs_inode_put(struct gfs_inode *ip)
-{
-	gfs_assert(ip->i_sbd, atomic_read(&ip->i_count) > 0,);
-	atomic_dec(&ip->i_count);
-}
-
-/**
- * gfs_inode_destroy - Destroy a GFS inode structure with no references on it
- * @ip: The GFS inode
- *
- * Also, unhold the iopen glock and release indirect addressing buffers.
- * This function must be called with a glocks held on the inode and 
- *   the associated iopen.
- *
- */
-
-void
-gfs_inode_destroy(struct gfs_inode *ip)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_glock *io_gl = ip->i_iopen_gh.gh_gl;
-	struct gfs_glock *i_gl = ip->i_gl;
-
-	gfs_assert_warn(sdp, !atomic_read(&ip->i_count));
-	gfs_assert(sdp, get_gl2gl(io_gl) == i_gl,);
-
-	/* Unhold the iopen glock */
-	spin_lock(&io_gl->gl_spin);
-	set_gl2gl(io_gl, NULL);
-	gfs_glock_put(i_gl);
-	spin_unlock(&io_gl->gl_spin);
-
-	gfs_glock_dq_uninit(&ip->i_iopen_gh);
-
-	/* Release indirect addressing buffers, destroy the GFS inode struct */
-	gfs_flush_meta_cache(ip);
-	kmem_cache_free(gfs_inode_cachep, ip);
-
-	set_gl2ip(i_gl, NULL);
-	gfs_glock_put(i_gl);
-
-	atomic_dec(&sdp->sd_inode_count);
-}
-
-/**
- * dinode_mark_unused - Set UNUSED flag in on-disk dinode
- * @ip:
- *
- * Also:
- * --  Increment incarnation number, to indicate that it no longer
- *       represents the old inode.
- * --  Update change time (ctime)
- *
- * Returns: errno
- */
-
-static int
-dinode_mark_unused(struct gfs_inode *ip)
-{
-	struct buffer_head *dibh;
-	struct gfs_dinode *di;
-	uint32_t incarn;
-	uint64_t ctime;
-	uint32_t flags;
-	int error;
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-	if (error)
-		return error;
-
-	di = (struct gfs_dinode *)dibh->b_data;
-
-	gfs_trans_add_bh(ip->i_gl, dibh);
-
-	incarn = gfs32_to_cpu(di->di_header.mh_incarn) + 1;
-	di->di_header.mh_incarn = cpu_to_gfs32(incarn);
-
-	ctime = get_seconds();
-	di->di_ctime = cpu_to_gfs64(ctime);
-
-	flags = (gfs32_to_cpu(di->di_flags)) | GFS_DIF_UNUSED;
-	di->di_flags = cpu_to_gfs32(flags);
-
-	brelse(dibh);
-
-	return 0;
-}
-
-/**
- * dinode_dealloc - Put deallocate a dinode
- * @ip: The GFS inode
- *
- * Returns: errno
- */
-
-static int
-dinode_dealloc(struct gfs_inode *ip)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_alloc *al;
-	struct gfs_rgrpd *rgd;
-	int error;
-
-	if (ip->i_di.di_blocks != 1) {
-		if (gfs_consist_inode(ip))
-			gfs_dinode_print(&ip->i_di);
-		return -EIO;
-	}
-
-	al = gfs_alloc_get(ip);
-
-	error = gfs_quota_hold_m(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
-	if (error)
-		goto out;
-
-	error = gfs_rindex_hold(sdp, &al->al_ri_gh);
-	if (error)
-		goto out_qs;
-
-	rgd = gfs_blk2rgrpd(sdp, ip->i_num.no_addr);
-	if (!rgd) {
-		gfs_consist_inode(ip);
-		error = -EIO;
-		goto out_rindex_relse;
-	}
-
-	error = gfs_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, &al->al_rgd_gh);
-	if (error)
-		goto out_rindex_relse;
-
-	/* Trans may require:
-	   One block for the RG header.
-	   One block for the dinode bit.
-	   One block for the dinode.
-	   We also need a block for the unlinked change.
-	   One block for the quota change. */
-
-	error = gfs_trans_begin(sdp, 3, 2);
-	if (error)
-		goto out_rg_gunlock;
-
-	/* Set the UNUSED flag in the on-disk dinode block, increment incarn */
-	error = dinode_mark_unused(ip);
-	if (error)
-		goto out_end_trans;
-
-	/* De-allocate on-disk dinode block to FREEMETA */
-	gfs_difree(rgd, ip);
-
-	gfs_trans_add_unlinked(sdp, GFS_LOG_DESC_IDA, &ip->i_num);
-	clear_bit(GLF_STICKY, &ip->i_gl->gl_flags);
-
- out_end_trans:
-	gfs_trans_end(sdp);
-
- out_rg_gunlock:
-	gfs_glock_dq_uninit(&al->al_rgd_gh);
-
- out_rindex_relse:
-	gfs_glock_dq_uninit(&al->al_ri_gh);
-
- out_qs:
-	gfs_quota_unhold_m(ip);
-
- out:
-	gfs_alloc_put(ip);
-
-	return error;
-}
-
-/**
- * inode_dealloc - Deallocate all on-disk blocks for an inode (dinode)
- * @sdp: the filesystem
- * @inum: the inode number to deallocate
- * @io_gh: a holder for the iopen glock for this inode
- *
- * De-allocates all on-disk blocks, data and metadata, associated with an inode.
- * All metadata blocks become GFS_BLKST_FREEMETA.
- * All data blocks become GFS_BLKST_FREE.
- * Also de-allocates incore gfs_inode structure.
- *
- * Returns: errno
- */
-
-static int
-inode_dealloc(struct gfs_sbd *sdp, struct gfs_inum *inum,
-		struct gfs_holder *io_gh)
-{
-	struct gfs_inode *ip;
-	struct gfs_holder i_gh;
-	int error;
-
-	/* Lock the inode as we blow it away */
-	error = gfs_glock_nq_num(sdp,
-				 inum->no_formal_ino, &gfs_inode_glops,
-				 LM_ST_EXCLUSIVE, 0, &i_gh);
-	if (error)
-		return error;
-
-	/* We reacquire the iopen lock here to avoid a race with the NFS server
-	   calling gfs_read_inode() with the inode number of a inode we're in
-	   the process of deallocating.  And we can't keep our hold on the lock
-	   from inode_dealloc_init() for deadlock reasons.  We do, however,
-	   overlap this iopen lock with the one to be acquired EX within
-	   inode_create(), below (recursive EX locks will be granted to same
-	   holder process, i.e. this process). */
-
-	gfs_holder_reinit(LM_ST_EXCLUSIVE, LM_FLAG_TRY, io_gh);
-	error = gfs_glock_nq(io_gh);
-	switch (error) {
-	case 0:
-		break;
-	case GLR_TRYFAILED:
-		error = 0;
-		goto fail;
-	default:
-		goto fail;
-	}
-
-	gfs_assert_warn(sdp, !get_gl2ip(i_gh.gh_gl));
-	error = inode_create(i_gh.gh_gl, inum, io_gh->gh_gl, LM_ST_EXCLUSIVE,
-			     &ip);
-
-	gfs_glock_dq(io_gh);
-
-	if (error)
-		goto fail;
-
-	/* Verify disk (d)inode, gfs inode, and VFS (v)inode are unused */
-	if (ip->i_di.di_nlink) {
-		if (gfs_consist_inode(ip))
-			gfs_dinode_print(&ip->i_di);
-		error = -EIO;
-		goto fail_iput;
-	}
-	gfs_assert_warn(sdp, atomic_read(&ip->i_count) == 1);
-	gfs_assert_warn(sdp, !ip->i_vnode);
-
-	/* Free all on-disk directory leaves (if any) to FREEMETA state */
-	if (ip->i_di.di_type == GFS_FILE_DIR &&
-	    (ip->i_di.di_flags & GFS_DIF_EXHASH)) {
-		error = gfs_dir_exhash_free(ip);
-		if (error)
-			goto fail_iput;
-	}
-
-	/* Free all on-disk extended attribute blocks to FREEMETA state */
-	if (ip->i_di.di_eattr) {
-		error = gfs_ea_dealloc(ip);
-		if (error)
-			goto fail_iput;
-	}
-
-	/* Free all data blocks to FREE state, and meta blocks to FREEMETA */
-	error = gfs_shrink(ip, 0, NULL);
-	if (error)
-		goto fail_iput;
-
-	/* Set UNUSED flag and increment incarn # in on-disk dinode block,
-	   and de-alloc the block to FREEMETA */
-	error = dinode_dealloc(ip);
-	if (error)
-		goto fail_iput;
-
-	/* Free the GFS inode structure, unhold iopen and inode glocks */
-	gfs_inode_put(ip);
-	gfs_inode_destroy(ip);
-
-	gfs_glock_dq_uninit(&i_gh);
-
-	return 0;
-
- fail_iput:
-	gfs_inode_put(ip);
-	gfs_inode_destroy(ip);
-
- fail:
-	gfs_glock_dq_uninit(&i_gh);
-
-	return error;
-}
-
-/**
- * inode_dealloc_init - Try to deallocate an initialized on-disk inode (dinode)
- *      and all of its associated data and meta blocks
- * @sdp: the filesystem
- *
- * Returns: 0 on success, -errno on error, 1 on busy (inode open)
- */
-
-static int
-inode_dealloc_init(struct gfs_sbd *sdp, struct gfs_inum *inum)
-{
-	struct gfs_holder io_gh;
-	int error = 0;
-
-	/* If not busy (on this node), de-alloc GFS incore inode, releasing
-	   any indirect addressing buffers, and unholding iopen glock */
-	gfs_try_toss_inode(sdp, inum);
-
-	/* Does another process (cluster-wide) have this inode open? */
-	error = gfs_glock_nq_num(sdp,
-				 inum->no_addr, &gfs_iopen_glops,
-				 LM_ST_EXCLUSIVE, LM_FLAG_TRY_1CB, &io_gh);
-	switch (error) {
-	case 0:
-		break;
-	case GLR_TRYFAILED:
-		return 1;
-	default:
-		return error;
-	}
-
-	/* Unlock here to prevent deadlock */
-	gfs_glock_dq(&io_gh);
-
-	/* No other process in the entire cluster has this inode open;
-	   we can remove it and all of its associated blocks from disk */
-	error = inode_dealloc(sdp, inum, &io_gh);
-	gfs_holder_uninit(&io_gh);
-
-	return error;
-}
-
-/**
- * inode_dealloc_uninit - dealloc an uninitialized on-disk inode (dinode) block
- * @sdp: the filesystem
- *
- * Create a transaction to change dinode block's alloc state to FREEMETA
- *
- * Returns: 0 on success, -errno on error, 1 on busy
- */
-
-static int
-inode_dealloc_uninit(struct gfs_sbd *sdp, struct gfs_inum *inum)
-{
-	struct gfs_rgrpd *rgd;
-	struct gfs_holder ri_gh, rgd_gh;
-	int error;
-
-	error = gfs_rindex_hold(sdp, &ri_gh);
-	if (error)
-		return error;
-
-	rgd = gfs_blk2rgrpd(sdp, inum->no_addr);
-	if (!rgd) {
-		gfs_consist(sdp);
-		error = -EIO;
-		goto fail;
-	}
-
-	error = gfs_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, &rgd_gh);
-	if (error)
-		goto fail;
-
-	/* Trans may require:
-	   One block for the RG header.
-	   One block for the dinode bit.
-	   We also need a block for the unlinked change. */
-
-	error = gfs_trans_begin(sdp, 2, 1);
-	if (error)
-		goto fail_gunlock;
-
-	gfs_difree_uninit(rgd, inum->no_addr);
-	gfs_trans_add_unlinked(sdp, GFS_LOG_DESC_IDA, inum);
-
-	gfs_trans_end(sdp);
-
-	gfs_glock_dq_uninit(&rgd_gh);
-	gfs_glock_dq_uninit(&ri_gh);
-
-	return 0;
-
- fail_gunlock:
-	gfs_glock_dq_uninit(&rgd_gh);
-
- fail:
-	gfs_glock_dq_uninit(&ri_gh);
-
-	return error;
-}
-
-/**
- * gfs_inode_dealloc - Grab an unlinked inode off the list and try to free it.
- * @sdp: the filesystem
- *
- * Returns: 0 on success, -errno on error, 1 on busy
- */
-
-int
-gfs_inode_dealloc(struct gfs_sbd *sdp, struct gfs_inum *inum)
-{
-	if (inum->no_formal_ino)
-		return inode_dealloc_init(sdp, inum);
-	else
-		return inode_dealloc_uninit(sdp, inum);
-}
-
-/**
- * gfs_change_nlink - Change nlink count on inode
- * @ip: The GFS inode
- * @diff: The change in the nlink count required
- *
- * Returns: errno
- */
-
-int
-gfs_change_nlink(struct gfs_inode *ip, int diff)
-{
-	struct buffer_head *dibh;
-	uint32_t nlink;
-	int error;
-
-	nlink = ip->i_di.di_nlink + diff;
-
-	/* Tricky.  If we are reducing the nlink count,
-	   but the new value ends up being bigger than the
-	   old one, we must have underflowed. */
-	if (diff < 0 && nlink > ip->i_di.di_nlink) {
-		if (gfs_consist_inode(ip))
-			gfs_dinode_print(&ip->i_di);
-		return -EIO;
-	}
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-	if (error)
-		return error;
-
-	ip->i_di.di_nlink = nlink;
-	ip->i_di.di_ctime = get_seconds();
-
-	gfs_trans_add_bh(ip->i_gl, dibh);
-	gfs_dinode_out(&ip->i_di, dibh->b_data);
-	brelse(dibh);
-
-	return 0;
-}
-
-/**
- * gfs_lookupi - Look up a filename in a directory and return its inode
- * @d_gh: An initialized holder for the directory glock
- * @name: The name of the inode to look for
- * @is_root: If TRUE, ignore the caller's permissions
- * @i_gh: An uninitialized holder for the new inode glock
- *
- * There will always be a vnode (Linux VFS inode) for the d_gh inode unless
- *   @is_root is true.
- *
- * Returns: errno
- */
-
-int
-gfs_lookupi(struct gfs_holder *d_gh, struct qstr *name,
-	    int is_root, struct gfs_holder *i_gh)
-{
-	struct gfs_inode *dip = get_gl2ip(d_gh->gh_gl);
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct gfs_glock *gl;
-	struct gfs_inode *ip;
-	struct gfs_inum inum, inum2;
-	unsigned int type;
-	int error;
-
-	i_gh->gh_gl = NULL;
-
-	if (!name->len || name->len > GFS_FNAMESIZE)
-		return -ENAMETOOLONG;
-
-	if (gfs_filecmp(name, ".", 1) ||
-	    (gfs_filecmp(name, "..", 2) && dip == sdp->sd_rooti)) {
-		gfs_holder_reinit(LM_ST_SHARED, 0, d_gh);
-		error = gfs_glock_nq(d_gh);
-		if (!error) {
-			error = gfs_glock_nq_init(dip->i_gl,
-						  LM_ST_SHARED, 0,
-						  i_gh);
-			if (error) {
-				gfs_glock_dq(d_gh);
-				return error;
-			}
-			gfs_inode_hold(dip);
-		}
-		return error;
-	}
-
-	if (gfs_assert_warn(sdp, !gfs_glock_is_locked_by_me(d_gh->gh_gl)))
-		return -EINVAL;
-
-	gfs_holder_reinit(LM_ST_SHARED, 0, d_gh);
-	error = gfs_glock_nq(d_gh);
-	if (error)
-		return error;
-
-	if (!is_root) {
-		error = inode_permission(dip->i_vnode, MAY_EXEC);
-		if (error) {
-			gfs_glock_dq(d_gh);
-			return error;
-		}
-	}
-
-	error = gfs_dir_search(dip, name, &inum, &type);
-	if (error) {
-		gfs_glock_dq(d_gh);
-		if (error == -ENOENT)
-			error = 0;
-		return error;
-	}
-
- restart:
-	error = gfs_glock_get(sdp, inum.no_formal_ino, &gfs_inode_glops,
-			      CREATE, &gl);
-	if (error) {
-		gfs_glock_dq(d_gh);
-		return error;
-	}
-
-	/*  Acquire the second lock  */
-
-	if (gl->gl_name.ln_number < dip->i_gl->gl_name.ln_number) {
-		gfs_glock_dq(d_gh);
-
-		error = gfs_glock_nq_init(gl, LM_ST_SHARED,
-					  LM_FLAG_ANY | GL_LOCAL_EXCL,
-					  i_gh);
-		if (error)
-			goto out;
-
-		gfs_holder_reinit(LM_ST_SHARED, 0, d_gh);
-		error = gfs_glock_nq(d_gh);
-		if (error) {
-			gfs_glock_dq_uninit(i_gh);
-			goto out;
-		}
-
-		if (!is_root) {
-			error = inode_permission(dip->i_vnode, MAY_EXEC);
-			if (error) {
-				gfs_glock_dq(d_gh);
-				gfs_glock_dq_uninit(i_gh);
-				goto out;
-			}
-		}
-
-		error = gfs_dir_search(dip, name, &inum2, &type);
-		if (error) {
-			gfs_glock_dq(d_gh);
-			gfs_glock_dq_uninit(i_gh);
-			if (error == -ENOENT)
-				error = 0;
-			goto out;
-		}
-
-		if (!gfs_inum_equal(&inum, &inum2)) {
-			gfs_glock_dq_uninit(i_gh);
-			gfs_glock_put(gl);
-			inum = inum2;
-			goto restart;
-		}
-	} else {
-		error = gfs_glock_nq_init(gl, LM_ST_SHARED,
-					  LM_FLAG_ANY | GL_LOCAL_EXCL,
-					  i_gh);
-		if (error) {
-			gfs_glock_dq(d_gh);
-			goto out;
-		}
-	}
-
-	error = gfs_inode_get(gl, &inum, CREATE, &ip);
-	if (error) {
-		gfs_glock_dq(d_gh);
-		gfs_glock_dq_uninit(i_gh);
-	} else if (ip->i_di.di_type != type) {
-		gfs_consist_inode(dip);
-		gfs_inode_put(ip);
-		gfs_glock_dq(d_gh);
-		gfs_glock_dq_uninit(i_gh);
-		error = -EIO;
-	}
-
- out:
-	gfs_glock_put(gl);
-
-	return error;
-}
-
-/**
- * create_ok - OK to create a new on-disk inode here?
- * @dip:  Directory in which dinode is to be created
- * @name:  Name of new dinode
- * @type:  GFS_FILE_XXX (regular file, dir, etc.)
- *
- * Returns: errno
- */
-
-static int
-create_ok(struct gfs_inode *dip, struct qstr *name, unsigned int type)
-{
-	int error;
-
-	error = inode_permission(dip->i_vnode, MAY_WRITE | MAY_EXEC);
-	if (error)
-		return error;
-
-	/*  Don't create entries in an unlinked directory  */
-
-	if (!dip->i_di.di_nlink)
-		return -EPERM;
-
-	error = gfs_dir_search(dip, name, NULL, NULL);
-	switch (error) {
-	case -ENOENT:
-		error = 0;
-		break;
-	case 0:
-		return -EEXIST;
-	default:
-		return error;
-	}
-
-	if (dip->i_di.di_entries == (uint32_t)-1)
-		return -EFBIG;
-	if (type == GFS_FILE_DIR && dip->i_di.di_nlink == (uint32_t)-1)
-		return -EMLINK;
-
-	return 0;
-}
-
-/**
- * dinode_alloc - Create an on-disk inode
- * @dip:  Directory in which to create the dinode
- * @ul:
- *
- * Since this dinode is not yet linked, we also create an unlinked inode
- *   descriptor.
- *
- * Returns: errno
- */
-
-static int
-dinode_alloc(struct gfs_inode *dip, struct gfs_unlinked **ul)
-{
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct gfs_alloc *al;
-	struct gfs_inum inum;
-	int error;
-
-	/* Create in-place allocation structure, reserve 1 dinode */
-	al = gfs_alloc_get(dip);
-	al->al_requested_di = 1;
-	error = gfs_inplace_reserve(dip);
-	if (error)
-		goto out;
-
-	error = gfs_trans_begin(sdp, al->al_rgd->rd_ri.ri_length, 1);
-	if (error)
-		goto out_inplace;
-
-	inum.no_formal_ino = 0;
-	error = gfs_dialloc(dip, &inum.no_addr);
-	if (error)
-		goto out_end_trans;
-
-	*ul = gfs_trans_add_unlinked(sdp, GFS_LOG_DESC_IUL, &inum);
-	gfs_unlinked_lock(sdp, *ul);
-
-	gfs_trans_add_gl(dip->i_gl);
-
- out_end_trans:
-	gfs_trans_end(sdp);
-
- out_inplace:
-	gfs_inplace_release(dip);
-
- out:
-	gfs_alloc_put(dip);
-
-	return error;
-}
-
-/**
- * pick_formal_ino - Pick a formal inode number for a given inode
- * @sdp: the filesystem
- * @inum: the inode number structure
- *
- */
-
-static void
-pick_formal_ino(struct gfs_sbd *sdp, struct gfs_inum *inum)
-{
-	/*  This won't always be true  */
-	inum->no_formal_ino = inum->no_addr;
-}
-
-/**
- * make_dinode - Fill in a new dinode structure
- * @dip: the directory this inode is being created in
- * @gl: The glock covering the new inode
- * @inum: the inode number
- * @type: the file type
- * @mode: the file permissions
- * @uid:
- * @gid:
- *
- */
-
-static int
-make_dinode(struct gfs_inode *dip,
-	    struct gfs_glock *gl, struct gfs_inum *inum,
-	    unsigned int type, unsigned int mode,
-	    unsigned int uid, unsigned int gid)
-{
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct gfs_dinode di;
-	struct buffer_head *dibh;
-	struct gfs_rgrpd *rgd;
-	int error;
-
-	error = gfs_dread(gl, inum->no_addr,
-			  DIO_NEW | DIO_START | DIO_WAIT,
-			  &dibh);
-	if (error)
-		return error;
-
-	gfs_trans_add_bh(gl, dibh);
-	gfs_metatype_set(dibh, GFS_METATYPE_DI, GFS_FORMAT_DI);
-	gfs_buffer_clear_tail(dibh, sizeof(struct gfs_dinode));
-
-	memset(&di, 0, sizeof(struct gfs_dinode));
-
-	gfs_meta_header_in(&di.di_header, dibh->b_data);
-
-	di.di_num = *inum;
-
-	di.di_mode = mode & S_IALLUGO;
-	di.di_uid = uid;
-	di.di_gid = gid;
-	di.di_nlink = 1;
-	di.di_blocks = 1;
-	di.di_atime = di.di_mtime = di.di_ctime = get_seconds();
-
-	rgd = gfs_blk2rgrpd(sdp, inum->no_addr);
-	if (!rgd) {
-		if (gfs_consist(sdp))
-			printk("GFS: fsid=%s: block = %"PRIu64"\n",
-			       sdp->sd_fsname, inum->no_addr);
-		brelse(dibh);
-		return -EIO;
-	}
-
-	di.di_rgrp = rgd->rd_ri.ri_addr;
-	di.di_goal_rgrp = di.di_rgrp;
-	di.di_goal_dblk = di.di_goal_mblk = inum->no_addr - rgd->rd_ri.ri_data1;
-
-	if (type == GFS_FILE_REG) {
-		if ((dip->i_di.di_flags & GFS_DIF_INHERIT_JDATA) ||
-		    gfs_tune_get(sdp, gt_new_files_jdata))
-			di.di_flags |= GFS_DIF_JDATA;
-		if ((dip->i_di.di_flags & GFS_DIF_INHERIT_DIRECTIO) ||
-		    gfs_tune_get(sdp, gt_new_files_directio))
-			di.di_flags |= GFS_DIF_DIRECTIO;
-	} else if (type == GFS_FILE_DIR) {
-		di.di_flags |= (dip->i_di.di_flags & GFS_DIF_INHERIT_DIRECTIO);
-		di.di_flags |= (dip->i_di.di_flags & GFS_DIF_INHERIT_JDATA);
-	}
-
-	di.di_type = type;
-
-	gfs_dinode_out(&di, dibh->b_data);
-	brelse(dibh);
-
-	return 0;
-}
-
-/**
- * inode_init_and_link -
- * @dip:
- * @name:
- * @inum:
- * @gl:
- * @type:
- * @mode:
- *
- * Returns: errno
- */
-
-static int
-inode_init_and_link(struct gfs_inode *dip, struct qstr *name,
-		    struct gfs_inum *inum, struct gfs_glock *gl,
-		    unsigned int type, mode_t mode)
-{
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct gfs_alloc *al;
-	struct gfs_inode *ip;
-	unsigned int uid, gid;
-	int alloc_required;
-	void *acl_a_data = NULL, *acl_d_data = NULL;
-	unsigned int acl_size = 0, acl_blocks = 0;
-	int error;
-
-	if (sdp->sd_args.ar_suiddir &&
-	    (dip->i_di.di_mode & S_ISUID) &&
-	    dip->i_di.di_uid) {
-		if (type == GFS_FILE_DIR)
-			mode |= S_ISUID;
-		else if (dip->i_di.di_uid != current->fsuid)
-			mode &= ~07111;
-		uid = dip->i_di.di_uid;
-	} else
-		uid = current->fsuid;
-
-	if (dip->i_di.di_mode & S_ISGID) {
-		if (type == GFS_FILE_DIR)
-			mode |= S_ISGID;
-		gid = dip->i_di.di_gid;
-	} else
-		gid = current->fsgid;
-
-	error = gfs_acl_new_prep(dip, type, &mode,
-				 &acl_a_data, &acl_d_data,
-				 &acl_size, &acl_blocks);
-	if (error)
-		return error;
-
-	al = gfs_alloc_get(dip);
-
-	error = gfs_quota_lock_m(dip, uid, gid);
-	if (error)
-		goto fail;
-
-	error = gfs_quota_check(dip, uid, gid);
-	if (error)
-		goto fail_gunlock_q;
-
-	if (acl_blocks)
-		alloc_required = TRUE;
-	else {
-		error = gfs_diradd_alloc_required(dip, name, &alloc_required);
-		if (error)
-			goto fail_gunlock_q;
-	}
-
-	if (alloc_required) {
-		error = gfs_quota_check(dip, dip->i_di.di_uid, dip->i_di.di_gid);
-		if (error)
-			goto fail_gunlock_q;
-
-		al->al_requested_meta = sdp->sd_max_dirres + acl_blocks;
-
-		error = gfs_inplace_reserve(dip);
-		if (error)
-			goto fail_gunlock_q;
-
-		/* Trans may require:
-		   blocks for two dinodes, the directory blocks necessary for
-		   a new entry, RG bitmap blocks for an allocation,
-		   and one block for a quota change and
-		   one block for an unlinked tag. */
-
-		error = gfs_trans_begin(sdp,
-					2 + sdp->sd_max_dirres + acl_blocks +
-					al->al_rgd->rd_ri.ri_length, 2);
-		if (error)
-			goto fail_inplace;
-	} else {
-		error = gfs_rindex_hold(sdp, &al->al_ri_gh);
-		if (error)
-			goto fail_gunlock_q;
-
-		/* Trans may require:
-		   blocks for two dinodes, a leaf block,
-		   and one block for a quota change and
-		   one block for an unlinked tag. */
-
-		error = gfs_trans_begin(sdp, 3, 2);
-		if (error)
-			goto fail_inplace;
-	}
-
-	error = gfs_dir_add(dip, name, inum, type);
-	if (error)
-		goto fail_end_trans;
-
-	error = make_dinode(dip, gl, inum, type, mode, uid, gid);
-	if (error)
-		goto fail_end_trans;
-
-	al->al_ul = gfs_trans_add_unlinked(sdp, GFS_LOG_DESC_IDA,
-					   &(struct gfs_inum){0, inum->no_addr});
-	gfs_trans_add_quota(sdp, +1, uid, gid);
-
-	error = gfs_inode_get(gl, inum, CREATE, &ip);
-
-	/* This should only fail if we are already shutdown. */
-	if (gfs_assert_withdraw(sdp, !error))
-		goto fail_end_trans;
-
-	if (acl_blocks)
-		error = gfs_acl_new_init(dip, ip,
-					 acl_a_data, acl_d_data,
-					 acl_size);
-
-	if (!alloc_required)
-		gfs_glock_dq_uninit(&al->al_ri_gh);
-
-	return error;
-
- fail_end_trans:
-	gfs_trans_end(sdp);
-
- fail_inplace:
-	if (alloc_required)
-		gfs_inplace_release(dip);
-	else
-		gfs_glock_dq_uninit(&al->al_ri_gh);
-
- fail_gunlock_q:
-	gfs_quota_unlock_m(dip);
-
- fail:
-	gfs_alloc_put(dip);
-	if (acl_a_data)
-		kfree(acl_a_data);
-	else if (acl_d_data)
-		kfree(acl_d_data);
-
-	return error;
-}
-
-/**
- * gfs_createi - Create a new inode
- * @d_gh: An initialized holder for the directory glock
- * @name: The name of the new file
- * @type: The type of dinode (GFS_FILE_REG, GFS_FILE_DIR, GFS_FILE_LNK, ...)
- * @mode: the permissions on the new inode
- * @i_gh: An uninitialized holder for the new inode glock
- *
- * If the return value is 0, the glocks on both the directory and the new
- * file are held.  A transaction has been started and an inplace reservation
- * is held, as well.
- *
- * Returns: errno
- */
-
-int
-gfs_createi(struct gfs_holder *d_gh, struct qstr *name,
-	    unsigned int type, unsigned int mode,
-	    struct gfs_holder *i_gh)
-{
-	struct gfs_inode *dip = get_gl2ip(d_gh->gh_gl);
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct gfs_unlinked *ul;
-	struct gfs_inum inum;
-	struct gfs_holder io_gh;
-	int error;
-
-	if (!name->len || name->len > GFS_FNAMESIZE)
-		return -ENAMETOOLONG;
-
-	gfs_holder_reinit(LM_ST_EXCLUSIVE, 0, d_gh);
-	error = gfs_glock_nq(d_gh);
-	if (error)
-		return error;
-
-	error = create_ok(dip, name, type);
-	if (error)
-		goto fail;
-
-	error = dinode_alloc(dip, &ul);
-	if (error)
-		goto fail;
-
-	inum.no_addr = ul->ul_inum.no_addr;
-	pick_formal_ino(sdp, &inum);
-
-	if (inum.no_formal_ino < dip->i_num.no_formal_ino) {
-		gfs_glock_dq(d_gh);
-
-		error = gfs_glock_nq_num(sdp,
-					 inum.no_formal_ino, &gfs_inode_glops,
-					 LM_ST_EXCLUSIVE, GL_SKIP, i_gh);
-		if (error) {
-			gfs_unlinked_unlock(sdp, ul);
-			return error;
-		}
-
-		gfs_holder_reinit(LM_ST_EXCLUSIVE, 0, d_gh);
-		error = gfs_glock_nq(d_gh);
-		if (error) {
-			gfs_glock_dq_uninit(i_gh);
-			gfs_unlinked_unlock(sdp, ul);
-			return error;
-		}
-
-		error = create_ok(dip, name, type);
-		if (error)
-			goto fail_gunlock_i;
-	} else {
-		error = gfs_glock_nq_num(sdp,
-					 inum.no_formal_ino, &gfs_inode_glops,
-					 LM_ST_EXCLUSIVE, GL_SKIP, i_gh);
-		if (error)
-			goto fail_ul;
-	}
-
-	error = gfs_glock_nq_num(sdp,
-				 inum.no_addr, &gfs_iopen_glops,
-				 LM_ST_SHARED, GL_LOCAL_EXCL | GL_EXACT,
-				 &io_gh);
-	if (error)
-		goto fail_gunlock_i;
-
-	error = inode_init_and_link(dip, name, &inum, i_gh->gh_gl, type, mode);
-	if (error)
-		goto fail_gunlock_io;
-
-	gfs_glock_dq_uninit(&io_gh);
-
-	return 0;
-
- fail_gunlock_io:
-	gfs_glock_dq_uninit(&io_gh);
-
- fail_gunlock_i:
-	gfs_glock_dq_uninit(i_gh);
-
- fail_ul:
-	gfs_unlinked_unlock(sdp, ul);
-
- fail:
-	gfs_glock_dq(d_gh);
-
-	return error;
-}
-
-/**
- * gfs_unlinki - Unlink a file
- * @dip: The inode of the directory
- * @name: The name of the file to be unlinked
- * @ip: The inode of the file to be removed
- *
- * Assumes Glocks on both dip and ip are held.
- *
- * Returns: errno
- */
-
-int
-gfs_unlinki(struct gfs_inode *dip, struct qstr *name, struct gfs_inode *ip)
-{
-	struct gfs_sbd *sdp = dip->i_sbd;
-	int error;
-
-	error = gfs_dir_del(dip, name);
-	if (error)
-		return error;
-
-	error = gfs_change_nlink(ip, -1);
-	if (error)
-		return error;
-
-	/* If this inode is being unlinked from the directory structure,
-	   we need to mark that in the log so that it isn't lost during
-	   a crash. */
-
-	if (!ip->i_di.di_nlink) {
-		gfs_trans_add_unlinked(sdp, GFS_LOG_DESC_IUL, &ip->i_num);
-		set_bit(GLF_STICKY, &ip->i_gl->gl_flags);
-	}
-
-	return 0;
-}
-
-/**
- * gfs_rmdiri - Remove a directory
- * @dip: The parent directory of the directory to be removed
- * @name: The name of the directory to be removed
- * @ip: The GFS inode of the directory to be removed
- *
- * Assumes Glocks on dip and ip are held
- *
- * Returns: errno
- */
-
-int
-gfs_rmdiri(struct gfs_inode *dip, struct qstr *name, struct gfs_inode *ip)
-{
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct qstr dotname;
-	int error;
-
-	if (ip->i_di.di_entries != 2) {
-		if (gfs_consist_inode(ip))
-			gfs_dinode_print(&ip->i_di);
-		return -EIO;
-	}
-
-	error = gfs_dir_del(dip, name);
-	if (error)
-		return error;
-
-	error = gfs_change_nlink(dip, -1);
-	if (error)
-		return error;
-
-	dotname.len = 1;
-	dotname.name = ".";
-	error = gfs_dir_del(ip, &dotname);
-	if (error)
-		return error;
-
-	dotname.len = 2;
-	dotname.name = "..";
-	error = gfs_dir_del(ip, &dotname);
-	if (error)
-		return error;
-
-	error = gfs_change_nlink(ip, -2);
-	if (error)
-		return error;
-
-	/* This inode is being unlinked from the directory structure and
-	   we need to mark that in the log so that it isn't lost during
-	   a crash. */
-
-	gfs_trans_add_unlinked(sdp, GFS_LOG_DESC_IUL, &ip->i_num);
-	set_bit(GLF_STICKY, &ip->i_gl->gl_flags);
-
-	return 0;
-}
-
-/*
- * gfs_unlink_ok - check to see that a inode is still in a directory
- * @dip: the directory
- * @name: the name of the file
- * @ip: the inode
- *
- * Assumes that the lock on (at least) @dip is held.
- *
- * Returns: 0 if the parent/child relationship is correct, errno if it isn't
- */
-
-int
-gfs_unlink_ok(struct gfs_inode *dip, struct qstr *name, struct gfs_inode *ip)
-{
-	struct gfs_inum inum;
-	unsigned int type;
-	int error;
-
-	if (IS_IMMUTABLE(ip->i_vnode) || IS_APPEND(ip->i_vnode))
-		return -EPERM;
-
-	if ((dip->i_di.di_mode & S_ISVTX) &&
-	    dip->i_di.di_uid != current->fsuid &&
-	    ip->i_di.di_uid != current->fsuid &&
-	    !capable(CAP_FOWNER))
-		return -EPERM;
-
-	if (IS_APPEND(dip->i_vnode))
-		return -EPERM;
-
-	error = inode_permission(dip->i_vnode, MAY_WRITE | MAY_EXEC);
-	if (error)
-		return error;
-
-	error = gfs_dir_search(dip, name, &inum, &type);
-	if (error)
-		return error;
-
-	if (inum.no_formal_ino != ip->i_num.no_formal_ino)
-		return -ENOENT;
-
-	if (ip->i_di.di_type != type) {
-		gfs_consist_inode(dip);
-		return -EIO;
-	}
-
-	return 0;
-}
-
-/*
- * gfs_ok_to_move - check if it's ok to move a directory to another directory
- * @this: move this
- * @to: to here
- *
- * Follow @to back to the root and make sure we don't encounter @this
- * Assumes we already hold the rename lock.
- *
- * Returns: errno
- */
-
-int
-gfs_ok_to_move(struct gfs_inode *this, struct gfs_inode *to)
-{
-	struct gfs_sbd *sdp = this->i_sbd;
-	struct gfs_inode *tmp;
-	struct gfs_holder to_gh, tmp_gh;
-	struct qstr dotdot;
-	int error = 0;
-
-	memset(&dotdot, 0, sizeof (struct qstr));
-	dotdot.name = "..";
-	dotdot.len = 2;
-
-	gfs_inode_hold(to);
-
-	for (;;) {
-		if (to == this) {
-			error = -EINVAL;
-			break;
-		}
-		if (to == sdp->sd_rooti) {
-			error = 0;
-			break;
-		}
-
-		gfs_holder_init(to->i_gl, 0, 0, &to_gh);
-
-		error = gfs_lookupi(&to_gh, &dotdot, TRUE, &tmp_gh);
-		if (error) {
-			gfs_holder_uninit(&to_gh);
-			break;
-		}
-		if (!tmp_gh.gh_gl) {
-			gfs_holder_uninit(&to_gh);
-			error = -ENOENT;
-			break;
-		}
-
-		tmp = get_gl2ip(tmp_gh.gh_gl);
-
-		gfs_glock_dq_uninit(&to_gh);
-		gfs_glock_dq_uninit(&tmp_gh);
-
-		gfs_inode_put(to);
-		to = tmp;
-	}
-
-	gfs_inode_put(to);
-
-	return error;
-}
-
-/**
- * gfs_readlinki - return the contents of a symlink
- * @ip: the symlink's inode
- * @buf: a pointer to the buffer to be filled
- * @len: a pointer to the length of @buf
- *
- * If @buf is too small, a piece of memory is kmalloc()ed and needs
- * to be freed by the caller.
- *
- * Returns: errno
- */
-
-int
-gfs_readlinki(struct gfs_inode *ip, char **buf, unsigned int *len)
-{
-	struct gfs_holder i_gh;
-	struct buffer_head *dibh;
-	unsigned int x;
-	int error;
-
-	gfs_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &i_gh);
-	error = gfs_glock_nq_atime(&i_gh);
-	if (error) {
-		gfs_holder_uninit(&i_gh);
-		return error;
-	}
-
-	if (!ip->i_di.di_size) {
-		gfs_consist_inode(ip);
-		error = -EIO;
-		goto out;
-	}
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-	if (error)
-		goto out;
-
-	x = ip->i_di.di_size + 1;
-	if (x > *len) {
-		*buf = kmalloc(x, GFP_KERNEL);
-		if (!*buf) {
-			error = -ENOMEM;
-			goto out_brelse;
-		}
-	}
-
-	memcpy(*buf, dibh->b_data + sizeof(struct gfs_dinode), x);
-	*len = x;
-
- out_brelse:
-	brelse(dibh);
-
- out:
-	gfs_glock_dq_uninit(&i_gh);
-
-	return error;
-}
-
-/**
- * gfs_glock_nq_atime - Acquire a hold on an inode's glock, and
- *       conditionally update the inode's atime
- * @gh: the holder to acquire
- *
- * Tests atime (access time) for gfs_read, gfs_readdir and gfs_mmap
- * Update if the difference between the current time and the inode's current
- * atime is greater than an interval specified at mount (or default).
- *
- * Will not update if GFS mounted NOATIME (this is *the* place where NOATIME
- *   has an effect) or Read-Only.
- *
- * Returns: errno
- */
-
-int
-gfs_glock_nq_atime(struct gfs_holder *gh)
-{
-	struct gfs_glock *gl = gh->gh_gl;
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct gfs_inode *ip = get_gl2ip(gl);
-	int64_t curtime, quantum = gfs_tune_get(sdp, gt_atime_quantum);
-	unsigned int state;
-	int flags;
-	int error;
-
-	if (gfs_assert_warn(sdp, gh->gh_flags & GL_ATIME) ||
-	    gfs_assert_warn(sdp, !(gh->gh_flags & GL_ASYNC)) ||
-	    gfs_assert_warn(sdp, gl->gl_ops == &gfs_inode_glops))
-		return -EINVAL;
-
-	/* Save original request state of lock holder */
-	state = gh->gh_state;
-	flags = gh->gh_flags;
-
-	error = gfs_glock_nq(gh);
-	if (error)
-		return error;
-
-	if (test_bit(SDF_NOATIME, &sdp->sd_flags) ||
-	    test_bit(SDF_ROFS, &sdp->sd_flags))
-		return 0;
-
-	curtime = get_seconds();
-	if (curtime - ip->i_di.di_atime >= quantum) {
-		/* Get EX hold (force EX glock via !ANY) to write the dinode */
-		gfs_glock_dq(gh);
-		gfs_holder_reinit(LM_ST_EXCLUSIVE,
-				  gh->gh_flags & ~LM_FLAG_ANY,
-				  gh);
-		error = gfs_glock_nq(gh);
-		if (error)
-			return error;
-
-		/* Verify that atime hasn't been updated while we were
-		   trying to get exclusive lock. */
-
-		curtime = get_seconds();
-		if (curtime - ip->i_di.di_atime >= quantum) {
-			struct buffer_head *dibh;
-
-			error = gfs_trans_begin(sdp, 1, 0);
-			if (error == -EROFS)
-				return 0;
-			if (error)
-				goto fail;
-
-			error = gfs_get_inode_buffer(ip, &dibh);
-			if (error)
-				goto fail_end_trans;
-
-			ip->i_di.di_atime = curtime;
-
-			gfs_trans_add_bh(ip->i_gl, dibh);
-			gfs_dinode_out(&ip->i_di, dibh->b_data);
-			brelse(dibh);
-
-			gfs_trans_end(sdp);
-		}
-
-		/* If someone else has asked for the glock,
-		   unlock and let them have it. Then reacquire
-		   in the original state. */
-		if (gfs_glock_is_blocking(gl)) {
-			gfs_glock_dq(gh);
-			gfs_holder_reinit(state, flags, gh);
-			return gfs_glock_nq(gh);
-		}
-	}
-
-	return 0;
-
- fail_end_trans:
-	gfs_trans_end(sdp);
-
- fail:
-	gfs_glock_dq(gh);
-
-	return error;
-}
-
-/**
- * glock_compare_atime - Compare two struct gfs_glock structures for gfs_sort()
- * @arg_a: the first structure
- * @arg_b: the second structure
- *
- * Sort order determined by (in order of priority):
- * -- lock number
- * -- lock state (SHARED > EXCLUSIVE or GL_ATIME, which can demand EXCLUSIVE)
- *
- * Returns: 1 if A > B
- *         -1 if A < B
- *          0 if A = B
- */
-
-static int
-glock_compare_atime(const void *arg_a, const void *arg_b)
-{
-	struct gfs_holder *gh_a = *(struct gfs_holder **)arg_a;
-	struct gfs_holder *gh_b = *(struct gfs_holder **)arg_b;
-	struct lm_lockname *a = &gh_a->gh_gl->gl_name;
-	struct lm_lockname *b = &gh_b->gh_gl->gl_name;
-	int ret = 0;
-
-	if (a->ln_number > b->ln_number)
-		ret = 1;
-	else if (a->ln_number < b->ln_number)
-		ret = -1;
-	else {
-		if (gh_a->gh_state == LM_ST_SHARED &&
-		    gh_b->gh_state == LM_ST_EXCLUSIVE)
-			ret = 1;
-		else if (gh_a->gh_state == LM_ST_SHARED &&
-			 (gh_b->gh_flags & GL_ATIME))
-			ret = 1;
-	}
-
-	return ret;
-}
-
-/**
- * gfs_glock_nq_m_atime - acquire multiple glocks where one may need an
- *      atime update
- * @num_gh: the number of structures
- * @ghs: an array of struct gfs_holder structures
- *
- * Returns: 0 on success (all glocks acquired),
- *          errno on failure (no glocks acquired)
- */
-
-int
-gfs_glock_nq_m_atime(unsigned int num_gh, struct gfs_holder *ghs)
-{
-	struct gfs_holder **p;
-	unsigned int x;
-	int error = 0;
-
-	if (!num_gh)
-		return 0;
-
-	if (num_gh == 1) {
-		ghs->gh_flags &= ~(LM_FLAG_TRY | GL_ASYNC);
-		if (ghs->gh_flags & GL_ATIME)
-			error = gfs_glock_nq_atime(ghs);
-		else
-			error = gfs_glock_nq(ghs);
-		return error;
-	}
-
-	p = kmalloc(num_gh * sizeof(struct gfs_holder *), GFP_KERNEL);
-	if (!p)
-		return -ENOMEM;
-
-	for (x = 0; x < num_gh; x++)
-		p[x] = &ghs[x];
-
-	gfs_sort(p, num_gh, sizeof(struct gfs_holder *), glock_compare_atime);
-
-	for (x = 0; x < num_gh; x++) {
-		p[x]->gh_flags &= ~(LM_FLAG_TRY | GL_ASYNC);
-
-		if (p[x]->gh_flags & GL_ATIME)
-			error = gfs_glock_nq_atime(p[x]);
-		else
-			error = gfs_glock_nq(p[x]);
-
-		if (error) {
-			while (x--)
-				gfs_glock_dq(p[x]);
-			break;
-		}
-	}
-
-	kfree(p);
-	return error;
-}
-
-/**
- * gfs_try_toss_vnode - See if we can toss a vnode from memory
- * @ip: the inode
- *
- * Returns:  TRUE if the vnode was tossed
- */
-
-void
-gfs_try_toss_vnode(struct gfs_inode *ip)
-{
-	struct inode *inode;
-
-	inode = gfs_iget(ip, NO_CREATE);
-	if (!inode)
-		return;
-
-	d_prune_aliases(inode);
-
-	if (ip->i_di.di_type == GFS_FILE_DIR) {
-		struct list_head *head = &inode->i_dentry;
-		struct dentry *d = NULL;
-
-		spin_lock(&dcache_lock);
-		if (list_empty(head))
-			spin_unlock(&dcache_lock);
-		else {
-			d = list_entry(head->next, struct dentry, d_alias);
-			dget_locked(d);
-			spin_unlock(&dcache_lock);
-
-			if (have_submounts(d))
-				dput(d);
-			else {
-				shrink_dcache_parent(d);
-				dput(d);
-				d_prune_aliases(inode);
-			}
-		}
-	}
-
-	inode->i_nlink = 0;
-	iput(inode);
-}
-
-
-static int
-__gfs_setattr_simple(struct gfs_inode *ip, struct iattr *attr)
-{
-	struct buffer_head *dibh;
-	int error;
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-	if (!error) {
-		error = inode_setattr(ip->i_vnode, attr);
-		gfs_assert_warn(ip->i_sbd, !error);
-		gfs_inode_attr_out(ip);
-
-		gfs_trans_add_bh(ip->i_gl, dibh);
-		gfs_dinode_out(&ip->i_di, dibh->b_data);
-		brelse(dibh);
-	}
-
-	return error;
-}
-
-/**
- * gfs_setattr_simple -
- * @ip:
- * @attr:
- *
- * Called with a reference on the vnode.
- *
- * Returns: errno
- */
-
-int
-gfs_setattr_simple(struct gfs_inode *ip, struct iattr *attr)
-{
-	int error;
-
-	if (get_transaction)
-		return __gfs_setattr_simple(ip, attr);
-
-	/* Trans may require:
-	   one dinode block. */
-
-	error = gfs_trans_begin(ip->i_sbd, 1, 0);
-	if (error)
-		return error;
-
-	error = __gfs_setattr_simple(ip, attr);
-
-	gfs_trans_end(ip->i_sbd);
-
-	return error;
-}
-
-/**
- * iah_make_jdata -
- * @gl:
- * @inum:
- *
- */
-
-static void
-iah_make_jdata(struct gfs_glock *gl, struct gfs_inum *inum)
-{
-	struct buffer_head *bh;
-	struct gfs_dinode *di;
-	uint32_t flags;
-	int error;
-
-	error = gfs_dread(gl, inum->no_addr, DIO_START | DIO_WAIT, &bh);
-
-	/* This should only fail if we are already shutdown. */
-	if (gfs_assert_withdraw(gl->gl_sbd, !error))
-		return;
-
-	di = (struct gfs_dinode *)bh->b_data;
-
-	flags = di->di_flags;
-	flags = gfs32_to_cpu(flags) | GFS_DIF_JDATA;
-	di->di_flags = cpu_to_gfs32(flags);
-
-	brelse(bh);
-}
-
-/**
- * iah_super_update - Write superblock to disk
- * @sdp:  filesystem instance structure
- *
- * Returns: errno
- *
- * Update on-disk superblock, using (modified) data in sdp->sd_sb
- */
-
-static int
-iah_super_update(struct gfs_sbd *sdp)
-{
-	struct gfs_glock *gl;
-	struct buffer_head *bh;
-	int error;
-
-	error = gfs_glock_get(sdp,
-			      GFS_SB_LOCK, &gfs_meta_glops,
-			      NO_CREATE, &gl);
-	if (gfs_assert_withdraw(sdp, !error && gl)) /* This should already be held. */
-		return -EINVAL;
-
-	error = gfs_dread(gl, GFS_SB_ADDR >> sdp->sd_fsb2bb_shift,
-			  DIO_START | DIO_WAIT, &bh);
-	if (!error) {
-		gfs_trans_add_bh(gl, bh);
-		gfs_sb_out(&sdp->sd_sb, bh->b_data);
-		brelse(bh);
-	}
-
-	gfs_glock_put(gl);
-
-	return error;
-}
-
-/**
- * inode_alloc_hidden - allocate on-disk inode for a special (hidden) file
- * @sdp:  the filesystem instance structure
- * @inum:  new dinode's block # and formal inode #, to be filled
- *         in by this function.
- *
- * Returns: errno
- *
- * This function is called only very rarely, when the first-to-mount
- * node can't find a pre-existing special file (e.g. license or quota file) that
- * it expects to find.  This should happen only when upgrading from an older
- * version of the filesystem.
- *
- * The @inum must be a member of sdp->sd_sb in order to get updated to on-disk
- * superblock properly.
- */
-
-static int
-inode_alloc_hidden(struct gfs_sbd *sdp, struct gfs_inum *inum)
-{
-	struct gfs_inode *dip = sdp->sd_rooti;
-	struct gfs_holder d_gh, i_gh;
-	struct gfs_unlinked *ul;
-	int error;
-
-	error = gfs_glock_nq_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, &d_gh);
-	if (error)
-		return error;
-
-	error = dinode_alloc(dip, &ul);
-	if (error)
-		goto fail;
-
-	inum->no_addr = ul->ul_inum.no_addr;
-	pick_formal_ino(sdp, inum);
-
-	/* Don't worry about deadlock ordering here.  We're the first
-	   mounter and still under the mount lock (i.e. there is no
-	   contention). */
-
-	error = gfs_glock_nq_num(sdp,
-				 inum->no_formal_ino, &gfs_inode_glops,
-				 LM_ST_EXCLUSIVE, GL_SKIP, &i_gh);
-	if (error)
-		goto fail_ul;
-
-	gfs_alloc_get(dip);
-
-	error = gfs_quota_hold_m(dip, 0, 0);
-	if (error)
-		goto fail_al;
-
-	/* Trans may require:
-	   The new inode, the superblock,
-	   and one block for a quota change and
-	   one block for an unlinked tag. */
-      
-	error = gfs_trans_begin(sdp, 2, 2);
-	if (error)
-		goto fail_unhold;
-	
-	error = make_dinode(dip, i_gh.gh_gl, inum, GFS_FILE_REG, 0600, 0, 0);
-	if (error)
-		goto fail_end_trans;
-
-	/* Hidden files get all of their data (not just metadata) journaled */
-	iah_make_jdata(i_gh.gh_gl, inum);
-
-	error = iah_super_update(sdp);
-	if (error)
-		goto fail_end_trans;
-
-	gfs_trans_add_unlinked(sdp, GFS_LOG_DESC_IDA,
-			       &(struct gfs_inum){0, inum->no_addr});
-	gfs_trans_add_quota(sdp, +1, 0, 0);
-	gfs_trans_add_gl(dip->i_gl);
-
-	gfs_trans_end(sdp);
-	gfs_quota_unhold_m(dip);
-	gfs_alloc_put(dip);
-
-	gfs_glock_dq_uninit(&i_gh);
-	gfs_glock_dq_uninit(&d_gh);
-
-	gfs_unlinked_unlock(sdp, ul);
-
-	gfs_log_flush(sdp);
-
-	return 0;
-
- fail_end_trans:
-	gfs_trans_end(sdp);
-
- fail_unhold:
-	gfs_quota_unhold_m(dip);
-
- fail_al:
-	gfs_alloc_put(dip);
-	gfs_glock_dq_uninit(&i_gh);
-
- fail_ul:
-	gfs_unlinked_unlock(sdp, ul);
-
- fail:
-	gfs_glock_dq_uninit(&d_gh);
-
-	return error;
-}
-
-/**
- * gfs_alloc_qinode - allocate a quota inode
- * @sdp: The GFS superblock
- *
- * Returns: 0 on success, error code otherwise
- */
-
-int
-gfs_alloc_qinode(struct gfs_sbd *sdp)
-{
-	return inode_alloc_hidden(sdp, &sdp->sd_sb.sb_quota_di);
-}
-
-/**
- * gfs_alloc_linode - allocate a license inode
- * @sdp: The GFS superblock
- *
- * Returns: 0 on success, error code otherwise
- */
-
-int
-gfs_alloc_linode(struct gfs_sbd *sdp)
-{
-	return inode_alloc_hidden(sdp, &sdp->sd_sb.sb_license_di);
-}
diff --git a/gfs-kernel/src/gfs/inode.h b/gfs-kernel/src/gfs/inode.h
deleted file mode 100644
index 01f80b7..0000000
--- a/gfs-kernel/src/gfs/inode.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef __INODE_DOT_H__
-#define __INODE_DOT_H__
-
-void gfs_inode_attr_in(struct gfs_inode *ip);
-void gfs_inode_attr_out(struct gfs_inode *ip);
-struct inode *gfs_iget(struct gfs_inode *ip, int create);
-
-int gfs_copyin_dinode(struct gfs_inode *ip);
-
-int gfs_inode_get(struct gfs_glock *i_gl, struct gfs_inum *inum, int create,
-		    struct gfs_inode **ipp);
-void gfs_inode_hold(struct gfs_inode *ip);
-void gfs_inode_put(struct gfs_inode *ip);
-void gfs_inode_destroy(struct gfs_inode *ip);
-
-int gfs_inode_dealloc(struct gfs_sbd *sdp, struct gfs_inum *inum);
-
-int gfs_change_nlink(struct gfs_inode *ip, int diff);
-int gfs_lookupi(struct gfs_holder *d_gh, struct qstr *name,
-		int is_root, struct gfs_holder *i_gh);
-int gfs_createi(struct gfs_holder *d_gh, struct qstr *name,
-		unsigned int type, unsigned int mode,
-		struct gfs_holder *i_gh);
-int gfs_unlinki(struct gfs_inode *dip, struct qstr *name, struct gfs_inode *ip);
-int gfs_rmdiri(struct gfs_inode *dip, struct qstr *name, struct gfs_inode *ip);
-int gfs_unlink_ok(struct gfs_inode *dip, struct qstr *name,
-		  struct gfs_inode *ip);
-int gfs_ok_to_move(struct gfs_inode *this, struct gfs_inode *to);
-int gfs_readlinki(struct gfs_inode *ip, char **buf, unsigned int *len);
-
-int gfs_glock_nq_atime(struct gfs_holder *gh);
-int gfs_glock_nq_m_atime(unsigned int num_gh, struct gfs_holder *ghs);
-
-void gfs_try_toss_vnode(struct gfs_inode *ip);
-
-int gfs_setattr_simple(struct gfs_inode *ip, struct iattr *attr);
-
-/*  Backwards compatibility functions  */
-
-int gfs_alloc_qinode(struct gfs_sbd *sdp);
-int gfs_alloc_linode(struct gfs_sbd *sdp);
-
-/*  Inlines  */
-
-static __inline__ int
-gfs_is_stuffed(struct gfs_inode *ip)
-{
-	return !ip->i_di.di_height;
-}
-
-static __inline__ int
-gfs_is_jdata(struct gfs_inode *ip)
-{
-	return ip->i_di.di_flags & GFS_DIF_JDATA;
-}
-
-#endif /* __INODE_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/ioctl.c b/gfs-kernel/src/gfs/ioctl.c
deleted file mode 100644
index d5489b5..0000000
--- a/gfs-kernel/src/gfs/ioctl.c
+++ /dev/null
@@ -1,1605 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <asm/uaccess.h>
-#include <linux/compat.h>
-
-#include "gfs_ioctl.h"
-#include "gfs.h"
-#include "bmap.h"
-#include "dio.h"
-#include "dir.h"
-#include "eattr.h"
-#include "file.h"
-#include "glock.h"
-#include "glops.h"
-#include "inode.h"
-#include "ioctl.h"
-#include "log.h"
-#include "quota.h"
-#include "rgrp.h"
-#include "super.h"
-#include "trans.h"
-
-typedef int (*gi_filler_t) (struct gfs_inode *ip,
-			    struct gfs_ioctl *gi,
-			    char *buf,
-			    unsigned int size,
-			    unsigned int *count);
-
-#define ARG_SIZE (32)
-
-/**
- * gi_skeleton - Setup a buffer that functions can print into
- * @ip:
- * @gi:
- * @filler:
- *
- * Returns: -errno or count of bytes copied to userspace
- */
-
-static int
-gi_skeleton(struct gfs_inode *ip, struct gfs_ioctl *gi,
-	    gi_filler_t filler)
-{
-	unsigned int size = gfs_tune_get(ip->i_sbd, gt_lockdump_size);
-        char *buf;
-	unsigned int count = 0;
-        int error;
-
-	if (size > gi->gi_size)
-		size = gi->gi_size;
-
-        buf = kmalloc(size, GFP_KERNEL);
-        if (!buf)
-                return -ENOMEM;
-
-        error = filler(ip, gi, buf, size, &count);
-	if (error)
-		goto out;
-
-	if (copy_to_user(gi->gi_data, buf, count + 1))
-		error = -EFAULT;
-	else
-		error = count + 1;
-
- out:
-	kfree(buf);
-
-	return error;
-}
-
-/**
- * gi_get_cookie - Return the "cookie" (identifying string) for a
- *                 filesystem mount
- * @ip:
- * @gi:
- * @buf:
- * @size:
- * @count:
- *
- * Returns: errno
- */ 
-
-static int
-gi_get_cookie(struct gfs_inode *ip,
-	      struct gfs_ioctl *gi,
-	      char *buf,
-	      unsigned int size,
-	      unsigned int *count)
-{
-        int error = -ENOBUFS;
-
-	if (gi->gi_argc != 1)
-		return -EINVAL;
-
-	gfs_printf("version 0\n");
-        gfs_printf("%lu", (unsigned long)ip->i_sbd);
-
-        error = 0;
-
- out:
-        return error;
-}
-
-/**
- * gi_get_super - Return the "struct gfs_sb" for a filesystem
- * @sdp:
- * @gi:
- *
- * Returns: errno
- */
-
-static int
-gi_get_super(struct gfs_sbd *sdp, struct gfs_ioctl *gi)
-{
-	struct gfs_holder sb_gh;
-	struct buffer_head *bh;
-	struct gfs_sb *sb;
-	int error;
-
-	if (gi->gi_argc != 1)
-		return -EINVAL;
-	if (gi->gi_size != sizeof(struct gfs_sb))
-		return -EINVAL;
-
-	sb = kmalloc(sizeof(struct gfs_sb), GFP_KERNEL);
-	if (!sb)
-		return -ENOMEM;
-
-	error = gfs_glock_nq_num(sdp,
-				 GFS_SB_LOCK, &gfs_meta_glops,
-				 LM_ST_SHARED, 0, &sb_gh);
-	if (error)
-		goto out;
-
-	error = gfs_dread(sb_gh.gh_gl, GFS_SB_ADDR >> sdp->sd_fsb2bb_shift,
-			  DIO_START | DIO_WAIT, &bh);
-	if (error) {
-		gfs_glock_dq_uninit(&sb_gh);
-		goto out;
-	}
-	gfs_sb_in(sb, bh->b_data);
-	brelse(bh);
-
-	gfs_glock_dq_uninit(&sb_gh);
-
-	if (copy_to_user(gi->gi_data, sb,
-			 sizeof(struct gfs_sb)))
-	        error = -EFAULT;
-	else
-		error = sizeof(struct gfs_sb);
-
- out:
-	kfree(sb);
-
-	return error;
-}
-
-/**
- * gi_get_args - Return the mount arguments
- * @ip:
- * @gi:
- * @buf:
- * @size:
- * @count:
- *
- * Returns: errno
- */ 
-
-static int
-gi_get_args(struct gfs_inode *ip,
-	    struct gfs_ioctl *gi,
-	    char *buf,
-	    unsigned int size,
-	    unsigned int *count)
-{
-	struct gfs_args *args = &ip->i_sbd->sd_args;
-	int error = -ENOBUFS;
-
-	if (gi->gi_argc != 1)
-		return -EINVAL;
-
-	gfs_printf("version 0\n");
-	gfs_printf("lockproto %s\n", args->ar_lockproto);
-	gfs_printf("locktable %s\n", args->ar_locktable);
-	gfs_printf("hostdata %s\n", args->ar_hostdata);
-	gfs_printf("ignore_local_fs %d\n", args->ar_ignore_local_fs);
-	gfs_printf("localcaching %d\n", args->ar_localcaching);
-        gfs_printf("localflocks %d\n", args->ar_localflocks);
-        gfs_printf("oopses_ok %d\n", args->ar_oopses_ok);
-        gfs_printf("upgrade %d\n", args->ar_upgrade);
-	gfs_printf("num_glockd %u\n", args->ar_num_glockd);
-        gfs_printf("posix_acls %d\n", args->ar_posix_acls);
-        gfs_printf("suiddir %d\n", args->ar_suiddir);
-
-	error = 0;
-	
- out:
-	return error;
-}
-
-/**
- * gi_get_lockstruct - Return the information in the FS' lockstruct
- * @ip:
- * @gi:
- * @buf:
- * @size:
- * @count:
- *
- * Returns: errno
- */ 
-
-static int
-gi_get_lockstruct(struct gfs_inode *ip,
-		  struct gfs_ioctl *gi,
-		  char *buf,
-		  unsigned int size,
-		  unsigned int *count)
-{
-	struct lm_lockstruct *ls = &ip->i_sbd->sd_lockstruct;
-        int error = -ENOBUFS;
-
-	if (gi->gi_argc != 1)
-		return -EINVAL;
-
-	gfs_printf("version 0\n");
-        gfs_printf("jid %u\n", ls->ls_jid);
-        gfs_printf("first %u\n", ls->ls_first);
-        gfs_printf("lvb_size %u\n", ls->ls_lvb_size);
-        gfs_printf("flags %d\n", ls->ls_flags);
-
-	error = 0;
-
- out:
-        return error;
-}
-
-/**
- * gi_get_stat_gfs - Return a filesystem's space usage information
- * @ip:
- * @gi:
- * @buf:
- * @size:
- * @count:
- *
- * Returns: errno
- */ 
-
-static int
-gi_get_stat_gfs(struct gfs_inode *ip,
-		struct gfs_ioctl *gi,
-		char *buf,
-		unsigned int size,
-		unsigned int *count)
-{
-	struct gfs_stat_gfs sg;
-        int error;
-
-	if (gi->gi_argc != 1)
-		return -EINVAL;
-
-	error = gfs_stat_gfs(ip->i_sbd, &sg, TRUE);
-	if (error)
-		return error;
-
-	error = -ENOBUFS;
-
-	gfs_printf("version 0\n");
-	gfs_printf("bsize %u\n", ip->i_sbd->sd_sb.sb_bsize);
-        gfs_printf("total_blocks %"PRIu64"\n", sg.sg_total_blocks);
-        gfs_printf("free %"PRIu64"\n", sg.sg_free);
-        gfs_printf("used_dinode %"PRIu64"\n", sg.sg_used_dinode);
-        gfs_printf("free_dinode %"PRIu64"\n", sg.sg_free_dinode);
-        gfs_printf("used_meta %"PRIu64"\n", sg.sg_used_meta);
-        gfs_printf("free_meta %"PRIu64"\n", sg.sg_free_meta);
-
-	error = 0;
-
- out:
-        return error;
-}
-
-/**
- * handle_roll - Read a atomic_t as an unsigned int
- * @a: a counter
- *
- * if @a is negative, reset it to zero
- *
- * Returns: the value of the counter
- */
-
-static unsigned int
-handle_roll(atomic_t *a)
-{
-	int x = atomic_read(a);
-	if (x < 0) {
-		atomic_set(a, 0);
-		return 0;
-	}
-	return (unsigned int)x;
-}
-
-/**
- * gi_get_counters - Return usage counters
- * @ip:
- * @gi:
- * @buf:
- * @size:
- * @count:
- *
- * Returns: errno
- */ 
-
-static int
-gi_get_counters(struct gfs_inode *ip,
-		struct gfs_ioctl *gi,
-		char *buf,
-		unsigned int size,
-		unsigned int *count)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-        int error = -ENOBUFS;
-
-	if (gi->gi_argc != 1)
-		return -EINVAL;
-
-	gfs_printf("version 0\n");
-	gfs_printf("sd_glock_count:locks::%d\n",
-		   atomic_read(&sdp->sd_glock_count));
-	gfs_printf("sd_glock_held_count:locks held::%d\n",
-		   atomic_read(&sdp->sd_glock_held_count));
-	gfs_printf("sd_freeze_count:freeze count::%d\n",
-		   sdp->sd_freeze_count);
-	gfs_printf("sd_inode_count:incore inodes::%d\n",
-		   atomic_read(&sdp->sd_inode_count));
-	gfs_printf("sd_bufdata_count:metadata buffers::%d\n",
-		   atomic_read(&sdp->sd_bufdata_count));
-	gfs_printf("sd_unlinked_ic_count:unlinked inodes::%d\n",
-		   atomic_read(&sdp->sd_unlinked_ic_count));
-	gfs_printf("sd_quota_count:quota IDs::%d\n",
-		   atomic_read(&sdp->sd_quota_count));
-	gfs_printf("sd_log_buffers:incore log buffers::%u\n",
-		   sdp->sd_log_buffers);
-	gfs_printf("sd_log_seg_free:log segments free::%u\n",
-		   sdp->sd_log_seg_free);
-	gfs_printf("ji_nsegment:log segments total::%u\n",
-		   sdp->sd_jdesc.ji_nsegment);
-	gfs_printf("sd_mhc_count:meta header cache entries::%d\n",
-		   atomic_read(&sdp->sd_mhc_count));
-	gfs_printf("sd_depend_count:glock dependencies::%d\n",
-		   atomic_read(&sdp->sd_depend_count));
-	gfs_printf("sd_reclaim_count:glocks on reclaim list::%d\n",
-		   atomic_read(&sdp->sd_reclaim_count));
-	gfs_printf("sd_log_wrap:log wraps::%"PRIu64"\n",
-		   sdp->sd_log_wrap);
-	gfs_printf("sd_lm_outstanding:outstanding LM calls::%d\n",
-		   atomic_read(&sdp->sd_lm_outstanding));
-	gfs_printf("sd_bio_outstanding:outstanding BIO calls::%u\n",
-		   atomic_read(&sdp->sd_bio_outstanding));
-	gfs_printf("sd_fh2dentry_misses:fh2dentry misses:diff:%u\n",
-		   handle_roll(&sdp->sd_fh2dentry_misses));
-	gfs_printf("sd_reclaimed:glocks reclaimed:diff:%u\n",
-		   handle_roll(&sdp->sd_reclaimed));
-	gfs_printf("sd_glock_nq_calls:glock nq calls:diff:%u\n",
-		   handle_roll(&sdp->sd_glock_nq_calls));
-	gfs_printf("sd_glock_dq_calls:glock dq calls:diff:%u\n",
-		   handle_roll(&sdp->sd_glock_dq_calls));
-	gfs_printf("sd_glock_prefetch_calls:glock prefetch calls:diff:%u\n",
-		   handle_roll(&sdp->sd_glock_prefetch_calls));
-	gfs_printf("sd_lm_lock_calls:lm_lock calls:diff:%u\n",
-		   handle_roll(&sdp->sd_lm_lock_calls));
-	gfs_printf("sd_lm_unlock_calls:lm_unlock calls:diff:%u\n",
-		   handle_roll(&sdp->sd_lm_unlock_calls));
-	gfs_printf("sd_lm_callbacks:lm callbacks:diff:%u\n",
-		   handle_roll(&sdp->sd_lm_callbacks));
-	gfs_printf("sd_ops_address:address operations:diff:%u\n",
-		   handle_roll(&sdp->sd_ops_address));
-	gfs_printf("sd_ops_dentry:dentry operations:diff:%u\n",
-		   handle_roll(&sdp->sd_ops_dentry));
-	gfs_printf("sd_ops_export:export operations:diff:%u\n",
-		   handle_roll(&sdp->sd_ops_export));
-	gfs_printf("sd_ops_file:file operations:diff:%u\n",
-		   handle_roll(&sdp->sd_ops_file));
-	gfs_printf("sd_ops_inode:inode operations:diff:%u\n",
-		   handle_roll(&sdp->sd_ops_inode));
-	gfs_printf("sd_ops_super:super operations:diff:%u\n",
-		   handle_roll(&sdp->sd_ops_super));
-	gfs_printf("sd_ops_vm:vm operations:diff:%u\n",
-		   handle_roll(&sdp->sd_ops_vm));
-	gfs_printf("sd_bio_reads:block I/O reads:diff:%u\n",
-		   handle_roll(&sdp->sd_bio_reads) >>
-		   (sdp->sd_sb.sb_bsize_shift - 9));
-	gfs_printf("sd_bio_writes:block I/O writes:diff:%u\n",
-		   handle_roll(&sdp->sd_bio_writes) >>
-		   (sdp->sd_sb.sb_bsize_shift - 9));
-
-        error = 0;
-
- out:
-        return error;
-}
-
-/**
- * gi_get_tune - Return current values of the tuneable parameters
- * @ip:
- * @gi:
- * @buf:
- * @size:
- * @count:
- *
- * Returns: errno
- */ 
-
-static int
-gi_get_tune(struct gfs_inode *ip,
-	    struct gfs_ioctl *gi,
-	    char *buf,
-	    unsigned int size,
-	    unsigned int *count)
-{
-	struct gfs_tune *gt = &ip->i_sbd->sd_tune;
-	int error = -ENOBUFS;
-
-	if (gi->gi_argc != 1)
-		return -EINVAL;
-
-	spin_lock(&gt->gt_spin);
-
-	gfs_printf("version 0\n");
-        gfs_printf("ilimit1 %u\n", gt->gt_ilimit1);
-        gfs_printf("ilimit1_tries %u\n", gt->gt_ilimit1_tries);
-        gfs_printf("ilimit1_min %u\n", gt->gt_ilimit1_min);
-        gfs_printf("ilimit2 %u\n", gt->gt_ilimit2);
-        gfs_printf("ilimit2_tries %u\n", gt->gt_ilimit2_tries);
-        gfs_printf("ilimit2_min %u\n", gt->gt_ilimit2_min);
-        gfs_printf("demote_secs %u\n", gt->gt_demote_secs);
-        gfs_printf("incore_log_blocks %u\n", gt->gt_incore_log_blocks);
-        gfs_printf("jindex_refresh_secs %u\n", gt->gt_jindex_refresh_secs);
-        gfs_printf("depend_secs %u\n", gt->gt_depend_secs);
-        gfs_printf("scand_secs %u\n", gt->gt_scand_secs);
-        gfs_printf("recoverd_secs %u\n", gt->gt_recoverd_secs);
-        gfs_printf("logd_secs %u\n", gt->gt_logd_secs);
-        gfs_printf("quotad_secs %u\n", gt->gt_quotad_secs);
-        gfs_printf("inoded_secs %u\n", gt->gt_inoded_secs);
-        gfs_printf("glock_purge %u\n", gt->gt_glock_purge);
-        gfs_printf("quota_simul_sync %u\n", gt->gt_quota_simul_sync);
-        gfs_printf("quota_warn_period %u\n", gt->gt_quota_warn_period);
-        gfs_printf("atime_quantum %u\n", gt->gt_atime_quantum);
-        gfs_printf("quota_quantum %u\n", gt->gt_quota_quantum);
-        gfs_printf("quota_scale_num %u\n", gt->gt_quota_scale_num);
-        gfs_printf("quota_scale_den %u\n", gt->gt_quota_scale_den);
-        gfs_printf("quota_enforce %u\n", gt->gt_quota_enforce);
-        gfs_printf("quota_account %u\n", gt->gt_quota_account);
-        gfs_printf("new_files_jdata %u\n", gt->gt_new_files_jdata);
-        gfs_printf("new_files_directio %u\n", gt->gt_new_files_directio);
-        gfs_printf("max_atomic_write %u\n", gt->gt_max_atomic_write);
-        gfs_printf("max_readahead %u\n", gt->gt_max_readahead);
-        gfs_printf("lockdump_size %u\n", gt->gt_lockdump_size);
-        gfs_printf("stall_secs %u\n", gt->gt_stall_secs);
-        gfs_printf("complain_secs %u\n", gt->gt_complain_secs);
-        gfs_printf("reclaim_limit %u\n", gt->gt_reclaim_limit);
-        gfs_printf("entries_per_readdir %u\n", gt->gt_entries_per_readdir);
-        gfs_printf("prefetch_secs %u\n", gt->gt_prefetch_secs);
-        gfs_printf("statfs_slots %u\n", gt->gt_statfs_slots);
-        gfs_printf("max_mhc %u\n", gt->gt_max_mhc);
-        gfs_printf("greedy_default %u\n", gt->gt_greedy_default);
-        gfs_printf("greedy_quantum %u\n", gt->gt_greedy_quantum);
-        gfs_printf("greedy_max %u\n", gt->gt_greedy_max);
-        gfs_printf("rgrp_try_threshold %u\n", gt->gt_rgrp_try_threshold);
-        gfs_printf("statfs_fast %u\n", gt->gt_statfs_fast);
-
-        error = 0;
-
- out:
-	spin_unlock(&gt->gt_spin);
-
-        return error;
-}
-
-#define tune_set(f, v) \
-do { \
-	spin_lock(&gt->gt_spin); \
-	gt->f = (v); \
-	spin_unlock(&gt->gt_spin); \
-} while (0)
-
-/**
- * gi_set_tune - Set a tuneable parameter
- * @sdp:
- * @gi:
- *
- * Returns: errno
- */
-
-static int
-gi_set_tune(struct gfs_sbd *sdp, struct gfs_ioctl *gi, int from_user)
-{
-	struct gfs_tune *gt = &sdp->sd_tune;
- 	char param[ARG_SIZE], value[ARG_SIZE];
-	unsigned int x;
-	int error;
-
-	if (!capable(CAP_SYS_ADMIN))
-                return -EACCES;
-	if (gi->gi_argc != 3)
-		return -EINVAL;
-
-	if (from_user) {
-		if (strncpy_from_user(param, gi->gi_argv[1], ARG_SIZE) < 0)
-			return -EFAULT;
-	} else {
-		strncpy(param, gi->gi_argv[1], ARG_SIZE);
-	}
-	param[ARG_SIZE - 1] = 0;
-
-	if (from_user) {
-		if (strncpy_from_user(value, gi->gi_argv[2], ARG_SIZE) < 0)
-			return -EFAULT;
-	} else {
-		strncpy(value, gi->gi_argv[2], ARG_SIZE);
-	}
-
-	value[ARG_SIZE - 1] = 0;
-
-	if (strcmp(param, "ilimit1") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_ilimit1, x);
-
-	} else if (strcmp(param, "ilimit1_tries") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_ilimit1_tries, x);
-
-	} else if (strcmp(param, "ilimit1_min") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_ilimit1_min, x);
-
-	} else if (strcmp(param, "ilimit2") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_ilimit2, x);
-
-	} else if (strcmp(param, "ilimit2_tries") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_ilimit2_tries, x);
-
-	} else if (strcmp(param, "ilimit2_min") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_ilimit2_min, x);
-
-	} else if (strcmp(param, "demote_secs") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_demote_secs, x);
-
-	} else if (strcmp(param, "incore_log_blocks") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_incore_log_blocks, x);
-
-	} else if (strcmp(param, "jindex_refresh_secs") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_jindex_refresh_secs, x);
-
-	} else if (strcmp(param, "depend_secs") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_depend_secs, x);
-
-	} else if (strcmp(param, "scand_secs") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_scand_secs, x);
-		wake_up_process(sdp->sd_scand_process);
-
-	} else if (strcmp(param, "recoverd_secs") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_recoverd_secs, x);
-		wake_up_process(sdp->sd_recoverd_process);
-
-	} else if (strcmp(param, "logd_secs") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_logd_secs, x);
-		wake_up_process(sdp->sd_logd_process);
-
-	} else if (strcmp(param, "quotad_secs") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_quotad_secs, x);
-		wake_up_process(sdp->sd_quotad_process);
-
-	} else if (strcmp(param, "inoded_secs") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_inoded_secs, x);
-		wake_up_process(sdp->sd_inoded_process);
-
-	} else if (strcmp(param, "glock_purge") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_glock_purge, x);
-
-	} else if (strcmp(param, "quota_simul_sync") == 0) {
-		if (sscanf(value, "%u", &x) != 1 || !x)
-			return -EINVAL;
-		tune_set(gt_quota_simul_sync, x);
-
-	} else if (strcmp(param, "quota_warn_period") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_quota_warn_period, x);
-
-	} else if (strcmp(param, "atime_quantum") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_atime_quantum, x);
-
-	} else if (strcmp(param, "quota_quantum") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_quota_quantum, x);
-
-	} else if (strcmp(param, "quota_scale") == 0) {
-		unsigned int y;
-		if (sscanf(value, "%u %u", &x, &y) != 2 || !y)
-			return -EINVAL;
-		spin_lock(&gt->gt_spin);
-		gt->gt_quota_scale_num = x;
-		gt->gt_quota_scale_den = y;
-		spin_unlock(&gt->gt_spin);
-
-	} else if (strcmp(param, "quota_enforce") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		x = !!x;
-		spin_lock(&gt->gt_spin);
-		gt->gt_quota_enforce = x;
-		if (x)
-			gt->gt_quota_account = 1;
-		spin_unlock(&gt->gt_spin);
-
-	} else if (strcmp(param, "quota_account") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		x = !!x;
-		spin_lock(&gt->gt_spin);
-		gt->gt_quota_account = x;
-		if (x)
-			spin_unlock(&gt->gt_spin);
-		else {
-			unsigned int y;
-			gt->gt_quota_enforce = 0;
-			spin_unlock(&gt->gt_spin);
-			for (y = 0; y < 2; y++) {
-				gfs_log_flush(sdp);
-				gfs_sync_meta(sdp);
-				gfs_quota_sync(sdp);
-			}
-		}
-
-	} else if (strcmp(param, "new_files_jdata") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		x = !!x;
-		tune_set(gt_new_files_jdata, x);
-
-	} else if (strcmp(param, "new_files_directio") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		x = !!x;
-		tune_set(gt_new_files_directio, x);
-
-	} else if (strcmp(param, "max_atomic_write") == 0) {
-		if (sscanf(value, "%u", &x) != 1 || !x)
-			return -EINVAL;
-		tune_set(gt_max_atomic_write, x);
-
-	} else if (strcmp(param, "max_readahead") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_max_readahead, x);
-
-	} else if (strcmp(param, "lockdump_size") == 0) {
-		if (sscanf(value, "%u", &x) != 1 || !x)
-			return -EINVAL;
-		tune_set(gt_lockdump_size, x);
-
-	} else if (strcmp(param, "stall_secs") == 0) {
-		if (sscanf(value, "%u", &x) != 1 || !x)
-			return -EINVAL;
-		tune_set(gt_stall_secs, x);
-
-	} else if (strcmp(param, "complain_secs") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_complain_secs, x);
-
-	} else if (strcmp(param, "reclaim_limit") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_reclaim_limit, x);
-
-	} else if (strcmp(param, "entries_per_readdir") == 0) {
-		if (sscanf(value, "%u", &x) != 1 || !x)
-			return -EINVAL;
-		tune_set(gt_entries_per_readdir, x);
-
-	} else if (strcmp(param, "prefetch_secs") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_prefetch_secs, x);
-
-	} else if (strcmp(param, "statfs_slots") == 0) {
-		if (sscanf(value, "%u", &x) != 1 || !x)
-			return -EINVAL;
-		tune_set(gt_statfs_slots, x);
-
-	} else if (strcmp(param, "max_mhc") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_max_mhc, x);
-
-	} else if (strcmp(param, "greedy_default") == 0) {
-		if (sscanf(value, "%u", &x) != 1 || !x)
-			return -EINVAL;
-		tune_set(gt_greedy_default, x);
-
-	} else if (strcmp(param, "greedy_quantum") == 0) {
-		if (sscanf(value, "%u", &x) != 1 || !x)
-			return -EINVAL;
-		tune_set(gt_greedy_quantum, x);
-
-	} else if (strcmp(param, "greedy_max") == 0) {
-		if (sscanf(value, "%u", &x) != 1 || !x)
-			return -EINVAL;
-		tune_set(gt_greedy_max, x);
-
-	} else if (strcmp(param, "rgrp_try_threshold") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		tune_set(gt_rgrp_try_threshold, x);
-
-	} else if (strcmp(param, "statfs_fast") == 0) {
-		if (sscanf(value, "%u", &x) != 1)
-			return -EINVAL;
-		error = gfs_statfs_init(sdp, x);
-		if (error)
-			return error;
-		else
-			tune_set(gt_statfs_fast, x);
-
-
-	} else
-		return -EINVAL;
-
-	return 0;
-}
-
-/**
- * gi_do_reclaim - Reclaim unused metadata
- * @ip:
- * @gi:
- * @buf:
- * @size:
- * @count:
- *
- * Returns: errno
- */ 
-
-static int
-gi_do_reclaim(struct gfs_inode *ip,
-	      struct gfs_ioctl *gi,
-	      char *buf,
-	      unsigned int size,
-	      unsigned int *count)
-{
-	uint64_t inodes, metadata;
-        int error;
-
-	if (!capable(CAP_SYS_ADMIN))
-		return -EACCES;
-	if (gi->gi_argc != 1)
-		return -EINVAL;
-
-	error = gfs_reclaim_metadata(ip->i_sbd,
-				     &inodes,
-				     &metadata);
-	if (error)
-		return error;
-
-	error = -ENOBUFS;
-
-	gfs_printf("version 0\n");
-        gfs_printf("inodes %"PRIu64"\n", inodes);
-        gfs_printf("metadata %"PRIu64"\n", metadata);
-
-        error = 0;
-
- out:
-        return error;
-}
-
-/**
- * gi_do_shrink - throw out unused glocks
- * @sdp:
- * @gi:
- *
- * Returns: 0
- */
-
-static int
-gi_do_shrink(struct gfs_sbd *sdp, struct gfs_ioctl *gi)
-{
-	if (!capable(CAP_SYS_ADMIN))
-		return -EACCES;
-	if (gi->gi_argc != 1)
-		return -EINVAL;
-	gfs_gl_hash_clear(sdp, FALSE);
-	return 0;
-}
-
-/**
- * gi_get_file_stat -
- * @ip:
- * @gi:
- *
- * Returns: the number of bytes copied, or -errno
- */
-
-static int
-gi_get_file_stat(struct gfs_inode *ip, struct gfs_ioctl *gi)
-{
-	struct gfs_holder i_gh;
-	struct gfs_dinode *di;
-	int error;
-
-	if (gi->gi_argc != 1)
-		return -EINVAL;
-	if (gi->gi_size != sizeof(struct gfs_dinode))
-		return -EINVAL;
-
-	di = kmalloc(sizeof(struct gfs_dinode), GFP_KERNEL);
-	if (!di)
-		return -ENOMEM;
-
-	error = gfs_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh);
-	if (error)
-		goto out;
-	memcpy(di, &ip->i_di, sizeof(struct gfs_dinode));
-	gfs_glock_dq_uninit(&i_gh);
-
-	if (copy_to_user(gi->gi_data, di,
-			 sizeof(struct gfs_dinode)))
-		error = -EFAULT;
-	else
-		error = sizeof(struct gfs_dinode);
-
- out:
-	kfree(di);
-
-	return error;
-}
-
-/**
- * gi_set_file_flag - set or clear a flag on a file
- * @ip:
- * @gi:
- *
- * Returns: errno
- */
-
-static int
-gi_set_file_flag(struct gfs_inode *ip, struct gfs_ioctl *gi, int from_user)
-{
-	char buf[ARG_SIZE];
-	int set;
-	uint32_t flag;
-	struct gfs_holder i_gh;
-	struct buffer_head *dibh;
-	int error;
-
-	if (gi->gi_argc != 3)
-		return -EINVAL;
-
-	if (from_user) {
-		if (strncpy_from_user(buf, gi->gi_argv[1], ARG_SIZE) < 0)
-			return -EFAULT;
-	} else {
-		strncpy(buf, gi->gi_argv[1], ARG_SIZE);
-	}
-	buf[ARG_SIZE - 1] = 0;
-
-	if (strcmp(buf, "set") == 0)
-		set = TRUE;
-	else if (strcmp(buf, "clear") == 0)
-		set = FALSE;
-	else
-		return -EINVAL;
-
-	if (from_user) {
-		if (strncpy_from_user(buf, gi->gi_argv[2], ARG_SIZE) < 0)
-			return -EFAULT;
-	} else {
-		strncpy(buf, gi->gi_argv[2], ARG_SIZE);
-	}
-        buf[ARG_SIZE - 1] = 0;
-
-	error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh);
-	if (error)
-		return error;
-
-	error = -EACCES;
-	if (ip->i_di.di_uid != current->fsuid && !capable(CAP_FOWNER))
-		goto out;
-
-	error = -EINVAL;
-
-	if (strcmp(buf, "jdata") == 0) {
-		if (ip->i_di.di_type != GFS_FILE_REG ||
-		    ip->i_di.di_size)
-			goto out;
-		flag = GFS_DIF_JDATA;
-	} else if (strcmp(buf, "directio") == 0) {
-		if (ip->i_di.di_type != GFS_FILE_REG)
-			goto out;
-		flag = GFS_DIF_DIRECTIO;
-	} else if (strcmp(buf, "immutable") == 0) {
-		/* The IMMUTABLE flag can only be changed by
-		   the relevant capability. */
-		error = -EPERM;
-		if (!capable(CAP_LINUX_IMMUTABLE))
-			goto out;
-		flag = GFS_DIF_IMMUTABLE;
-	} else if (strcmp(buf, "appendonly") == 0) {
-                /* The APPENDONLY flag can only be changed by
-                   the relevant capability. */
-                error = -EPERM;
-                if (!capable(CAP_LINUX_IMMUTABLE))
-                        goto out;
-		flag = GFS_DIF_APPENDONLY;
-	} else if (strcmp(buf, "inherit_jdata") == 0) {
-		if (ip->i_di.di_type != GFS_FILE_DIR) 
-			goto out;
-		flag = GFS_DIF_INHERIT_JDATA;
-	} else if (strcmp(buf, "inherit_directio") == 0) {
-		if (ip->i_di.di_type != GFS_FILE_DIR)
-			goto out;
-                flag = GFS_DIF_INHERIT_DIRECTIO;
-	} else
-		goto out;
-
-	error = gfs_trans_begin(ip->i_sbd, 1, 0);
-	if (error)
-		goto out;
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-	if (error)
-		goto out_trans_end;
-
-	if (set)
-		ip->i_di.di_flags |= flag;
-	else
-		ip->i_di.di_flags &= ~flag;
-
-	gfs_trans_add_bh(ip->i_gl, dibh);
-	gfs_dinode_out(&ip->i_di, dibh->b_data);
-
-	brelse(dibh);
-
- out_trans_end:
-	gfs_trans_end(ip->i_sbd);
-
- out:
-	gfs_glock_dq_uninit(&i_gh);
-
-	return error;
-
-}
-
-/**
- * gi_get_file_meta - Return all the metadata for a file
- * @ip:
- * @gi:
- *
- * Returns: the number of bytes copied, or -errno
- */
-
-static int
-gi_get_file_meta(struct gfs_inode *ip, struct gfs_ioctl *gi)
-{
-	struct gfs_holder i_gh;
-	struct gfs_user_buffer ub;
-	int error;
-
-	if (gi->gi_argc != 1)
-		return -EINVAL;
-
-	ub.ub_data = gi->gi_data;
-	ub.ub_size = gi->gi_size;
-	ub.ub_count = 0;
-
-	error = gfs_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh);
-	if (error)
-		return error;
-
-        error = -EACCES;
-        if (ip->i_di.di_uid != current->fsuid && !capable(CAP_FOWNER))
-                goto out;
-
-	error = gfs_get_file_meta(ip, &ub);
-	if (error)
-		goto out;
-
-	if (ip->i_di.di_type == GFS_FILE_DIR &&
-	    (ip->i_di.di_flags & GFS_DIF_EXHASH)) {
-		error = gfs_get_dir_meta(ip, &ub);
-		if (error)
-			goto out;
-	}
-
-	if (ip->i_di.di_eattr) {
-		error = gfs_get_eattr_meta(ip, &ub);
-		if (error)
-			goto out;
-	}
-
-	error = ub.ub_count;
-
- out:
-	gfs_glock_dq_uninit(&i_gh);
-
-	return error;
-}
-
-/**
- * gi_do_file_flush - sync out all dirty data and
- *                    drop the cache (and lock) for a file.
- * @ip:
- * @gi:
- *
- * Returns: errno
- */
-
-static int
-gi_do_file_flush(struct gfs_inode *ip, struct gfs_ioctl *gi)
-{
-	if (gi->gi_argc != 1)
-		return -EINVAL;
-	gfs_glock_force_drop(ip->i_gl);
-	return 0;
-}
-
-/**
- * gi2hip - return the "struct gfs_inode" for a hidden file
- * @sdp:
- * @gi:
- *
- * Returns: the "struct gfs_inode"
- */
-
-static struct gfs_inode *
-gi2hip(struct gfs_sbd *sdp, struct gfs_ioctl *gi, int from_user)
-{
-	char buf[ARG_SIZE];
-
-	if (gi->gi_argc != 2)
-		return ERR_PTR(-EINVAL);
-
-	if (from_user) {
-		if (strncpy_from_user(buf, gi->gi_argv[1], ARG_SIZE) < 0)
-			return ERR_PTR(-EFAULT);
-	} else {
-		strncpy(buf, gi->gi_argv[1], ARG_SIZE);
-	}
-        buf[ARG_SIZE - 1] = 0;
-
-	if (strcmp(buf, "jindex") == 0)
-		return sdp->sd_jiinode;
-	else if (strcmp(buf, "rindex") == 0)
-		return sdp->sd_riinode;
-	else if (strcmp(buf, "quota") == 0)
-		return sdp->sd_qinode;
-	else if (strcmp(buf, "license") == 0)
-		return sdp->sd_linode;
-	else
-		return ERR_PTR(-EINVAL);
-}
-
-/**
- * gi_get_hfile_stat - get stat info on a hidden file
- * @sdp:
- * @gi:
- *
- * Returns: the number of bytes copied, or -errno
- */
-
-static int
-gi_get_hfile_stat(struct gfs_sbd *sdp, struct gfs_ioctl *gi, int from_user)
-{
-	struct gfs_inode *ip;
-	struct gfs_dinode *di;
-	struct gfs_holder i_gh;
-	int error;
-
-	ip = gi2hip(sdp, gi, from_user);
-	if (IS_ERR(ip))
-		return PTR_ERR(ip);
-
-	if (gi->gi_size != sizeof(struct gfs_dinode))
-		return -EINVAL;
-
-        di = kmalloc(sizeof(struct gfs_dinode), GFP_KERNEL);
-        if (!di)
-                return -ENOMEM;
-
-	error = gfs_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh);
-	if (error)
-		goto out;
-	memcpy(di, &ip->i_di, sizeof(struct gfs_dinode));
-	gfs_glock_dq_uninit(&i_gh);
-
-        if (copy_to_user(gi->gi_data, di,
-                         sizeof(struct gfs_dinode)))
-                error = -EFAULT;
-        else
-                error = sizeof(struct gfs_dinode);
-
- out:
-	kfree(di);
-
-	return error;
-}
-
-/**
- * gi_do_hfile_read - Read data from a hidden file
- * @sdp:
- * @gi:
- *
- * Returns: the number of bytes read, or -errno
- */
-
-static int
-gi_do_hfile_read(struct gfs_sbd *sdp, struct gfs_ioctl *gi, int from_user)
-{
-	struct gfs_inode *ip;
-	struct gfs_holder i_gh;
-	int error;
-
-        if (!capable(CAP_SYS_ADMIN))
-                return -EACCES;
-
-	ip = gi2hip(sdp, gi, from_user);
-	if (IS_ERR(ip))
-		return PTR_ERR(ip);
-
-	if (!access_ok(VERIFY_WRITE, gi->gi_data, gi->gi_size))
-		return -EFAULT;
-
-	error = gfs_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &i_gh);
-	if (error)
-		return error;
-
-	error = gfs_readi(ip, gi->gi_data, gi->gi_offset, gi->gi_size,
-			  gfs_copy2user);
-
-	gfs_glock_dq_uninit(&i_gh);
-
-	return error;
-}
-
-/**
- * gi_do_hfile_write - Write data to a hidden file
- * @sdp:
- * @gi:
- *
- * Returns: the number of bytes written, or -errno
- */
-
-static int
-gi_do_hfile_write(struct gfs_sbd *sdp, struct gfs_ioctl *gi, int from_user)
-{
-	struct gfs_inode *ip;
-	struct gfs_alloc *al = NULL;
-	struct gfs_holder i_gh;
-	unsigned int data_blocks, ind_blocks;
-	int alloc_required;
-	int error;
-
-        if (!capable(CAP_SYS_ADMIN))
-                return -EACCES;
-
-	ip = gi2hip(sdp, gi, from_user);
-	if (IS_ERR(ip))
-		return PTR_ERR(ip);
-
-	if (!access_ok(VERIFY_READ, gi->gi_data, gi->gi_size))
-		return -EFAULT;
-
-	gfs_write_calc_reserv(ip, gi->gi_size, &data_blocks, &ind_blocks);
-
-	error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE,
-				 LM_FLAG_PRIORITY | GL_SYNC | GL_NOCANCEL_OTHER,
-				 &i_gh);
-	if (error)
-		return error;
-
-        if (!gfs_is_jdata(ip)) {
-                gfs_consist_inode(ip);
-		error = -EIO;
-		goto out;
-        }
-
-	error = gfs_write_alloc_required(ip, gi->gi_offset, gi->gi_size,
-					 &alloc_required);
-	if (error)
-		goto out;
-
-	if (alloc_required) {
-		al = gfs_alloc_get(ip);
-
-		error = gfs_quota_hold_m(ip, NO_QUOTA_CHANGE,
-					 NO_QUOTA_CHANGE);
-		if (error)
-			goto out_alloc;
-
-		al->al_requested_meta = ind_blocks + data_blocks;
-
-		error = gfs_inplace_reserve(ip);
-		if (error)
-			goto out_qs;
-
-		/* Trans may require:
-		   All blocks for a RG bitmap, all the "data" blocks, whatever
-		   indirect blocks we need, a modified dinode, and a quota change */
-
-		error = gfs_trans_begin(sdp,
-					1 + al->al_rgd->rd_ri.ri_length +
-					ind_blocks + data_blocks, 1);
-		if (error)
-			goto out_relse;
-	} else {
-		/* Trans may require:
-		   All the "data" blocks and a modified dinode. */
-
-		error = gfs_trans_begin(sdp, 1 + data_blocks, 0);
-		if (error)
-			goto out_relse;
-	}
-
-	if (from_user)
-		error = gfs_writei(ip, gi->gi_data, gi->gi_offset, gi->gi_size,
-				   gfs_copy_from_user, NULL);
-	else
-		error = gfs_writei(ip, gi->gi_data, gi->gi_offset, gi->gi_size,
-				   gfs_copy_from_mem, NULL);
-
-	gfs_trans_end(sdp);
-
- out_relse:
-	if (alloc_required) {
-		gfs_assert_warn(sdp, error || al->al_alloced_meta);
-		gfs_inplace_release(ip);
-	}
-
- out_qs:
-	if (alloc_required)
-		gfs_quota_unhold_m(ip);
-
- out_alloc:
-	if (alloc_required)
-		gfs_alloc_put(ip);
-
- out:
-	ip->i_gl->gl_vn++;
-	gfs_glock_dq_uninit(&i_gh);
-
-	return error;
-}
-
-/**
- * gi_do_hfile_trunc - truncate a hidden file
- * @sdp:
- * @gi:
- *
- * Returns: the number of bytes copied, or -errno
- */
-
-static int
-gi_do_hfile_trunc(struct gfs_sbd *sdp, struct gfs_ioctl *gi, int from_user)
-{
-	struct gfs_inode *ip;
-	struct gfs_holder i_gh;
-	int error;
-
-	if (!capable(CAP_SYS_ADMIN))
-		return -EACCES;
-
-	ip = gi2hip(sdp, gi, from_user);
-	if (IS_ERR(ip))
-		return PTR_ERR(ip);
-
-	error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_SYNC, &i_gh);
-	if (error)
-		return error;
-
-	error = gfs_truncatei(ip, gi->gi_offset, NULL);
-
-	ip->i_gl->gl_vn++;
-	gfs_glock_dq_uninit(&i_gh);
-
-	return error;
-}
-
-/**
- * gi_do_quota_sync - sync the outstanding quota changes for a FS
- * @sdp:
- * @gi:
- *
- * Returns: errno
- */
-
-static int
-gi_do_quota_sync(struct gfs_sbd *sdp, struct gfs_ioctl *gi)
-{
-	if (!capable(CAP_SYS_ADMIN))
-		return -EACCES;
-	if (gi->gi_argc != 1)
-		return -EINVAL;
-	return gfs_quota_sync(sdp);
-}
-
-/**
- * gi_do_quota_refresh - Refresh the a quota LVB from the quota file
- * @sdp:
- * @gi:
- *
- * Returns: errno
- */
-
-static int
-gi_do_quota_refresh(struct gfs_sbd *sdp, struct gfs_ioctl *gi, int from_user)
-{
-	char buf[ARG_SIZE];
-	int user;
-	uint32_t id;
-
-	if (!capable(CAP_SYS_ADMIN))
-		return -EACCES;
-	if (gi->gi_argc != 2)
-		return -EINVAL;
-
-	if (from_user) {
-		if (strncpy_from_user(buf, gi->gi_argv[1], ARG_SIZE) < 0)
-			return -EFAULT;
-	} else {
-		strncpy(buf, gi->gi_argv[1], ARG_SIZE);
-	}
-        buf[ARG_SIZE - 1] = 0;
-
-	switch (buf[0]) {
-	case 'u':
-		user = TRUE;
-		break;
-	case 'g':
-		user = FALSE;
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	if (buf[1] != ':')
-		return -EINVAL;
-
-	if (sscanf(buf + 2, "%u", &id) != 1)
-		return -EINVAL;
-
-	return gfs_quota_refresh(sdp, user, id);
-}
-
-/**
- * gi_do_quota_read - read quota values from the quota file
- * @sdp:
- * @gi:
- *
- * Returns: errno
- */
-
-static int
-gi_do_quota_read(struct gfs_sbd *sdp, struct gfs_ioctl *gi, int from_user)
-{
-	char buf[ARG_SIZE];
-	int user;
-	uint32_t id;
-	struct gfs_quota q;
-	int error;
-
-	if (gi->gi_argc != 2)
-		return -EINVAL;
-	if (gi->gi_size != sizeof(struct gfs_quota))
-		return -EINVAL;
-
-	if (from_user) {
-		if (strncpy_from_user(buf, gi->gi_argv[1], ARG_SIZE) < 0)
-			return -EFAULT;
-	} else {
-		strncpy(buf, gi->gi_argv[1], ARG_SIZE);
-	}
-        buf[ARG_SIZE - 1] = 0;
-
-	switch (buf[0]) {
-	case 'u':
-		user = TRUE;
-		break;
-	case 'g':
-		user = FALSE;
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	if (buf[1] != ':')
-		return -EINVAL;
-
-	if (sscanf(buf + 2, "%u", &id) != 1)
-		return -EINVAL;
-
-	error = gfs_quota_read(sdp, user, id, &q);
-	if (error)
-		return error;
-
-	if (copy_to_user(gi->gi_data, &q, sizeof(struct gfs_quota)))
-		return -EFAULT;
-
-	return 0;
-}
-
-int
-gfs_ioctl_i_local(struct gfs_inode *ip, struct gfs_ioctl *gi, const char *arg0,
-	int from_user)
-{
-	int error = -EFAULT;
-
-	if (strcmp(arg0, "get_cookie") == 0)
-		error = gi_skeleton(ip, gi, gi_get_cookie);
-	else if (strcmp(arg0, "get_super") == 0)
-		error = gi_get_super(ip->i_sbd, gi);
-	else if (strcmp(arg0, "get_args") == 0)
-		error = gi_skeleton(ip, gi, gi_get_args);
-	else if (strcmp(arg0, "get_lockstruct") == 0)
-		error = gi_skeleton(ip, gi, gi_get_lockstruct);
-	else if (strcmp(arg0, "get_stat_gfs") == 0)
-		error = gi_skeleton(ip, gi, gi_get_stat_gfs);
-	else if (strcmp(arg0, "get_counters") == 0)
-		error = gi_skeleton(ip, gi, gi_get_counters);
-	else if (strcmp(arg0, "get_tune") == 0)
-		error = gi_skeleton(ip, gi, gi_get_tune);
-	else if (strcmp(arg0, "set_tune") == 0)
-		error = gi_set_tune(ip->i_sbd, gi, from_user);
-	else if (strcmp(arg0, "do_reclaim") == 0)
-		error = gi_skeleton(ip, gi, gi_do_reclaim);
-	else if (strcmp(arg0, "do_shrink") == 0)
-		error = gi_do_shrink(ip->i_sbd, gi);
-	else if (strcmp(arg0, "get_file_stat") == 0)
-		error = gi_get_file_stat(ip, gi);
-	else if (strcmp(arg0, "set_file_flag") == 0)
-		error = gi_set_file_flag(ip, gi, from_user);
-	else if (strcmp(arg0, "get_file_meta") == 0)
-		error = gi_get_file_meta(ip, gi);
-	else if (strcmp(arg0, "get_file_meta_quota") == 0)
-		error = gi_get_file_meta(ip->i_sbd->sd_qinode, gi);
-	else if (strcmp(arg0, "do_file_flush") == 0)
-		error = gi_do_file_flush(ip, gi);
-	else if (strcmp(arg0, "get_hfile_stat") == 0)
-		error = gi_get_hfile_stat(ip->i_sbd, gi, from_user);
-	else if (strcmp(arg0, "do_hfile_read") == 0)
-		error = gi_do_hfile_read(ip->i_sbd, gi, from_user);
-	else if (strcmp(arg0, "do_hfile_write") == 0)
-		error = gi_do_hfile_write(ip->i_sbd, gi, from_user);
-	else if (strcmp(arg0, "do_hfile_trunc") == 0)
-		error = gi_do_hfile_trunc(ip->i_sbd, gi, from_user);
-	else if (strcmp(arg0, "do_quota_sync") == 0)
-		error = gi_do_quota_sync(ip->i_sbd, gi);
-	else if (strcmp(arg0, "do_quota_refresh") == 0)
-		error = gi_do_quota_refresh(ip->i_sbd, gi, from_user);
-	else if (strcmp(arg0, "do_quota_read") == 0)
-		error = gi_do_quota_read(ip->i_sbd, gi, from_user);
-	else
-		error = -ENOTTY;
-
-	return error;
-}
-
-/**
- * gfs_ioctl_i - Normal ioctls
- * @ip:
- * @arg:
- *
- * Returns: -errno or positive byte count
- */
-
-int
-gfs_ioctl_i(struct gfs_inode *ip, void *arg)
-{
-	struct gfs_ioctl *gi_user = (struct gfs_ioctl *)arg;
-	struct gfs_ioctl gi;
-	char **argv;
-	char arg0[ARG_SIZE];
-	int error = -EFAULT;
-
-	if (copy_from_user(&gi, gi_user, sizeof(struct gfs_ioctl)))
-		return -EFAULT;
-	if (!gi.gi_argc)
-		return -EINVAL;
-	argv = kmalloc(gi.gi_argc * sizeof(char *), GFP_KERNEL);
-	if (!argv)
-		return -ENOMEM;
-	if (copy_from_user(argv, gi.gi_argv,
-			   gi.gi_argc * sizeof(char *)))
-		goto out;
-	gi.gi_argv = argv;
-
-	if (strncpy_from_user(arg0, argv[0], ARG_SIZE) < 0)
-		goto out;
-	arg0[ARG_SIZE - 1] = 0;
-	error = gfs_ioctl_i_local(ip, &gi, arg0, 1);
- out:
-	kfree(argv);
-
-	return error;
-}
-
-#ifdef CONFIG_COMPAT
-/**
- * gfs_ioctl_i_compat - compatibility ioctls
- *                      These ioctls are used to provide ioctls for situations
- *                      where userland and kernel arch is different.
- *                      For example, userland may be 32-bit ppc whereas the
- *                      kernel may be ppc64.  In this case, we need to do
- *                      extra translation between the addresses.
- * @ip:
- * @arg:
- *
- * Returns: -errno or positive byte count
- */
-
-int
-gfs_ioctl_i_compat(struct gfs_inode *ip, unsigned long arg)
-{
-	struct gfs_ioctl_compat *src;
-	struct gfs_ioctl dst;
-	char **argv, *argptr;
-	uint32_t *ptr;
-	char arg0[ARG_SIZE];
-	char *tmparg;
-	int i;
-	int error = -EFAULT;
-
-	src = (struct gfs_ioctl_compat *)compat_ptr(arg);
-
-	memset(&dst, 0, sizeof(dst));
-	dst.gi_argc = src->gi_argc;
-	dst.gi_size = src->gi_size;
-	dst.gi_offset = src->gi_offset;
-
-	argv = kmalloc(dst.gi_argc * sizeof(char *), GFP_KERNEL);
-	if (!argv)
-		return -ENOMEM;
-
-	memset(argv, 0, dst.gi_argc * sizeof(char *));
-	ptr = (uint32_t *)compat_ptr(src->gi_argv);
-
-	for (i = 0; i < dst.gi_argc; i++) { /* for each parm */
-		tmparg = kmalloc(ARG_SIZE * sizeof(char *), GFP_KERNEL);
-		if (!tmparg)
-			goto out;
-		argptr = (char *)compat_ptr(*ptr);
-		if (strncpy_from_user(tmparg, argptr, ARG_SIZE) < 0)
-			goto out;
-		argv[i] = tmparg;
-		ptr++;
-	}
-
-	strncpy(arg0, argv[0], ARG_SIZE);
-	arg0[ARG_SIZE - 1] = 0;
-	dst.gi_argv = argv;
-	dst.gi_data = compat_ptr(src->gi_data);
-	error = gfs_ioctl_i_local(ip, &dst, arg0, 0);
- out:
-	for (i = 0; i < dst.gi_argc; i++)
-		kfree(argv[i]);
-	kfree(argv);
-	return error;
-}
-#endif
diff --git a/gfs-kernel/src/gfs/ioctl.h b/gfs-kernel/src/gfs/ioctl.h
deleted file mode 100644
index 8377496..0000000
--- a/gfs-kernel/src/gfs/ioctl.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __IOCTL_DOT_H__
-#define __IOCTL_DOT_H__
-
-int gfs_ioctl_i_local(struct gfs_inode *ip, struct gfs_ioctl *gi,
-		      const char *arg0, int from_user);
-int gfs_ioctl_i_compat(struct gfs_inode *ip, unsigned long arg);
-int gfs_ioctl_i(struct gfs_inode *ip, void *arg);
-
-#endif /* __IOCTL_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/lm.c b/gfs-kernel/src/gfs/lm.c
deleted file mode 100644
index f27d581..0000000
--- a/gfs-kernel/src/gfs/lm.c
+++ /dev/null
@@ -1,233 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/spinlock.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <linux/delay.h>
-
-#include "gfs_ondisk.h"
-#include "gfs.h"
-#include "incore.h"
-#include "glock.h"
-#include "lm.h"
-#include "super.h"
-#include "util.h"
-#include "lvb.h"
-
-/**
- * gfs_lm_mount - mount a locking protocol
- * @sdp: the filesystem
- * @args: mount arguements
- * @silent: if 1, don't complain if the FS isn't a GFS fs
- *
- * Returns: errno
- */
-
-int gfs_lm_mount(struct gfs_sbd *sdp, int silent)
-{
-	char *proto = sdp->sd_proto_name;
-	char *table = sdp->sd_table_name;
-	int flags = 0;
-	int error;
-
-	if (sdp->sd_args.ar_spectator)
-		flags |= LM_MFLAG_SPECTATOR;
-
-	printk("Trying to join cluster \"%s\", \"%s\"\n", proto, table);
-
-	error = gfs_mount_lockproto(proto, table, sdp->sd_args.ar_hostdata,
-				     gfs_glock_cb, sdp,
-				     GFS_MIN_LVB_SIZE, flags,
-				     &sdp->sd_lockstruct, &sdp->sd_kobj);
-	if (error) {
-		printk("can't mount proto=%s, table=%s, hostdata=%s\n",
-			   proto, table, sdp->sd_args.ar_hostdata);
-		goto out;
-	}
-
-	if (gfs_assert_warn(sdp, sdp->sd_lockstruct.ls_lockspace) ||
-	    gfs_assert_warn(sdp, sdp->sd_lockstruct.ls_ops) ||
-	    gfs_assert_warn(sdp, sdp->sd_lockstruct.ls_lvb_size >=
-				  GFS_MIN_LVB_SIZE)) {
-		gfs_unmount_lockproto(&sdp->sd_lockstruct);
-		goto out;
-	}
-
-	if (sdp->sd_args.ar_spectator)
-		snprintf(sdp->sd_fsname, 256, "%s.s", table);
-	else
-		snprintf(sdp->sd_fsname, 256, "%s.%u", table,
-			 sdp->sd_lockstruct.ls_jid);
-
-	printk("Joined cluster. Now mounting FS...\n");
-	if ((sdp->sd_lockstruct.ls_flags & LM_LSFLAG_LOCAL) &&
-	    !sdp->sd_args.ar_ignore_local_fs) {
-		sdp->sd_args.ar_localflocks = 1;
-		sdp->sd_args.ar_localcaching = 1;
-	}
-
- out:
-	return error;
-}
-
-void gfs_lm_others_may_mount(struct gfs_sbd *sdp)
-{
-	if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-		sdp->sd_lockstruct.ls_ops->lm_others_may_mount(
-					sdp->sd_lockstruct.ls_lockspace);
-}
-
-void gfs_lm_unmount(struct gfs_sbd *sdp)
-{
-	if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-		gfs_unmount_lockproto(&sdp->sd_lockstruct);
-}
-
-int gfs_lm_withdraw(struct gfs_sbd *sdp, char *fmt, ...)
-{
-	va_list args;
-
-	if (test_and_set_bit(SDF_SHUTDOWN, &sdp->sd_flags))
-		return 0;
-
-	va_start(args, fmt);
-	vprintk(fmt, args);
-	va_end(args);
-
-	printk("GFS: fsid=%s: about to withdraw from the cluster\n",
-	       sdp->sd_fsname);
-
-	BUG_ON(sdp->sd_args.ar_debug);
-
-	printk("GFS: fsid=%s: telling LM to withdraw\n",
-	       sdp->sd_fsname);
-
-	gfs_withdraw_lockproto(&sdp->sd_lockstruct);
-
-	printk("GFS: fsid=%s: withdrawn\n",
-	       sdp->sd_fsname);
-	dump_stack();
-
-	return -1;
-}
-
-int gfs_lm_get_lock(struct gfs_sbd *sdp, struct lm_lockname *name,
-		     void **lockp)
-{
-	int error;
-	if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-		error = -EIO;
-	else
-		error = sdp->sd_lockstruct.ls_ops->lm_get_lock(
-				sdp->sd_lockstruct.ls_lockspace, name, lockp);
-	return error;
-}
-
-void gfs_lm_put_lock(struct gfs_sbd *sdp, void *lock)
-{
-	if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-		sdp->sd_lockstruct.ls_ops->lm_put_lock(lock);
-}
-
-unsigned int gfs_lm_lock(struct gfs_sbd *sdp, void *lock,
-			  unsigned int cur_state, unsigned int req_state,
-			  unsigned int flags)
-{
-	int ret;
-	if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-		ret = 0;
-	else
-		ret = sdp->sd_lockstruct.ls_ops->lm_lock(lock,
-							 cur_state,
-							 req_state, flags);
-	return ret;
-}
-
-unsigned int gfs_lm_unlock(struct gfs_sbd *sdp, void *lock,
-			    unsigned int cur_state)
-{
-	int ret;
-	if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-		ret = 0;
-	else
-		ret = sdp->sd_lockstruct.ls_ops->lm_unlock(lock, cur_state);
-	return ret;
-}
-
-void gfs_lm_cancel(struct gfs_sbd *sdp, void *lock)
-{
-	if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-		sdp->sd_lockstruct.ls_ops->lm_cancel(lock);
-}
-
-int gfs_lm_hold_lvb(struct gfs_sbd *sdp, void *lock, char **lvbp)
-{
-	int error;
-	if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-		error = -EIO;
-	else
-		error = sdp->sd_lockstruct.ls_ops->lm_hold_lvb(lock, lvbp);
-	return error;
-}
-
-void gfs_lm_unhold_lvb(struct gfs_sbd *sdp, void *lock, char *lvb)
-{
-	if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-		sdp->sd_lockstruct.ls_ops->lm_unhold_lvb(lock, lvb);
-}
-
-#if 0
-void gfs_lm_sync_lvb(struct gfs_sbd *sdp, void *lock, char *lvb)
-{
-	if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-		sdp->sd_lockstruct.ls_ops->lm_sync_lvb(lock, lvb);
-}
-#endif
-
-int gfs_lm_plock_get(struct gfs_sbd *sdp, struct lm_lockname *name,
-		      struct file *file, struct file_lock *fl)
-{
-	int error;
-	if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-		error = -EIO;
-	else
-		error = sdp->sd_lockstruct.ls_ops->lm_plock_get(
-			sdp->sd_lockstruct.ls_lockspace,
-			name, file, fl);
-	return error;
-}
-
-int gfs_lm_plock(struct gfs_sbd *sdp, struct lm_lockname *name,
-		  struct file *file, int cmd, struct file_lock *fl)
-{
-	int error;
-	if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-		error = -EIO;
-	else
-		error = sdp->sd_lockstruct.ls_ops->lm_plock(
-			sdp->sd_lockstruct.ls_lockspace,
-			name, file, cmd, fl);
-	return error;
-}
-
-int gfs_lm_punlock(struct gfs_sbd *sdp, struct lm_lockname *name,
-		    struct file *file, struct file_lock *fl)
-{
-	int error;
-	if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-		error = -EIO;
-	else
-		error = sdp->sd_lockstruct.ls_ops->lm_punlock(
-			sdp->sd_lockstruct.ls_lockspace,
-			name, file, fl);
-	return error;
-}
-
-void gfs_lm_recovery_done(struct gfs_sbd *sdp, unsigned int jid,
-			   unsigned int message)
-{
-	if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-		sdp->sd_lockstruct.ls_ops->lm_recovery_done(
-			sdp->sd_lockstruct.ls_lockspace, jid, message);
-}
-
diff --git a/gfs-kernel/src/gfs/lm.h b/gfs-kernel/src/gfs/lm.h
deleted file mode 100644
index 40ddf2b..0000000
--- a/gfs-kernel/src/gfs/lm.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef __LM_DOT_H__
-#define __LM_DOT_H__
-
-int gfs_lm_mount(struct gfs_sbd *sdp, int silent);
-void gfs_lm_others_may_mount(struct gfs_sbd *sdp);
-void gfs_lm_unmount(struct gfs_sbd *sdp);
-int gfs_lm_withdraw(struct gfs_sbd *sdp, char *fmt, ...)
-__attribute__ ((format(printf, 2, 3)));
-int gfs_lm_get_lock(struct gfs_sbd *sdp,
-		    struct lm_lockname *name, void **lockp);
-void gfs_lm_put_lock(struct gfs_sbd *sdp, void *lock);
-unsigned int gfs_lm_lock(struct gfs_sbd *sdp, void *lock,
-			 unsigned int cur_state, unsigned int req_state,
-			 unsigned int flags);
-unsigned int gfs_lm_unlock(struct gfs_sbd *sdp, void *lock,
-			   unsigned int cur_state);
-void gfs_lm_cancel(struct gfs_sbd *sdp, void *lock);
-int gfs_lm_hold_lvb(struct gfs_sbd *sdp, void *lock, char **lvbp);
-void gfs_lm_unhold_lvb(struct gfs_sbd *sdp, void *lock, char *lvb);
-int gfs_lm_plock_get(struct gfs_sbd *sdp,
-		     struct lm_lockname *name,
-		     struct file *file, struct file_lock *fl);
-int gfs_lm_plock(struct gfs_sbd *sdp,
-		 struct lm_lockname *name,
-		 struct file *file, int cmd, struct file_lock *fl);
-int gfs_lm_punlock(struct gfs_sbd *sdp,
-		   struct lm_lockname *name,
-		   struct file *file, struct file_lock *fl);
-void gfs_lm_recovery_done(struct gfs_sbd *sdp,
-			  unsigned int jid, unsigned int message);
-
-#endif /* __LM_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/lm_interface.h b/gfs-kernel/src/gfs/lm_interface.h
deleted file mode 100644
index fd07379..0000000
--- a/gfs-kernel/src/gfs/lm_interface.h
+++ /dev/null
@@ -1,269 +0,0 @@
-#ifndef __LM_INTERFACE_DOT_H__
-#define __LM_INTERFACE_DOT_H__
-
-
-typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data);
-
-/*
- * lm_mount() flags
- *
- * LM_MFLAG_SPECTATOR
- * GFS is asking to join the filesystem's lockspace, but it doesn't want to
- * modify the filesystem.  The lock module shouldn't assign a journal to the FS
- * mount.  It shouldn't send recovery callbacks to the FS mount.  If the node
- * dies or withdraws, all locks can be wiped immediately.
- */
-
-#define LM_MFLAG_SPECTATOR	0x00000001
-
-/*
- * lm_lockstruct flags
- *
- * LM_LSFLAG_LOCAL
- * The lock_nolock module returns LM_LSFLAG_LOCAL to GFS, indicating that GFS
- * can make single-node optimizations.
- */
-
-#define LM_LSFLAG_LOCAL		0x00000001
-
-/*
- * lm_lockname types
- */
-
-#define LM_TYPE_RESERVED	0x00
-#define LM_TYPE_NONDISK		0x01
-#define LM_TYPE_INODE		0x02
-#define LM_TYPE_RGRP		0x03
-#define LM_TYPE_META		0x04
-#define LM_TYPE_IOPEN		0x05
-#define LM_TYPE_FLOCK		0x06
-#define LM_TYPE_PLOCK		0x07
-#define LM_TYPE_QUOTA		0x08
-#define LM_TYPE_JOURNAL		0x09
-
-/*
- * lm_lock() states
- *
- * SHARED is compatible with SHARED, not with DEFERRED or EX.
- * DEFERRED is compatible with DEFERRED, not with SHARED or EX.
- */
-
-#define LM_ST_UNLOCKED		0
-#define LM_ST_EXCLUSIVE		1
-#define LM_ST_DEFERRED		2
-#define LM_ST_SHARED		3
-
-/*
- * lm_lock() flags
- *
- * LM_FLAG_TRY
- * Don't wait to acquire the lock if it can't be granted immediately.
- *
- * LM_FLAG_TRY_1CB
- * Send one blocking callback if TRY is set and the lock is not granted.
- *
- * LM_FLAG_NOEXP
- * GFS sets this flag on lock requests it makes while doing journal recovery.
- * These special requests should not be blocked due to the recovery like
- * ordinary locks would be.
- *
- * LM_FLAG_ANY
- * A SHARED request may also be granted in DEFERRED, or a DEFERRED request may
- * also be granted in SHARED.  The preferred state is whichever is compatible
- * with other granted locks, or the specified state if no other locks exist.
- *
- * LM_FLAG_PRIORITY
- * Override fairness considerations.  Suppose a lock is held in a shared state
- * and there is a pending request for the deferred state.  A shared lock
- * request with the priority flag would be allowed to bypass the deferred
- * request and directly join the other shared lock.  A shared lock request
- * without the priority flag might be forced to wait until the deferred
- * requested had acquired and released the lock.
- */
-
-#define LM_FLAG_TRY		0x00000001
-#define LM_FLAG_TRY_1CB		0x00000002
-#define LM_FLAG_NOEXP		0x00000004
-#define LM_FLAG_ANY		0x00000008
-#define LM_FLAG_PRIORITY	0x00000010
-
-/*
- * lm_lock() and lm_async_cb return flags
- *
- * LM_OUT_ST_MASK
- * Masks the lower two bits of lock state in the returned value.
- *
- * LM_OUT_CACHEABLE
- * The lock hasn't been released so GFS can continue to cache data for it.
- *
- * LM_OUT_CANCELED
- * The lock request was canceled.
- *
- * LM_OUT_ASYNC
- * The result of the request will be returned in an LM_CB_ASYNC callback.
- */
-
-#define LM_OUT_ST_MASK		0x00000003
-#define LM_OUT_CACHEABLE	0x00000004
-#define LM_OUT_CANCELED		0x00000008
-#define LM_OUT_ASYNC		0x00000080
-#define LM_OUT_ERROR		0x00000100
-
-/*
- * lm_callback_t types
- *
- * LM_CB_NEED_E LM_CB_NEED_D LM_CB_NEED_S
- * Blocking callback, a remote node is requesting the given lock in
- * EXCLUSIVE, DEFERRED, or SHARED.
- *
- * LM_CB_NEED_RECOVERY
- * The given journal needs to be recovered.
- *
- * LM_CB_DROPLOCKS
- * Reduce the number of cached locks.
- *
- * LM_CB_ASYNC
- * The given lock has been granted.
- */
-
-#define LM_CB_NEED_E		257
-#define LM_CB_NEED_D		258
-#define LM_CB_NEED_S		259
-#define LM_CB_NEED_RECOVERY	260
-#define LM_CB_DROPLOCKS		261
-#define LM_CB_ASYNC		262
-
-/*
- * lm_recovery_done() messages
- */
-
-#define LM_RD_GAVEUP		308
-#define LM_RD_SUCCESS		309
-
-
-struct lm_lockname {
-	u64 ln_number;
-	unsigned int ln_type;
-};
-
-#define lm_name_equal(name1, name2) \
-	(((name1)->ln_number == (name2)->ln_number) && \
-	 ((name1)->ln_type == (name2)->ln_type)) \
-
-struct lm_async_cb {
-	struct lm_lockname lc_name;
-	int lc_ret;
-};
-
-struct lm_lockstruct;
-
-struct lm_lockops {
-	const char *lm_proto_name;
-
-	/*
-	 * Mount/Unmount
-	 */
-
-	int (*lm_mount) (char *table_name, char *host_data,
-			 lm_callback_t cb, void *cb_data,
-			 unsigned int min_lvb_size, int flags,
-			 struct lm_lockstruct *lockstruct,
-			 struct kobject *fskobj);
-
-	void (*lm_others_may_mount) (void *lockspace);
-
-	void (*lm_unmount) (void *lockspace);
-
-	void (*lm_withdraw) (void *lockspace);
-
-	/*
-	 * Lock oriented operations
-	 */
-
-	int (*lm_get_lock) (void *lockspace, struct lm_lockname *name, void **lockp);
-
-	void (*lm_put_lock) (void *lock);
-
-	unsigned int (*lm_lock) (void *lock, unsigned int cur_state,
-				 unsigned int req_state, unsigned int flags);
-
-	unsigned int (*lm_unlock) (void *lock, unsigned int cur_state);
-
-	void (*lm_cancel) (void *lock);
-
-	int (*lm_hold_lvb) (void *lock, char **lvbp);
-	void (*lm_unhold_lvb) (void *lock, char *lvb);
-
-	/*
-	 * Posix Lock oriented operations
-	 */
-
-	int (*lm_plock_get) (void *lockspace, struct lm_lockname *name,
-			     struct file *file, struct file_lock *fl);
-
-	int (*lm_plock) (void *lockspace, struct lm_lockname *name,
-			 struct file *file, int cmd, struct file_lock *fl);
-
-	int (*lm_punlock) (void *lockspace, struct lm_lockname *name,
-			   struct file *file, struct file_lock *fl);
-
-	/*
-	 * Client oriented operations
-	 */
-
-	void (*lm_recovery_done) (void *lockspace, unsigned int jid,
-				  unsigned int message);
-
-	struct module *lm_owner;
-};
-
-/*
- * lm_mount() return values
- *
- * ls_jid - the journal ID this node should use
- * ls_first - this node is the first to mount the file system
- * ls_lvb_size - size in bytes of lock value blocks
- * ls_lockspace - lock module's context for this file system
- * ls_ops - lock module's functions
- * ls_flags - lock module features
- */
-
-struct lm_lockstruct {
-	unsigned int ls_jid;
-	unsigned int ls_first;
-	unsigned int ls_lvb_size;
-	void *ls_lockspace;
-	const struct lm_lockops *ls_ops;
-	int ls_flags;
-};
-
-/*
- * Lock module bottom interface.  A lock module makes itself available to GFS
- * with these functions.
- */
-
-int gfs_register_lockproto(const struct lm_lockops *proto);
-void gfs_unregister_lockproto(const struct lm_lockops *proto);
-
-/*
- * Lock module top interface.  GFS calls these functions when mounting or
- * unmounting a file system.
- */
-
-int gfs_mount_lockproto(char *proto_name, char *table_name, char *host_data,
-			 lm_callback_t cb, void *cb_data,
-			 unsigned int min_lvb_size, int flags,
-			 struct lm_lockstruct *lockstruct,
-			 struct kobject *fskobj);
-
-void gfs_unmount_lockproto(struct lm_lockstruct *lockstruct);
-
-void gfs_withdraw_lockproto(struct lm_lockstruct *lockstruct);
-
-int init_lock_dlm(void);
-void exit_lock_dlm(void);
-int init_nolock(void);
-void exit_nolock(void);
-
-#endif /* __LM_INTERFACE_DOT_H__ */
-
diff --git a/gfs-kernel/src/gfs/lock_dlm.h b/gfs-kernel/src/gfs/lock_dlm.h
deleted file mode 100644
index 15908cd..0000000
--- a/gfs-kernel/src/gfs/lock_dlm.h
+++ /dev/null
@@ -1,173 +0,0 @@
-#ifndef LOCK_DLM_DOT_H
-#define LOCK_DLM_DOT_H
-
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/spinlock.h>
-#include <linux/types.h>
-#include <linux/string.h>
-#include <linux/list.h>
-#include <linux/socket.h>
-#include <linux/delay.h>
-#include <linux/kthread.h>
-#include <linux/kobject.h>
-#include <linux/fcntl.h>
-#include <linux/wait.h>
-#include <net/sock.h>
-
-#include <linux/dlm.h>
-#include <linux/dlm_plock.h>
-#include "lm_interface.h"
-
-/*
- * Internally, we prefix things with gdlm_ and GDLM_ (for gfs-dlm) since a
- * prefix of lock_dlm_ gets awkward.  Externally, GFS refers to this module
- * as "lock_dlm".
- */
-
-#define GDLM_STRNAME_BYTES	24
-#define GDLM_LVB_SIZE		32
-#define GDLM_DROP_COUNT		0
-#define GDLM_DROP_PERIOD	60
-#define GDLM_NAME_LEN		128
-
-/* GFS uses 12 bytes to identify a resource (32 bit type + 64 bit number).
-   We sprintf these numbers into a 24 byte string of hex values to make them
-   human-readable (to make debugging simpler.) */
-
-struct gdlm_strname {
-	unsigned char		name[GDLM_STRNAME_BYTES];
-	unsigned short		namelen;
-};
-
-enum {
-	DFL_BLOCK_LOCKS		= 0,
-	DFL_SPECTATOR		= 1,
-	DFL_WITHDRAW		= 2,
-};
-
-struct gdlm_ls {
-	u32		id;
-	int			jid;
-	int			first;
-	int			first_done;
-	unsigned long		flags;
-	struct kobject		kobj;
-	char			clustername[GDLM_NAME_LEN];
-	char			fsname[GDLM_NAME_LEN];
-	int			fsflags;
-	dlm_lockspace_t		*dlm_lockspace;
-	lm_callback_t		fscb;
-	struct gfs_sbd		*sdp;
-	int			recover_jid;
-	int			recover_jid_done;
-	int			recover_jid_status;
-	spinlock_t		async_lock;
-	struct list_head	complete;
-	struct list_head	blocking;
-	struct list_head	delayed;
-	struct list_head	submit;
-	struct list_head	all_locks;
-	u32		all_locks_count;
-	wait_queue_head_t	wait_control;
-	struct task_struct	*thread1;
-	struct task_struct	*thread2;
-	wait_queue_head_t	thread_wait;
-	unsigned long		drop_time;
-	int			drop_locks_count;
-	int			drop_locks_period;
-};
-
-enum {
-	LFL_NOBLOCK		= 0,
-	LFL_NOCACHE		= 1,
-	LFL_DLM_UNLOCK		= 2,
-	LFL_DLM_CANCEL		= 3,
-	LFL_SYNC_LVB		= 4,
-	LFL_FORCE_PROMOTE	= 5,
-	LFL_REREQUEST		= 6,
-	LFL_ACTIVE		= 7,
-	LFL_INLOCK		= 8,
-	LFL_CANCEL		= 9,
-	LFL_NOBAST		= 10,
-	LFL_HEADQUE		= 11,
-	LFL_UNLOCK_DELETE	= 12,
-	LFL_AST_WAIT		= 13,
-};
-
-struct gdlm_lock {
-	struct gdlm_ls		*ls;
-	struct lm_lockname	lockname;
-	struct gdlm_strname	strname;
-	char			*lvb;
-	struct dlm_lksb		lksb;
-
-	s16			cur;
-	s16			req;
-	s16			prev_req;
-	u32			lkf;		/* dlm flags DLM_LKF_ */
-	unsigned long		flags;		/* lock_dlm flags LFL_ */
-
-	int			bast_mode;	/* protected by async_lock */
-
-	struct list_head	clist;		/* complete */
-	struct list_head	blist;		/* blocking */
-	struct list_head	delay_list;	/* delayed */
-	struct list_head	all_list;	/* all locks for the fs */
-	struct gdlm_lock	*hold_null;	/* NL lock for hold_lvb */
-};
-
-#define gdlm_assert(assertion, fmt, args...)                                  \
-do {                                                                          \
-	if (unlikely(!(assertion))) {                                         \
-		printk(KERN_EMERG "lock_dlm: fatal assertion failed \"%s\"\n" \
-				  "lock_dlm:  " fmt "\n",                     \
-				  #assertion, ##args);                        \
-		BUG();                                                        \
-	}                                                                     \
-} while (0)
-
-#define log_print(lev, fmt, arg...) printk(lev "lock_dlm: " fmt "\n" , ## arg)
-#define log_info(fmt, arg...)  log_print(KERN_INFO , fmt , ## arg)
-#define log_error(fmt, arg...) log_print(KERN_ERR , fmt , ## arg)
-#ifdef LOCK_DLM_LOG_DEBUG
-#define log_debug(fmt, arg...) log_print(KERN_DEBUG , fmt , ## arg)
-#else
-#define log_debug(fmt, arg...)
-#endif
-
-/* sysfs.c */
-
-int gdlm_sysfs_init(void);
-void gdlm_sysfs_exit(void);
-int gdlm_kobject_setup(struct gdlm_ls *, struct kobject *);
-void gdlm_kobject_release(struct gdlm_ls *);
-
-/* thread.c */
-
-int gdlm_init_threads(struct gdlm_ls *);
-void gdlm_release_threads(struct gdlm_ls *);
-
-/* lock.c */
-
-s16 gdlm_make_lmstate(s16);
-void gdlm_queue_delayed(struct gdlm_lock *);
-void gdlm_submit_delayed(struct gdlm_ls *);
-int gdlm_release_all_locks(struct gdlm_ls *);
-void gdlm_delete_lp(struct gdlm_lock *);
-unsigned int gdlm_do_lock(struct gdlm_lock *);
-
-int gdlm_get_lock(void *, struct lm_lockname *, void **);
-void gdlm_put_lock(void *);
-unsigned int gdlm_lock(void *, unsigned int, unsigned int, unsigned int);
-unsigned int gdlm_unlock(void *, unsigned int);
-void gdlm_cancel(void *);
-int gdlm_hold_lvb(void *, char **);
-void gdlm_unhold_lvb(void *, char *);
-
-/* mount.c */
-
-extern const struct lm_lockops gdlm_ops;
-
-#endif
-
diff --git a/gfs-kernel/src/gfs/lock_dlm_lock.c b/gfs-kernel/src/gfs/lock_dlm_lock.c
deleted file mode 100644
index 65ef0bd..0000000
--- a/gfs-kernel/src/gfs/lock_dlm_lock.c
+++ /dev/null
@@ -1,518 +0,0 @@
-#include "lock_dlm.h"
-
-static char junk_lvb[GDLM_LVB_SIZE];
-
-static void queue_complete(struct gdlm_lock *lp)
-{
-	struct gdlm_ls *ls = lp->ls;
-
-	clear_bit(LFL_ACTIVE, &lp->flags);
-
-	spin_lock(&ls->async_lock);
-	list_add_tail(&lp->clist, &ls->complete);
-	spin_unlock(&ls->async_lock);
-	wake_up(&ls->thread_wait);
-}
-
-static inline void gdlm_ast(void *astarg)
-{
-	queue_complete(astarg);
-}
-
-static inline void gdlm_bast(void *astarg, int mode)
-{
-	struct gdlm_lock *lp = astarg;
-	struct gdlm_ls *ls = lp->ls;
-
-	if (!mode) {
-		printk(KERN_INFO "lock_dlm: bast mode zero %x,%llx\n",
-			lp->lockname.ln_type,
-			(unsigned long long)lp->lockname.ln_number);
-		return;
-	}
-
-	spin_lock(&ls->async_lock);
-	if (!lp->bast_mode) {
-		list_add_tail(&lp->blist, &ls->blocking);
-		lp->bast_mode = mode;
-	} else if (lp->bast_mode < mode)
-		lp->bast_mode = mode;
-	spin_unlock(&ls->async_lock);
-	wake_up(&ls->thread_wait);
-}
-
-void gdlm_queue_delayed(struct gdlm_lock *lp)
-{
-	struct gdlm_ls *ls = lp->ls;
-
-	spin_lock(&ls->async_lock);
-	list_add_tail(&lp->delay_list, &ls->delayed);
-	spin_unlock(&ls->async_lock);
-}
-
-/* convert gfs lock-state to dlm lock-mode */
-
-static s16 make_mode(s16 lmstate)
-{
-	switch (lmstate) {
-	case LM_ST_UNLOCKED:
-		return DLM_LOCK_NL;
-	case LM_ST_EXCLUSIVE:
-		return DLM_LOCK_EX;
-	case LM_ST_DEFERRED:
-		return DLM_LOCK_CW;
-	case LM_ST_SHARED:
-		return DLM_LOCK_PR;
-	}
-	gdlm_assert(0, "unknown LM state %d", lmstate);
-	return -1;
-}
-
-/* convert dlm lock-mode to gfs lock-state */
-
-s16 gdlm_make_lmstate(s16 dlmmode)
-{
-	switch (dlmmode) {
-	case DLM_LOCK_IV:
-	case DLM_LOCK_NL:
-		return LM_ST_UNLOCKED;
-	case DLM_LOCK_EX:
-		return LM_ST_EXCLUSIVE;
-	case DLM_LOCK_CW:
-		return LM_ST_DEFERRED;
-	case DLM_LOCK_PR:
-		return LM_ST_SHARED;
-	}
-	gdlm_assert(0, "unknown DLM mode %d", dlmmode);
-	return -1;
-}
-
-/* verify agreement with GFS on the current lock state, NB: DLM_LOCK_NL and
-   DLM_LOCK_IV are both considered LM_ST_UNLOCKED by GFS. */
-
-static void check_cur_state(struct gdlm_lock *lp, unsigned int cur_state)
-{
-	s16 cur = make_mode(cur_state);
-	if (lp->cur != DLM_LOCK_IV)
-		gdlm_assert(lp->cur == cur, "%d, %d", lp->cur, cur);
-}
-
-static inline unsigned int make_flags(struct gdlm_lock *lp,
-				      unsigned int gfs_flags,
-				      s16 cur, s16 req)
-{
-	unsigned int lkf = 0;
-
-	if (gfs_flags & LM_FLAG_TRY)
-		lkf |= DLM_LKF_NOQUEUE;
-
-	if (gfs_flags & LM_FLAG_TRY_1CB) {
-		lkf |= DLM_LKF_NOQUEUE;
-		lkf |= DLM_LKF_NOQUEUEBAST;
-	}
-
-	if (gfs_flags & LM_FLAG_PRIORITY) {
-		lkf |= DLM_LKF_NOORDER;
-		lkf |= DLM_LKF_HEADQUE;
-	}
-
-	if (gfs_flags & LM_FLAG_ANY) {
-		if (req == DLM_LOCK_PR)
-			lkf |= DLM_LKF_ALTCW;
-		else if (req == DLM_LOCK_CW)
-			lkf |= DLM_LKF_ALTPR;
-	}
-
-	if (lp->lksb.sb_lkid != 0) {
-		lkf |= DLM_LKF_CONVERT;
-
-		/* Conversion deadlock avoidance by DLM */
-
-		if (!test_bit(LFL_FORCE_PROMOTE, &lp->flags) &&
-		    !(lkf & DLM_LKF_NOQUEUE) &&
-		    cur > DLM_LOCK_NL && req > DLM_LOCK_NL && cur != req)
-			lkf |= DLM_LKF_CONVDEADLK;
-	}
-
-	if (lp->lvb)
-		lkf |= DLM_LKF_VALBLK;
-
-	return lkf;
-}
-
-/* make_strname - convert GFS lock numbers to a string */
-
-static inline void make_strname(const struct lm_lockname *lockname,
-				struct gdlm_strname *str)
-{
-	sprintf(str->name, "%8x%16llx", lockname->ln_type,
-		(unsigned long long)lockname->ln_number);
-	str->namelen = GDLM_STRNAME_BYTES;
-}
-
-static int gdlm_create_lp(struct gdlm_ls *ls, struct lm_lockname *name,
-			  struct gdlm_lock **lpp)
-{
-	struct gdlm_lock *lp;
-
-	lp = kzalloc(sizeof(struct gdlm_lock), GFP_NOFS);
-	if (!lp)
-		return -ENOMEM;
-
-	lp->lockname = *name;
-	make_strname(name, &lp->strname);
-	lp->ls = ls;
-	lp->cur = DLM_LOCK_IV;
-	lp->lvb = NULL;
-	lp->hold_null = NULL;
-	INIT_LIST_HEAD(&lp->clist);
-	INIT_LIST_HEAD(&lp->blist);
-	INIT_LIST_HEAD(&lp->delay_list);
-
-	spin_lock(&ls->async_lock);
-	list_add(&lp->all_list, &ls->all_locks);
-	ls->all_locks_count++;
-	spin_unlock(&ls->async_lock);
-
-	*lpp = lp;
-	return 0;
-}
-
-void gdlm_delete_lp(struct gdlm_lock *lp)
-{
-	struct gdlm_ls *ls = lp->ls;
-
-	spin_lock(&ls->async_lock);
-	if (!list_empty(&lp->clist))
-		list_del_init(&lp->clist);
-	if (!list_empty(&lp->blist))
-		list_del_init(&lp->blist);
-	if (!list_empty(&lp->delay_list))
-		list_del_init(&lp->delay_list);
-	gdlm_assert(!list_empty(&lp->all_list), "%x,%llx", lp->lockname.ln_type,
-		    (unsigned long long)lp->lockname.ln_number);
-	list_del_init(&lp->all_list);
-	ls->all_locks_count--;
-	spin_unlock(&ls->async_lock);
-
-	kfree(lp);
-}
-
-int gdlm_get_lock(void *lockspace, struct lm_lockname *name,
-		  void **lockp)
-{
-	struct gdlm_lock *lp;
-	int error;
-
-	error = gdlm_create_lp(lockspace, name, &lp);
-
-	*lockp = lp;
-	return error;
-}
-
-void gdlm_put_lock(void *lock)
-{
-	gdlm_delete_lp(lock);
-}
-
-unsigned int gdlm_do_lock(struct gdlm_lock *lp)
-{
-	struct gdlm_ls *ls = lp->ls;
-	int error, bast = 1;
-
-	/*
-	 * When recovery is in progress, delay lock requests for submission
-	 * once recovery is done.  Requests for recovery (NOEXP) and unlocks
-	 * can pass.
-	 */
-
-	if (test_bit(DFL_BLOCK_LOCKS, &ls->flags) &&
-	    !test_bit(LFL_NOBLOCK, &lp->flags) && lp->req != DLM_LOCK_NL) {
-		gdlm_queue_delayed(lp);
-		return LM_OUT_ASYNC;
-	}
-
-	/*
-	 * Submit the actual lock request.
-	 */
-
-	if (test_bit(LFL_NOBAST, &lp->flags))
-		bast = 0;
-
-	set_bit(LFL_ACTIVE, &lp->flags);
-
-	log_debug("lk %x,%llx id %x %d,%d %x", lp->lockname.ln_type,
-		  (unsigned long long)lp->lockname.ln_number, lp->lksb.sb_lkid,
-		  lp->cur, lp->req, lp->lkf);
-
-	error = dlm_lock(ls->dlm_lockspace, lp->req, &lp->lksb, lp->lkf,
-			 lp->strname.name, lp->strname.namelen, 0, gdlm_ast,
-			 lp, bast ? gdlm_bast : NULL);
-
-	if ((error == -EAGAIN) && (lp->lkf & DLM_LKF_NOQUEUE)) {
-		lp->lksb.sb_status = -EAGAIN;
-		queue_complete(lp);
-		error = 0;
-	}
-
-	if (error) {
-		log_error("%s: gdlm_lock %x,%llx err=%d cur=%d req=%d lkf=%x "
-			  "flags=%lx", ls->fsname, lp->lockname.ln_type,
-			  (unsigned long long)lp->lockname.ln_number, error,
-			  lp->cur, lp->req, lp->lkf, lp->flags);
-		return LM_OUT_ERROR;
-	}
-	return LM_OUT_ASYNC;
-}
-
-static unsigned int gdlm_do_unlock(struct gdlm_lock *lp)
-{
-	struct gdlm_ls *ls = lp->ls;
-	unsigned int lkf = 0;
-	int error;
-
-	set_bit(LFL_DLM_UNLOCK, &lp->flags);
-	set_bit(LFL_ACTIVE, &lp->flags);
-
-	if (lp->lvb)
-		lkf = DLM_LKF_VALBLK;
-
-	log_debug("un %x,%llx %x %d %x", lp->lockname.ln_type,
-		  (unsigned long long)lp->lockname.ln_number,
-		  lp->lksb.sb_lkid, lp->cur, lkf);
-
-	error = dlm_unlock(ls->dlm_lockspace, lp->lksb.sb_lkid, lkf, NULL, lp);
-
-	if (error) {
-		log_error("%s: gdlm_unlock %x,%llx err=%d cur=%d req=%d lkf=%x "
-			  "flags=%lx", ls->fsname, lp->lockname.ln_type,
-			  (unsigned long long)lp->lockname.ln_number, error,
-			  lp->cur, lp->req, lp->lkf, lp->flags);
-		return LM_OUT_ERROR;
-	}
-	return LM_OUT_ASYNC;
-}
-
-unsigned int gdlm_lock(void *lock, unsigned int cur_state,
-		       unsigned int req_state, unsigned int flags)
-{
-	struct gdlm_lock *lp = lock;
-
-	clear_bit(LFL_DLM_CANCEL, &lp->flags);
-	if (flags & LM_FLAG_NOEXP)
-		set_bit(LFL_NOBLOCK, &lp->flags);
-
-	check_cur_state(lp, cur_state);
-	lp->req = make_mode(req_state);
-	lp->lkf = make_flags(lp, flags, lp->cur, lp->req);
-
-	return gdlm_do_lock(lp);
-}
-
-unsigned int gdlm_unlock(void *lock, unsigned int cur_state)
-{
-	struct gdlm_lock *lp = lock;
-
-	clear_bit(LFL_DLM_CANCEL, &lp->flags);
-	if (lp->cur == DLM_LOCK_IV)
-		return 0;
-	return gdlm_do_unlock(lp);
-}
-
-void gdlm_cancel(void *lock)
-{
-	struct gdlm_lock *lp = lock;
-	struct gdlm_ls *ls = lp->ls;
-	int error, delay_list = 0;
-
-	if (test_bit(LFL_DLM_CANCEL, &lp->flags))
-		return;
-
-	log_info("gdlm_cancel %x,%llx flags %lx", lp->lockname.ln_type,
-		 (unsigned long long)lp->lockname.ln_number, lp->flags);
-
-	spin_lock(&ls->async_lock);
-	if (!list_empty(&lp->delay_list)) {
-		list_del_init(&lp->delay_list);
-		delay_list = 1;
-	}
-	spin_unlock(&ls->async_lock);
-
-	if (delay_list) {
-		set_bit(LFL_CANCEL, &lp->flags);
-		set_bit(LFL_ACTIVE, &lp->flags);
-		queue_complete(lp);
-		return;
-	}
-
-	if (!test_bit(LFL_ACTIVE, &lp->flags) ||
-	    test_bit(LFL_DLM_UNLOCK, &lp->flags)) {
-		log_info("gdlm_cancel skip %x,%llx flags %lx",
-		 	 lp->lockname.ln_type,
-			 (unsigned long long)lp->lockname.ln_number, lp->flags);
-		return;
-	}
-
-	/* the lock is blocked in the dlm */
-
-	set_bit(LFL_DLM_CANCEL, &lp->flags);
-	set_bit(LFL_ACTIVE, &lp->flags);
-
-	error = dlm_unlock(ls->dlm_lockspace, lp->lksb.sb_lkid, DLM_LKF_CANCEL,
-			   NULL, lp);
-
-	log_info("gdlm_cancel rv %d %x,%llx flags %lx", error,
-		 lp->lockname.ln_type,
-		 (unsigned long long)lp->lockname.ln_number, lp->flags);
-
-	if (error == -EBUSY)
-		clear_bit(LFL_DLM_CANCEL, &lp->flags);
-}
-
-static int gdlm_add_lvb(struct gdlm_lock *lp)
-{
-	char *lvb;
-
-	lvb = kzalloc(GDLM_LVB_SIZE, GFP_NOFS);
-	if (!lvb)
-		return -ENOMEM;
-
-	lp->lksb.sb_lvbptr = lvb;
-	lp->lvb = lvb;
-	return 0;
-}
-
-static void gdlm_del_lvb(struct gdlm_lock *lp)
-{
-	kfree(lp->lvb);
-	lp->lvb = NULL;
-	lp->lksb.sb_lvbptr = NULL;
-}
-
-static int gdlm_ast_wait(void *word)
-{
-	schedule();
-	return 0;
-}
-
-/* This can do a synchronous dlm request (requiring a lock_dlm thread to get
-   the completion) because gfs won't call hold_lvb() during a callback (from
-   the context of a lock_dlm thread). */
-
-static int hold_null_lock(struct gdlm_lock *lp)
-{
-	struct gdlm_lock *lpn = NULL;
-	int error;
-
-	if (lp->hold_null) {
-		printk(KERN_INFO "lock_dlm: lvb already held\n");
-		return 0;
-	}
-
-	error = gdlm_create_lp(lp->ls, &lp->lockname, &lpn);
-	if (error)
-		goto out;
-
-	lpn->lksb.sb_lvbptr = junk_lvb;
-	lpn->lvb = junk_lvb;
-
-	lpn->req = DLM_LOCK_NL;
-	lpn->lkf = DLM_LKF_VALBLK | DLM_LKF_EXPEDITE;
-	set_bit(LFL_NOBAST, &lpn->flags);
-	set_bit(LFL_INLOCK, &lpn->flags);
-	set_bit(LFL_AST_WAIT, &lpn->flags);
-
-	gdlm_do_lock(lpn);
-	wait_on_bit(&lpn->flags, LFL_AST_WAIT, gdlm_ast_wait, TASK_UNINTERRUPTIBLE);
-	error = lpn->lksb.sb_status;
-	if (error) {
-		printk(KERN_INFO "lock_dlm: hold_null_lock dlm error %d\n",
-		       error);
-		gdlm_delete_lp(lpn);
-		lpn = NULL;
-	}
-out:
-	lp->hold_null = lpn;
-	return error;
-}
-
-/* This cannot do a synchronous dlm request (requiring a lock_dlm thread to get
-   the completion) because gfs may call unhold_lvb() during a callback (from
-   the context of a lock_dlm thread) which could cause a deadlock since the
-   other lock_dlm thread could be engaged in recovery. */
-
-static void unhold_null_lock(struct gdlm_lock *lp)
-{
-	struct gdlm_lock *lpn = lp->hold_null;
-
-	gdlm_assert(lpn, "%x,%llx", lp->lockname.ln_type,
-		    (unsigned long long)lp->lockname.ln_number);
-	lpn->lksb.sb_lvbptr = NULL;
-	lpn->lvb = NULL;
-	set_bit(LFL_UNLOCK_DELETE, &lpn->flags);
-	gdlm_do_unlock(lpn);
-	lp->hold_null = NULL;
-}
-
-/* Acquire a NL lock because gfs requires the value block to remain
-   intact on the resource while the lvb is "held" even if it's holding no locks
-   on the resource. */
-
-int gdlm_hold_lvb(void *lock, char **lvbp)
-{
-	struct gdlm_lock *lp = lock;
-	int error;
-
-	error = gdlm_add_lvb(lp);
-	if (error)
-		return error;
-
-	*lvbp = lp->lvb;
-
-	error = hold_null_lock(lp);
-	if (error)
-		gdlm_del_lvb(lp);
-
-	return error;
-}
-
-void gdlm_unhold_lvb(void *lock, char *lvb)
-{
-	struct gdlm_lock *lp = lock;
-
-	unhold_null_lock(lp);
-	gdlm_del_lvb(lp);
-}
-
-void gdlm_submit_delayed(struct gdlm_ls *ls)
-{
-	struct gdlm_lock *lp, *safe;
-
-	spin_lock(&ls->async_lock);
-	list_for_each_entry_safe(lp, safe, &ls->delayed, delay_list) {
-		list_del_init(&lp->delay_list);
-		list_add_tail(&lp->delay_list, &ls->submit);
-	}
-	spin_unlock(&ls->async_lock);
-	wake_up(&ls->thread_wait);
-}
-
-int gdlm_release_all_locks(struct gdlm_ls *ls)
-{
-	struct gdlm_lock *lp, *safe;
-	int count = 0;
-
-	spin_lock(&ls->async_lock);
-	list_for_each_entry_safe(lp, safe, &ls->all_locks, all_list) {
-		list_del_init(&lp->all_list);
-
-		if (lp->lvb && lp->lvb != junk_lvb)
-			kfree(lp->lvb);
-		kfree(lp);
-		count++;
-	}
-	spin_unlock(&ls->async_lock);
-
-	return count;
-}
-
diff --git a/gfs-kernel/src/gfs/lock_dlm_main.c b/gfs-kernel/src/gfs/lock_dlm_main.c
deleted file mode 100644
index be7c625..0000000
--- a/gfs-kernel/src/gfs/lock_dlm_main.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <linux/init.h>
-
-#include "lock_dlm.h"
-
-int init_lock_dlm()
-{
-	int error;
-
-	error = gfs_register_lockproto(&gdlm_ops);
-	if (error) {
-		printk(KERN_WARNING "lock_dlm:  can't register protocol: %d\n",
-		       error);
-		return error;
-	}
-
-	error = gdlm_sysfs_init();
-	if (error) {
-		gfs_unregister_lockproto(&gdlm_ops);
-		return error;
-	}
-
-	printk(KERN_INFO
-	       "Lock_DLM (built %s %s) installed\n", __DATE__, __TIME__);
-	return 0;
-}
-
-void exit_lock_dlm()
-{
-	gdlm_sysfs_exit();
-	gfs_unregister_lockproto(&gdlm_ops);
-}
diff --git a/gfs-kernel/src/gfs/lock_dlm_mount.c b/gfs-kernel/src/gfs/lock_dlm_mount.c
deleted file mode 100644
index ce5906a..0000000
--- a/gfs-kernel/src/gfs/lock_dlm_mount.c
+++ /dev/null
@@ -1,278 +0,0 @@
-#include "lock_dlm.h"
-
-const struct lm_lockops gdlm_ops;
-
-
-static struct gdlm_ls *init_gdlm(lm_callback_t cb, struct gfs_sbd *sdp,
-				 int flags, char *table_name)
-{
-	struct gdlm_ls *ls;
-	char buf[256], *p;
-
-	ls = kzalloc(sizeof(struct gdlm_ls), GFP_KERNEL);
-	if (!ls)
-		return NULL;
-
-	ls->drop_locks_count = GDLM_DROP_COUNT;
-	ls->drop_locks_period = GDLM_DROP_PERIOD;
-	ls->fscb = cb;
-	ls->sdp = sdp;
-	ls->fsflags = flags;
-	spin_lock_init(&ls->async_lock);
-	INIT_LIST_HEAD(&ls->complete);
-	INIT_LIST_HEAD(&ls->blocking);
-	INIT_LIST_HEAD(&ls->delayed);
-	INIT_LIST_HEAD(&ls->submit);
-	INIT_LIST_HEAD(&ls->all_locks);
-	init_waitqueue_head(&ls->thread_wait);
-	init_waitqueue_head(&ls->wait_control);
-	ls->thread1 = NULL;
-	ls->thread2 = NULL;
-	ls->drop_time = jiffies;
-	ls->jid = -1;
-
-	strncpy(buf, table_name, 256);
-	buf[255] = '\0';
-
-	p = strchr(buf, ':');
-	if (!p) {
-		log_info("invalid table_name \"%s\"", table_name);
-		kfree(ls);
-		return NULL;
-	}
-	*p = '\0';
-	p++;
-
-	strncpy(ls->clustername, buf, GDLM_NAME_LEN);
-	strncpy(ls->fsname, p, GDLM_NAME_LEN);
-
-	return ls;
-}
-
-static int make_args(struct gdlm_ls *ls, char *data_arg, int *nodir)
-{
-	char data[256];
-	char *options, *x, *y;
-	int error = 0;
-
-	memset(data, 0, 256);
-	strncpy(data, data_arg, 255);
-
-	if (!strlen(data)) {
-		log_error("no mount options, (u)mount helpers not installed");
-		return -EINVAL;
-	}
-
-	for (options = data; (x = strsep(&options, ":")); ) {
-		if (!*x)
-			continue;
-
-		y = strchr(x, '=');
-		if (y)
-			*y++ = 0;
-
-		if (!strcmp(x, "jid")) {
-			if (!y) {
-				log_error("need argument to jid");
-				error = -EINVAL;
-				break;
-			}
-			sscanf(y, "%u", &ls->jid);
-
-		} else if (!strcmp(x, "first")) {
-			if (!y) {
-				log_error("need argument to first");
-				error = -EINVAL;
-				break;
-			}
-			sscanf(y, "%u", &ls->first);
-
-		} else if (!strcmp(x, "id")) {
-			if (!y) {
-				log_error("need argument to id");
-				error = -EINVAL;
-				break;
-			}
-			sscanf(y, "%u", &ls->id);
-
-		} else if (!strcmp(x, "nodir")) {
-			if (!y) {
-				log_error("need argument to nodir");
-				error = -EINVAL;
-				break;
-			}
-			sscanf(y, "%u", nodir);
-
-		} else {
-			log_error("unkonwn option: %s", x);
-			error = -EINVAL;
-			break;
-		}
-	}
-
-	return error;
-}
-
-static int gdlm_mount(char *table_name, char *host_data,
-			lm_callback_t cb, void *cb_data,
-			unsigned int min_lvb_size, int flags,
-			struct lm_lockstruct *lockstruct,
-			struct kobject *fskobj)
-{
-	struct gdlm_ls *ls;
-	int error = -ENOMEM, nodir = 0;
-
-	if (min_lvb_size > GDLM_LVB_SIZE)
-		goto out;
-
-	ls = init_gdlm(cb, cb_data, flags, table_name);
-	if (!ls)
-		goto out;
-
-	error = make_args(ls, host_data, &nodir);
-	if (error)
-		goto out;
-
-	error = gdlm_init_threads(ls);
-	if (error)
-		goto out_free;
-
-	error = gdlm_kobject_setup(ls, fskobj);
-	if (error)
-		goto out_thread;
-
-	error = dlm_new_lockspace(ls->fsname, strlen(ls->fsname),
-				  &ls->dlm_lockspace,
-				  DLM_LSFL_FS | (nodir ? DLM_LSFL_NODIR : 0),
-				  GDLM_LVB_SIZE);
-	if (error) {
-		log_error("dlm_new_lockspace error %d", error);
-		goto out_kobj;
-	}
-
-	lockstruct->ls_jid = ls->jid;
-	lockstruct->ls_first = ls->first;
-	lockstruct->ls_lockspace = ls;
-	lockstruct->ls_ops = &gdlm_ops;
-	lockstruct->ls_flags = 0;
-	lockstruct->ls_lvb_size = GDLM_LVB_SIZE;
-	return 0;
-
-out_kobj:
-	gdlm_kobject_release(ls);
-out_thread:
-	gdlm_release_threads(ls);
-out_free:
-	kfree(ls);
-out:
-	return error;
-}
-
-static void gdlm_unmount(void *lockspace)
-{
-	struct gdlm_ls *ls = lockspace;
-	int rv;
-
-	log_debug("unmount flags %lx", ls->flags);
-
-	/* FIXME: serialize unmount and withdraw in case they
-	   happen at once.  Also, if unmount follows withdraw,
-	   wait for withdraw to finish. */
-
-	if (test_bit(DFL_WITHDRAW, &ls->flags))
-		goto out;
-
-	gdlm_kobject_release(ls);
-	dlm_release_lockspace(ls->dlm_lockspace, 2);
-	gdlm_release_threads(ls);
-	rv = gdlm_release_all_locks(ls);
-	if (rv)
-		log_info("gdlm_unmount: %d stray locks freed", rv);
-out:
-	kfree(ls);
-}
-
-static void gdlm_recovery_done(void *lockspace, unsigned int jid,
-                               unsigned int message)
-{
-	char env_jid[20];
-	char env_status[20];
-	char *envp[] = { env_jid, env_status, NULL };
-	struct gdlm_ls *ls = lockspace;
-	ls->recover_jid_done = jid;
-	ls->recover_jid_status = message;
-	sprintf(env_jid, "JID=%d", jid);
-	sprintf(env_status, "RECOVERY=%s",
-		message == LM_RD_SUCCESS ? "Done" : "Failed");
-	kobject_uevent_env(&ls->kobj, KOBJ_CHANGE, envp);
-}
-
-static void gdlm_others_may_mount(void *lockspace)
-{
-	char *message = "FIRSTMOUNT=Done";
-	char *envp[] = { message, NULL };
-	struct gdlm_ls *ls = lockspace;
-	ls->first_done = 1;
-	kobject_uevent_env(&ls->kobj, KOBJ_CHANGE, envp);
-}
-
-/* Userspace gets the offline uevent, blocks new gfs locks on
-   other mounters, and lets us know (sets WITHDRAW flag).  Then,
-   userspace leaves the mount group while we leave the lockspace. */
-
-static void gdlm_withdraw(void *lockspace)
-{
-	struct gdlm_ls *ls = lockspace;
-
-	kobject_uevent(&ls->kobj, KOBJ_OFFLINE);
-
-	wait_event_interruptible(ls->wait_control,
-				 test_bit(DFL_WITHDRAW, &ls->flags));
-
-	dlm_release_lockspace(ls->dlm_lockspace, 2);
-	gdlm_release_threads(ls);
-	gdlm_release_all_locks(ls);
-	gdlm_kobject_release(ls);
-}
-
-static int gdlm_plock(void *lockspace, struct lm_lockname *name,
-	       struct file *file, int cmd, struct file_lock *fl)
-{
-	struct gdlm_ls *ls = lockspace;
-	return dlm_posix_lock(ls->dlm_lockspace, name->ln_number, file, cmd, fl);
-}
-
-static int gdlm_punlock(void *lockspace, struct lm_lockname *name,
-		 struct file *file, struct file_lock *fl)
-{
-	struct gdlm_ls *ls = lockspace;
-	return dlm_posix_unlock(ls->dlm_lockspace, name->ln_number, file, fl);
-}
-
-static int gdlm_plock_get(void *lockspace, struct lm_lockname *name,
-		   struct file *file, struct file_lock *fl)
-{
-	struct gdlm_ls *ls = lockspace;
-	return dlm_posix_get(ls->dlm_lockspace, name->ln_number, file, fl);
-}
-
-const struct lm_lockops gdlm_ops = {
-	.lm_proto_name = "lock_dlm",
-	.lm_mount = gdlm_mount,
-	.lm_others_may_mount = gdlm_others_may_mount,
-	.lm_unmount = gdlm_unmount,
-	.lm_withdraw = gdlm_withdraw,
-	.lm_get_lock = gdlm_get_lock,
-	.lm_put_lock = gdlm_put_lock,
-	.lm_lock = gdlm_lock,
-	.lm_unlock = gdlm_unlock,
-	.lm_plock = gdlm_plock,
-	.lm_punlock = gdlm_punlock,
-	.lm_plock_get = gdlm_plock_get,
-	.lm_cancel = gdlm_cancel,
-	.lm_hold_lvb = gdlm_hold_lvb,
-	.lm_unhold_lvb = gdlm_unhold_lvb,
-	.lm_recovery_done = gdlm_recovery_done,
-	.lm_owner = THIS_MODULE,
-};
-
diff --git a/gfs-kernel/src/gfs/lock_dlm_sysfs.c b/gfs-kernel/src/gfs/lock_dlm_sysfs.c
deleted file mode 100644
index 01445a5..0000000
--- a/gfs-kernel/src/gfs/lock_dlm_sysfs.c
+++ /dev/null
@@ -1,229 +0,0 @@
-#include <linux/ctype.h>
-#include <linux/stat.h>
-
-#include "lock_dlm.h"
-
-static ssize_t proto_name_show(struct gdlm_ls *ls, char *buf)
-{
-	return sprintf(buf, "%s\n", gdlm_ops.lm_proto_name);
-}
-
-static ssize_t block_show(struct gdlm_ls *ls, char *buf)
-{
-	ssize_t ret;
-	int val = 0;
-
-	if (test_bit(DFL_BLOCK_LOCKS, &ls->flags))
-		val = 1;
-	ret = sprintf(buf, "%d\n", val);
-	return ret;
-}
-
-static ssize_t block_store(struct gdlm_ls *ls, const char *buf, size_t len)
-{
-	ssize_t ret = len;
-	int val;
-
-	val = simple_strtol(buf, NULL, 0);
-
-	if (val == 1)
-		set_bit(DFL_BLOCK_LOCKS, &ls->flags);
-	else if (val == 0) {
-		clear_bit(DFL_BLOCK_LOCKS, &ls->flags);
-		gdlm_submit_delayed(ls);
-	} else {
-		ret = -EINVAL;
-	}
-	return ret;
-}
-
-static ssize_t withdraw_show(struct gdlm_ls *ls, char *buf)
-{
-	ssize_t ret;
-	int val = 0;
-
-	if (test_bit(DFL_WITHDRAW, &ls->flags))
-		val = 1;
-	ret = sprintf(buf, "%d\n", val);
-	return ret;
-}
-
-static ssize_t withdraw_store(struct gdlm_ls *ls, const char *buf, size_t len)
-{
-	ssize_t ret = len;
-	int val;
-
-	val = simple_strtol(buf, NULL, 0);
-
-	if (val == 1)
-		set_bit(DFL_WITHDRAW, &ls->flags);
-	else
-		ret = -EINVAL;
-	wake_up(&ls->wait_control);
-	return ret;
-}
-
-static ssize_t id_show(struct gdlm_ls *ls, char *buf)
-{
-	return sprintf(buf, "%u\n", ls->id);
-}
-
-static ssize_t jid_show(struct gdlm_ls *ls, char *buf)
-{
-	return sprintf(buf, "%d\n", ls->jid);
-}
-
-static ssize_t first_show(struct gdlm_ls *ls, char *buf)
-{
-	return sprintf(buf, "%d\n", ls->first);
-}
-
-static ssize_t first_done_show(struct gdlm_ls *ls, char *buf)
-{
-	return sprintf(buf, "%d\n", ls->first_done);
-}
-
-static ssize_t recover_show(struct gdlm_ls *ls, char *buf)
-{
-	return sprintf(buf, "%d\n", ls->recover_jid);
-}
-
-static ssize_t recover_store(struct gdlm_ls *ls, const char *buf, size_t len)
-{
-	ls->recover_jid = simple_strtol(buf, NULL, 0);
-	ls->fscb(ls->sdp, LM_CB_NEED_RECOVERY, &ls->recover_jid);
-	return len;
-}
-
-static ssize_t recover_done_show(struct gdlm_ls *ls, char *buf)
-{
-	return sprintf(buf, "%d\n", ls->recover_jid_done);
-}
-
-static ssize_t recover_status_show(struct gdlm_ls *ls, char *buf)
-{
-	return sprintf(buf, "%d\n", ls->recover_jid_status);
-}
-
-static ssize_t drop_count_show(struct gdlm_ls *ls, char *buf)
-{
-	return sprintf(buf, "%d\n", ls->drop_locks_count);
-}
-
-static ssize_t drop_count_store(struct gdlm_ls *ls, const char *buf, size_t len)
-{
-	ls->drop_locks_count = simple_strtol(buf, NULL, 0);
-	return len;
-}
-
-struct gdlm_attr {
-	struct attribute attr;
-	ssize_t (*show)(struct gdlm_ls *, char *);
-	ssize_t (*store)(struct gdlm_ls *, const char *, size_t);
-};
-
-#define GDLM_ATTR(_name,_mode,_show,_store) \
-static struct gdlm_attr gdlm_attr_##_name = __ATTR(_name,_mode,_show,_store)
-
-GDLM_ATTR(proto_name,     0444, proto_name_show,     NULL);
-GDLM_ATTR(block,          0644, block_show,          block_store);
-GDLM_ATTR(withdraw,       0644, withdraw_show,       withdraw_store);
-GDLM_ATTR(id,             0444, id_show,             NULL);
-GDLM_ATTR(jid,            0444, jid_show,            NULL);
-GDLM_ATTR(first,          0444, first_show,          NULL);
-GDLM_ATTR(first_done,     0444, first_done_show,     NULL);
-GDLM_ATTR(recover,        0644, recover_show,        recover_store);
-GDLM_ATTR(recover_done,   0444, recover_done_show,   NULL);
-GDLM_ATTR(recover_status, 0444, recover_status_show, NULL);
-GDLM_ATTR(drop_count,     0644, drop_count_show,     drop_count_store);
-
-static struct attribute *gdlm_attrs[] = {
-	&gdlm_attr_proto_name.attr,
-	&gdlm_attr_block.attr,
-	&gdlm_attr_withdraw.attr,
-	&gdlm_attr_id.attr,
-	&gdlm_attr_jid.attr,
-	&gdlm_attr_first.attr,
-	&gdlm_attr_first_done.attr,
-	&gdlm_attr_recover.attr,
-	&gdlm_attr_recover_done.attr,
-	&gdlm_attr_recover_status.attr,
-	&gdlm_attr_drop_count.attr,
-	NULL,
-};
-
-static ssize_t gdlm_attr_show(struct kobject *kobj, struct attribute *attr,
-			      char *buf)
-{
-	struct gdlm_ls *ls = container_of(kobj, struct gdlm_ls, kobj);
-	struct gdlm_attr *a = container_of(attr, struct gdlm_attr, attr);
-	return a->show ? a->show(ls, buf) : 0;
-}
-
-static ssize_t gdlm_attr_store(struct kobject *kobj, struct attribute *attr,
-			       const char *buf, size_t len)
-{
-	struct gdlm_ls *ls = container_of(kobj, struct gdlm_ls, kobj);
-	struct gdlm_attr *a = container_of(attr, struct gdlm_attr, attr);
-	return a->store ? a->store(ls, buf, len) : len;
-}
-
-static struct sysfs_ops gdlm_attr_ops = {
-	.show  = gdlm_attr_show,
-	.store = gdlm_attr_store,
-};
-
-static struct kobj_type gdlm_ktype = {
-	.default_attrs = gdlm_attrs,
-	.sysfs_ops     = &gdlm_attr_ops,
-};
-
-static struct kset *gdlm_kset;
-
-int gdlm_kobject_setup(struct gdlm_ls *ls, struct kobject *fskobj)
-{
-	int error;
-
-	ls->kobj.kset = gdlm_kset;
-	error = kobject_init_and_add(&ls->kobj, &gdlm_ktype, fskobj,
-				     "lock_module");
-	if (error)
-		log_error("can't register kobj %d", error);
-	kobject_uevent(&ls->kobj, KOBJ_ADD);
-
-	return error;
-}
-
-void gdlm_kobject_release(struct gdlm_ls *ls)
-{
-	kobject_put(&ls->kobj);
-}
-
-static int gdlm_uevent(struct kset *kset, struct kobject *kobj,
-		       struct kobj_uevent_env *env)
-{
-	struct gdlm_ls *ls = container_of(kobj, struct gdlm_ls, kobj);
-	add_uevent_var(env, "LOCKTABLE=%s:%s", ls->clustername, ls->fsname);
-	add_uevent_var(env, "LOCKPROTO=lock_dlm");
-	return 0;
-}
-
-static struct kset_uevent_ops gdlm_uevent_ops = {
-	.uevent = gdlm_uevent,
-};
-
-int gdlm_sysfs_init(void)
-{
-	gdlm_kset = kset_create_and_add("lock_dlm_gfs", &gdlm_uevent_ops, kernel_kobj);
-	if (!gdlm_kset) {
-		printk(KERN_WARNING "%s: can not create kset\n", __FUNCTION__);
-		return -ENOMEM;
-	}
-	return 0;
-}
-
-void gdlm_sysfs_exit(void)
-{
-	kset_unregister(gdlm_kset);
-}
-
diff --git a/gfs-kernel/src/gfs/lock_dlm_thread.c b/gfs-kernel/src/gfs/lock_dlm_thread.c
deleted file mode 100644
index 58641c7..0000000
--- a/gfs-kernel/src/gfs/lock_dlm_thread.c
+++ /dev/null
@@ -1,358 +0,0 @@
-#include "lock_dlm.h"
-
-/* A lock placed on this queue is re-submitted to DLM as soon as the lock_dlm
-   thread gets to it. */
-
-static void queue_submit(struct gdlm_lock *lp)
-{
-	struct gdlm_ls *ls = lp->ls;
-
-	spin_lock(&ls->async_lock);
-	list_add_tail(&lp->delay_list, &ls->submit);
-	spin_unlock(&ls->async_lock);
-	wake_up(&ls->thread_wait);
-}
-
-static void process_blocking(struct gdlm_lock *lp, int bast_mode)
-{
-	struct gdlm_ls *ls = lp->ls;
-	unsigned int cb = 0;
-
-	switch (gdlm_make_lmstate(bast_mode)) {
-	case LM_ST_EXCLUSIVE:
-		cb = LM_CB_NEED_E;
-		break;
-	case LM_ST_DEFERRED:
-		cb = LM_CB_NEED_D;
-		break;
-	case LM_ST_SHARED:
-		cb = LM_CB_NEED_S;
-		break;
-	default:
-		gdlm_assert(0, "unknown bast mode %u", lp->bast_mode);
-	}
-
-	ls->fscb(ls->sdp, cb, &lp->lockname);
-}
-
-static void wake_up_ast(struct gdlm_lock *lp)
-{
-	clear_bit(LFL_AST_WAIT, &lp->flags);
-	smp_mb__after_clear_bit();
-	wake_up_bit(&lp->flags, LFL_AST_WAIT);
-}
-
-static void process_complete(struct gdlm_lock *lp)
-{
-	struct gdlm_ls *ls = lp->ls;
-	struct lm_async_cb acb;
-	s16 prev_mode = lp->cur;
-
-	memset(&acb, 0, sizeof(acb));
-
-	if (lp->lksb.sb_status == -DLM_ECANCEL) {
-		log_info("complete dlm cancel %x,%llx flags %lx",
-		 	 lp->lockname.ln_type,
-			 (unsigned long long)lp->lockname.ln_number,
-			 lp->flags);
-
-		lp->req = lp->cur;
-		acb.lc_ret |= LM_OUT_CANCELED;
-		if (lp->cur == DLM_LOCK_IV)
-			lp->lksb.sb_lkid = 0;
-		goto out;
-	}
-
-	if (test_and_clear_bit(LFL_DLM_UNLOCK, &lp->flags)) {
-		if (lp->lksb.sb_status != -DLM_EUNLOCK) {
-			log_info("unlock sb_status %d %x,%llx flags %lx",
-				 lp->lksb.sb_status, lp->lockname.ln_type,
-				 (unsigned long long)lp->lockname.ln_number,
-				 lp->flags);
-			return;
-		}
-
-		lp->cur = DLM_LOCK_IV;
-		lp->req = DLM_LOCK_IV;
-		lp->lksb.sb_lkid = 0;
-
-		if (test_and_clear_bit(LFL_UNLOCK_DELETE, &lp->flags)) {
-			gdlm_delete_lp(lp);
-			return;
-		}
-		goto out;
-	}
-
-	if (lp->lksb.sb_flags & DLM_SBF_VALNOTVALID)
-		memset(lp->lksb.sb_lvbptr, 0, GDLM_LVB_SIZE);
-
-	if (lp->lksb.sb_flags & DLM_SBF_ALTMODE) {
-		if (lp->req == DLM_LOCK_PR)
-			lp->req = DLM_LOCK_CW;
-		else if (lp->req == DLM_LOCK_CW)
-			lp->req = DLM_LOCK_PR;
-	}
-
-	/*
-	 * A canceled lock request.  The lock was just taken off the delayed
-	 * list and was never even submitted to dlm.
-	 */
-
-	if (test_and_clear_bit(LFL_CANCEL, &lp->flags)) {
-		log_info("complete internal cancel %x,%llx",
-		 	 lp->lockname.ln_type,
-			 (unsigned long long)lp->lockname.ln_number);
-		lp->req = lp->cur;
-		acb.lc_ret |= LM_OUT_CANCELED;
-		goto out;
-	}
-
-	/*
-	 * An error occured.
-	 */
-
-	if (lp->lksb.sb_status) {
-		/* a "normal" error */
-		if ((lp->lksb.sb_status == -EAGAIN) &&
-		    (lp->lkf & DLM_LKF_NOQUEUE)) {
-			lp->req = lp->cur;
-			if (lp->cur == DLM_LOCK_IV)
-				lp->lksb.sb_lkid = 0;
-			goto out;
-		}
-
-		/* this could only happen with cancels I think */
-		log_info("ast sb_status %d %x,%llx flags %lx",
-			 lp->lksb.sb_status, lp->lockname.ln_type,
-			 (unsigned long long)lp->lockname.ln_number,
-			 lp->flags);
-		return;
-	}
-
-	/*
-	 * This is an AST for an EX->EX conversion for sync_lvb from GFS.
-	 */
-
-	if (test_and_clear_bit(LFL_SYNC_LVB, &lp->flags)) {
-		wake_up_ast(lp);
-		return;
-	}
-
-	/*
-	 * A lock has been demoted to NL because it initially completed during
-	 * BLOCK_LOCKS.  Now it must be requested in the originally requested
-	 * mode.
-	 */
-
-	if (test_and_clear_bit(LFL_REREQUEST, &lp->flags)) {
-		gdlm_assert(lp->req == DLM_LOCK_NL, "%x,%llx",
-			    lp->lockname.ln_type,
-			    (unsigned long long)lp->lockname.ln_number);
-		gdlm_assert(lp->prev_req > DLM_LOCK_NL, "%x,%llx",
-			    lp->lockname.ln_type,
-			    (unsigned long long)lp->lockname.ln_number);
-
-		lp->cur = DLM_LOCK_NL;
-		lp->req = lp->prev_req;
-		lp->prev_req = DLM_LOCK_IV;
-		lp->lkf &= ~DLM_LKF_CONVDEADLK;
-
-		set_bit(LFL_NOCACHE, &lp->flags);
-
-		if (test_bit(DFL_BLOCK_LOCKS, &ls->flags) &&
-		    !test_bit(LFL_NOBLOCK, &lp->flags))
-			gdlm_queue_delayed(lp);
-		else
-			queue_submit(lp);
-		return;
-	}
-
-	/*
-	 * A request is granted during dlm recovery.  It may be granted
-	 * because the locks of a failed node were cleared.  In that case,
-	 * there may be inconsistent data beneath this lock and we must wait
-	 * for recovery to complete to use it.  When gfs recovery is done this
-	 * granted lock will be converted to NL and then reacquired in this
-	 * granted state.
-	 */
-
-	if (test_bit(DFL_BLOCK_LOCKS, &ls->flags) &&
-	    !test_bit(LFL_NOBLOCK, &lp->flags) &&
-	    lp->req != DLM_LOCK_NL) {
-
-		lp->cur = lp->req;
-		lp->prev_req = lp->req;
-		lp->req = DLM_LOCK_NL;
-		lp->lkf |= DLM_LKF_CONVERT;
-		lp->lkf &= ~DLM_LKF_CONVDEADLK;
-
-		log_debug("rereq %x,%llx id %x %d,%d",
-			  lp->lockname.ln_type,
-			  (unsigned long long)lp->lockname.ln_number,
-			  lp->lksb.sb_lkid, lp->cur, lp->req);
-
-		set_bit(LFL_REREQUEST, &lp->flags);
-		queue_submit(lp);
-		return;
-	}
-
-	/*
-	 * DLM demoted the lock to NL before it was granted so GFS must be
-	 * told it cannot cache data for this lock.
-	 */
-
-	if (lp->lksb.sb_flags & DLM_SBF_DEMOTED)
-		set_bit(LFL_NOCACHE, &lp->flags);
-
-out:
-	/*
-	 * This is an internal lock_dlm lock
-	 */
-
-	if (test_bit(LFL_INLOCK, &lp->flags)) {
-		clear_bit(LFL_NOBLOCK, &lp->flags);
-		lp->cur = lp->req;
-		wake_up_ast(lp);
-		return;
-	}
-
-	/*
-	 * Normal completion of a lock request.  Tell GFS it now has the lock.
-	 */
-
-	clear_bit(LFL_NOBLOCK, &lp->flags);
-	lp->cur = lp->req;
-
-	acb.lc_name = lp->lockname;
-	acb.lc_ret |= gdlm_make_lmstate(lp->cur);
-
-	if (!test_and_clear_bit(LFL_NOCACHE, &lp->flags) &&
-	    (lp->cur > DLM_LOCK_NL) && (prev_mode > DLM_LOCK_NL))
-		acb.lc_ret |= LM_OUT_CACHEABLE;
-
-	ls->fscb(ls->sdp, LM_CB_ASYNC, &acb);
-}
-
-static inline int no_work(struct gdlm_ls *ls, int blocking)
-{
-	int ret;
-
-	spin_lock(&ls->async_lock);
-	ret = list_empty(&ls->complete) && list_empty(&ls->submit);
-	if (ret && blocking)
-		ret = list_empty(&ls->blocking);
-	spin_unlock(&ls->async_lock);
-
-	return ret;
-}
-
-static inline int check_drop(struct gdlm_ls *ls)
-{
-	if (!ls->drop_locks_count)
-		return 0;
-
-	if (time_after(jiffies, ls->drop_time + ls->drop_locks_period * HZ)) {
-		ls->drop_time = jiffies;
-		if (ls->all_locks_count >= ls->drop_locks_count)
-			return 1;
-	}
-	return 0;
-}
-
-static int gdlm_thread(void *data, int blist)
-{
-	struct gdlm_ls *ls = (struct gdlm_ls *) data;
-	struct gdlm_lock *lp = NULL;
-	uint8_t complete, blocking, submit, drop;
-
-	/* Only thread1 is allowed to do blocking callbacks since gfs
-	   may wait for a completion callback within a blocking cb. */
-
-	while (!kthread_should_stop()) {
-		wait_event_interruptible(ls->thread_wait,
-				!no_work(ls, blist) || kthread_should_stop());
-
-		complete = blocking = submit = drop = 0;
-
-		spin_lock(&ls->async_lock);
-
-		if (blist && !list_empty(&ls->blocking)) {
-			lp = list_entry(ls->blocking.next, struct gdlm_lock,
-					blist);
-			list_del_init(&lp->blist);
-			blocking = lp->bast_mode;
-			lp->bast_mode = 0;
-		} else if (!list_empty(&ls->complete)) {
-			lp = list_entry(ls->complete.next, struct gdlm_lock,
-					clist);
-			list_del_init(&lp->clist);
-			complete = 1;
-		} else if (!list_empty(&ls->submit)) {
-			lp = list_entry(ls->submit.next, struct gdlm_lock,
-					delay_list);
-			list_del_init(&lp->delay_list);
-			submit = 1;
-		}
-
-		drop = check_drop(ls);
-		spin_unlock(&ls->async_lock);
-
-		if (complete)
-			process_complete(lp);
-
-		else if (blocking)
-			process_blocking(lp, blocking);
-
-		else if (submit)
-			gdlm_do_lock(lp);
-
-		if (drop)
-			ls->fscb(ls->sdp, LM_CB_DROPLOCKS, NULL);
-
-		schedule();
-	}
-
-	return 0;
-}
-
-static int gdlm_thread1(void *data)
-{
-	return gdlm_thread(data, 1);
-}
-
-static int gdlm_thread2(void *data)
-{
-	return gdlm_thread(data, 0);
-}
-
-int gdlm_init_threads(struct gdlm_ls *ls)
-{
-	struct task_struct *p;
-	int error;
-
-	p = kthread_run(gdlm_thread1, ls, "lock_dlm1");
-	error = IS_ERR(p);
-	if (error) {
-		log_error("can't start lock_dlm1 thread %d", error);
-		return error;
-	}
-	ls->thread1 = p;
-
-	p = kthread_run(gdlm_thread2, ls, "lock_dlm2");
-	error = IS_ERR(p);
-	if (error) {
-		log_error("can't start lock_dlm2 thread %d", error);
-		kthread_stop(ls->thread1);
-		return error;
-	}
-	ls->thread2 = p;
-
-	return 0;
-}
-
-void gdlm_release_threads(struct gdlm_ls *ls)
-{
-	kthread_stop(ls->thread1);
-	kthread_stop(ls->thread2);
-}
-
diff --git a/gfs-kernel/src/gfs/lock_nolock_main.c b/gfs-kernel/src/gfs/lock_nolock_main.c
deleted file mode 100644
index 18315ef..0000000
--- a/gfs-kernel/src/gfs/lock_nolock_main.c
+++ /dev/null
@@ -1,221 +0,0 @@
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/init.h>
-#include <linux/types.h>
-#include <linux/fs.h>
-#include "lm_interface.h"
-
-struct nolock_lockspace {
-	unsigned int nl_lvb_size;
-};
-
-static const struct lm_lockops nolock_ops;
-
-static int nolock_mount(char *table_name, char *host_data,
-			lm_callback_t cb, void *cb_data,
-			unsigned int min_lvb_size, int flags,
-			struct lm_lockstruct *lockstruct,
-			struct kobject *fskobj)
-{
-	char *c;
-	unsigned int jid;
-	struct nolock_lockspace *nl;
-
-	c = strstr(host_data, "jid=");
-	if (!c)
-		jid = 0;
-	else {
-		c += 4;
-		sscanf(c, "%u", &jid);
-	}
-
-	nl = kzalloc(sizeof(struct nolock_lockspace), GFP_KERNEL);
-	if (!nl)
-		return -ENOMEM;
-
-	nl->nl_lvb_size = min_lvb_size;
-
-	lockstruct->ls_jid = jid;
-	lockstruct->ls_first = 1;
-	lockstruct->ls_lvb_size = min_lvb_size;
-	lockstruct->ls_lockspace = nl;
-	lockstruct->ls_ops = &nolock_ops;
-	lockstruct->ls_flags = LM_LSFLAG_LOCAL;
-
-	return 0;
-}
-
-static void nolock_others_may_mount(void *lockspace)
-{
-}
-
-static void nolock_unmount(void *lockspace)
-{
-	struct nolock_lockspace *nl = lockspace;
-	kfree(nl);
-}
-
-static void nolock_withdraw(void *lockspace)
-{
-}
-
-/**
- * nolock_get_lock - get a lm_lock_t given a descripton of the lock
- * @lockspace: the lockspace the lock lives in
- * @name: the name of the lock
- * @lockp: return the lm_lock_t here
- *
- * Returns: 0 on success, -EXXX on failure
- */
-
-static int nolock_get_lock(void *lockspace, struct lm_lockname *name,
-			   void **lockp)
-{
-	*lockp = lockspace;
-	return 0;
-}
-
-/**
- * nolock_put_lock - get rid of a lock structure
- * @lock: the lock to throw away
- *
- */
-
-static void nolock_put_lock(void *lock)
-{
-}
-
-/**
- * nolock_lock - acquire a lock
- * @lock: the lock to manipulate
- * @cur_state: the current state
- * @req_state: the requested state
- * @flags: modifier flags
- *
- * Returns: A bitmap of LM_OUT_*
- */
-
-static unsigned int nolock_lock(void *lock, unsigned int cur_state,
-				unsigned int req_state, unsigned int flags)
-{
-	return req_state | LM_OUT_CACHEABLE;
-}
-
-/**
- * nolock_unlock - unlock a lock
- * @lock: the lock to manipulate
- * @cur_state: the current state
- *
- * Returns: 0
- */
-
-static unsigned int nolock_unlock(void *lock, unsigned int cur_state)
-{
-	return 0;
-}
-
-static void nolock_cancel(void *lock)
-{
-}
-
-/**
- * nolock_hold_lvb - hold on to a lock value block
- * @lock: the lock the LVB is associated with
- * @lvbp: return the lm_lvb_t here
- *
- * Returns: 0 on success, -EXXX on failure
- */
-
-static int nolock_hold_lvb(void *lock, char **lvbp)
-{
-	struct nolock_lockspace *nl = lock;
-	int error = 0;
-
-	*lvbp = kzalloc(nl->nl_lvb_size, GFP_NOFS);
-	if (!*lvbp)
-		error = -ENOMEM;
-
-	return error;
-}
-
-/**
- * nolock_unhold_lvb - release a LVB
- * @lock: the lock the LVB is associated with
- * @lvb: the lock value block
- *
- */
-
-static void nolock_unhold_lvb(void *lock, char *lvb)
-{
-	kfree(lvb);
-}
-
-static int nolock_plock_get(void *lockspace, struct lm_lockname *name,
-			    struct file *file, struct file_lock *fl)
-{
-	posix_test_lock(file, fl);
-
-	return 0;
-}
-
-static int nolock_plock(void *lockspace, struct lm_lockname *name,
-			struct file *file, int cmd, struct file_lock *fl)
-{
-	int error;
-	error = posix_lock_file_wait(file, fl);
-	return error;
-}
-
-static int nolock_punlock(void *lockspace, struct lm_lockname *name,
-			  struct file *file, struct file_lock *fl)
-{
-	int error;
-	error = posix_lock_file_wait(file, fl);
-	return error;
-}
-
-static void nolock_recovery_done(void *lockspace, unsigned int jid,
-				 unsigned int message)
-{
-}
-
-static const struct lm_lockops nolock_ops = {
-	.lm_proto_name = "lock_nolock",
-	.lm_mount = nolock_mount,
-	.lm_others_may_mount = nolock_others_may_mount,
-	.lm_unmount = nolock_unmount,
-	.lm_withdraw = nolock_withdraw,
-	.lm_get_lock = nolock_get_lock,
-	.lm_put_lock = nolock_put_lock,
-	.lm_lock = nolock_lock,
-	.lm_unlock = nolock_unlock,
-	.lm_cancel = nolock_cancel,
-	.lm_hold_lvb = nolock_hold_lvb,
-	.lm_unhold_lvb = nolock_unhold_lvb,
-	.lm_plock_get = nolock_plock_get,
-	.lm_plock = nolock_plock,
-	.lm_punlock = nolock_punlock,
-	.lm_recovery_done = nolock_recovery_done,
-	.lm_owner = THIS_MODULE,
-};
-
-int init_nolock()
-{
-	int error;
-
-	error = gfs_register_lockproto(&nolock_ops);
-	if (error) {
-		printk(KERN_WARNING
-		       "lock_nolock: can't register protocol: %d\n", error);
-		return error;
-	}
-
-	printk(KERN_INFO
-	       "Lock_Nolock (built %s %s) installed\n", __DATE__, __TIME__);
-	return 0;
-}
-
-void exit_nolock()
-{
-	gfs_unregister_lockproto(&nolock_ops);
-}
diff --git a/gfs-kernel/src/gfs/locking.c b/gfs-kernel/src/gfs/locking.c
deleted file mode 100644
index 26c3c51..0000000
--- a/gfs-kernel/src/gfs/locking.c
+++ /dev/null
@@ -1,171 +0,0 @@
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/string.h>
-#include <linux/slab.h>
-#include <linux/wait.h>
-#include <linux/sched.h>
-#include <linux/kmod.h>
-#include <linux/fs.h>
-#include <linux/delay.h>
-#include "lm_interface.h"
-
-struct lmh_wrapper {
-	struct list_head lw_list;
-	const struct lm_lockops *lw_ops;
-};
-
-/* List of registered low-level locking protocols.  A file system selects one
-   of them by name at mount time, e.g. lock_nolock, lock_dlm. */
-
-static LIST_HEAD(lmh_list);
-static DEFINE_MUTEX(lmh_lock);
-
-/**
- * gfs_register_lockproto - Register a low-level locking protocol
- * @proto: the protocol definition
- *
- * Returns: 0 on success, -EXXX on failure
- */
-
-int gfs_register_lockproto(const struct lm_lockops *proto)
-{
-	struct lmh_wrapper *lw;
-
-	mutex_lock(&lmh_lock);
-
-	list_for_each_entry(lw, &lmh_list, lw_list) {
-		if (!strcmp(lw->lw_ops->lm_proto_name, proto->lm_proto_name)) {
-			mutex_unlock(&lmh_lock);
-			printk(KERN_INFO "GFS2: protocol %s already exists\n",
-			       proto->lm_proto_name);
-			return -EEXIST;
-		}
-	}
-
-	lw = kzalloc(sizeof(struct lmh_wrapper), GFP_KERNEL);
-	if (!lw) {
-		mutex_unlock(&lmh_lock);
-		return -ENOMEM;
-	}
-
-	lw->lw_ops = proto;
-	list_add(&lw->lw_list, &lmh_list);
-
-	mutex_unlock(&lmh_lock);
-
-	return 0;
-}
-
-/**
- * gfs_unregister_lockproto - Unregister a low-level locking protocol
- * @proto: the protocol definition
- *
- */
-
-void gfs_unregister_lockproto(const struct lm_lockops *proto)
-{
-	struct lmh_wrapper *lw;
-
-	mutex_lock(&lmh_lock);
-
-	list_for_each_entry(lw, &lmh_list, lw_list) {
-		if (!strcmp(lw->lw_ops->lm_proto_name, proto->lm_proto_name)) {
-			list_del(&lw->lw_list);
-			mutex_unlock(&lmh_lock);
-			kfree(lw);
-			return;
-		}
-	}
-
-	mutex_unlock(&lmh_lock);
-
-	printk(KERN_WARNING "GFS2: can't unregister lock protocol %s\n",
-	       proto->lm_proto_name);
-}
-
-/**
- * gfs_mount_lockproto - Mount a lock protocol
- * @proto_name - the name of the protocol
- * @table_name - the name of the lock space
- * @host_data - data specific to this host
- * @cb - the callback to the code using the lock module
- * @sdp - The GFS2 superblock
- * @min_lvb_size - the mininum LVB size that the caller can deal with
- * @flags - LM_MFLAG_*
- * @lockstruct - a structure returned describing the mount
- *
- * Returns: 0 on success, -EXXX on failure
- */
-
-int gfs_mount_lockproto(char *proto_name, char *table_name, char *host_data,
-			 lm_callback_t cb, void *cb_data,
-			 unsigned int min_lvb_size, int flags,
-			 struct lm_lockstruct *lockstruct,
-			 struct kobject *fskobj)
-{
-	struct lmh_wrapper *lw = NULL;
-	int try = 0;
-	int error, found;
-
-retry:
-	mutex_lock(&lmh_lock);
-
-	found = 0;
-	list_for_each_entry(lw, &lmh_list, lw_list) {
-		if (!strcmp(lw->lw_ops->lm_proto_name, proto_name)) {
-			found = 1;
-			break;
-		}
-	}
-
-	if (!found) {
-		if (!try && capable(CAP_SYS_MODULE)) {
-			try = 1;
-			mutex_unlock(&lmh_lock);
-			request_module(proto_name);
-			goto retry;
-		}
-		printk(KERN_INFO "GFS2: can't find protocol %s\n", proto_name);
-		error = -ENOENT;
-		goto out;
-	}
-
-	if (!try_module_get(lw->lw_ops->lm_owner)) {
-		try = 0;
-		mutex_unlock(&lmh_lock);
-		msleep(1000);
-		goto retry;
-	}
-
-	error = lw->lw_ops->lm_mount(table_name, host_data, cb, cb_data,
-				     min_lvb_size, flags, lockstruct, fskobj);
-	if (error)
-		module_put(lw->lw_ops->lm_owner);
-out:
-	mutex_unlock(&lmh_lock);
-	return error;
-}
-
-void gfs_unmount_lockproto(struct lm_lockstruct *lockstruct)
-{
-	mutex_lock(&lmh_lock);
-	lockstruct->ls_ops->lm_unmount(lockstruct->ls_lockspace);
-	if (lockstruct->ls_ops->lm_owner)
-		module_put(lockstruct->ls_ops->lm_owner);
-	mutex_unlock(&lmh_lock);
-}
-
-/**
- * gfs_withdraw_lockproto - abnormally unmount a lock module
- * @lockstruct: the lockstruct passed into mount
- *
- */
-
-void gfs_withdraw_lockproto(struct lm_lockstruct *lockstruct)
-{
-	mutex_lock(&lmh_lock);
-	lockstruct->ls_ops->lm_withdraw(lockstruct->ls_lockspace);
-	if (lockstruct->ls_ops->lm_owner)
-		module_put(lockstruct->ls_ops->lm_owner);
-	mutex_unlock(&lmh_lock);
-}
diff --git a/gfs-kernel/src/gfs/log.c b/gfs-kernel/src/gfs/log.c
deleted file mode 100644
index 8305ff2..0000000
--- a/gfs-kernel/src/gfs/log.c
+++ /dev/null
@@ -1,1440 +0,0 @@
-/*
-          What rolls down stairs
-             Alone or in pairs
-      Rolls over your neighbor's dog.
-         What's great for a snack
-           And fits on your back
-             It's log, log, log!
-             It's lo-og, lo-og,
-       It's big, it's heavy, it's wood.
-             It's lo-og, lo-og,
-       It's better than bad, it's good.
-           Everyone wants a log,
-         You're gonna love it, log
-         Come on and get your log,
-           Everyone needs a log...
-            LOG... FROM BLAMMO!
-
-                     -- The Ren and Stimpy Show
-*/
-
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-
-#include "gfs.h"
-#include "dio.h"
-#include "log.h"
-#include "lops.h"
-
-/**
- * gfs_struct2blk - compute stuff
- * @sdp: the filesystem
- * @nstruct: the number of structures
- * @ssize: the size of the structures
- *
- * Compute the number of log descriptor blocks needed to hold a certain number
- * of structures of a certain size.
- *
- * Returns: the number of blocks needed (minimum is always 1)
- */
-
-unsigned int
-gfs_struct2blk(struct gfs_sbd *sdp, unsigned int nstruct, unsigned int ssize)
-{
-	unsigned int blks;
-	unsigned int first, second;
-
-	blks = 1;
-	first = (sdp->sd_sb.sb_bsize - sizeof(struct gfs_log_descriptor)) / ssize;
-
-	if (nstruct > first) {
-		second = sdp->sd_sb.sb_bsize / ssize;
-		blks += DIV_RU(nstruct - first, second);
-	}
-
-	return blks;
-}
-
-/**
- * gfs_blk2seg - Convert number of blocks into number of segments
- * @sdp: The GFS superblock
- * @blocks: The number of blocks
- *
- * Returns: The number of journal segments
- */
-
-unsigned int
-gfs_blk2seg(struct gfs_sbd *sdp, unsigned int blocks)
-{
-	return DIV_RU(blocks, sdp->sd_sb.sb_seg_size - 1);
-}
-
-/**
- * log_distance - Compute distance between two journal blocks
- * @sdp: The GFS superblock
- * @newer: The most recent journal block of the pair
- * @older: The older journal block of the pair
- *
- *   Compute the distance (in the journal direction) between two
- *   blocks in the journal
- *
- * Returns: the distance in blocks
- */
-
-static __inline__ unsigned int
-log_distance(struct gfs_sbd *sdp, uint64_t newer, uint64_t older)
-{
-	int64_t dist;
-
-	dist = newer - older;
-	if (dist < 0)
-		dist += sdp->sd_jdesc.ji_nsegment * sdp->sd_sb.sb_seg_size;
-
-	return dist;
-}
-
-/**
- * log_incr_head - Increment journal head (next block to fill in journal)
- * @sdp: The GFS superblock
- * @head: the variable holding the head of the journal
- *
- * Increment journal head by one. 
- * At the end of the journal, wrap head back to the start.
- * Don't confuse journal/log head with a gfs_log_header!
- */
-
-static __inline__ void
-log_incr_head(struct gfs_sbd *sdp, uint64_t * head)
-{
-	struct gfs_jindex *jdesc = &sdp->sd_jdesc;
-
-	if (++*head ==
-	    jdesc->ji_addr + jdesc->ji_nsegment * sdp->sd_sb.sb_seg_size)
-		*head = jdesc->ji_addr;
-}
-
-/**
- * gfs_ail_start - Start I/O on the AIL
- * @sdp: the filesystem
- * @flags:  DIO_ALL -- flush *all* AIL transactions to disk
- *          default -- flush first-on-list AIL transaction to disk
- *
- */
-
-void
-gfs_ail_start(struct gfs_sbd *sdp, int flags)
-{
-	struct list_head *head = &sdp->sd_log_ail;
-	struct list_head *first, *tmp;
-	struct gfs_trans *first_tr, *tr;
-
-	gfs_log_lock(sdp);
-
-	if (list_empty(head)) {
-		gfs_log_unlock(sdp);
-		return;
-	}
-
-	first = head->prev;
-	first_tr = list_entry(first, struct gfs_trans, tr_list);
-	gfs_ail_start_trans(sdp, first_tr);
-
-	if (flags & DIO_ALL)
-		first_tr = NULL;
-
-	for (tmp = first->prev; tmp != head; tmp = tmp->prev) {
-		if (first_tr && gfs_ail_empty_trans(sdp, first_tr))
-			break;
-
-		tr = list_entry(tmp, struct gfs_trans, tr_list);
-		gfs_ail_start_trans(sdp, tr);
-	}
-
-	gfs_log_unlock(sdp);
-}
-
-/**
- * current_tail - Find block number of current log tail
- * @sdp: The GFS superblock
- *
- * Find the block number of the current tail of the log.
- * Assumes that the log lock is held.
- *
- * Returns: The tail's block number (must be on a log segment boundary)
- */
-
-static uint64_t
-current_tail(struct gfs_sbd *sdp)
-{
-	struct gfs_trans *tr;
-	uint64_t tail;
-
-	if (list_empty(&sdp->sd_log_ail)) {
-		tail = sdp->sd_log_head;
-
-		if (!gfs_log_is_header(sdp, tail)) {
-			tail--;
-			gfs_assert(sdp, gfs_log_is_header(sdp, tail), );
-		}
-	} else {
-		tr = list_entry(sdp->sd_log_ail.prev,
-				struct gfs_trans, tr_list);
-		tail = tr->tr_first_head;
-	}
-
-	return tail;
-}
-
-/**
- * gfs_ail_empty - move the tail of the log forward (if possible)
- * @sdp: the filesystem
- *
- * Returns: TRUE if the AIL is empty
- *
- * Checks each transaction on sd_log_ail, to see if it has been successfully
- *   flushed to in-place blocks on disk.  If so, removes trans from sd_log_ail,
- *   effectively advancing the tail of the log (freeing log segments so they
- *   can be overwritten).
- * Adds # freed log segments to sd_log_seg_free.
- */
-
-int
-gfs_ail_empty(struct gfs_sbd *sdp)
-{
-	struct list_head *head, *tmp, *prev;
-	struct gfs_trans *tr;
-	uint64_t oldtail, newtail;
-	unsigned int dist;
-	unsigned int segments;
-	int ret;
-
-	gfs_log_lock(sdp);
-
-	oldtail = current_tail(sdp);
-
-	for (head = &sdp->sd_log_ail, tmp = head->prev, prev = tmp->prev;
-	     tmp != head;
-	     tmp = prev, prev = tmp->prev) {
-		tr = list_entry(tmp, struct gfs_trans, tr_list);
-		if (gfs_ail_empty_trans(sdp, tr)) {
-			list_del(&tr->tr_list);
-			kfree(tr);
-		}
-	}
-
-	newtail = current_tail(sdp);
-
-	if (oldtail != newtail) {
-		dist = log_distance(sdp, newtail, oldtail);
-
-		segments = dist / sdp->sd_sb.sb_seg_size;
-		gfs_assert(sdp, segments * sdp->sd_sb.sb_seg_size == dist,);
-
-		sdp->sd_log_seg_ail2 += segments;
-		gfs_assert(sdp, sdp->sd_log_seg_free + sdp->sd_log_seg_ail2 <=
-			   sdp->sd_jdesc.ji_nsegment,); 
-	}
-
-	ret = list_empty(head);
-
-	gfs_log_unlock(sdp);
-
-	return ret;
-}
-
-/**
- * gfs_log_reserve - Make a log reservation
- * @sdp: The GFS superblock
- * @segments: The number of segments to reserve
- * @jump_queue: if TRUE, don't care about fairness ordering
- *
- * Returns: errno
- */
-
-int
-gfs_log_reserve(struct gfs_sbd *sdp, unsigned int segments, int jump_queue)
-{
-	struct list_head list;
-	unsigned int try = 0;
-
-	if (gfs_assert_warn(sdp, segments))
-		return -EINVAL;
-	if (gfs_assert_warn(sdp, segments < sdp->sd_jdesc.ji_nsegment))
-		return -EINVAL;
-
-	INIT_LIST_HEAD(&list);
-
-	for (;;) {
-		spin_lock(&sdp->sd_log_seg_lock);
-
-		if (list_empty(&list)) {
-			if (jump_queue)
-				list_add(&list, &sdp->sd_log_seg_list);
-			else {
-				list_add_tail(&list, &sdp->sd_log_seg_list);
-				while (sdp->sd_log_seg_list.next != &list) {
-					DECLARE_WAITQUEUE(__wait_chan, current);
-					set_current_state(TASK_UNINTERRUPTIBLE);
-					add_wait_queue(&sdp->sd_log_seg_wait,
-						       &__wait_chan);
-					spin_unlock(&sdp->sd_log_seg_lock);
-					schedule();
-					spin_lock(&sdp->sd_log_seg_lock);
-					remove_wait_queue(&sdp->sd_log_seg_wait,
-							  &__wait_chan);
-					set_current_state(TASK_RUNNING);
-				}
-			}
-		}
-
-		if (sdp->sd_log_seg_free > segments) {
-			sdp->sd_log_seg_free -= segments;
-			list_del(&list);
-			spin_unlock(&sdp->sd_log_seg_lock);
-			wake_up(&sdp->sd_log_seg_wait);
-			break;
-		}
-
-		spin_unlock(&sdp->sd_log_seg_lock);
-
-		if (try) {
-			gfs_log_flush(sdp);
-			gfs_ail_start(sdp, 0);
-		}
-
-		gfs_ail_empty(sdp);
-
-		try++;
-		yield();
-	}
-
-	return 0;
-}
-
-/**
- * gfs_log_release - Release a given number of log segments
- * @sdp: The GFS superblock
- * @segments: The number of segments
- *
- */
-
-void
-gfs_log_release(struct gfs_sbd *sdp, unsigned int segments)
-{
-	spin_lock(&sdp->sd_log_seg_lock);
-	sdp->sd_log_seg_free += segments;
-	gfs_assert(sdp, sdp->sd_log_seg_free + sdp->sd_log_seg_ail2 <=
-		   sdp->sd_jdesc.ji_nsegment,);
-	spin_unlock(&sdp->sd_log_seg_lock);
-}
-
-/**
- * log_get_header - Get and initialize a journal header buffer
- * @sdp: The GFS superblock
- * @tr: The transaction that needs a log header
- * @next: FALSE if this log header appears in midst of current transaction
- *        TRUE if this starts next transaction (and commits current trans)
- *
- * Returns: the initialized log buffer descriptor
- *
- * Initialize one of the transaction's pre-allocated buffers (and associated
- *   log buffer descriptor) to be a log header for this transaction.
- * A log header gets written to *each* log segment boundary block, so journal
- *   recovery will quickly be able to get its bearings.  A single transaction
- *   may span several log segments, which means that log headers will appear
- *   in the midst of that transaction (@next == FALSE).  These headers get
- *   added to trans' list of buffers to write to log.
- * Log commit is accomplished by writing the log header for the next
- *   transaction (@next == TRUE), with pre-incremented sequence number,
- *   and updated first-in-transaction block number.  These headers do *not* get
- *   added to trans' buffer list, since they are written separately to disk
- *   *after* the trans gets completely flushed to on-disk log.
- * NOTE:  This buffer will *not* get written to an in-place location in the
- *        filesystem; it is for use only within the log.
- */
-
-static struct gfs_log_buf *
-log_get_header(struct gfs_sbd *sdp, struct gfs_trans *tr, int next)
-{
-	struct gfs_log_buf *lb;
-	struct list_head *bmem;
-	struct gfs_log_header header;
-
-	/* Make sure we're on a log segment boundary block */
-	gfs_assert(sdp, gfs_log_is_header(sdp, tr->tr_log_head),);
-
-	/* Grab a free log buffer descriptor (attached to trans) */
-	gfs_assert(sdp, tr->tr_num_free_bufs &&
-		   !list_empty(&tr->tr_free_bufs),);
-	lb = list_entry(tr->tr_free_bufs.next, struct gfs_log_buf, lb_list);
-	list_del(&lb->lb_list);
-	tr->tr_num_free_bufs--;
-
-	/* Grab a free log buffer (attached to trans) */
-	gfs_assert(sdp, tr->tr_num_free_bmem &&
-		   !list_empty(&tr->tr_free_bmem),);
-	bmem = tr->tr_free_bmem.next;
-	list_del(bmem);
-	tr->tr_num_free_bmem--;
-
-	/* Create "fake" bh to write bmem to log header block */
-	gfs_logbh_init(sdp, &lb->lb_bh, tr->tr_log_head, (char *)bmem);
-	memset(bmem, 0, sdp->sd_sb.sb_bsize);
-
-	memset(&header, 0, sizeof (header));
-
-	if (next) {
-		/* Fill in header for next transaction, committing previous */
-		header.lh_header.mh_magic = GFS_MAGIC;
-		header.lh_header.mh_type = GFS_METATYPE_LH;
-		header.lh_header.mh_format = GFS_FORMAT_LH;
-		header.lh_first = tr->tr_log_head;
-		header.lh_sequence = sdp->sd_sequence + 1;
-		header.lh_tail = current_tail(sdp);
-		header.lh_last_dump = sdp->sd_log_dump_last;
-	} else {
-		/* Fill in another header for this transaction */
-		header.lh_header.mh_magic = GFS_MAGIC;
-		header.lh_header.mh_type = GFS_METATYPE_LH;
-		header.lh_header.mh_format = GFS_FORMAT_LH;
-		header.lh_first = tr->tr_first_head;
-		header.lh_sequence = sdp->sd_sequence;
-		header.lh_tail = current_tail(sdp);
-		header.lh_last_dump = sdp->sd_log_dump_last;
-
-		/* Attach log header buf to trans' list of bufs going to log */
-		list_add(&lb->lb_list, &tr->tr_bufs);
-	}
-
-	/* Copy log header struct to beginning and end of buffer's 1st 512B */
-	gfs_log_header_out(&header, lb->lb_bh.b_data);
-	gfs_log_header_out(&header,
-			   lb->lb_bh.b_data + GFS_BASIC_BLOCK -
-			   sizeof(struct gfs_log_header));
-
-	/* Find next log buffer to fill */
-	log_incr_head(sdp, &tr->tr_log_head);
-
-	return lb;
-}
-
-/**
- * gfs_log_get_buf - Get and initialize a buffer to use for log control data
- * @sdp: The GFS superblock
- * @tr: The GFS transaction
- *
- * Initialize one of the transaction's pre-allocated buffers (and associated
- *   log buffer descriptor) to be used for log control data (e.g. log tags).
- * Make sure this buffer is attached to the transaction, to be logged to disk.
- * NOTE:  This buffer will *not* get written to an in-place location in the
- *        filesystem; it is for use only within the log.
- *
- * Returns: the log buffer descriptor
- */
-
-struct gfs_log_buf *
-gfs_log_get_buf(struct gfs_sbd *sdp, struct gfs_trans *tr)
-{
-	struct gfs_log_buf *lb;
-	struct list_head *bmem;
-
-	/* If next block in log is on a segment boundary, we need to
-	    write a log header */
-	if (gfs_log_is_header(sdp, tr->tr_log_head))
-		log_get_header(sdp, tr, FALSE);
-
-	/* Grab a free buffer descriptor (attached to trans) */
-	gfs_assert(sdp, tr->tr_num_free_bufs &&
-		   !list_empty(&tr->tr_free_bufs),);
-	lb = list_entry(tr->tr_free_bufs.next, struct gfs_log_buf, lb_list);
-	list_del(&lb->lb_list);
-	tr->tr_num_free_bufs--;
-
-	/* Grab a free buffer (attached to trans) */
-	gfs_assert(sdp, tr->tr_num_free_bmem
-		   && !list_empty(&tr->tr_free_bmem),);
-	bmem = tr->tr_free_bmem.next;
-	list_del(bmem);
-	tr->tr_num_free_bmem--;
-
-	/* Create "fake" bh to write bmem to log block */
-	gfs_logbh_init(sdp, &lb->lb_bh, tr->tr_log_head, (char *)bmem);
-	memset(bmem, 0, sdp->sd_sb.sb_bsize);
-
-	list_add(&lb->lb_list, &tr->tr_bufs);
-
-	/* Find next log buffer to fill */
-	log_incr_head(sdp, &tr->tr_log_head);
-
-	return lb;
-}
-
-/**
- * gfs_log_fake_buf - Build a fake buffer head to write metadata buffer to log
- * @sdp: the filesystem
- * @tr: the transaction this is part of
- * @data: the data the buffer_head should point to
- * @unlock: a buffer_head to be unlocked when struct gfs_log_buf is torn down
- *    (i.e. the "real" buffer_head that will write to in-place location)
- *
- * Initialize one of the transaction's pre-allocated log buffer descriptors
- *   to be used for writing a metadata buffer into the log.
- * Make sure this buffer is attached to the transaction, to be logged to disk.
- * NOTE:  This buffer *will* be written to in-place location within filesytem,
- *        in addition to being written into the log.
- * 
- */
-
-void
-gfs_log_fake_buf(struct gfs_sbd *sdp, struct gfs_trans *tr, char *data,
-		 struct buffer_head *unlock)
-{
-	struct gfs_log_buf *lb;
-
-	if (gfs_log_is_header(sdp, tr->tr_log_head))
-		log_get_header(sdp, tr, FALSE);
-
-	/* Grab a free buffer descriptor (attached to trans) */
-	gfs_assert(sdp, tr->tr_num_free_bufs &&
-		   !list_empty(&tr->tr_free_bufs),);
-	lb = list_entry(tr->tr_free_bufs.next, struct gfs_log_buf, lb_list);
-	list_del(&lb->lb_list);
-	tr->tr_num_free_bufs--;
-
-	/* Create "fake" bh to write data to log block */
-	gfs_logbh_init(sdp, &lb->lb_bh, tr->tr_log_head, data);
-	lb->lb_unlock = unlock;
-
-	list_add(&lb->lb_list, &tr->tr_bufs);
-
-	/* Find next log buffer to fill */
-	log_incr_head(sdp, &tr->tr_log_head);
-}
-
-/**
- * check_seg_usage - Check that we didn't use too many segments
- * @sdp: The GFS superblock
- * @tr: The transaction
- *
- * Also, make sure we don't write ever get to a point where there are
- * no dumps in the log (corrupting the log).  Panic before we let
- * that happen.
- * 
- */
-
-static void
-check_seg_usage(struct gfs_sbd *sdp, struct gfs_trans *tr)
-{
-	struct gfs_jindex *jdesc = &sdp->sd_jdesc;
-	unsigned int dist;
-	unsigned int segments;
-	uint64_t head_off, head_wrap;
-	uint64_t dump_off, dump_wrap;
-
-	dist = log_distance(sdp, tr->tr_log_head, tr->tr_first_head);
-
-	segments = dist / sdp->sd_sb.sb_seg_size;
-	gfs_assert(sdp, segments * sdp->sd_sb.sb_seg_size == dist,);
-	gfs_assert(sdp, segments == tr->tr_seg_reserved,);
-
-	if (sdp->sd_log_dump_last) {
-		int diff;
-
-		head_off = tr->tr_first_head +
-			tr->tr_seg_reserved * sdp->sd_sb.sb_seg_size;
-		head_wrap = sdp->sd_log_wrap;
-		if (head_off >= jdesc->ji_addr +
-		    jdesc->ji_nsegment * sdp->sd_sb.sb_seg_size) {
-			head_off -= jdesc->ji_nsegment * sdp->sd_sb.sb_seg_size;
-			head_wrap++;
-		}
-
-		dump_off = sdp->sd_log_dump_last;
-		dump_wrap = sdp->sd_log_dump_last_wrap;
-
-		diff = (int)(head_wrap - dump_wrap);
-		switch (diff) {
-		case 0:
-			break;
-
-		case 1:
-			if (head_off < dump_off - sdp->sd_sb.sb_seg_size)
-				break;
-			else if (head_off <= dump_off &&
-				 (tr->tr_flags & TRF_LOG_DUMP))
-				break;
-
-		default:
-			gfs_assert(sdp, FALSE,
-				   printk("GFS: fsid=%s: head_off = %"PRIu64", head_wrap = %"PRIu64"\n"
-					  "GFS: fsid=%s: dump_off = %"PRIu64", dump_wrap = %"PRIu64"\n",
-					  sdp->sd_fsname, head_off, head_wrap,
-					  sdp->sd_fsname, dump_off, dump_wrap););
-			break;
-		}
-	}
-}
-
-/**
- * log_free_buf - Free a struct gfs_log_buf (and possibly the data it points to)
- * @sdp: the filesystem
- * @lb: the log buffer descriptor
- *
- * If buffer contains (meta)data to be written into filesystem in-place block,
- *   descriptor will point to the "real" (lb_unlock) buffer head.  Unlock it.
- * If buffer was used only for log header or control data (e.g. tags), we're
- *   done with it as soon as it gets written to on-disk log.  Free it.
- * Either way, we can free the log descriptor structure.
- */
-
-static void
-log_free_buf(struct gfs_sbd *sdp, struct gfs_log_buf *lb)
-{
-	char *bmem;
-
-	bmem = lb->lb_bh.b_data;
-	gfs_logbh_uninit(sdp, &lb->lb_bh);
-
-	if (lb->lb_unlock)
-		gfs_unlock_buffer(lb->lb_unlock);
-	else
-		kfree(bmem);
-
-	kfree(lb);
-}
-
-/**
- * sync_trans - Add "last" descriptor, sync transaction to on-disk log
- * @sdp: The GFS superblock
- * @tr: The transaction
- *
- * Add the "last" descriptor onto the end of the current transaction
- *   and sync the whole transaction out to on-disk log.
- * Don't log-commit (i.e. write next transaction's log header) yet, though.
- *
- * Returns: errno
- */
-
-static int
-sync_trans(struct gfs_sbd *sdp, struct gfs_trans *tr)
-{
-	struct list_head *tmp, *head, *prev;
-	struct gfs_log_descriptor desc;
-	struct gfs_log_buf *lb;
-	uint64_t blk;
-	int error = 0, e;
-
-	/*  Build LAST descriptor  */
-
-	lb = gfs_log_get_buf(sdp, tr);
-
-	memset(&desc, 0, sizeof(struct gfs_log_descriptor));
-	desc.ld_header.mh_magic = GFS_MAGIC;
-	desc.ld_header.mh_type = GFS_METATYPE_LD;
-	desc.ld_header.mh_format = GFS_FORMAT_LD;
-	desc.ld_type = GFS_LOG_DESC_LAST;
-	desc.ld_length = 1;
-	for (blk = tr->tr_log_head; !gfs_log_is_header(sdp, blk); blk++)
-		desc.ld_length++;
-	gfs_desc_out(&desc, lb->lb_bh.b_data);
-
-	while (!gfs_log_is_header(sdp, tr->tr_log_head))
-		log_incr_head(sdp, &tr->tr_log_head);
-
-	check_seg_usage(sdp, tr);
-
-	/* Start I/O
-	   Go in "prev" direction to start the I/O in order. */
-
-	for (head = &tr->tr_bufs, tmp = head->prev, prev = tmp->prev;
-	     tmp != head;
-	     tmp = prev, prev = tmp->prev) {
-		lb = list_entry(tmp, struct gfs_log_buf, lb_list);
-		if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) {
-			gfs_logbh_start(sdp, &lb->lb_bh);
-		} else {
-			list_del(&lb->lb_list);
-			log_free_buf(sdp, lb);
-			error = -EIO;
-		}
-	}
-
-	/* Wait on I/O
-	   Go in "next" direction to minimize sleeps/wakeups. */
-
-	while (!list_empty(&tr->tr_bufs)) {
-		lb = list_entry(tr->tr_bufs.next, struct gfs_log_buf, lb_list);
-
-		e = gfs_logbh_wait(sdp, &lb->lb_bh);
-		if (e)
-			error = e;
-
-		list_del(&lb->lb_list);
-		log_free_buf(sdp, lb);
-	}
-
-	return error;
-}
-
-/**
- * commit_trans - Commit the current transaction
- * @sdp: The GFS superblock
- * @tr: The transaction
- *
- * Write next header to commit
- *
- * Returns: errno
- */
-
-static int
-commit_trans(struct gfs_sbd *sdp, struct gfs_trans *tr)
-{
-	struct gfs_log_buf *lb;
-	int error = 0;
-
-	lb = log_get_header(sdp, tr, TRUE);
-
-	if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) {
-		gfs_logbh_start(sdp, &lb->lb_bh);
-		error = gfs_logbh_wait(sdp, &lb->lb_bh);
-	}
-	if (!error) {
-		spin_lock(&sdp->sd_log_seg_lock);
-		if (!(tr->tr_flags & TRF_DUMMY))
-			sdp->sd_log_seg_free += sdp->sd_log_seg_ail2;
-		else
-			sdp->sd_log_seg_free += (sdp->sd_log_seg_ail2 - 1);
-		sdp->sd_log_seg_ail2 = 0;
-		spin_unlock(&sdp->sd_log_seg_lock);
-	}
-	log_free_buf(sdp, lb);
-
-	return error;
-}
-
-/**
- * disk_commit - Write a transaction to the on-disk journal
- * @sdp: The GFS superblock
- * @tr: The transaction
- *
- * Returns: errno
- */
-
-static int
-disk_commit(struct gfs_sbd *sdp, struct gfs_trans *tr)
-{
-	uint64_t last_dump, last_dump_wrap;
-	int error = 0;
-
-	gfs_assert(sdp, !test_bit(SDF_ROFS, &sdp->sd_flags),);
-	tr->tr_log_head = sdp->sd_log_head;
-	tr->tr_first_head = tr->tr_log_head - 1;
-	gfs_assert(sdp, gfs_log_is_header(sdp, tr->tr_first_head),);
-
-	LO_BUILD_BHLIST(sdp, tr);
-
-	if (!(tr->tr_flags & TRF_DUMMY))
-		gfs_assert(sdp, !list_empty(&tr->tr_bufs),);
-
-	error = sync_trans(sdp, tr);
-	if (error) {
-		/* Eat unusable commit buffer */
-		log_free_buf(sdp, log_get_header(sdp, tr, TRUE));
-		goto out;
-	}
-
-	if (tr->tr_flags & TRF_LOG_DUMP) {
-		/* This commit header should point to the log dump we're
-		   commiting as the current one.  But save the copy of the
-		   old one in case we have problems commiting the dump. */
-
-		last_dump = sdp->sd_log_dump_last;
-		last_dump_wrap = sdp->sd_log_dump_last_wrap;
-
-		sdp->sd_log_dump_last = tr->tr_first_head;
-		sdp->sd_log_dump_last_wrap = sdp->sd_log_wrap;
-
-		error = commit_trans(sdp, tr);
-		if (error) {
-			sdp->sd_log_dump_last = last_dump;
-			sdp->sd_log_dump_last_wrap = last_dump_wrap;
-			goto out;
-		}
-	} else {
-		error = commit_trans(sdp, tr);
-		if (error)
-			goto out;
-	}
-
-	if (sdp->sd_log_head > tr->tr_log_head)
-		sdp->sd_log_wrap++;
-   sdp->sd_log_head = tr->tr_log_head;
-   sdp->sd_sequence++;
-
- out:
-	gfs_assert_warn(sdp, !tr->tr_num_free_bufs &&
-			list_empty(&tr->tr_free_bufs));
-	gfs_assert_warn(sdp, !tr->tr_num_free_bmem &&
-			list_empty(&tr->tr_free_bmem));
-
-	return error;
-}
-
-/**
- * add_trans_to_ail - Add a ondisk commited transaction to the AIL
- * @sdp: the filesystem
- * @tr: the transaction 
- *
- */
-
-static void
-add_trans_to_ail(struct gfs_sbd *sdp, struct gfs_trans *tr)
-{
-	struct gfs_log_element *le;
-
-	while (!list_empty(&tr->tr_elements)) {
-		le = list_entry(tr->tr_elements.next,
-				struct gfs_log_element, le_list);
-		LO_ADD_TO_AIL(sdp, le);
-	}
-
-	list_add(&tr->tr_list, &sdp->sd_log_ail);
-}
-
-/**
- * log_refund - Refund log segments to the free pool
- * @sdp: The GFS superblock
- * @tr: The transaction to examine
- *
- * Look at the number of segments reserved for this transaction and the
- * number of segments actually needed for it.  If they aren't the
- * same, refund the difference to the free segment pool.
- *
- * De-alloc any unneeded log buffers and log buffer descriptors.
- *
- * Called with the log lock held.
- */
-
-static void
-log_refund(struct gfs_sbd *sdp, struct gfs_trans *tr)
-{
-	struct gfs_log_buf *lb;
-	struct list_head *bmem;
-	unsigned int num_bufs = 0, num_bmem = 0;
-	unsigned int segments;
-
-	LO_TRANS_SIZE(sdp, tr, NULL, NULL, &num_bufs, &num_bmem);
-
-	segments = gfs_blk2seg(sdp, num_bufs + 1);
-	num_bufs += segments + 1;
-	num_bmem += segments + 1;
-
-	/* Unreserve unneeded log segments */
-	if (tr->tr_seg_reserved > segments) {
-		spin_lock(&sdp->sd_log_seg_lock);
-		sdp->sd_log_seg_free += tr->tr_seg_reserved - segments;
-		gfs_assert(sdp, sdp->sd_log_seg_free + sdp->sd_log_seg_ail2 <=
-			   sdp->sd_jdesc.ji_nsegment,);
-		spin_unlock(&sdp->sd_log_seg_lock);
-
-		tr->tr_seg_reserved = segments;
-	} else
-		gfs_assert(sdp, tr->tr_seg_reserved == segments,);
-
-	/* De-alloc unneeded log buffer descriptors */
-	gfs_assert(sdp, tr->tr_num_free_bufs >= num_bufs,);
-	while (tr->tr_num_free_bufs > num_bufs) {
-		lb = list_entry(tr->tr_free_bufs.next,
-				struct gfs_log_buf, lb_list);
-		list_del(&lb->lb_list);
-		kfree(lb);
-		tr->tr_num_free_bufs--;
-	}
-
-	/* De-alloc unneeded log buffers */
-	gfs_assert(sdp, tr->tr_num_free_bmem >= num_bmem,);
-	while (tr->tr_num_free_bmem > num_bmem) {
-		bmem = tr->tr_free_bmem.next;
-		list_del(bmem);
-		kfree(bmem);
-		tr->tr_num_free_bmem--;
-	}
-}
-
-/**
- * trans_combine - combine two transactions
- * @sdp: the filesystem
- * @tr: the surviving transaction
- * @new_tr: the transaction that gets freed
- *
- * Assumes that the two transactions are independent.
- */
-
-static void
-trans_combine(struct gfs_sbd *sdp, struct gfs_trans *tr,
-	      struct gfs_trans *new_tr)
-{
-	struct gfs_log_element *le;
-	struct gfs_log_buf *lb;
-	struct list_head *bmem;
-
-	tr->tr_file = __FILE__;
-	tr->tr_line = __LINE__;
-	tr->tr_seg_reserved += new_tr->tr_seg_reserved;
-	tr->tr_flags |= new_tr->tr_flags;
-	tr->tr_num_free_bufs += new_tr->tr_num_free_bufs;
-	tr->tr_num_free_bmem += new_tr->tr_num_free_bmem;
-
-	/*  Combine the log elements of the two transactions  */
-
-	while (!list_empty(&new_tr->tr_elements)) {
-		le = list_entry(new_tr->tr_elements.next,
-				struct gfs_log_element, le_list);
-		gfs_assert(sdp, le->le_trans == new_tr,);
-		le->le_trans = tr;
-		list_move(&le->le_list, &tr->tr_elements);
-	}
-
-	LO_TRANS_COMBINE(sdp, tr, new_tr);
-
-	/* Move free log buffer descriptors to surviving trans */
-	while (!list_empty(&new_tr->tr_free_bufs)) {
-		lb = list_entry(new_tr->tr_free_bufs.next,
-				struct gfs_log_buf, lb_list);
-		list_move(&lb->lb_list, &tr->tr_free_bufs);
-		new_tr->tr_num_free_bufs--;
-	}
-	/* Move free log buffers to surviving trans */
-	while (!list_empty(&new_tr->tr_free_bmem)) {
-		bmem = new_tr->tr_free_bmem.next;
-		list_move(bmem, &tr->tr_free_bmem);
-		new_tr->tr_num_free_bmem--;
-	}
-
-	gfs_assert_warn(sdp, !new_tr->tr_num_free_bufs);
-	gfs_assert_warn(sdp, !new_tr->tr_num_free_bmem);
-
-	kfree(new_tr);
-}
-
-static void
-make_dummy_transaction(struct gfs_sbd *sdp, struct gfs_trans *tr)
-{
-	struct gfs_log_buf *lb;
-	struct list_head *bmem;
-
-	memset(tr, 0, sizeof(struct gfs_trans));
-	INIT_LIST_HEAD(&tr->tr_list);
-	INIT_LIST_HEAD(&tr->tr_elements);
-	INIT_LIST_HEAD(&tr->tr_free_bufs);
-	INIT_LIST_HEAD(&tr->tr_free_bmem);
-	INIT_LIST_HEAD(&tr->tr_bufs);
-	INIT_LIST_HEAD(&tr->tr_ail_bufs);
-	tr->tr_flags = TRF_DUMMY;
-	tr->tr_file = __FILE__;
-	tr->tr_line = __LINE__;
-	tr->tr_seg_reserved = 1;
-	while (tr->tr_num_free_bufs < 2) {
-		lb = gmalloc(sizeof(struct gfs_log_buf));
-		memset(lb, 0, sizeof(struct gfs_log_buf));
-		list_add(&lb->lb_list, &tr->tr_free_bufs);
-		tr->tr_num_free_bufs++;
-	}
-	while (tr->tr_num_free_bmem < 2) {
-		bmem = gmalloc(sdp->sd_sb.sb_bsize);
-		list_add(bmem, &tr->tr_free_bmem);
-		tr->tr_num_free_bmem++;
-	}
-}
-
-
-/**
- * log_flush_internal - flush incore transaction(s)
- * @sdp: the filesystem
- * @gl: The glock structure to flush.  If NULL, flush the whole incore log
- *
- * If a glock is provided, we flush, to on-disk log, all of the metadata for
- *   the one incore-committed (complete, but not-yet-flushed-to-log)
- *   transaction that the glock protects.
- * If NULL, we combine *all* of the filesystem's incore-committed
- *   transactions into one big transaction, and flush it to the log.
- */
-
-static void
-log_flush_internal(struct gfs_sbd *sdp, struct gfs_glock *gl)
-{
-	
-	struct gfs_trans *trans = NULL, *tr;
-	int error;
-
-	gfs_log_lock(sdp);
-
-	if (!gl && list_empty(&sdp->sd_log_incore)) {
-		if (sdp->sd_log_seg_ail2) {
-			trans = gmalloc(sizeof(struct gfs_trans));
-			make_dummy_transaction(sdp, trans);
-		}
-		else
-			goto out;
-	}
-
-	if (gl) {
-		if (!gl->gl_incore_le.le_trans)
-			goto out;
-
-		trans = gl->gl_incore_le.le_trans;
-
-		list_del(&trans->tr_list);
-	} else {
-		/* combine *all* transactions in incore list */
-		while (!list_empty(&sdp->sd_log_incore)) {
-			tr = list_entry(sdp->sd_log_incore.next,
-					struct gfs_trans, tr_list);
-
-			list_del(&tr->tr_list);
-
-			if (trans)
-				trans_combine(sdp, trans, tr);
-			else
-				trans = tr;
-		}
-	}
-
-	log_refund(sdp, trans);
-
-	/*  Actually do the stuff to commit the transaction  */
-
-	error = disk_commit(sdp, trans);
-	if (error)
-		gfs_io_error(sdp);
-
-	add_trans_to_ail(sdp, trans);
-
-	if (log_distance(sdp, sdp->sd_log_head, sdp->sd_log_dump_last) * GFS_DUMPS_PER_LOG >=
-	    sdp->sd_jdesc.ji_nsegment * sdp->sd_sb.sb_seg_size)
-		set_bit(SDF_NEED_LOG_DUMP, &sdp->sd_flags);
-
- out:
-	if (list_empty(&sdp->sd_log_incore))
-		sdp->sd_vfs->s_dirt = FALSE;
-
-	gfs_log_unlock(sdp);
-
-	/*  Dump if we need to.  */
-
-	if (test_bit(SDF_NEED_LOG_DUMP, &sdp->sd_flags))
-		gfs_log_dump(sdp, FALSE);
-}
-
-/**
- * gfs_log_flush - flush the whole incore log
- * @sdp: the filesystem
- *
- */
-
-void
-gfs_log_flush(struct gfs_sbd *sdp)
-{
-	log_flush_internal(sdp, NULL);
-}
-
-/**
- * gfs_log_flush_glock - flush the incore log for a glock
- * @gl: the glock
- *
- */
-
-void
-gfs_log_flush_glock(struct gfs_glock *gl)
-{
-	log_flush_internal(gl->gl_sbd, gl);
-}
-
-/**
- * incore_commit - commit a transaction in-core
- * @sdp: the filesystem
- * @new_tr: the transaction to commit
- *
- * Add the transaction @new_tr to the end of the incore commit list.
- * Pull up and merge any previously committed transactions that share
- * locks.  Also pull up any rename transactions that need it.
- */
-
-static void
-incore_commit(struct gfs_sbd *sdp, struct gfs_trans *new_tr)
-{
-	struct gfs_log_element *le;
-	struct gfs_trans *trans = NULL, *exist_tr;
-	struct gfs_log_buf *lb;
-	struct list_head *bmem;
-	struct list_head *tmp, *head, *next;
-
-	for (head = &new_tr->tr_elements, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		le = list_entry(tmp, struct gfs_log_element, le_list);
-
-		/* Do overlap_trans log-op, if any, to find another
-		   incore transaction with which we can combine new_tr */
-		exist_tr = LO_OVERLAP_TRANS(sdp, le);
-		if (!exist_tr)
-			continue;
-
-		if (exist_tr != trans) {
-			/* remove trans from superblock's sd_log_incore list */
-			list_del(&exist_tr->tr_list);
-
-			/* Maybe there's more than one that can be combined.
-			   If so, combine them together before merging new_tr */
-			if (trans)
-				trans_combine(sdp, trans, exist_tr);
-			else
-				trans = exist_tr;
-		}
-	}
-
-	/* Yes, we can combine new_tr with pre-existing transaction(s) */
-	if (trans) {
-		trans->tr_file = __FILE__;
-		trans->tr_line = __LINE__;
-		trans->tr_seg_reserved += new_tr->tr_seg_reserved;
-		trans->tr_flags |= new_tr->tr_flags;
-		trans->tr_num_free_bufs += new_tr->tr_num_free_bufs;
-		trans->tr_num_free_bmem += new_tr->tr_num_free_bmem;
-
-		/* Move free log buffer descriptors to surviving trans */
-		while (!list_empty(&new_tr->tr_free_bufs)) {
-			lb = list_entry(new_tr->tr_free_bufs.next,
-					struct gfs_log_buf, lb_list);
-			list_move(&lb->lb_list, &trans->tr_free_bufs);
-			new_tr->tr_num_free_bufs--;
-		}
-
-		/* Move free log buffers to surviving trans */
-		while (!list_empty(&new_tr->tr_free_bmem)) {
-			bmem = new_tr->tr_free_bmem.next;
-			list_move(bmem, &trans->tr_free_bmem);
-			new_tr->tr_num_free_bmem--;
-		}
-	} else
-		trans = new_tr;
-
-	/* Do incore_commit log-op for each *new* log element (in new_tr).
-	   Each commit log-op removes its log element from "new_tr" LE list,
-	   and attaches an LE to "trans" LE list; if there was no trans
-	   combining, "new_tr" is the same transaction as "trans". */
-	for (head = &new_tr->tr_elements, tmp = head->next, next = tmp->next;
-	     tmp != head;
-	     tmp = next, next = next->next) {
-		le = list_entry(tmp, struct gfs_log_element, le_list);
-		LO_INCORE_COMMIT(sdp, trans, le);
-	}
-
-	/* If we successfully combined transactions, new_tr should be empty */
-	if (trans != new_tr) {
-		gfs_assert_warn(sdp, !new_tr->tr_num_free_bufs);
-		gfs_assert_warn(sdp, !new_tr->tr_num_free_bmem);
-		gfs_assert_warn(sdp, list_empty(&new_tr->tr_elements));
-		kfree(new_tr);
-	}
-
-	/* If we successfully combined transactions, we might have some log
-	   segments that we reserved, and log buffers and buffer descriptors
-	   that we allocated, but now don't need. */
-	log_refund(sdp, trans);
-
-	list_add(&trans->tr_list, &sdp->sd_log_incore);
-}
-
-/**
- * gfs_log_commit - Commit a transaction to the log
- * @sdp: the filesystem
- * @tr: the transaction
- *
- * Returns: errno
- */
-
-void
-gfs_log_commit(struct gfs_sbd *sdp, struct gfs_trans *tr)
-{
-	struct gfs_log_buf *lb;
-	struct list_head *bmem;
-	unsigned int num_mblks = 0, num_eblks = 0, num_bufs = 0, num_bmem = 0;
-	unsigned int segments;
-
-	/* Calculate actual log area needed for this trans */
-	LO_TRANS_SIZE(sdp, tr, &num_mblks, &num_eblks, &num_bufs, &num_bmem);
-
-	gfs_assert(sdp, num_mblks <= tr->tr_mblks_asked &&
-		   num_eblks <= tr->tr_eblks_asked,
-		   printk("GFS: fsid=%s: type = (%s, %u)\n"
-			  "GFS: fsid=%s: num_mblks = %u, tr->tr_mblks_asked = %u\n"
-			  "GFS: fsid=%s: num_eblks = %u, tr->tr_eblks_asked = %u\n",
-			  sdp->sd_fsname, tr->tr_file, tr->tr_line,
-			  sdp->sd_fsname, num_mblks, tr->tr_mblks_asked,
-			  sdp->sd_fsname, num_eblks, tr->tr_eblks_asked););
-
-	segments = gfs_blk2seg(sdp, num_bufs + 1);
-	num_bufs += segments + 1;
-	num_bmem += segments + 1;
-
-	/* Alloc log buffer descriptors */
-	while (num_bufs--) {
-		lb = gmalloc(sizeof(struct gfs_log_buf));
-		memset(lb, 0, sizeof(struct gfs_log_buf));
-		list_add(&lb->lb_list, &tr->tr_free_bufs);
-		tr->tr_num_free_bufs++;
-	}
-	/* Alloc log buffers */
-	while (num_bmem--) {
-		bmem = gmalloc(sdp->sd_sb.sb_bsize);
-		list_add(bmem, &tr->tr_free_bmem);
-		tr->tr_num_free_bmem++;
-	}
-
-	gfs_log_lock(sdp);
-
-	incore_commit(sdp, tr);
-
-	/* Flush log buffers to disk if we're over the threshold */
-	if (sdp->sd_log_buffers > gfs_tune_get(sdp, gt_incore_log_blocks)) {
-		gfs_log_unlock(sdp);
-		gfs_log_flush(sdp);
-	} else {
-		sdp->sd_vfs->s_dirt = TRUE;
-		gfs_log_unlock(sdp);
-	}
-
-}
-
-/**
- * gfs_log_dump - make a Log Dump entry in the log
- * @sdp: the filesystem
- * @force: if TRUE, always make the dump even if one has been made recently
- *
- */
-
-void
-gfs_log_dump(struct gfs_sbd *sdp, int force)
-{
-	struct gfs_log_element *le;
-	struct gfs_trans tr;
-	struct gfs_log_buf *lb;
-	struct list_head *bmem;
-	unsigned int num_bufs, num_bmem;
-	unsigned int segments;
-	int error;
-
-	if (test_and_set_bit(SDF_IN_LOG_DUMP, &sdp->sd_flags)) {
-		gfs_assert(sdp, !force,);
-		return;
-	}
-
-	memset(&tr, 0, sizeof(struct gfs_trans));
-	INIT_LIST_HEAD(&tr.tr_elements);
-	INIT_LIST_HEAD(&tr.tr_free_bufs);
-	INIT_LIST_HEAD(&tr.tr_free_bmem);
-	INIT_LIST_HEAD(&tr.tr_bufs);
-	tr.tr_flags = TRF_LOG_DUMP;
-	tr.tr_file = __FILE__;
-	tr.tr_line = __LINE__;
-
-	for (;;) {
-		gfs_log_lock(sdp);
-
-		if (!force && !test_bit(SDF_NEED_LOG_DUMP, &sdp->sd_flags))
-			goto out;
-
-		num_bufs = num_bmem = 0;
-		LO_DUMP_SIZE(sdp, NULL, &num_bufs, &num_bmem);
-		gfs_assert(sdp, num_bufs,);
-		segments = gfs_blk2seg(sdp, num_bufs + 1);
-		num_bufs += segments + 1;
-		num_bmem += segments + 1;
-
-		if (tr.tr_seg_reserved >= segments &&
-		    tr.tr_num_free_bufs >= num_bufs &&
-		    tr.tr_num_free_bmem >= num_bmem)
-			break;
-
-		gfs_log_unlock(sdp);
-
-		if (tr.tr_seg_reserved < segments) {
-			error = gfs_log_reserve(sdp,
-						segments - tr.tr_seg_reserved,
-						TRUE);
-			gfs_assert(sdp, !error,);
-			tr.tr_seg_reserved = segments;
-		}
-		while (tr.tr_num_free_bufs < num_bufs) {
-			lb = gmalloc(sizeof(struct gfs_log_buf));
-			memset(lb, 0, sizeof(struct gfs_log_buf));
-			list_add(&lb->lb_list, &tr.tr_free_bufs);
-			tr.tr_num_free_bufs++;
-		}
-		while (tr.tr_num_free_bmem < num_bmem) {
-			bmem = gmalloc(sdp->sd_sb.sb_bsize);
-			list_add(bmem, &tr.tr_free_bmem);
-			tr.tr_num_free_bmem++;
-		}
-	}
-
-	if (tr.tr_seg_reserved > segments) {
-		spin_lock(&sdp->sd_log_seg_lock);
-		sdp->sd_log_seg_free += tr.tr_seg_reserved - segments;
-		gfs_assert(sdp, sdp->sd_log_seg_free + sdp->sd_log_seg_ail2 <=
-			   sdp->sd_jdesc.ji_nsegment,);
-		spin_unlock(&sdp->sd_log_seg_lock);
-		tr.tr_seg_reserved = segments;
-	}
-	while (tr.tr_num_free_bufs > num_bufs) {
-		lb = list_entry(tr.tr_free_bufs.next,
-				struct gfs_log_buf, lb_list);
-		list_del(&lb->lb_list);
-		kfree(lb);
-		tr.tr_num_free_bufs--;
-	}
-	while (tr.tr_num_free_bmem > num_bmem) {
-		bmem = tr.tr_free_bmem.next;
-		list_del(bmem);
-		kfree(bmem);
-		tr.tr_num_free_bmem--;
-	}
-
-	LO_BUILD_DUMP(sdp, &tr);
-
-	error = disk_commit(sdp, &tr);
-	if (error)
-		gfs_io_error(sdp);
-
-	while (!list_empty(&tr.tr_elements)) {
-		le = list_entry(tr.tr_elements.next,
-				struct gfs_log_element, le_list);
-		LO_CLEAN_DUMP(sdp, le);
-	}
-
-	/* If there isn't anything in the AIL, we won't get back the log
-	   space we reserved unless we do it ourselves. */
-
-	if (list_empty(&sdp->sd_log_ail)) {
-		spin_lock(&sdp->sd_log_seg_lock);
-		sdp->sd_log_seg_free += tr.tr_seg_reserved;
-		gfs_assert(sdp, sdp->sd_log_seg_free + sdp->sd_log_seg_ail2 <=
-			   sdp->sd_jdesc.ji_nsegment,);
-		spin_unlock(&sdp->sd_log_seg_lock);
-	}
-
-	clear_bit(SDF_NEED_LOG_DUMP, &sdp->sd_flags);
-
- out:
-	gfs_log_unlock(sdp);
-	clear_bit(SDF_IN_LOG_DUMP, &sdp->sd_flags);
-}
-
-/**
- * gfs_log_shutdown - write a shutdown header into a journal
- * @sdp: the filesystem
- *
- */
-
-void
-gfs_log_shutdown(struct gfs_sbd *sdp)
-{
-	struct gfs_log_buf *lb;
-	char *bmem;
-	struct gfs_log_header head;
-	struct gfs_log_descriptor desc;
-	unsigned int elements = 0;
-	int error;
-
-	lb = gmalloc(sizeof(struct gfs_log_buf));
-	memset(lb, 0, sizeof(struct gfs_log_buf));
-	bmem = gmalloc(sdp->sd_sb.sb_bsize);
-
-	gfs_log_lock(sdp);
-
-	gfs_assert_withdraw(sdp, list_empty(&sdp->sd_log_ail));
-	gfs_assert_withdraw(sdp, sdp->sd_log_seg_free + sdp->sd_log_seg_ail2 ==
-			    sdp->sd_jdesc.ji_nsegment);
-	gfs_assert_withdraw(sdp, !sdp->sd_log_buffers);
-	gfs_assert_withdraw(sdp, gfs_log_is_header(sdp, sdp->sd_log_head - 1));
-	if (test_bit(SDF_SHUTDOWN, &sdp->sd_flags))
-		goto out;
-
-	/*  Build a "last" log descriptor  */
-
-	memset(&desc, 0, sizeof(struct gfs_log_descriptor));
-	desc.ld_header.mh_magic = GFS_MAGIC;
-	desc.ld_header.mh_type = GFS_METATYPE_LD;
-	desc.ld_header.mh_format = GFS_FORMAT_LD;
-	desc.ld_type = GFS_LOG_DESC_LAST;
-	desc.ld_length = sdp->sd_sb.sb_seg_size - 1;
-
-	/*  Write the descriptor  */
-
-	gfs_logbh_init(sdp, &lb->lb_bh, sdp->sd_log_head, bmem);
-	memset(bmem, 0, sdp->sd_sb.sb_bsize);
-	gfs_desc_out(&desc, lb->lb_bh.b_data);
-	if (test_bit(SDF_SHUTDOWN, &sdp->sd_flags))
-		goto out;
-	gfs_logbh_start(sdp, &lb->lb_bh);
-	error = gfs_logbh_wait(sdp, &lb->lb_bh);
-	gfs_logbh_uninit(sdp, &lb->lb_bh);
-
-	if (error)
-		goto out;
-
-	/*  Move to the next header  */
-
-	while (!gfs_log_is_header(sdp, sdp->sd_log_head))
-		log_incr_head(sdp, &sdp->sd_log_head);
-
-	LO_DUMP_SIZE(sdp, &elements, NULL, NULL);
-
-	/*  Build the shutdown header  */
-
-	memset(&head, 0, sizeof (struct gfs_log_header));
-	head.lh_header.mh_magic = GFS_MAGIC;
-	head.lh_header.mh_type = GFS_METATYPE_LH;
-	head.lh_header.mh_format = GFS_FORMAT_LH;
-	head.lh_flags = GFS_LOG_HEAD_UNMOUNT;
-	head.lh_first = sdp->sd_log_head;
-	head.lh_sequence = sdp->sd_sequence + 1;
-	/*  Don't care about tail  */
-	head.lh_last_dump = (elements) ? sdp->sd_log_dump_last : 0;
-
-	/*  Write out the shutdown header  */
-
-	gfs_logbh_init(sdp, &lb->lb_bh, sdp->sd_log_head, bmem);
-	memset(bmem, 0, sdp->sd_sb.sb_bsize);
-	gfs_log_header_out(&head, lb->lb_bh.b_data);
-	gfs_log_header_out(&head,
-			   lb->lb_bh.b_data + GFS_BASIC_BLOCK -
-			   sizeof(struct gfs_log_header));
-	if (!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) {
-		gfs_logbh_start(sdp, &lb->lb_bh);
-		gfs_logbh_wait(sdp, &lb->lb_bh);
-		gfs_logbh_uninit(sdp, &lb->lb_bh);
-	}
-   /* If a withdraw is called before we've a chance to relock the trans
-    * lock, the sd_log_head points to the wrong place, and a umount will
-    * fail on asserts because of this.
-    * Adding one puts sd_log_head at a value that passes the assert.  The
-    * value may not be correct for on disk, but we've withdrawn so there is
-    * no more disk io.
-    * If we're not withdrawn, the next io will grab the trans lock, which
-    * will fill sd_log_head with the correct value.
-    */
-   sdp->sd_log_head += 1;
-
- out:
-	gfs_log_unlock(sdp);
-
-	kfree(lb);
-	kfree(bmem);
-}
diff --git a/gfs-kernel/src/gfs/log.h b/gfs-kernel/src/gfs/log.h
deleted file mode 100644
index 649d43d..0000000
--- a/gfs-kernel/src/gfs/log.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef __LOG_DOT_H__
-#define __LOG_DOT_H__
-
-/**
- * gfs_log_lock - acquire the right to mess with the log manager
- * @sdp: the filesystem
- *
- */
-
-static __inline__ void
-gfs_log_lock(struct gfs_sbd *sdp)
-{
-	down_write(&sdp->sd_log_lock);
-}
-
-/**
- * gfs_log_unlock - release the right to mess with the log manager
- * @sdp: the filesystem
- *
- */
-
-static __inline__ void
-gfs_log_unlock(struct gfs_sbd *sdp)
-{
-	up_write(&sdp->sd_log_lock);
-}
-
-unsigned int gfs_struct2blk(struct gfs_sbd *sdp, unsigned int nstruct,
-			    unsigned int ssize);
-unsigned int gfs_blk2seg(struct gfs_sbd *sdp, unsigned int blocks);
-
-int gfs_log_reserve(struct gfs_sbd *sdp, unsigned int segments, int jump_queue);
-void gfs_log_release(struct gfs_sbd *sdp, unsigned int segments);
-
-void gfs_ail_start(struct gfs_sbd *sdp, int flags);
-int gfs_ail_empty(struct gfs_sbd *sdp);
-
-void gfs_log_commit(struct gfs_sbd *sdp, struct gfs_trans *trans);
-void gfs_log_flush(struct gfs_sbd *sdp);
-void gfs_log_flush_glock(struct gfs_glock *gl);
-
-void gfs_log_shutdown(struct gfs_sbd *sdp);
-
-void gfs_log_dump(struct gfs_sbd *sdp, int force);
-
-/*  Internal crap used the log operations  */
-
-/**
- * gfs_log_is_header - Discover if block is on journal header
- * @sdp: The GFS superblock
- * @block: The block number
- *
- * Returns: TRUE if the block is on a journal segment boundary, FALSE otherwise
- */
-
-static __inline__ int
-gfs_log_is_header(struct gfs_sbd *sdp, uint64_t block)
-{
-	return !do_mod(block, sdp->sd_sb.sb_seg_size);
-}
-
-struct gfs_log_buf *gfs_log_get_buf(struct gfs_sbd *sdp, struct gfs_trans *tr);
-void gfs_log_fake_buf(struct gfs_sbd *sdp, struct gfs_trans *tr, char *data,
-		      struct buffer_head *unlock);
-
-#endif /* __LOG_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/lops.c b/gfs-kernel/src/gfs/lops.c
deleted file mode 100644
index 6010444..0000000
--- a/gfs-kernel/src/gfs/lops.c
+++ /dev/null
@@ -1,1648 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-
-#include "gfs.h"
-#include "dio.h"
-#include "glock.h"
-#include "log.h"
-#include "lops.h"
-#include "quota.h"
-#include "recovery.h"
-#include "trans.h"
-#include "unlinked.h"
-
-/**
- * generic_le_add - generic routine to add a log element to a transaction
- * @sdp: the filesystem
- * @le: the log entry
- *
- */
-
-static void
-generic_le_add(struct gfs_sbd *sdp, struct gfs_log_element *le)
-{
-	struct gfs_trans *tr;
-
-	/* Make sure it's not attached to a transaction already */
-	gfs_assert(sdp, le->le_ops &&
-		   !le->le_trans &&
-		   list_empty(&le->le_list),);
-
-	/* Attach it to the (one) transaction being built by this process */
-	tr = get_transaction;
-	gfs_assert(sdp, tr,);
-
-	le->le_trans = tr;
-	list_add(&le->le_list, &tr->tr_elements);
-}
-
-/**
- * glock_trans_end - drop a glock reference
- * @sdp: the filesystem
- * @le: the log element
- *
- * Called before incore-committing a transaction
- * Release reference that was taken in gfs_trans_add_gl()
- */
-
-static void
-glock_trans_end(struct gfs_sbd *sdp, struct gfs_log_element *le)
-{
-	struct gfs_glock *gl = container_of(le, struct gfs_glock, gl_new_le);
-
-	gfs_assert(sdp, gfs_glock_is_locked_by_me(gl) &&
-		   gfs_glock_is_held_excl(gl),);
-	gfs_glock_put(gl);
-}
-
-/**
- * glock_print - print debug info about a log element
- * @sdp: the filesystem
- * @le: the log element
- * @where: is this a new transaction or a incore transaction
- *
- */
-
-static void
-glock_print(struct gfs_sbd *sdp, struct gfs_log_element *le, unsigned int where)
-{
-	struct gfs_glock *gl;
-
-	switch (where) {
-	case TRANS_IS_NEW:
-		gl = container_of(le, struct gfs_glock, gl_new_le);
-		break;
-	case TRANS_IS_INCORE:
-		gl = container_of(le, struct gfs_glock, gl_incore_le);
-		break;
-	default:
-		gfs_assert_warn(sdp, FALSE);
-		return;
-	}
-
-	printk("  Glock:  (%u, %"PRIu64")\n",
-	       gl->gl_name.ln_type,
-	       gl->gl_name.ln_number);
-}
-
-/**
- * glock_overlap_trans - Find any incore transactions that might overlap with
- *   (i.e. be combinable with the transaction containing) this LE
- * @sdp: the filesystem
- * @le: the log element
- *
- * Transactions that share a given glock are combinable.
- *
- * For a glock, the scope of the "search" is just the (max) one unique incore
- *   committed transaction to which the glock may be attached via its
- *   gl->gl_incore_le embedded log element.  This trans may have previously
- *   been combined with other transactions, though (i.e. previous
- *   incore committed transactions that shared the same glock).
- *  
- * Called as a beginning part of the incore commit of a transaction.
- */
-
-static struct gfs_trans *
-glock_overlap_trans(struct gfs_sbd *sdp, struct gfs_log_element *le)
-{
-	struct gfs_glock *gl = container_of(le, struct gfs_glock, gl_new_le);
-
-	return gl->gl_incore_le.le_trans;
-}
-
-/**
- * glock_incore_commit - commit this LE to the incore log
- * @sdp: the filesystem
- * @tr: the being-incore-committed transaction this LE is to be a part of
- * @le: the log element (should be a gl->gl_new_le), which is attached
- *      to a "new" (just-ended) transaction.
- *      
- * Attach glock's gl_incore_le to the being-incore-committed trans' LE list.
- * Remove glock's gl_new_le from the just-ended new trans' LE list.
- * If the just-ended new trans (le->le_trans) was combined (in incore_commit())
- *   with a pre-existing incore trans (tr), this function effectively moves
- *   the LE from the new to the combined incore trans.
- * If there was no combining, then the new trans itself is being committed
- *   (le->le_trans == tr); this function simply replaces the gl_new_le with a
- *   gl_incore_le on the trans' LE list.
- * 
- * Make sure that this glock's gl_incore_le is attached to one and only one
- *   incore-committed transaction's (this one's) tr_elements list.
- *   One transaction (instead of a list of transactions) is sufficient,
- *   because incore_commit() combines multiple transactions that share a glock
- *   into one trans.
- * Since transactions can contain multiple glocks, there are multiple
- *   possibilities for shared glocks, therefore multiple potential "bridges"
- *   for combining transactions.
- */
-
-static void
-glock_incore_commit(struct gfs_sbd *sdp, struct gfs_trans *tr,
-		    struct gfs_log_element *le)
-{
-	struct gfs_glock *gl = container_of(le, struct gfs_glock, gl_new_le);
-
-	/* Transactions were combined, based on this glock */
-	if (gl->gl_incore_le.le_trans)
-		gfs_assert(sdp, gl->gl_incore_le.le_trans == tr,);
-	else {
-		/* Attach gl->gl_incore_le to being-committed trans */
-		gl->gl_incore_le.le_trans = tr;
-		list_add(&gl->gl_incore_le.le_list, &tr->tr_elements);
-
-		/* If transactions were combined (via another shared glock),
-		   the combined trans is getting a new glock log element */
-		if (tr != le->le_trans)
-			tr->tr_num_gl++;
-	}
-
-	/* Remove gl->gl_new_le from "new" trans */
-	le->le_trans = NULL;
-	list_del_init(&le->le_list);
-}
-
-/**
- * glock_add_to_ail - Add this LE to the AIL
- * @sdp: the filesystem
- * @le: the log element
- *
- * Glocks don't really get added to AIL (there's nothing to write to disk),
- * they just get removed from the transaction at this time.
- */
-
-static void
-glock_add_to_ail(struct gfs_sbd *sdp, struct gfs_log_element *le)
-{
-	le->le_trans = NULL;
-	list_del_init(&le->le_list);
-}
-
-/**
- * glock_trans_combine - combine two incore transactions
- * @sdp: the filesystem
- * @tr: the surviving transaction
- * @new_tr: the transaction that's going to disappear
- *
- */
-
-static void
-glock_trans_combine(struct gfs_sbd *sdp, struct gfs_trans *tr,
-		    struct gfs_trans *new_tr)
-{
-	tr->tr_num_gl += new_tr->tr_num_gl;
-}
-
-/**
- * buf_print - print debug info about a log element
- * @sdp: the filesystem
- * @le: the log element
- * @where: is this a new transaction or a incore transaction
- *
- */
-
-static void
-buf_print(struct gfs_sbd *sdp, struct gfs_log_element *le, unsigned int where)
-{
-	struct gfs_bufdata *bd;
-
-	switch (where) {
-	case TRANS_IS_NEW:
-		bd = container_of(le, struct gfs_bufdata, bd_new_le);
-		break;
-	case TRANS_IS_INCORE:
-		bd = container_of(le, struct gfs_bufdata, bd_incore_le);
-		break;
-	default:
-		gfs_assert_warn(sdp, FALSE);
-		return;
-	}
-
-	printk("  Buffer:  %"PRIu64"\n", (uint64_t)bd->bd_bh->b_blocknr);
-}
-
-/**
- * buf_incore_commit - commit this buffer LE to the incore log
- * @sdp: the filesystem
- * @tr: the incore transaction this LE is a part of
- * @le: the log element for the "new" (just now complete) trans
- *
- * Invoked from incore_commit().
- * Move this buffer from "new" stage to "incore committed" stage of the
- *   transaction pipeline.
- * If this buffer was already attached to a pre-existing incore trans, GFS is
- *   combining the new and incore transactions; decrement buffer's recursive
- *   pin count that was incremented when it was added to the new transaction,
- *   and remove the reference to the "new" (being swallowed) trans.
- * Else, move this buffer's attach point from "new" to "incore" embedded LE
- *   (same transaction, just new status) and add this buf to (incore) trans'
- *   LE list.
- */
-
-static void
-buf_incore_commit(struct gfs_sbd *sdp, struct gfs_trans *tr,
-		  struct gfs_log_element *le)
-{
-	struct gfs_bufdata *bd = container_of(le, struct gfs_bufdata, bd_new_le);
-
-	/* We've completed our (atomic) changes to this buffer for this trans.
-	   We no longer need the frozen copy.  If frozen copy was not written
-	   to on-disk log already, there's no longer a need to; we can now
-	   write the "real" buffer (with more up-to-date content) instead. */
-	if (bd->bd_frozen) {
-		kfree(bd->bd_frozen);
-		bd->bd_frozen = NULL;
-	}
-
-	/* New trans being combined with pre-existing incore trans? */
-	if (bd->bd_incore_le.le_trans) {
-		gfs_assert(sdp, bd->bd_incore_le.le_trans == tr,);
-		gfs_dunpin(sdp, bd->bd_bh, NULL);
-	} else {
-		bd->bd_incore_le.le_trans = tr;
-		list_add(&bd->bd_incore_le.le_list, &tr->tr_elements);
-		if (tr != le->le_trans)
-			tr->tr_num_buf++;
-
-		sdp->sd_log_buffers++;
-	}
-
-	/* Reset buffer's bd_new_le */
-	le->le_trans = NULL;
-	list_del_init(&le->le_list);
-}
-
-/**
- * buf_add_to_ail - Add this LE to the AIL
- * @sdp: the filesystem
- * @le: the log element
- *
- */
-
-static void
-buf_add_to_ail(struct gfs_sbd *sdp, struct gfs_log_element *le)
-{
-	struct gfs_bufdata *bd = container_of(le,
-					       struct gfs_bufdata,
-					       bd_incore_le);
-
-	gfs_dunpin(sdp, bd->bd_bh, le->le_trans);
-
-	le->le_trans = NULL;
-	list_del_init(&le->le_list);
-
-	gfs_assert(sdp, sdp->sd_log_buffers,);
-	sdp->sd_log_buffers--;
-}
-
-/**
- * buf_trans_size - compute how much space the LE class takes up in a transaction
- * @sdp: the filesystem
- * @tr: the transaction
- * @mblks: the number of regular metadata blocks
- * @eblks: the number of extra blocks
- * @blocks: the number of log blocks
- * @bmem: the number of buffer-sized chunks of memory we need
- *
- */
-
-static void
-buf_trans_size(struct gfs_sbd *sdp, struct gfs_trans *tr,
-	       unsigned int *mblks, unsigned int *eblks,
-	       unsigned int *blocks, unsigned int *bmem)
-{
-	unsigned int cblks;
-
-	if (tr->tr_num_buf) {
-		cblks = gfs_struct2blk(sdp, tr->tr_num_buf,
-				       sizeof(struct gfs_block_tag));
-
-		if (mblks)
-			*mblks += tr->tr_num_buf;
-		if (blocks)
-			*blocks += tr->tr_num_buf + cblks;
-		if (bmem)
-			*bmem += cblks;
-	}
-}
-
-/**
- * buf_trans_combine - combine two incore transactions
- * @sdp: the filesystem
- * @tr: the surviving transaction
- * @new_tr: the transaction that's going to disappear
- *
- */
-
-static void
-buf_trans_combine(struct gfs_sbd *sdp, struct gfs_trans *tr,
-		  struct gfs_trans *new_tr)
-{
-	tr->tr_num_buf += new_tr->tr_num_buf;
-}
-
-/**
- * increment_generation - increment the generation number in metadata buffer
- * @sdp: the filesystem
- * @bd: the struct gfs_bufdata structure associated with the buffer
- *
- * Increment the generation # of the most recent buffer contents, as well as
- *   that of frozen buffer, if any.  If there is a frozen buffer, only *it*
- *   will be going to the log now ... in this case, the current buffer will
- *   have its gen # incremented again later, when it gets written to log.
- * Gen # is used by journal recovery (replay_block()) to determine whether
- *   to overwrite an inplace block with the logged block contents.
- */
-
-static void
-increment_generation(struct gfs_sbd *sdp, struct gfs_bufdata *bd)
-{
-	struct gfs_meta_header *mh, *mh2;
-	uint64_t tmp64;
-
-	mh = (struct gfs_meta_header *)bd->bd_bh->b_data;
-
-	tmp64 = gfs64_to_cpu(mh->mh_generation) + 1;
-	tmp64 = cpu_to_gfs64(tmp64);
-
-	if (bd->bd_frozen) {
-		mh2 = (struct gfs_meta_header *)bd->bd_frozen;
-		gfs_assert(sdp, mh->mh_generation == mh2->mh_generation,);
-		mh2->mh_generation = tmp64;
-	}
-	mh->mh_generation = tmp64;
-}
-
-/**
- * buf_build_bhlist - create the buffers that will make up the ondisk part of a transaction
- * @sdp: the filesystem
- * @tr: the transaction
- *
- * Create the log (transaction) descriptor block
- */
-
-static void
-buf_build_bhlist(struct gfs_sbd *sdp, struct gfs_trans *tr)
-{
-	struct list_head *tmp, *head;
-	struct gfs_log_element *le;
-	struct gfs_bufdata *bd;
-	struct gfs_log_descriptor desc;
-	struct gfs_block_tag tag;
-	struct gfs_log_buf *clb = NULL;
-	unsigned int num_ctl;
-	unsigned int offset = sizeof(struct gfs_log_descriptor);
-	unsigned int x, bufs;
-
-	if (!tr->tr_num_buf)
-		return;
-
-	/* set up control buffers for descriptor and tags */
-
-	num_ctl = gfs_struct2blk(sdp, tr->tr_num_buf,
-				 sizeof(struct gfs_block_tag));
-
-	for (x = 0; x < num_ctl; x++) {
-		if (clb)
-			gfs_log_get_buf(sdp, tr);
-		else
-			clb = gfs_log_get_buf(sdp, tr);
-	}
-
-	/* Init and copy log descriptor into 1st control block */
-	memset(&desc, 0, sizeof(struct gfs_log_descriptor));
-	desc.ld_header.mh_magic = GFS_MAGIC;
-	desc.ld_header.mh_type = GFS_METATYPE_LD;
-	desc.ld_header.mh_format = GFS_FORMAT_LD;
-	desc.ld_type = GFS_LOG_DESC_METADATA;
-	desc.ld_length = num_ctl + tr->tr_num_buf;
-	desc.ld_data1 = tr->tr_num_buf;
-	gfs_desc_out(&desc, clb->lb_bh.b_data);
-
-	x = 1;
-	bufs = 0;
-
-	for (head = &tr->tr_elements, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		le = list_entry(tmp, struct gfs_log_element, le_list);
-
-		/* Skip over non-buffer (e.g. glock, unlinked, etc.) LEs */
-		if (le->le_ops != &gfs_buf_lops)
-			continue;
-
-		bd = container_of(le, struct gfs_bufdata, bd_incore_le);
-
-		gfs_meta_check(sdp, bd->bd_bh);
-
-		gfs_lock_buffer(bd->bd_bh);
-
-		increment_generation(sdp, bd);
-
-		/* Create "fake" buffer head to write block to on-disk log.  Use
-		   frozen copy if another transaction is modifying the "real"
-		   buffer contents.  Unlock real bh after log write completes,
-		   so Linux can write real contents to inplace block. */
-		gfs_log_fake_buf(sdp, tr,
-				 (bd->bd_frozen) ? bd->bd_frozen : bd->bd_bh->b_data,
-				 bd->bd_bh);
-
-		/* find another buffer for tags if we're overflowing this one */
-		if (offset + sizeof(struct gfs_block_tag) > sdp->sd_sb.sb_bsize) {
-			clb = list_entry(clb->lb_list.prev,
-					 struct gfs_log_buf, lb_list);
-			if (gfs_log_is_header(sdp, clb->lb_bh.b_blocknr))
-				clb = list_entry(clb->lb_list.prev,
-						 struct gfs_log_buf, lb_list);
-			x++;
-			offset = 0;
-		}
-
-		/* Write this LE's tag into a control buffer */
-		memset(&tag, 0, sizeof(struct gfs_block_tag));
-		tag.bt_blkno = bd->bd_bh->b_blocknr;
-
-		gfs_block_tag_out(&tag, clb->lb_bh.b_data + offset);
-
-		offset += sizeof(struct gfs_block_tag);
-		bufs++;
-	}
-
-	gfs_assert(sdp, x == num_ctl,);
-	gfs_assert(sdp, bufs == tr->tr_num_buf,);
-}
-
-/**
- * buf_before_scan - called before journal replay
- * @sdp: the filesystem
- * @jid: the journal ID about to be replayed
- * @head: the current head of the log
- * @pass: the pass through the journal
- *
- */
-
-static void
-buf_before_scan(struct gfs_sbd *sdp, unsigned int jid,
-		struct gfs_log_header *head, unsigned int pass)
-{
-	if (pass == GFS_RECPASS_A1)
-		sdp->sd_recovery_replays =
-			sdp->sd_recovery_skips =
-			sdp->sd_recovery_sames = 0;
-}
-
-/**
- * replay_block - Replay a single metadata block
- * @sdp: the filesystem
- * @jdesc: the struct gfs_jindex structure for the journal being replayed
- * @gl: the journal's glock
- * @tag: the block tag describing the inplace location of the block
- * @blkno: the location of the log's copy of the block
- *
- * Returns: errno
- *
- * Read in-place block from disk
- * Read log (journal) block from disk
- * Compare generation numbers
- * Copy log block to in-place block on-disk if:
- *   log generation # > in-place generation #
- *   OR generation #s are ==, but data contained in block is different (corrupt)
- */
-
-static int
-replay_block(struct gfs_sbd *sdp, struct gfs_jindex *jdesc,
-	     struct gfs_glock *gl, struct gfs_block_tag *tag, uint64_t blkno)
-{
-	struct buffer_head *inplace_bh, *log_bh;
-	struct gfs_meta_header inplace_mh, log_mh;
-	int replay_block = TRUE;
-	int error = 0;
-
-	gfs_replay_check(sdp);
-
-	/* Warning:  Using a real buffer here instead of a tempbh can be bad
-	   on a OS that won't support multiple simultaneous buffers for the
-	   same block on different glocks. */
-
-	error = gfs_dread(gl, tag->bt_blkno,
-			  DIO_START | DIO_WAIT, &inplace_bh);
-	if (error)
-		return error;
-	if (gfs_meta_check(sdp, inplace_bh)) {
-		brelse(inplace_bh);
-		return -EIO;
-	}
-	gfs_meta_header_in(&inplace_mh, inplace_bh->b_data);
-
-	error = gfs_dread(gl, blkno, DIO_START | DIO_WAIT, &log_bh);
-	if (error) {
-		brelse(inplace_bh);
-		return error;
-	}
-	if (gfs_meta_check(sdp, log_bh)) {
-		brelse(inplace_bh);
-		brelse(log_bh);
-		return -EIO;
-	}
-	gfs_meta_header_in(&log_mh, log_bh->b_data);
-
-	if (log_mh.mh_generation < inplace_mh.mh_generation) {
-		replay_block = FALSE;
-		sdp->sd_recovery_skips++;
-	} else if (log_mh.mh_generation == inplace_mh.mh_generation) {
-		if (memcmp(log_bh->b_data,
-			   inplace_bh->b_data,
-			   sdp->sd_sb.sb_bsize) == 0) {
-			replay_block = FALSE;
-			sdp->sd_recovery_sames++;
-		}
-	}
-
-	if (replay_block) {
-		memcpy(inplace_bh->b_data,
-		       log_bh->b_data,
-		       sdp->sd_sb.sb_bsize);
-
-		error = gfs_replay_buf(gl, inplace_bh);
-		if (!error)
-			sdp->sd_recovery_replays++;
-	}
-
-	brelse(log_bh);
-	brelse(inplace_bh);
-
-	return error;
-}
-
-/**
- * buf_scan_elements - Replay a metadata log descriptor
- * @sdp: the filesystem
- * @jdesc: the struct gfs_jindex structure for the journal being replayed
- * @gl: the journal's glock
- * @start: the starting block of the descriptor
- * @desc: the descriptor structure
- * @pass: the pass through the journal
- *
- * Returns: errno
- */
-
-static int
-buf_scan_elements(struct gfs_sbd *sdp, struct gfs_jindex *jdesc,
-		  struct gfs_glock *gl, uint64_t start,
-		  struct gfs_log_descriptor *desc, unsigned int pass)
-{
-	struct gfs_block_tag tag;
-	struct buffer_head *bh;
-	uint64_t cblk = start;
-	unsigned int num_tags = desc->ld_data1;
-	unsigned int offset = sizeof(struct gfs_log_descriptor);
-	unsigned int x;
-	int error;
-
-	if (pass != GFS_RECPASS_A1)
-		return 0;
-	if (desc->ld_type != GFS_LOG_DESC_METADATA)
-		return 0;
-
-	x = gfs_struct2blk(sdp, num_tags, sizeof(struct gfs_block_tag));
-	while (x--) {
-		error = gfs_increment_blkno(sdp, jdesc, gl, &start, TRUE);
-		if (error)
-			return error;
-	}
-
-	for (;;) {
-		gfs_assert(sdp, num_tags,);
-
-		error = gfs_dread(gl, cblk, DIO_START | DIO_WAIT, &bh);
-		if (error)
-			return error;
-
-		/* Do readahead for the inplace blocks in this control block */
-		{
-			unsigned int o2 = offset;
-			unsigned int nt2 = num_tags;
-
-			while (o2 + sizeof(struct gfs_block_tag) <=
-			       sdp->sd_sb.sb_bsize) {
-				gfs_block_tag_in(&tag, bh->b_data + o2);
-				gfs_start_ra(gl, tag.bt_blkno, 1);
-				if (!--nt2)
-					break;
-				o2 += sizeof(struct gfs_block_tag);
-			}
-		}
-
-		while (offset + sizeof(struct gfs_block_tag) <=
-		       sdp->sd_sb.sb_bsize) {
-			gfs_block_tag_in(&tag, bh->b_data + offset);
-
-			error = replay_block(sdp, jdesc, gl, &tag, start);
-			if (error)
-				goto out_drelse;
-
-			if (!--num_tags)
-				goto out_drelse;
-
-			error = gfs_increment_blkno(sdp, jdesc, gl, &start, TRUE);
-			if (error)
-				goto out_drelse;
-
-			offset += sizeof(struct gfs_block_tag);
-		}
-
-		brelse(bh);
-
-		error = gfs_increment_blkno(sdp, jdesc, gl, &cblk, TRUE);
-		if (error)
-			return error;
-
-		offset = 0;
-	}
-
-	return 0;
-
- out_drelse:
-	brelse(bh);
-
-	return error;
-}
-
-/**
- * buf_after_scan - called after journal replay
- * @sdp: the filesystem
- * @jid: the journal ID about to be replayed
- * @pass: the pass through the journal
- *
- */
-
-static void
-buf_after_scan(struct gfs_sbd *sdp, unsigned int jid, unsigned int pass)
-{
-	if (pass == GFS_RECPASS_A1) {
-		printk("GFS: fsid=%s: jid=%u: Replayed %u of %u blocks\n",
-		       sdp->sd_fsname, jid,
-		       sdp->sd_recovery_replays,
-		       sdp->sd_recovery_replays + sdp->sd_recovery_skips +
-		       sdp->sd_recovery_sames);
-		printk("GFS: fsid=%s: jid=%u: replays = %u, skips = %u, sames = %u\n",
-		       sdp->sd_fsname, jid, sdp->sd_recovery_replays,
-		       sdp->sd_recovery_skips, sdp->sd_recovery_sames);
-	}
-}
-
-/**
- * unlinked_print - print debug info about a log element
- * @sdp: the filesystem
- * @le: the log element
- * @where: is this a new transaction or a incore transaction
- *
- */
-
-static void
-unlinked_print(struct gfs_sbd *sdp, struct gfs_log_element *le,
-	       unsigned int where)
-{
-	struct gfs_unlinked *ul;
-	char *type;
-
-	switch (where) {
-	case TRANS_IS_NEW:
-		ul = container_of(le, struct gfs_unlinked, ul_new_le);
-		type = (test_bit(ULF_NEW_UL, &ul->ul_flags)) ?
-			"unlink" : "dealloc";
-		break;
-	case TRANS_IS_INCORE:
-		ul = container_of(le, struct gfs_unlinked, ul_incore_le);
-		type = (test_bit(ULF_INCORE_UL, &ul->ul_flags)) ?
-			"unlink" : "dealloc";
-		break;
-	default:
-		gfs_assert_warn(sdp, FALSE);
-		return;
-	}
-
-	printk("  unlinked:  %"PRIu64"/%"PRIu64", %s\n",
-	       ul->ul_inum.no_formal_ino, ul->ul_inum.no_addr,
-	       type);
-}
-
-/**
- * unlinked_incore_commit - commit this LE to the incore log
- * @sdp: the filesystem
- * @tr: the incore transaction this LE is a part of
- * @le: the log element
- *
- */
-
-static void
-unlinked_incore_commit(struct gfs_sbd *sdp, struct gfs_trans *tr,
-		       struct gfs_log_element *le)
-{
-	struct gfs_unlinked *ul = container_of(le,
-					       struct gfs_unlinked,
-					       ul_new_le);
-	int n = !!test_bit(ULF_NEW_UL, &ul->ul_flags);
-	int i = !!test_bit(ULF_INCORE_UL, &ul->ul_flags);
-
-	if (ul->ul_incore_le.le_trans) {
-		gfs_assert(sdp, ul->ul_incore_le.le_trans == tr,);
-		gfs_assert(sdp, n != i,);
-
-		ul->ul_incore_le.le_trans = NULL;
-		list_del_init(&ul->ul_incore_le.le_list);
-		gfs_unlinked_put(sdp, ul);
-
-		if (i) {
-			gfs_assert(sdp, tr->tr_num_iul,);
-			tr->tr_num_iul--;
-		} else {
-			gfs_assert(sdp, tr->tr_num_ida,);
-			tr->tr_num_ida--;
-		}
-	} else {
-		gfs_unlinked_hold(sdp, ul);
-		ul->ul_incore_le.le_trans = tr;
-		list_add(&ul->ul_incore_le.le_list, &tr->tr_elements);
-
-		if (n) {
-			set_bit(ULF_INCORE_UL, &ul->ul_flags);
-			if (tr != le->le_trans)
-				tr->tr_num_iul++;
-		} else {
-			clear_bit(ULF_INCORE_UL, &ul->ul_flags);
-			if (tr != le->le_trans)
-				tr->tr_num_ida++;
-		}
-	}
-
-	if (n) {
-		gfs_unlinked_hold(sdp, ul);
-		gfs_assert(sdp, !test_bit(ULF_IC_LIST, &ul->ul_flags),);
-		set_bit(ULF_IC_LIST, &ul->ul_flags);
-		atomic_inc(&sdp->sd_unlinked_ic_count);
-	} else {
-		gfs_assert(sdp, test_bit(ULF_IC_LIST, &ul->ul_flags),);
-		clear_bit(ULF_IC_LIST, &ul->ul_flags);
-		gfs_unlinked_put(sdp, ul);
-		gfs_assert(sdp, atomic_read(&sdp->sd_unlinked_ic_count),);
-		atomic_dec(&sdp->sd_unlinked_ic_count);
-	}
-
-	le->le_trans = NULL;
-	list_del_init(&le->le_list);
-	gfs_unlinked_put(sdp, ul);
-}
-
-/**
- * unlinked_add_to_ail - Add this LE to the AIL
- * @sdp: the filesystem
- * @le: the log element
- *
- */
-
-static void
-unlinked_add_to_ail(struct gfs_sbd *sdp, struct gfs_log_element *le)
-{
-	struct gfs_unlinked *ul = container_of(le,
-						struct gfs_unlinked,
-						ul_incore_le);
-	int i = !!test_bit(ULF_INCORE_UL, &ul->ul_flags);
-
-	if (i) {
-		gfs_unlinked_hold(sdp, ul);
-		gfs_assert(sdp, !test_bit(ULF_OD_LIST, &ul->ul_flags),);
-		set_bit(ULF_OD_LIST, &ul->ul_flags);
-		atomic_inc(&sdp->sd_unlinked_od_count);
-	} else {
-		gfs_assert(sdp, test_bit(ULF_OD_LIST, &ul->ul_flags),);
-		clear_bit(ULF_OD_LIST, &ul->ul_flags);
-		gfs_unlinked_put(sdp, ul);
-		gfs_assert(sdp, atomic_read(&sdp->sd_unlinked_od_count),);
-		atomic_dec(&sdp->sd_unlinked_od_count);
-	}
-
-	le->le_trans = NULL;
-	list_del_init(&le->le_list);
-	gfs_unlinked_put(sdp, ul);
-}
-
-/**
- * unlinked_clean_dump - clean up a LE after a log dump
- * @sdp: the filesystem
- * @le: the log element
- *
- */
-
-static void
-unlinked_clean_dump(struct gfs_sbd *sdp, struct gfs_log_element *le)
-{
-	le->le_trans = NULL;
-	list_del_init(&le->le_list);
-}
-
-/**
- * unlinked_trans_size - compute how much space the LE class takes up in a transaction
- * @sdp: the filesystem
- * @tr: the transaction
- * @mblks: the number of regular metadata blocks
- * @eblks: the number of extra blocks
- * @blocks: the number of log blocks
- * @bmem: the number of buffer-sized chunks of memory we need
- *
- */
-
-static void
-unlinked_trans_size(struct gfs_sbd *sdp, struct gfs_trans *tr,
-		    unsigned int *mblks, unsigned int *eblks,
-		    unsigned int *blocks, unsigned int *bmem)
-{
-	unsigned int ublks = 0;
-
-	if (tr->tr_num_iul)
-		ublks = gfs_struct2blk(sdp, tr->tr_num_iul,
-				       sizeof(struct gfs_inum));
-	if (tr->tr_num_ida)
-		ublks += gfs_struct2blk(sdp, tr->tr_num_ida,
-					sizeof(struct gfs_inum));
-
-	if (eblks)
-		*eblks += ublks;
-	if (blocks)
-		*blocks += ublks;
-	if (bmem)
-		*bmem += ublks;
-}
-
-/**
- * unlinked_trans_combine - combine two incore transactions
- * @sdp: the filesystem
- * @tr: the surviving transaction
- * @new_tr: the transaction that's going to disappear
- *
- */
-
-static void
-unlinked_trans_combine(struct gfs_sbd *sdp, struct gfs_trans *tr,
-		       struct gfs_trans *new_tr)
-{
-	tr->tr_num_iul += new_tr->tr_num_iul;
-	tr->tr_num_ida += new_tr->tr_num_ida;
-}
-
-/**
- * unlinked_build_bhlist - create the buffers that will make up the ondisk part of a transaction
- * @sdp: the filesystem
- * @tr: the transaction
- *
- * For unlinked and/or deallocated inode log elements (separately):
- *   Get a log block
- *   Create a log descriptor in beginning of that block
- *   Fill rest of block with gfs_inum structs to identify each inode
- *     that became unlinked/deallocated during this transaction.
- *   Get another log block if needed, continue filling with gfs_inums.
- */
-
-static void
-unlinked_build_bhlist(struct gfs_sbd *sdp, struct gfs_trans *tr)
-{
-	struct list_head *tmp, *head;
-	struct gfs_log_element *le;
-	struct gfs_unlinked *ul;
-	struct gfs_log_descriptor desc;
-	struct gfs_log_buf *lb;
-	unsigned int pass = 2;
-	unsigned int type, number;
-	unsigned int offset, entries;
-
-	/* 2 passes:  1st for Unlinked, 2nd for De-Alloced inodes,
-	     unless this is a log dump:  just 1 pass, for Unlinked */
-	while (pass--) {
-		if (tr->tr_flags & TRF_LOG_DUMP) {
-			if (pass) {
-				type = GFS_LOG_DESC_IUL;
-				number = tr->tr_num_iul;
-			} else
-				break;
-		} else {
-			if (pass) {
-				type = GFS_LOG_DESC_IUL;
-				number = tr->tr_num_iul;
-			} else {
-				type = GFS_LOG_DESC_IDA;
-				number = tr->tr_num_ida;
-			}
-
-			if (!number)
-				continue;
-		}
-
-		lb = gfs_log_get_buf(sdp, tr);
-
-		/* Header:  log descriptor */
-		memset(&desc, 0, sizeof(struct gfs_log_descriptor));
-		desc.ld_header.mh_magic = GFS_MAGIC;
-		desc.ld_header.mh_type = GFS_METATYPE_LD;
-		desc.ld_header.mh_format = GFS_FORMAT_LD;
-		desc.ld_type = type;
-		desc.ld_length = gfs_struct2blk(sdp, number, sizeof(struct gfs_inum));
-		desc.ld_data1 = (tr->tr_flags & TRF_LOG_DUMP) ? TRUE : FALSE;
-		gfs_desc_out(&desc, lb->lb_bh.b_data);
-
-		offset = sizeof(struct gfs_log_descriptor);
-		entries = 0;
-
-		/* Look through transaction's log elements for Unlinked LEs */
-		for (head = &tr->tr_elements, tmp = head->next;
-		     tmp != head;
-		     tmp = tmp->next) {
-			le = list_entry(tmp, struct gfs_log_element, le_list);
-			if (le->le_ops != &gfs_unlinked_lops)
-				continue;
-			if (tr->tr_flags & TRF_LOG_DUMP)
-				ul = container_of(le,
-						  struct gfs_unlinked,
-						  ul_ondisk_le);
-			else {
-				ul = container_of(le,
-						  struct gfs_unlinked,
-						  ul_incore_le);
-				if (!!test_bit(ULF_INCORE_UL, &ul->ul_flags) != pass)
-					continue;
-			}
-
-			if (offset + sizeof(struct gfs_inum) > sdp->sd_sb.sb_bsize) {
-				offset = 0;
-				lb = gfs_log_get_buf(sdp, tr);
-			}
-
-			/* Payload:  write the inode identifier */
-			gfs_inum_out(&ul->ul_inum,
-				     lb->lb_bh.b_data + offset);
-
-			offset += sizeof(struct gfs_inum);
-			entries++;
-		}
-
-		gfs_assert(sdp, entries == number,);
-	}
-}
-
-/**
- * unlinked_dump_size - compute how much space the LE class takes up in a log dump
- * @sdp: the filesystem
- * @elements: the number of log elements in the dump
- * @blocks: the number of blocks in the dump
- * @bmem: the number of buffer-sized chunks of memory we need
- *
- */
-
-static void
-unlinked_dump_size(struct gfs_sbd *sdp, unsigned int *elements,
-		   unsigned int *blocks, unsigned int *bmem)
-{
-	unsigned int c = atomic_read(&sdp->sd_unlinked_od_count);
-	unsigned int b = gfs_struct2blk(sdp, c, sizeof(struct gfs_inum));
-
-	if (elements)
-		*elements += c;
-	if (blocks)
-		*blocks += b;
-	if (bmem)
-		*bmem += b;
-}
-
-/**
- * unlinked_build_dump - create a transaction that represents a log dump for this LE class
- * @sdp: the filesystem
- * @tr: the transaction to fill
- *
- */
-
-static void
-unlinked_build_dump(struct gfs_sbd *sdp, struct gfs_trans *tr)
-{
-	struct list_head *tmp, *head;
-	struct gfs_unlinked *ul;
-	unsigned int x = 0;
-
-	tr->tr_num_iul = atomic_read(&sdp->sd_unlinked_od_count);
-
-	spin_lock(&sdp->sd_unlinked_lock);
-
-	for (head = &sdp->sd_unlinked_list, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		ul = list_entry(tmp, struct gfs_unlinked, ul_list);
-		if (!test_bit(ULF_OD_LIST, &ul->ul_flags))
-			continue;
-
-		gfs_assert(sdp, !ul->ul_ondisk_le.le_trans,);
-		ul->ul_ondisk_le.le_trans = tr;
-		list_add(&ul->ul_ondisk_le.le_list, &tr->tr_elements);
-
-		x++;
-	}
-
-	spin_unlock(&sdp->sd_unlinked_lock);
-
-	gfs_assert(sdp, x == atomic_read(&sdp->sd_unlinked_od_count),);
-}
-
-/**
- * unlinked_before_scan - called before a log dump is recovered
- * @sdp: the filesystem
- * @jid: the journal ID about to be scanned
- * @head: the current head of the log
- * @pass: the pass through the journal
- *
- */
-
-static void
-unlinked_before_scan(struct gfs_sbd *sdp, unsigned int jid,
-		     struct gfs_log_header *head, unsigned int pass)
-{
-	if (pass == GFS_RECPASS_B1)
-		clear_bit(SDF_FOUND_UL_DUMP, &sdp->sd_flags);
-}
-
-/**
- * unlinked_scan_elements - scan unlinked inodes from the journal
- * @sdp: the filesystem
- * @jdesc: the struct gfs_jindex structure for the journal being scaned
- * @gl: the journal's glock
- * @start: the starting block of the descriptor
- * @desc: the descriptor structure
- * @pass: the pass through the journal
- *
- * Returns: errno
- */
-
-static int
-unlinked_scan_elements(struct gfs_sbd *sdp, struct gfs_jindex *jdesc,
-		       struct gfs_glock *gl, uint64_t start,
-		       struct gfs_log_descriptor *desc, unsigned int pass)
-{
-	struct gfs_inum inum;
-	struct buffer_head *bh;
-	unsigned int offset = sizeof(struct gfs_log_descriptor);
-	unsigned int x;
-	int error;
-
-	if (pass != GFS_RECPASS_B1)
-		return 0;
-
-	switch (desc->ld_type) {
-	case GFS_LOG_DESC_IUL:
-		if (test_bit(SDF_FOUND_UL_DUMP, &sdp->sd_flags))
-			gfs_assert(sdp, !desc->ld_data1,);
-		else {
-			gfs_assert(sdp, desc->ld_data1,);
-			set_bit(SDF_FOUND_UL_DUMP, &sdp->sd_flags);
-		}
-		break;
-
-	case GFS_LOG_DESC_IDA:
-		gfs_assert(sdp, test_bit(SDF_FOUND_UL_DUMP, &sdp->sd_flags),);
-		break;
-
-	default:
-		return 0;
-	}
-
-	for (x = 0; x < desc->ld_length; x++) {
-		error = gfs_dread(gl, start, DIO_START | DIO_WAIT, &bh);
-		if (error)
-			return error;
-
-		for (;
-		     offset + sizeof(struct gfs_inum) <= sdp->sd_sb.sb_bsize;
-		     offset += sizeof(struct gfs_inum)) {
-			gfs_inum_in(&inum, bh->b_data + offset);
-
-			if (inum.no_addr)
-				gfs_unlinked_merge(sdp, desc->ld_type, &inum);
-		}
-
-		brelse(bh);
-
-		error = gfs_increment_blkno(sdp, jdesc, gl, &start, TRUE);
-		if (error)
-			return error;
-
-		offset = 0;
-	}
-
-	return 0;
-}
-
-/**
- * unlinked_after_scan - called after a log dump is recovered
- * @sdp: the filesystem
- * @jid: the journal ID about to be scanned
- * @pass: the pass through the journal
- *
- */
-
-static void
-unlinked_after_scan(struct gfs_sbd *sdp, unsigned int jid, unsigned int pass)
-{
-	if (pass == GFS_RECPASS_B1) {
-		gfs_assert(sdp, test_bit(SDF_FOUND_UL_DUMP, &sdp->sd_flags),);
-		printk("GFS: fsid=%s: Found %d unlinked inodes\n",
-		       sdp->sd_fsname, atomic_read(&sdp->sd_unlinked_ic_count));
-	}
-}
-
-/**
- * quota_print - print debug info about a log element
- * @sdp: the filesystem
- * @le: the log element
- * @where: is this a new transaction or a incore transaction
- *
- */
-
-static void
-quota_print(struct gfs_sbd *sdp, struct gfs_log_element *le, unsigned int where)
-{
-	struct gfs_quota_le *ql;
-
-	ql = container_of(le, struct gfs_quota_le, ql_le);
-	printk("  quota:  %s %u:  %"PRId64" blocks\n",
-	       (test_bit(QDF_USER, &ql->ql_data->qd_flags)) ? "user" : "group",
-	       ql->ql_data->qd_id, ql->ql_change);
-}
-
-/**
- * quota_incore_commit - commit this LE to the incore log
- * @sdp: the filesystem
- * @tr: the incore transaction this LE is a part of
- * @le: the log element
- *
- */
-
-static void
-quota_incore_commit(struct gfs_sbd *sdp, struct gfs_trans *tr,
-		    struct gfs_log_element *le)
-{
-	struct gfs_quota_le *ql = container_of(le, struct gfs_quota_le, ql_le);
-	struct gfs_quota_data *qd = ql->ql_data;
-
-	gfs_assert(sdp, ql->ql_change,);
-
-	/*  Make this change under the sd_quota_lock, so other processes
-	   checking qd_change_ic don't have to acquire the log lock.  */
-
-	spin_lock(&sdp->sd_quota_lock);
-	qd->qd_change_new -= ql->ql_change;
-	qd->qd_change_ic += ql->ql_change;
-	spin_unlock(&sdp->sd_quota_lock);
-
-	if (le->le_trans == tr)
-		list_add(&ql->ql_data_list, &qd->qd_le_list);
-	else {
-		struct list_head *tmp, *head;
-		struct gfs_quota_le *tmp_ql;
-		int found = FALSE;
-
-		for (head = &qd->qd_le_list, tmp = head->next;
-		     tmp != head;
-		     tmp = tmp->next) {
-			tmp_ql = list_entry(tmp, struct gfs_quota_le, ql_data_list);
-			if (tmp_ql->ql_le.le_trans != tr)
-				continue;
-
-			tmp_ql->ql_change += ql->ql_change;
-
-			list_del(&le->le_list);
-			gfs_quota_put(sdp, qd);
-			kfree(ql);
-
-			if (!tmp_ql->ql_change) {
-				list_del(&tmp_ql->ql_data_list);
-				list_del(&tmp_ql->ql_le.le_list);
-				gfs_quota_put(sdp, tmp_ql->ql_data);
-				kfree(tmp_ql);
-				tr->tr_num_q--;
-			}
-
-			found = TRUE;
-			break;
-		}
-
-		if (!found) {
-			le->le_trans = tr;
-			list_move(&le->le_list, &tr->tr_elements);
-			tr->tr_num_q++;
-			list_add(&ql->ql_data_list, &qd->qd_le_list);
-		}
-	}
-}
-
-/**
- * quota_add_to_ail - Add this LE to the AIL
- * @sdp: the filesystem
- * @le: the log element
- *
- */
-
-static void
-quota_add_to_ail(struct gfs_sbd *sdp, struct gfs_log_element *le)
-{
-	struct gfs_quota_le *ql = container_of(le, struct gfs_quota_le, ql_le);
-	struct gfs_quota_data *qd = ql->ql_data;
-
-	qd->qd_change_od += ql->ql_change;
-	if (qd->qd_change_od) {
-		if (!test_bit(QDF_OD_LIST, &qd->qd_flags)) {
-			gfs_quota_hold(sdp, qd);
-			set_bit(QDF_OD_LIST, &qd->qd_flags);
-			atomic_inc(&sdp->sd_quota_od_count);
-		}
-	} else {
-		gfs_assert(sdp, test_bit(QDF_OD_LIST, &qd->qd_flags),);
-		clear_bit(QDF_OD_LIST, &qd->qd_flags);
-		gfs_quota_put(sdp, qd);
-		gfs_assert(sdp, atomic_read(&sdp->sd_quota_od_count),);
-		atomic_dec(&sdp->sd_quota_od_count);
-	}
-
-	list_del(&ql->ql_data_list);
-	list_del(&le->le_list);
-	gfs_quota_put(sdp, qd);
-	kfree(ql);
-}
-
-/**
- * quota_clean_dump - clean up a LE after a log dump
- * @sdp: the filesystem
- * @le: the log element
- *
- */
-
-static void
-quota_clean_dump(struct gfs_sbd *sdp, struct gfs_log_element *le)
-{
-	le->le_trans = NULL;
-	list_del_init(&le->le_list);
-}
-
-/**
- * quota_trans_size - compute how much space the LE class takes up in a transaction
- * @sdp: the filesystem
- * @tr: the transaction
- * @mblks: the number of regular metadata blocks
- * @eblks: the number of extra blocks
- * @blocks: the number of log blocks
- * @bmem: the number of buffer-sized chunks of memory we need
- *
- */
-
-static void
-quota_trans_size(struct gfs_sbd *sdp, struct gfs_trans *tr,
-		 unsigned int *mblks, unsigned int *eblks,
-		 unsigned int *blocks, unsigned int *bmem)
-{
-	unsigned int qblks;
-
-	if (tr->tr_num_q) {
-		qblks = gfs_struct2blk(sdp, tr->tr_num_q,
-				       sizeof(struct gfs_quota_tag));
-
-		if (eblks)
-			*eblks += qblks;
-		if (blocks)
-			*blocks += qblks;
-		if (bmem)
-			*bmem += qblks;
-	}
-}
-
-/**
- * quota_trans_combine - combine two incore transactions
- * @sdp: the filesystem
- * @tr: the surviving transaction
- * @new_tr: the transaction that's going to disappear
- *
- */
-
-static void
-quota_trans_combine(struct gfs_sbd *sdp, struct gfs_trans *tr,
-		    struct gfs_trans *new_tr)
-{
-	tr->tr_num_q += new_tr->tr_num_q;
-}
-
-/**
- * quota_build_bhlist - create the buffers that will make up the ondisk part of a transaction
- * @sdp: the filesystem
- * @tr: the transaction
- *
- */
-
-static void
-quota_build_bhlist(struct gfs_sbd *sdp, struct gfs_trans *tr)
-{
-	struct list_head *tmp, *head;
-	struct gfs_log_element *le;
-	struct gfs_quota_le *ql;
-	struct gfs_log_descriptor desc;
-	struct gfs_quota_tag tag;
-	struct gfs_log_buf *lb;
-	unsigned int offset = sizeof(struct gfs_log_descriptor), entries = 0;
-
-	if (!tr->tr_num_q && !(tr->tr_flags & TRF_LOG_DUMP))
-		return;
-
-	lb = gfs_log_get_buf(sdp, tr);
-
-	memset(&desc, 0, sizeof(struct gfs_log_descriptor));
-	desc.ld_header.mh_magic = GFS_MAGIC;
-	desc.ld_header.mh_type = GFS_METATYPE_LD;
-	desc.ld_header.mh_format = GFS_FORMAT_LD;
-	desc.ld_type = GFS_LOG_DESC_Q;
-	desc.ld_length = gfs_struct2blk(sdp, tr->tr_num_q,
-					sizeof(struct gfs_quota_tag));
-	desc.ld_data1 = tr->tr_num_q;
-	desc.ld_data2 = (tr->tr_flags & TRF_LOG_DUMP) ? TRUE : FALSE;
-	gfs_desc_out(&desc, lb->lb_bh.b_data);
-
-	for (head = &tr->tr_elements, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		le = list_entry(tmp, struct gfs_log_element, le_list);
-		if (le->le_ops != &gfs_quota_lops)
-			continue;
-
-		ql = container_of(le, struct gfs_quota_le, ql_le);
-
-		if (offset + sizeof(struct gfs_quota_tag) >
-		    sdp->sd_sb.sb_bsize) {
-			offset = 0;
-			lb = gfs_log_get_buf(sdp, tr);
-		}
-
-		memset(&tag, 0, sizeof(struct gfs_quota_tag));
-		tag.qt_change = ql->ql_change;
-		tag.qt_flags = (test_bit(QDF_USER, &ql->ql_data->qd_flags)) ?
-			GFS_QTF_USER : 0;
-		tag.qt_id = ql->ql_data->qd_id;
-
-		gfs_quota_tag_out(&tag, lb->lb_bh.b_data + offset);
-
-		offset += sizeof(struct gfs_quota_tag);
-		entries++;
-	}
-
-	gfs_assert(sdp, entries == tr->tr_num_q,);
-}
-
-/**
- * quota_dump_size - compute how much space the LE class takes up in a log dump
- * @sdp: the filesystem
- * @elements: the number of log elements in the dump
- * @blocks: the number of blocks in the dump
- * @bmem: the number of buffer-sized chunks of memory we need
- *
- */
-
-static void
-quota_dump_size(struct gfs_sbd *sdp, unsigned int *elements,
-		unsigned int *blocks, unsigned int *bmem)
-{
-	unsigned int c = atomic_read(&sdp->sd_quota_od_count);
-	unsigned int b = gfs_struct2blk(sdp, c, sizeof(struct gfs_quota_tag));
-
-	if (elements)
-		*elements += c;
-	if (blocks)
-		*blocks += b;
-	if (bmem)
-		*bmem += b;
-}
-
-/**
- * quota_build_dump - create a transaction that represents a log dump for this LE class
- * @sdp: the filesystem
- * @tr: the transaction to fill
- *
- */
-
-static void
-quota_build_dump(struct gfs_sbd *sdp, struct gfs_trans *tr)
-{
-	struct list_head *tmp, *head;
-	struct gfs_quota_data *qd;
-	struct gfs_quota_le *ql;
-	unsigned int x = 0;
-
-	tr->tr_num_q = atomic_read(&sdp->sd_quota_od_count);
-
-	spin_lock(&sdp->sd_quota_lock);
-
-	for (head = &sdp->sd_quota_list, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		qd = list_entry(tmp, struct gfs_quota_data, qd_list);
-		if (!test_bit(QDF_OD_LIST, &qd->qd_flags))
-			continue;
-
-		ql = &qd->qd_ondisk_ql;
-
-		ql->ql_le.le_ops = &gfs_quota_lops;
-		gfs_assert(sdp, !ql->ql_le.le_trans,);
-		ql->ql_le.le_trans = tr;
-		list_add(&ql->ql_le.le_list, &tr->tr_elements);
-
-		ql->ql_data = qd;
-		ql->ql_change = qd->qd_change_od;
-
-		x++;
-	}
-
-	spin_unlock(&sdp->sd_quota_lock);
-
-	gfs_assert(sdp, x == atomic_read(&sdp->sd_quota_od_count),);
-}
-
-/**
- * quota_before_scan - called before a log dump is recovered
- * @sdp: the filesystem
- * @jid: the journal ID about to be scanned
- * @head: the current head of the log
- * @pass: the pass through the journal
- *
- */
-
-static void
-quota_before_scan(struct gfs_sbd *sdp, unsigned int jid,
-		  struct gfs_log_header *head, unsigned int pass)
-{
-	if (pass == GFS_RECPASS_B1)
-		clear_bit(SDF_FOUND_Q_DUMP, &sdp->sd_flags);
-}
-
-/**
- * quota_scan_elements - scan quota inodes from the journal
- * @sdp: the filesystem
- * @jdesc: the struct gfs_jindex structure for the journal being scaned
- * @gl: the journal's glock
- * @start: the starting block of the descriptor
- * @desc: the descriptor structure
- * @pass: the pass through the journal
- *
- * Returns: errno
- */
-
-static int
-quota_scan_elements(struct gfs_sbd *sdp, struct gfs_jindex *jdesc,
-		    struct gfs_glock *gl, uint64_t start,
-		    struct gfs_log_descriptor *desc, unsigned int pass)
-{
-	struct gfs_quota_tag tag;
-	struct buffer_head *bh;
-	unsigned int num_tags = desc->ld_data1;
-	unsigned int offset = sizeof(struct gfs_log_descriptor);
-	unsigned int x;
-	int error;
-
-	if (pass != GFS_RECPASS_B1)
-		return 0;
-	if (desc->ld_type != GFS_LOG_DESC_Q)
-		return 0;
-
-	if (test_bit(SDF_FOUND_Q_DUMP, &sdp->sd_flags))
-		gfs_assert(sdp, !desc->ld_data2,);
-	else {
-		gfs_assert(sdp, desc->ld_data2,);
-		set_bit(SDF_FOUND_Q_DUMP, &sdp->sd_flags);
-	}
-
-	if (!num_tags)
-		return 0;
-
-	for (x = 0; x < desc->ld_length; x++) {
-		error = gfs_dread(gl, start, DIO_START | DIO_WAIT, &bh);
-		if (error)
-			return error;
-
-		while (offset + sizeof(struct gfs_quota_tag) <=
-		       sdp->sd_sb.sb_bsize) {
-			gfs_quota_tag_in(&tag, bh->b_data + offset);
-
-			error = gfs_quota_merge(sdp, &tag);
-			if (error)
-				goto out_drelse;
-
-			if (!--num_tags)
-				goto out_drelse;
-
-			offset += sizeof(struct gfs_quota_tag);
-		}
-
-		brelse(bh);
-
-		error = gfs_increment_blkno(sdp, jdesc, gl, &start, TRUE);
-		if (error)
-			return error;
-
-		offset = 0;
-	}
-
-	return 0;
-
- out_drelse:
-	brelse(bh);
-
-	return error;
-}
-
-/**
- * quota_after_scan - called after a log dump is recovered
- * @sdp: the filesystem
- * @jid: the journal ID about to be scanned
- * @pass: the pass through the journal
- *
- */
-
-static void
-quota_after_scan(struct gfs_sbd *sdp, unsigned int jid, unsigned int pass)
-{
-	if (pass == GFS_RECPASS_B1) {
-		gfs_assert(sdp, !sdp->sd_sb.sb_quota_di.no_formal_ino ||
-			   test_bit(SDF_FOUND_Q_DUMP, &sdp->sd_flags),);
-		printk("GFS: fsid=%s: Found quota changes for %d IDs\n",
-		       sdp->sd_fsname, atomic_read(&sdp->sd_quota_od_count));
-	}
-}
-
-struct gfs_log_operations gfs_glock_lops = {
-	.lo_add = generic_le_add,
-	.lo_trans_end = glock_trans_end,
-	.lo_print = glock_print,
-	.lo_overlap_trans = glock_overlap_trans,
-	.lo_incore_commit = glock_incore_commit,
-	.lo_add_to_ail = glock_add_to_ail,
-	.lo_trans_combine = glock_trans_combine,
-	.lo_name = "glock"
-};
-
-struct gfs_log_operations gfs_buf_lops = {
-	.lo_add = generic_le_add,
-	.lo_print = buf_print,
-	.lo_incore_commit = buf_incore_commit,
-	.lo_add_to_ail = buf_add_to_ail,
-	.lo_trans_size = buf_trans_size,
-	.lo_trans_combine = buf_trans_combine,
-	.lo_build_bhlist = buf_build_bhlist,
-	.lo_before_scan = buf_before_scan,
-	.lo_scan_elements = buf_scan_elements,
-	.lo_after_scan = buf_after_scan,
-	.lo_name = "buf"
-};
-
-struct gfs_log_operations gfs_unlinked_lops = {
-	.lo_add = generic_le_add,
-	.lo_print = unlinked_print,
-	.lo_incore_commit = unlinked_incore_commit,
-	.lo_add_to_ail = unlinked_add_to_ail,
-	.lo_clean_dump = unlinked_clean_dump,
-	.lo_trans_size = unlinked_trans_size,
-	.lo_trans_combine = unlinked_trans_combine,
-	.lo_build_bhlist = unlinked_build_bhlist,
-	.lo_dump_size = unlinked_dump_size,
-	.lo_build_dump = unlinked_build_dump,
-	.lo_before_scan = unlinked_before_scan,
-	.lo_scan_elements = unlinked_scan_elements,
-	.lo_after_scan = unlinked_after_scan,
-	.lo_name = "unlinked"
-};
-
-struct gfs_log_operations gfs_quota_lops = {
-	.lo_add = generic_le_add,
-	.lo_print = quota_print,
-	.lo_incore_commit = quota_incore_commit,
-	.lo_add_to_ail = quota_add_to_ail,
-	.lo_clean_dump = quota_clean_dump,
-	.lo_trans_size = quota_trans_size,
-	.lo_trans_combine = quota_trans_combine,
-	.lo_build_bhlist = quota_build_bhlist,
-	.lo_dump_size = quota_dump_size,
-	.lo_build_dump = quota_build_dump,
-	.lo_before_scan = quota_before_scan,
-	.lo_scan_elements = quota_scan_elements,
-	.lo_after_scan = quota_after_scan,
-	.lo_name = "quota"
-};
-
-struct gfs_log_operations *gfs_log_ops[] = {
-	&gfs_glock_lops,
-	&gfs_buf_lops,
-	&gfs_unlinked_lops,
-	&gfs_quota_lops,
-	NULL
-};
diff --git a/gfs-kernel/src/gfs/lops.h b/gfs-kernel/src/gfs/lops.h
deleted file mode 100644
index 2b752f1..0000000
--- a/gfs-kernel/src/gfs/lops.h
+++ /dev/null
@@ -1,166 +0,0 @@
-#ifndef __LOPS_DOT_H__
-#define __LOPS_DOT_H__
-
-extern struct gfs_log_operations gfs_glock_lops;
-extern struct gfs_log_operations gfs_buf_lops;
-extern struct gfs_log_operations gfs_unlinked_lops;
-extern struct gfs_log_operations gfs_quota_lops;
-
-extern struct gfs_log_operations *gfs_log_ops[];
-
-#define INIT_LE(le, lops) \
-do \
-{ \
-  (le)->le_ops = (lops); \
-  (le)->le_trans = NULL; \
-  INIT_LIST_HEAD(&(le)->le_list); \
-} \
-while (0)
-
-#define LO_ADD(sdp, le) \
-do \
-{ \
-  if ((le)->le_ops->lo_add) \
-    (le)->le_ops->lo_add((sdp), (le)); \
-} \
-while (0)
-
-#define LO_TRANS_END(sdp, le) \
-do \
-{ \
-  if ((le)->le_ops->lo_trans_end) \
-    (le)->le_ops->lo_trans_end((sdp), (le)); \
-} \
-while (0)
-
-#define LO_PRINT(sdp, le, where) \
-do \
-{ \
-  if ((le)->le_ops->lo_print) \
-    (le)->le_ops->lo_print((sdp), (le), (where)); \
-} \
-while (0)
-
-static __inline__ struct gfs_trans *
-LO_OVERLAP_TRANS(struct gfs_sbd *sdp, struct gfs_log_element *le)
-{
-	if (le->le_ops->lo_overlap_trans)
-		return le->le_ops->lo_overlap_trans(sdp, le);
-	else
-		return NULL;
-}
-
-#define LO_INCORE_COMMIT(sdp, tr, le) \
-do \
-{ \
-  if ((le)->le_ops->lo_incore_commit) \
-    (le)->le_ops->lo_incore_commit((sdp), (tr), (le)); \
-} \
-while (0)
-
-#define LO_ADD_TO_AIL(sdp, le) \
-do \
-{ \
-  if ((le)->le_ops->lo_add_to_ail) \
-    (le)->le_ops->lo_add_to_ail((sdp), (le)); \
-} \
-while (0)
-
-#define LO_CLEAN_DUMP(sdp, le) \
-do \
-{ \
-  if ((le)->le_ops->lo_clean_dump) \
-    (le)->le_ops->lo_clean_dump((sdp), (le)); \
-} \
-while (0)
-
-#define LO_TRANS_SIZE(sdp, tr, mblks, eblks, blocks, bmem) \
-do \
-{ \
-  int __lops_x; \
-  for (__lops_x = 0; gfs_log_ops[__lops_x]; __lops_x++) \
-    if (gfs_log_ops[__lops_x]->lo_trans_size) \
-      gfs_log_ops[__lops_x]->lo_trans_size((sdp), (tr), (mblks), (eblks), (blocks), (bmem)); \
-} \
-while (0)
-
-#define LO_TRANS_COMBINE(sdp, tr, new_tr) \
-do \
-{ \
-  int __lops_x; \
-  for (__lops_x = 0; gfs_log_ops[__lops_x]; __lops_x++) \
-    if (gfs_log_ops[__lops_x]->lo_trans_combine) \
-      gfs_log_ops[__lops_x]->lo_trans_combine((sdp), (tr), (new_tr)); \
-} \
-while (0)
-
-#define LO_BUILD_BHLIST(sdp, tr) \
-do \
-{ \
-  int __lops_x; \
-  for (__lops_x = 0; gfs_log_ops[__lops_x]; __lops_x++) \
-    if (gfs_log_ops[__lops_x]->lo_build_bhlist) \
-      gfs_log_ops[__lops_x]->lo_build_bhlist((sdp), (tr)); \
-} \
-while (0)
-
-#define LO_DUMP_SIZE(sdp, elements, blocks, bmem) \
-do \
-{ \
-  int __lops_x; \
-  for (__lops_x = 0; gfs_log_ops[__lops_x]; __lops_x++) \
-    if (gfs_log_ops[__lops_x]->lo_dump_size) \
-      gfs_log_ops[__lops_x]->lo_dump_size((sdp), (elements), (blocks), (bmem)); \
-} \
-while (0)
-
-#define LO_BUILD_DUMP(sdp, tr) \
-do \
-{ \
-  int __lops_x; \
-  for (__lops_x = 0; gfs_log_ops[__lops_x]; __lops_x++) \
-    if (gfs_log_ops[__lops_x]->lo_build_dump) \
-      gfs_log_ops[__lops_x]->lo_build_dump((sdp), (tr)); \
-} \
-while (0)
-
-#define LO_BEFORE_SCAN(sdp, jid, head, pass) \
-do \
-{ \
-  int __lops_x; \
-  for (__lops_x = 0; gfs_log_ops[__lops_x]; __lops_x++) \
-    if (gfs_log_ops[__lops_x]->lo_before_scan) \
-      gfs_log_ops[__lops_x]->lo_before_scan((sdp), (jid), (head), (pass)); \
-} \
-while (0)
-
-static __inline__ int
-LO_SCAN_ELEMENTS(struct gfs_sbd *sdp, struct gfs_jindex *jdesc,
-		 struct gfs_glock *gl, uint64_t start,
-		 struct gfs_log_descriptor *desc, unsigned int pass)
-{
-	int x;
-	int error;
-
-	for (x = 0; gfs_log_ops[x]; x++)
-		if (gfs_log_ops[x]->lo_scan_elements) {
-			error = gfs_log_ops[x]->lo_scan_elements(sdp, jdesc, gl,
-								 start, desc, pass);
-			if (error)
-				return error;
-		}
-
-	return 0;
-}
-
-#define LO_AFTER_SCAN(sdp, jid, pass) \
-do \
-{ \
-  int __lops_x; \
-  for (__lops_x = 0; gfs_log_ops[__lops_x]; __lops_x++) \
-    if (gfs_log_ops[__lops_x]->lo_after_scan) \
-      gfs_log_ops[__lops_x]->lo_after_scan((sdp), (jid), (pass)); \
-} \
-while (0)
-
-#endif /* __LOPS_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/lvb.c b/gfs-kernel/src/gfs/lvb.c
deleted file mode 100644
index 41fc26f..0000000
--- a/gfs-kernel/src/gfs/lvb.c
+++ /dev/null
@@ -1,135 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-
-#include "gfs.h"
-
-#define pv(struct, member, fmt) printk("  "#member" = "fmt"\n", struct->member);
-
-#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) = gfs16_to_cpu((s2->member));}
-#define CPOUT_16(s1, s2, member) {(s2->member) = cpu_to_gfs16((s1->member));}
-#define CPIN_32(s1, s2, member) {(s1->member) = gfs32_to_cpu((s2->member));}
-#define CPOUT_32(s1, s2, member) {(s2->member) = cpu_to_gfs32((s1->member));}
-#define CPIN_64(s1, s2, member) {(s1->member) = gfs64_to_cpu((s2->member));}
-#define CPOUT_64(s1, s2, member) {(s2->member) = cpu_to_gfs64((s1->member));}
-
-/**
- * gfs_rgrp_lvb_in - Read in rgrp data
- * @rb: the cpu-order structure
- * @lvb: the lvb
- *
- */
-
-void
-gfs_rgrp_lvb_in(struct gfs_rgrp_lvb *rb, char *lvb)
-{
-	struct gfs_rgrp_lvb *str = (struct gfs_rgrp_lvb *)lvb;
-
-	CPIN_32(rb, str, rb_magic);
-	CPIN_32(rb, str, rb_free);
-	CPIN_32(rb, str, rb_useddi);
-	CPIN_32(rb, str, rb_freedi);
-	CPIN_32(rb, str, rb_usedmeta);
-	CPIN_32(rb, str, rb_freemeta);
-}
-
-/**
- * gfs_rgrp_lvb_out - Write out rgrp data
- * @rb: the cpu-order structure
- * @lvb: the lvb
- *
- */
-
-void
-gfs_rgrp_lvb_out(struct gfs_rgrp_lvb *rb, char *lvb)
-{
-	struct gfs_rgrp_lvb *str = (struct gfs_rgrp_lvb *)lvb;
-
-	CPOUT_32(rb, str, rb_magic);
-	CPOUT_32(rb, str, rb_free);
-	CPOUT_32(rb, str, rb_useddi);
-	CPOUT_32(rb, str, rb_freedi);
-	CPOUT_32(rb, str, rb_usedmeta);
-	CPOUT_32(rb, str, rb_freemeta);
-}
-
-/**
- * gfs_rgrp_lvb_print - Print out rgrp data
- * @rb: the cpu-order structure
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- */
-
-void
-gfs_rgrp_lvb_print(struct gfs_rgrp_lvb *rb)
-{
-	pv(rb, rb_magic, "%u");
-	pv(rb, rb_free, "%u");
-	pv(rb, rb_useddi, "%u");
-	pv(rb, rb_freedi, "%u");
-	pv(rb, rb_usedmeta, "%u");
-	pv(rb, rb_freemeta, "%u");
-}
-
-/**
- * gfs_quota_lvb_in - Read in quota data
- * @rb: the cpu-order structure
- * @lvb: the lvb
- *
- */
-
-void
-gfs_quota_lvb_in(struct gfs_quota_lvb *qb, char *lvb)
-{
-	struct gfs_quota_lvb *str = (struct gfs_quota_lvb *)lvb;
-
-	CPIN_32(qb, str, qb_magic);
-	CPIN_32(qb, str, qb_pad);
-	CPIN_64(qb, str, qb_limit);
-	CPIN_64(qb, str, qb_warn);
-	CPIN_64(qb, str, qb_value);
-}
-
-/**
- * gfs_quota_lvb_out - Write out quota data
- * @rb: the cpu-order structure
- * @lvb: the lvb
- *
- */
-
-void
-gfs_quota_lvb_out(struct gfs_quota_lvb *qb, char *lvb)
-{
-	struct gfs_quota_lvb *str = (struct gfs_quota_lvb *)lvb;
-
-	CPOUT_32(qb, str, qb_magic);
-	CPOUT_32(qb, str, qb_pad);
-	CPOUT_64(qb, str, qb_limit);
-	CPOUT_64(qb, str, qb_warn);
-	CPOUT_64(qb, str, qb_value);
-}
-
-/**
- * gfs_quota_lvb_print - Print out quota data
- * @rb: the cpu-order structure
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- */
-
-void
-gfs_quota_lvb_print(struct gfs_quota_lvb *qb)
-{
-	pv(qb, qb_magic, "%u");
-	pv(qb, qb_pad, "%u");
-	pv(qb, qb_limit, "%"PRIu64);
-	pv(qb, qb_warn, "%"PRIu64);
-	pv(qb, qb_value, "%"PRId64);
-}
diff --git a/gfs-kernel/src/gfs/lvb.h b/gfs-kernel/src/gfs/lvb.h
deleted file mode 100644
index e729491..0000000
--- a/gfs-kernel/src/gfs/lvb.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Formats of Lock Value Blocks (LVBs) for various types of locks.
- * These 32-bit data chunks can be shared quickly between nodes
- *   via the inter-node lock manager (via LAN instead of on-disk).
- */
-
-#ifndef __LVB_DOT_H__
-#define __LVB_DOT_H__
-
-#define GFS_MIN_LVB_SIZE (32)
-
-/*
- * Resource Group block allocation statistics
- * Each resource group lock contains one of these in its LVB.
- * Used for sharing approximate current statistics for statfs.
- * Not used for actual block allocation.
- */
-struct gfs_rgrp_lvb {
-	uint32_t rb_magic;      /* GFS_MAGIC sanity check value */
-	uint32_t rb_free;       /* # free data blocks */
-	uint32_t rb_useddi;     /* # used dinode blocks */
-	uint32_t rb_freedi;     /* # free dinode blocks */
-	uint32_t rb_usedmeta;   /* # used metadata blocks */
-	uint32_t rb_freemeta;   /* # free metadata blocks */
-};
-
-/*
- * Quota
- * Each quota lock contains one of these in its LVB.
- * Keeps track of block allocation limits and current block allocation
- *   for either a cluster-wide user or a cluster-wide group.
- */
-struct gfs_quota_lvb {
-	uint32_t qb_magic;      /* GFS_MAGIC sanity check value */
-	uint32_t qb_pad;
-	uint64_t qb_limit;      /* Hard limit of # blocks to alloc */
-	uint64_t qb_warn;       /* Warn user when alloc is above this # */
-	int64_t qb_value;       /* Current # blocks allocated */
-};
-
-/*  Translation functions  */
-
-void gfs_rgrp_lvb_in(struct gfs_rgrp_lvb *rb, char *lvb);
-void gfs_rgrp_lvb_out(struct gfs_rgrp_lvb *rb, char *lvb);
-void gfs_quota_lvb_in(struct gfs_quota_lvb *qb, char *lvb);
-void gfs_quota_lvb_out(struct gfs_quota_lvb *qb, char *lvb);
-
-/*  Printing functions  */
-
-void gfs_rgrp_lvb_print(struct gfs_rgrp_lvb *rb);
-void gfs_quota_lvb_print(struct gfs_quota_lvb *qb);
-
-#endif /* __LVB_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/main.c b/gfs-kernel/src/gfs/main.c
deleted file mode 100644
index 16b520b..0000000
--- a/gfs-kernel/src/gfs/main.c
+++ /dev/null
@@ -1,134 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <linux/proc_fs.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/time.h>
-
-#include "gfs.h"
-#include "ops_fstype.h"
-#include "sys.h"
-#include "proc.h"
-
-/**
- * init_gfs_fs - Register GFS as a filesystem
- *
- * Returns: 0 on success, error code on failure
- */
-
-int __init init_gfs_fs(void)
-{
-	int error;
-	struct timespec tv;
-
-/*	gfs2_init_lmh(); gfs2 should do this for us*/
-
-	error = gfs_sys_init();
-	if (error)
-		return error;
-	error = gfs_proc_init();
-	if (error)
-		goto fail;
-
-	getnstimeofday(&tv);
-	gfs_random_number = tv.tv_nsec;
-
-	gfs_glock_cachep = kmem_cache_create("gfs_glock", sizeof(struct gfs_glock),
-					     0, 0,
-					     NULL);
-	gfs_inode_cachep = NULL;
-	gfs_bufdata_cachep = NULL;
-	gfs_mhc_cachep = NULL;
-	error = -ENOMEM;
-	if (!gfs_glock_cachep)
-		goto fail1;
-
-	gfs_inode_cachep = kmem_cache_create("gfs_inode", sizeof(struct gfs_inode),
-					     0, 0,
-					     NULL);
-	if (!gfs_inode_cachep)
-		goto fail1;
-
-	gfs_bufdata_cachep = kmem_cache_create("gfs_bufdata", sizeof(struct gfs_bufdata),
-					       0, 0,
-					       NULL);
-	if (!gfs_bufdata_cachep)
-		goto fail1;
-
-	gfs_mhc_cachep = kmem_cache_create("gfs_meta_header_cache", sizeof(struct gfs_meta_header_cache),
-					   0, 0,
-					   NULL);
-	if (!gfs_mhc_cachep)
-		goto fail;
-
-	error = register_filesystem(&gfs_fs_type);
-	if (error)
-		goto fail;
-
-	printk("GFS %s (built %s %s) installed\n",
-	       RELEASE_VERSION, __DATE__, __TIME__);
-
-	error = init_lock_dlm();
-	if (error)
-		goto fail1;
-
-	error = init_nolock();
-	if (error)
-		goto fail1;
-
-	return 0;
-
- fail1:
-	if (gfs_mhc_cachep)
-		kmem_cache_destroy(gfs_mhc_cachep);
-
-	if (gfs_bufdata_cachep)
-		kmem_cache_destroy(gfs_bufdata_cachep);
-
-	if (gfs_inode_cachep)
-		kmem_cache_destroy(gfs_inode_cachep);
-
-	if (gfs_glock_cachep)
-		kmem_cache_destroy(gfs_glock_cachep);
-
-	gfs_proc_uninit();
-	
- fail:
-	gfs_sys_uninit();
-
-	return error;
-}
-
-/**
- * exit_gfs_fs - Unregister the file system
- *
- */
-
-void __exit
-exit_gfs_fs(void)
-{
-	exit_nolock();
-	exit_lock_dlm();
-	unregister_filesystem(&gfs_fs_type);
-
-	kmem_cache_destroy(gfs_mhc_cachep);
-	kmem_cache_destroy(gfs_bufdata_cachep);
-	kmem_cache_destroy(gfs_inode_cachep);
-	kmem_cache_destroy(gfs_glock_cachep);
-
-	gfs_proc_uninit();
-	gfs_sys_uninit();
-}
-
-MODULE_DESCRIPTION("Global File System " RELEASE_VERSION);
-MODULE_AUTHOR("Red Hat, Inc.");
-MODULE_LICENSE("GPL");
-
-module_init(init_gfs_fs);
-module_exit(exit_gfs_fs);
-
diff --git a/gfs-kernel/src/gfs/mount.c b/gfs-kernel/src/gfs/mount.c
deleted file mode 100644
index 534b911..0000000
--- a/gfs-kernel/src/gfs/mount.c
+++ /dev/null
@@ -1,166 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-
-#include "gfs.h"
-#include "mount.h"
-#include "proc.h"
-#include "sys.h"
-
-/**
- * gfs_make_args - Parse mount arguments
- * @data:
- * @args:
- *
- * Return: errno
- */
-
-int
-gfs_make_args(char *data_arg, struct gfs_args *args, int remount)
-{
-	char *data = data_arg;
-	char *options, *x, *y;
-	int error = 0;
-
-	/*  If someone preloaded options, use those instead  */
-
-	spin_lock(&gfs_proc_margs_lock);
-	if (!remount && gfs_proc_margs) {
-		data = gfs_proc_margs;
-		gfs_proc_margs = NULL;
-	}
-	spin_unlock(&gfs_proc_margs_lock);
-
-	/*  Set some defaults  */
-
-	memset(args, 0, sizeof(struct gfs_args));
-	args->ar_num_glockd = GFS_GLOCKD_DEFAULT;
-
-	if (!remount) {
-		/*  If someone preloaded options, use those instead  */
-		spin_lock(&gfs_sys_margs_lock);
-		if (gfs_sys_margs) {
-			data = gfs_sys_margs;
-			gfs_sys_margs = NULL;
-		}
-		spin_unlock(&gfs_sys_margs_lock);
-		
-		/*  Set some defaults  */
-		args->ar_num_glockd = GFS_GLOCKD_DEFAULT;
-	}
-
-	/*  Split the options into tokens with the "," character and
-	    process them  */
-
-	for (options = data; (x = strsep(&options, ",")); ) {
-		if (!*x)
-			continue;
-
-		y = strchr(x, '=');
-		if (y)
-			*y++ = 0;
-
-		if (!strcmp(x, "lockproto")) {
-			if (!y) {
-				printk("GFS: need argument to lockproto\n");
-				error = -EINVAL;
-				break;
-			}
-			strncpy(args->ar_lockproto, y, GFS_LOCKNAME_LEN);
-			args->ar_lockproto[GFS_LOCKNAME_LEN - 1] = 0;
-		}
-
-		else if (!strcmp(x, "locktable")) {
-			if (!y) {
-				printk("GFS: need argument to locktable\n");
-				error = -EINVAL;
-				break;
-			}
-			strncpy(args->ar_locktable, y, GFS_LOCKNAME_LEN);
-			args->ar_locktable[GFS_LOCKNAME_LEN - 1] = 0;
-		}
-
-		else if (!strcmp(x, "hostdata")) {
-			if (!y) {
-				printk("GFS: need argument to hostdata\n");
-				error = -EINVAL;
-				break;
-			}
-			strncpy(args->ar_hostdata, y, GFS_LOCKNAME_LEN);
-			args->ar_hostdata[GFS_LOCKNAME_LEN - 1] = 0;
-		}
-
-		else if (!strcmp(x, "spectator"))
-			args->ar_spectator = TRUE;
-
-		else if (!strcmp(x, "ignore_local_fs"))
-			args->ar_ignore_local_fs = TRUE;
-
-		else if (!strcmp(x, "localflocks"))
-			args->ar_localflocks = TRUE;
-
-		else if (!strcmp(x, "localcaching"))
-			args->ar_localcaching = TRUE;
-
-		else if (!strcmp(x, "oopses_ok"))
-			args->ar_oopses_ok = TRUE;
-
-		else if (!strcmp(x, "debug")) {
-			args->ar_oopses_ok = TRUE;
-			args->ar_debug = TRUE;
-
-		} else if (!strcmp(x, "upgrade"))
-			args->ar_upgrade = TRUE;
-
-		else if (!strcmp(x, "num_glockd")) {
-			if (!y) {
-				printk("GFS: need argument to num_glockd\n");
-				error = -EINVAL;
-				break;
-			}
-			sscanf(y, "%u", &args->ar_num_glockd);
-			if (!args->ar_num_glockd || args->ar_num_glockd > GFS_GLOCKD_MAX) {
-				printk("GFS: 0 < num_glockd <= %u  (not %u)\n",
-				       GFS_GLOCKD_MAX, args->ar_num_glockd);
-				error = -EINVAL;
-				break;
-			}
-		}
-
-		else if (!strcmp(x, "acl"))
-			args->ar_posix_acls = TRUE;
-
-		else if (!strcmp(x, "noacl"))
-			args->ar_posix_acls = FALSE;
-
-		else if (!strcmp(x, "suiddir"))
-			args->ar_suiddir = TRUE;
-
-		else if (!strcmp(x, "noquota"))
-			args->ar_noquota = TRUE;
-
-		else if (!strcmp(x, "gfs_noatime"))
-			args->ar_noatime = TRUE;
-
-		/*  Unknown  */
-
-		else {
-			printk("GFS: unknown option: %s\n", x);
-			error = -EINVAL;
-			break;
-		}
-	}
-
-	if (error)
-		printk("GFS: invalid mount option(s)\n");
-
-	if (data != data_arg)
-		kfree(data);
-
-	return error;
-}
-
diff --git a/gfs-kernel/src/gfs/mount.h b/gfs-kernel/src/gfs/mount.h
deleted file mode 100644
index d3d09c9..0000000
--- a/gfs-kernel/src/gfs/mount.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __MOUNT_DOT_H__
-#define __MOUNT_DOT_H__
-
-int gfs_make_args(char *data, struct gfs_args *args, int remount);
-
-#endif /* __MOUNT_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/ondisk.c b/gfs-kernel/src/gfs/ondisk.c
deleted file mode 100644
index 1d169eb..0000000
--- a/gfs-kernel/src/gfs/ondisk.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-
-#include "gfs.h"
-
-#define pv(struct, member, fmt) printk("  "#member" = "fmt"\n", struct->member);
-
-#define WANT_GFS_CONVERSION_FUNCTIONS
-#include "gfs_ondisk.h"
-
diff --git a/gfs-kernel/src/gfs/ops_address.c b/gfs-kernel/src/gfs/ops_address.c
deleted file mode 100644
index 0a9c7cd..0000000
--- a/gfs-kernel/src/gfs/ops_address.c
+++ /dev/null
@@ -1,479 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <linux/pagemap.h>
-
-#include "gfs.h"
-#include "bmap.h"
-#include "dio.h"
-#include "file.h"
-#include "glock.h"
-#include "inode.h"
-#include "ops_address.h"
-#include "page.h"
-#include "quota.h"
-#include "trans.h"
-
-static int gfs_commit_write(struct file *file, struct page *page,
-							unsigned from, unsigned to);
-/**
- * get_block - Fills in a buffer head with details about a block
- * @inode: The inode
- * @lblock: The block number to look up
- * @bh_result: The buffer head to return the result in
- * @create: Non-zero if we may add block to the file
- *
- * Returns: errno
- */
-
-static int
-get_block(struct inode *inode, sector_t lblock, 
-	  struct buffer_head *bh_result, int create)
-{
-	struct gfs_inode *ip = get_v2ip(inode);
-	int new = create;
-	uint64_t dblock;
-	int error;
-
-	error = gfs_block_map(ip, lblock, &new, &dblock, NULL);
-	if (error)
-		return error;
-
-	if (!dblock)
-		return 0;
-
-	map_bh(bh_result, inode->i_sb, dblock);
-	if (new)
-		set_buffer_new(bh_result);
-
-	return 0;
-}
-
-/**
- * get_block_noalloc - Fills in a buffer head with details about a block
- * @inode: The inode
- * @lblock: The block number to look up
- * @bh_result: The buffer head to return the result in
- * @create: Non-zero if we may add block to the file
- *
- * Returns: errno
- */
-
-static int
-get_block_noalloc(struct inode *inode, sector_t lblock,
-		  struct buffer_head *bh_result, int create)
-{
-	int error;
-
-	error = get_block(inode, lblock, bh_result, FALSE);
-	if (error)
-		return error;
-
-	if (gfs_assert_withdraw(get_v2sdp(inode->i_sb),
-				!create || buffer_mapped(bh_result)))
-		return -EIO;
-
-	return 0;
-}
-
-/**
- * get_blocks - 
- * @inode:
- * @lblock:
- * @max_blocks:
- * @bh_result:
- * @create:
- *
- * Returns: errno
- */
-
-static int
-get_blocks(struct inode *inode, sector_t lblock,
-		   struct buffer_head *bh_result, int create)
-{
-	struct gfs_inode *ip = get_v2ip(inode);
-	int new = create;
-	uint64_t dblock;
-	int error;
-
-	error = gfs_block_map(ip, lblock, &new, &dblock, NULL);
-	if (error)
-		return error;
-
-	if (!dblock)
-		return 0;
-
-	map_bh(bh_result, inode->i_sb, dblock);
-	if (new)
-		set_buffer_new(bh_result);
-
-	return 0;
-}
-
-/**
- * get_blocks_noalloc - 
- * @inode:
- * @lblock:
- * @max_blocks:
- * @bh_result:
- * @create:
- *
- * Returns: errno
- */
-
-static int
-get_blocks_noalloc(struct inode *inode, sector_t lblock,
-		   struct buffer_head *bh_result, int create)
-{
-	int error;
-
-	error = get_blocks(inode, lblock, bh_result, FALSE);
-	if (error)
-		return error;
-
-	if (gfs_assert_withdraw(get_v2sdp(inode->i_sb),
-							!create || buffer_mapped(bh_result)))
-		return -EIO;
-
-	return 0;
-}
-
-/**
- * gfs_writepage - Write complete page
- * @page: Page to write
- *
- * Returns: errno
- *
- * Use Linux VFS block_write_full_page() to write one page,
- *   using GFS's get_block_noalloc to find which blocks to write.
- */
-
-static int
-gfs_writepage(struct page *page, struct writeback_control *wbc)
-{
-	struct gfs_inode *ip = get_v2ip(page->mapping->host);
-	struct gfs_sbd *sdp = ip->i_sbd;
-	int error;
-
-	atomic_inc(&sdp->sd_ops_address);
-
-	if (gfs_assert_withdraw(sdp, gfs_glock_is_held_excl(ip->i_gl))) {
-		unlock_page(page);
-		return -EIO;
-	}
-	if (get_transaction) {
-		redirty_page_for_writepage(wbc, page);
-		unlock_page(page);
-		return 0;
-	}
-
-	error = block_write_full_page(page, get_block_noalloc, wbc);
-
-	gfs_flush_meta_cache(ip);
-
-	return error;
-}
-
-/**
- * stuffed_readpage - Fill in a Linux page with stuffed file data
- * @ip: the inode
- * @page: the page
- *
- * Returns: errno
- */
-
-static int
-stuffed_readpage(struct gfs_inode *ip, struct page *page)
-{
-	struct buffer_head *dibh;
-	void *kaddr;
-	int error;
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-	if (!error) {
-		kaddr = kmap(page);
-		memcpy((char *)kaddr,
-		       dibh->b_data + sizeof(struct gfs_dinode),
-		       ip->i_di.di_size);
-		memset((char *)kaddr + ip->i_di.di_size,
-		       0,
-		       PAGE_CACHE_SIZE - ip->i_di.di_size);
-		kunmap(page);
-
-		brelse(dibh);
-
-		SetPageUptodate(page);
-	}
-
-	return error;
-}
-
-/**
- * readi_readpage - readpage that goes through gfs_internal_read()
- * @page: The page to read
- *
- * Returns: errno
- */
-
-static int
-readi_readpage(struct page *page)
-{
-	struct gfs_inode *ip = get_v2ip(page->mapping->host);
-	void *kaddr;
-	int ret;
-
-	kaddr = kmap(page);
-
-	ret = gfs_internal_read(ip, kaddr,
-				(uint64_t)page->index << PAGE_CACHE_SHIFT,
-				PAGE_CACHE_SIZE);
-	if (ret >= 0) {
-		if (ret < PAGE_CACHE_SIZE)
-			memset(kaddr + ret, 0, PAGE_CACHE_SIZE - ret);
-		SetPageUptodate(page);
-		ret = 0;
-	}
-
-	kunmap(page);
-
-	unlock_page(page);
-
-	return ret;
-}
-
-/**
- * gfs_readpage - readpage with locking
- * @file: The file to read a page for
- * @page: The page to read
- *
- * Returns: errno
- */
-
-static int
-gfs_readpage(struct file *file, struct page *page)
-{
-	struct gfs_inode *ip = get_v2ip(page->mapping->host);
-	struct gfs_sbd *sdp = ip->i_sbd;
-	int error;
-
-	atomic_inc(&sdp->sd_ops_address);
-
-	if (!gfs_glock_is_locked_by_me(ip->i_gl)) {
-		unlock_page(page);
-		return -ENOSYS;
-	}
-
-	if (!gfs_is_jdata(ip)) {
-		if (gfs_is_stuffed(ip) && !page->index) {
-			error = stuffed_readpage(ip, page);
-			unlock_page(page);
-		} else
-			error = block_read_full_page(page, get_block);
-	} else
-		error = readi_readpage(page);
-
-	if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-		error = -EIO;
-
-	return error;
-}
-
-/**
- * gfs_prepare_write - Prepare to write a page to a file
- * @file: The file to write to
- * @page: The page which is to be prepared for writing
- * @from: From (byte range within page)
- * @to: To (byte range within page)
- *
- * Returns: errno
- *
- * Make sure file's inode is glocked; we shouldn't write without that!
- * If GFS dinode is currently stuffed (small enough that all data fits within
- *   the dinode block), and new file size is too large, unstuff it.
- * Use Linux VFS block_prepare_write() to write blocks, using GFS' get_block()
- *   to find which blocks to write.
- */
-
-static int
-gfs_prepare_write(struct file *file, struct page *page,
-		  unsigned from, unsigned to)
-{
-	struct gfs_inode *ip = get_v2ip(page->mapping->host);
-	struct gfs_sbd *sdp = ip->i_sbd;
-	int error = 0;
-
-	atomic_inc(&sdp->sd_ops_address);
-
-	/* We can't set commit_write in the structure in the declare         */
-	/* because if we do, loopback (loop.c) will interpret that to mean   */
-	/* it's okay to do buffered writes without locking through sendfile. */
-	/* This is a kludge to get around the problem with loop.c because    */
-	/* the upstream community rejected my changes to loop.c.             */
-	ip->gfs_file_aops.commit_write = gfs_commit_write;
-
-	if (gfs_assert_warn(sdp, gfs_glock_is_locked_by_me(ip->i_gl)))
-		return -ENOSYS;
-
-	if (gfs_is_stuffed(ip)) {
-		uint64_t file_size = ((uint64_t)page->index << PAGE_CACHE_SHIFT) + to;
-
-		if (file_size > sdp->sd_sb.sb_bsize - sizeof(struct gfs_dinode)) {
-			error = gfs_unstuff_dinode(ip, gfs_unstuffer_page, page);
-			if (!error)
-				error = block_prepare_write(page, from, to, get_block);
-		} else if (!PageUptodate(page))
-			error = stuffed_readpage(ip, page);
-	} else
-		error = block_prepare_write(page, from, to, get_block);
-
-	return error;
-}
-
-/**
- * gfs_commit_write - Commit write to a file
- * @file: The file to write to
- * @page: The page containing the data
- * @from: From (byte range within page)
- * @to: To (byte range within page)
- *
- * Returns: errno
- */
-
-static int
-gfs_commit_write(struct file *file, struct page *page,
-		 unsigned from, unsigned to)
-{
-	struct inode *inode = page->mapping->host;
-	struct gfs_inode *ip = get_v2ip(inode);
-	struct gfs_sbd *sdp = ip->i_sbd;
-	int error;
-
-	atomic_inc(&sdp->sd_ops_address);
-
-	if (gfs_is_stuffed(ip)) {
-		struct buffer_head *dibh;
-		uint64_t file_size = ((uint64_t)page->index << PAGE_CACHE_SHIFT) + to;
-		void *kaddr;
-
-		error = gfs_get_inode_buffer(ip, &dibh);
-		if (error)
-			goto fail;
-
-		gfs_trans_add_bh(ip->i_gl, dibh);
-
-		kaddr = kmap(page);
-		memcpy(dibh->b_data + sizeof(struct gfs_dinode) + from,
-		       (char *)kaddr + from,
-		       to - from);
-		kunmap(page);
-
-		brelse(dibh);
-
-		SetPageUptodate(page);
-
-		if (inode->i_size < file_size)
-			i_size_write(inode, file_size);
-	} else {
-		loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
-		error = block_commit_write(page, from, to);
-		if (error)
-			goto fail;
-		if (pos > inode->i_size) {
-			i_size_write(inode, pos);
-			mark_inode_dirty(inode);
-		}
-	}
-
-	ip->gfs_file_aops.commit_write = NULL;
-	return 0;
-
- fail:
-	ClearPageUptodate(page);
-
-	return error;
-}
-
-/**
- * gfs_bmap - Block map function
- * @mapping: Address space info
- * @lblock: The block to map
- *
- * Returns: The disk address for the block or 0 on hole or error
- */
-
-static sector_t
-gfs_bmap(struct address_space *mapping, sector_t lblock)
-{
-	struct gfs_inode *ip = get_v2ip(mapping->host);
-	struct gfs_holder i_gh;
-	int dblock = 0;
-	int error;
-
-	atomic_inc(&ip->i_sbd->sd_ops_address);
-
-	error = gfs_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh);
-	if (error)
-		return 0;
-
-	if (!gfs_is_stuffed(ip))
-		dblock = generic_block_bmap(mapping, lblock, get_block);
-
-	gfs_glock_dq_uninit(&i_gh);
-
-	return dblock;
-}
-
-/**
- * gfs_direct_IO - 
- * @rw:
- * @iocb:
- * @iov:
- * @offset:
- * @nr_segs:
- *
- * Returns: errno
- */
-
-static ssize_t
-gfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
-	      loff_t offset, unsigned long nr_segs)
-{
-	struct file *file = iocb->ki_filp;
-	struct inode *inode = file->f_mapping->host;
-	struct gfs_inode *ip = get_v2ip(inode);
-	struct gfs_sbd *sdp = ip->i_sbd;
-	get_block_t *gb = get_blocks;
-
-	atomic_inc(&sdp->sd_ops_address);
-
-	if (gfs_assert_warn(sdp, gfs_glock_is_locked_by_me(ip->i_gl)) ||
-	    gfs_assert_warn(sdp, !gfs_is_stuffed(ip)))
-		return -EINVAL;
-
-	if (rw == WRITE && !get_transaction)
-		gb = get_blocks_noalloc;
-
-	if (rw == WRITE)
-		return blockdev_direct_IO(rw, iocb, inode,
-				  inode->i_sb->s_bdev, iov,
-				  offset, nr_segs, gb, NULL);
-	else
-		return blockdev_direct_IO_no_locking(rw, iocb, inode,
-				  inode->i_sb->s_bdev, iov,
-				  offset, nr_segs, gb, NULL);
-
-}
-
-struct address_space_operations gfs_file_aops = {
-	.writepage = gfs_writepage,
-	.readpage = gfs_readpage,
-	.sync_page = block_sync_page,
-	.prepare_write = gfs_prepare_write,
-	.bmap = gfs_bmap,
-	.direct_IO = gfs_direct_IO,
-};
diff --git a/gfs-kernel/src/gfs/ops_address.h b/gfs-kernel/src/gfs/ops_address.h
deleted file mode 100644
index f847a7a..0000000
--- a/gfs-kernel/src/gfs/ops_address.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __OPS_ADDRESS_DOT_H__
-#define __OPS_ADDRESS_DOT_H__
-
-extern struct address_space_operations gfs_file_aops;
-
-#endif /* __OPS_ADDRESS_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/ops_dentry.c b/gfs-kernel/src/gfs/ops_dentry.c
deleted file mode 100644
index 48efd34..0000000
--- a/gfs-kernel/src/gfs/ops_dentry.c
+++ /dev/null
@@ -1,111 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-
-#include "gfs.h"
-#include "dir.h"
-#include "glock.h"
-#include "ops_dentry.h"
-
-/**
- * gfs_drevalidate - Check directory lookup consistency
- * @dentry: the mapping to check
- * @nd:
- *
- * Check to make sure the lookup necessary to arrive at this inode from its
- * parent is still good.
- *
- * Returns: 1 if the dentry is ok, 0 if it isn't
- */
-
-static int
-gfs_drevalidate(struct dentry *dentry, struct nameidata *nd)
-{
-	struct dentry *parent = dget_parent(dentry);
-	struct gfs_inode *dip = get_v2ip(parent->d_inode);
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct inode *inode;
-	struct gfs_holder d_gh;
-	struct gfs_inode *ip;
-	struct gfs_inum inum;
-	unsigned int type;
-	int error;
-
-	lock_kernel();
-
-	atomic_inc(&sdp->sd_ops_dentry);
-
-	if (sdp->sd_args.ar_localcaching)
-		goto valid;
-
-	inode = dentry->d_inode;
-	if (inode && is_bad_inode(inode))
-		goto invalid;
-
-	error = gfs_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &d_gh);
-	if (error)
-		goto fail;
-
-	error = gfs_dir_search(dip, &dentry->d_name, &inum, &type);
-	switch (error) {
-	case 0:
-		if (!inode)
-			goto invalid_gunlock;
-		break;
-	case -ENOENT:
-		if (!inode)
-			goto valid_gunlock;
-		goto invalid_gunlock;
-	default:
-		goto fail_gunlock;
-	}
-
-	ip = get_v2ip(inode);
-
-	if (ip->i_num.no_formal_ino != inum.no_formal_ino)
-		goto invalid_gunlock;
-
-	if (ip->i_di.di_type != type) {
-		gfs_consist_inode(dip);
-		goto fail_gunlock;
-	}
-
- valid_gunlock:
-	gfs_glock_dq_uninit(&d_gh);
-
- valid:
-	unlock_kernel();
-	dput(parent);
-	return 1;
-
- invalid_gunlock:
-	gfs_glock_dq_uninit(&d_gh);
-
- invalid:
-	if (inode && S_ISDIR(inode->i_mode)) {
-		if (have_submounts(dentry))
-			goto valid;
-		shrink_dcache_parent(dentry);
-	}
-	d_drop(dentry);
-
-	unlock_kernel();
-	dput(parent);
-	return 0;
-
- fail_gunlock:
-	gfs_glock_dq_uninit(&d_gh);
-
- fail:
-	unlock_kernel();
-	dput(parent);
-	return 0;
-}
-
-struct dentry_operations gfs_dops = {
-	.d_revalidate = gfs_drevalidate,
-};
diff --git a/gfs-kernel/src/gfs/ops_dentry.h b/gfs-kernel/src/gfs/ops_dentry.h
deleted file mode 100644
index a6e7a75..0000000
--- a/gfs-kernel/src/gfs/ops_dentry.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __OPS_DENTRY_DOT_H__
-#define __OPS_DENTRY_DOT_H__
-
-extern struct dentry_operations gfs_dops;
-
-#endif /* __OPS_DENTRY_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/ops_export.c b/gfs-kernel/src/gfs/ops_export.c
deleted file mode 100644
index bf3484c..0000000
--- a/gfs-kernel/src/gfs/ops_export.c
+++ /dev/null
@@ -1,403 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <linux/exportfs.h>
-
-#include "gfs.h"
-#include "dio.h"
-#include "dir.h"
-#include "glock.h"
-#include "glops.h"
-#include "inode.h"
-#include "ops_dentry.h"
-#include "ops_export.h"
-#include "rgrp.h"
-
-struct inode_cookie
-{
-	uint64_t formal_ino;
-	uint32_t gen;
-	int gen_valid;
-};
-
-struct get_name_filldir
-{
-	uint64_t formal_ino;
-	char *name;
-};
-
-/**
- * gfs_encode_fh -
- * @param1: description
- * @param2: description
- * @param3: description
- *
- * Function description
- *
- * Returns: what is returned
- */
-
-int 
-gfs_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
-	      int connectable)
-{
-	struct inode *inode = dentry->d_inode;
-	struct gfs_inode *ip = get_v2ip(inode);
-	int maxlen = *len;
-
-	atomic_inc(&ip->i_sbd->sd_ops_export);
-
-	if (maxlen < 3)
-		return 255;
-
-	fh[0] = cpu_to_gfs32((uint32_t)(ip->i_num.no_formal_ino >> 32));
-	fh[1] = cpu_to_gfs32((uint32_t)(ip->i_num.no_formal_ino & 0xFFFFFFFF));
-	fh[2] = cpu_to_gfs32(inode->i_generation);  /* dinode's mh_incarn */
-	*len = 3;
-
-	if (maxlen < 5 || !connectable)
-		return 3;
-
-	spin_lock(&dentry->d_lock);
-
-	inode = dentry->d_parent->d_inode;
-	ip = get_v2ip(inode);
-
-	fh[3] = cpu_to_gfs32((uint32_t)(ip->i_num.no_formal_ino >> 32));
-	fh[4] = cpu_to_gfs32((uint32_t)(ip->i_num.no_formal_ino & 0xFFFFFFFF));
-	*len = 5;
-
-	if (maxlen < 6) {
-		spin_unlock(&dentry->d_lock);
-		return 5;
-	}
-
-	fh[5] = cpu_to_gfs32(inode->i_generation);  /* dinode's mh_incarn */
-
-	spin_unlock(&dentry->d_lock);
-
-	*len = 6;
-
-	return 6;
-}
-
-/**
- * get_name_filldir - 
- * @param1: description
- * @param2: description
- * @param3: description
- *
- * Function description
- *
- * Returns: what is returned
- */
-
-static int
-get_name_filldir(void *opaque,
-		 const char *name, unsigned int length,
-		 uint64_t offset,
-		 struct gfs_inum *inum, unsigned int type)
-{
-	struct get_name_filldir *gnfd = (struct get_name_filldir *)opaque;
-
-	if (inum->no_formal_ino != gnfd->formal_ino)
-		return 0;
-
-	memcpy(gnfd->name, name, length);
-	gnfd->name[length] = 0;
-
-	return 1;
-}
-
-/**
- * gfs_get_name -
- * @param1: description
- * @param2: description
- * @param3: description
- *
- * Function description
- *
- * Returns: what is returned
- */
-
-int gfs_get_name(struct dentry *parent, char *name,
-		 struct dentry *child)
-{
-	struct inode *dir = parent->d_inode;
-	struct inode *inode = child->d_inode;
-	struct gfs_inode *dip, *ip;
-	struct get_name_filldir gnfd;
-	struct gfs_holder gh;
-	uint64_t offset = 0;
-	int error;
-
-	if (!dir)
-		return -EINVAL;
-
-	atomic_inc(&get_v2sdp(dir->i_sb)->sd_ops_export);
-
-	if (!S_ISDIR(dir->i_mode) || !inode)
-		return -EINVAL;
-
-	dip = get_v2ip(dir);
-	ip = get_v2ip(inode);
-
-	*name = 0;
-	gnfd.formal_ino = ip->i_num.no_formal_ino;
-	gnfd.name = name;
-
-	error = gfs_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &gh);
-	if (error)
-		return error;
-
-	error = gfs_dir_read(dip, &offset, &gnfd, get_name_filldir);
-
-	gfs_glock_dq_uninit(&gh);
-
-	if (!error & !*name)
-		error = -ENOENT;
-
-	return error;
-}
-
-/**
- * gfs_get_parent -
- * @param1: description
- * @param2: description
- * @param3: description
- *
- * Function description
- *
- * Returns: what is returned
- */
-
-struct dentry *
-gfs_get_parent(struct dentry *child)
-{
-	struct gfs_inode *dip = get_v2ip(child->d_inode);
-	struct gfs_holder d_gh, i_gh;
-	struct qstr dotdot = { .name = "..", .len = 2 };
-	struct gfs_inode *ip;
-	struct inode *inode;
-	struct dentry *dentry;
-	int error;
-
-	atomic_inc(&dip->i_sbd->sd_ops_export);
-
-	gfs_holder_init(dip->i_gl, 0, 0, &d_gh);
-	error = gfs_lookupi(&d_gh, &dotdot, TRUE, &i_gh);
-	if (error)
-		goto fail;
-
-	error = -ENOENT;
-	if (!i_gh.gh_gl)
-		goto fail;
-
-	ip = get_gl2ip(i_gh.gh_gl);
-
-	inode = gfs_iget(ip, CREATE);
-	gfs_inode_put(ip);
-
-	gfs_glock_dq_uninit(&d_gh);
-	gfs_glock_dq_uninit(&i_gh);
-
-	if (!inode)
-		return ERR_PTR(-ENOMEM);
-
-	dentry = d_alloc_anon(inode);
-	if (!dentry) {
-		iput(inode);
-		return ERR_PTR(-ENOMEM);
-	}
-
-	dentry->d_op = &gfs_dops;
-	return dentry;
-
- fail:
-	gfs_holder_uninit(&d_gh);
-	return ERR_PTR(error);
-}
-
-/**
- * gfs_get_dentry -
- * @param1: description
- * @param2: description
- * @param3: description
- *
- * Function description
- *
- * Returns: what is returned
- */
-
-struct dentry *
-gfs_get_dentry(struct super_block *sb, struct inode_cookie *cookie)
-{
-	struct gfs_sbd *sdp = get_v2sdp(sb);
-	struct gfs_inum inum;
-	struct gfs_holder i_gh, ri_gh, rgd_gh;
-	struct gfs_rgrpd *rgd;
-	struct buffer_head *bh;
-	struct gfs_dinode *di;
-	struct gfs_inode *ip;
-	struct inode *inode;
-	struct dentry *dentry;
-	int error;
-
-	atomic_inc(&sdp->sd_ops_export);
-
-	if (!cookie->formal_ino ||
-	    cookie->formal_ino == sdp->sd_jiinode->i_num.no_formal_ino ||
-	    cookie->formal_ino == sdp->sd_riinode->i_num.no_formal_ino ||
-	    cookie->formal_ino == sdp->sd_qinode->i_num.no_formal_ino)
-		return ERR_PTR(-EINVAL);
-
-	inum.no_formal_ino = cookie->formal_ino;
-	inum.no_addr = cookie->formal_ino;
-
-	error = gfs_glock_nq_num(sdp,
-				 inum.no_formal_ino, &gfs_inode_glops,
-				 LM_ST_SHARED, LM_FLAG_ANY | GL_LOCAL_EXCL,
-				 &i_gh);
-	if (error)
-		return ERR_PTR(error);
-
-	error = gfs_inode_get(i_gh.gh_gl, &inum, NO_CREATE, &ip);
-	if (error)
-		goto fail;
-	if (ip)
-		goto out;
-
-	error = gfs_rindex_hold(sdp, &ri_gh);
-	if (error)
-		goto fail;
-
-	error = -EINVAL;
-	rgd = gfs_blk2rgrpd(sdp, inum.no_addr);
-	if (!rgd)
-		goto fail_rindex;
-
-	error = gfs_glock_nq_init(rgd->rd_gl, LM_ST_SHARED, 0, &rgd_gh);
-	if (error)
-		goto fail_rindex;
-
-	error = -ESTALE;
-	if (gfs_get_block_type(rgd, inum.no_addr) != GFS_BLKST_USEDMETA)
-		goto fail_rgd;
-
-	error = gfs_dread(i_gh.gh_gl, inum.no_addr,
-			  DIO_START | DIO_WAIT, &bh);
-	if (error)
-		goto fail_rgd;
-
-	di = (struct gfs_dinode *)bh->b_data;
-
-	error = -ESTALE;
-	if (gfs32_to_cpu(di->di_header.mh_magic) != GFS_MAGIC ||
-	    gfs32_to_cpu(di->di_header.mh_type) != GFS_METATYPE_DI ||
-	    (gfs32_to_cpu(di->di_flags) & GFS_DIF_UNUSED))
-		goto fail_relse;
-
-	brelse(bh);
-	gfs_glock_dq_uninit(&rgd_gh);
-	gfs_glock_dq_uninit(&ri_gh);
-
-	error = gfs_inode_get(i_gh.gh_gl, &inum, CREATE, &ip);
-	if (error)
-		goto fail;
-
-	atomic_inc(&sdp->sd_fh2dentry_misses);
-
- out:
-	inode = gfs_iget(ip, CREATE);
-	gfs_inode_put(ip);
-
-	gfs_glock_dq_uninit(&i_gh);
-
-	if (!inode)
-		return ERR_PTR(-ENOMEM);
-
-	/* inode->i_generation is GFS dinode's mh_incarn value */
-	if (cookie->gen_valid && cookie->gen != inode->i_generation) {
-		iput(inode);
-		return ERR_PTR(-ESTALE);
-	}
-
-	dentry = d_alloc_anon(inode);
-	if (!dentry) {
-		iput(inode);
-		return ERR_PTR(-ENOMEM);
-	}
-
-	dentry->d_op = &gfs_dops;
-	return dentry;
-
- fail_relse:
-        brelse(bh);
-
- fail_rgd:
-	gfs_glock_dq_uninit(&rgd_gh);
-
- fail_rindex:
-	gfs_glock_dq_uninit(&ri_gh);
-
- fail:
-	gfs_glock_dq_uninit(&i_gh);
-	return ERR_PTR(error);
-}
-
-static struct dentry *gfs_fh_to_dentry(struct super_block *sb, struct fid *fid,
-		int fh_len, int fh_type)
-{
-	struct inode_cookie this;
-	__u32 *fh = fid->raw;
-
-	atomic_inc(&get_v2sdp(sb)->sd_ops_export);
-
-	switch (fh_type) {
-	case 6:
-	case 5:
-	case 3:
-		this.gen_valid = TRUE;
-		this.gen = gfs32_to_cpu(fh[2]);
-		this.formal_ino = ((uint64_t)gfs32_to_cpu(fh[0])) << 32;
-		this.formal_ino |= (uint64_t)gfs32_to_cpu(fh[1]);
-		return gfs_get_dentry(sb, &this);
-	default:
-		return NULL;
-	}
-}
-
-static struct dentry *gfs_fh_to_parent(struct super_block *sb, struct fid *fid,
-		int fh_len, int fh_type)
-{
-	struct inode_cookie parent;
-	__u32 *fh = fid->raw;
-
-	atomic_inc(&get_v2sdp(sb)->sd_ops_export);
-
-	switch (fh_type) {
-	case 6:
-		parent.gen_valid = TRUE;
-		parent.gen = gfs32_to_cpu(fh[5]);
-	case 5:
-		parent.formal_ino = ((uint64_t)gfs32_to_cpu(fh[3])) << 32;
-		parent.formal_ino |= (uint64_t)gfs32_to_cpu(fh[4]);
-	default:
-		return NULL;
-	}
-
-	return gfs_get_dentry(sb, &parent);
-}
-
-const struct export_operations gfs_export_ops = {
-	.encode_fh = gfs_encode_fh,
-	.fh_to_dentry = gfs_fh_to_dentry,
-	.fh_to_parent = gfs_fh_to_parent,
-	.get_name = gfs_get_name,
-	.get_parent = gfs_get_parent,
-};
-
diff --git a/gfs-kernel/src/gfs/ops_export.h b/gfs-kernel/src/gfs/ops_export.h
deleted file mode 100644
index 778ca9e..0000000
--- a/gfs-kernel/src/gfs/ops_export.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __OPS_EXPORT_DOT_H__
-#define __OPS_EXPORT_DOT_H__
-
-extern const struct export_operations gfs_export_ops;
-
-#endif /* __OPS_EXPORT_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/ops_file.c b/gfs-kernel/src/gfs/ops_file.c
deleted file mode 100644
index bb55e5c..0000000
--- a/gfs-kernel/src/gfs/ops_file.c
+++ /dev/null
@@ -1,1911 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <asm/uaccess.h>
-#include <linux/pagemap.h>
-#include <linux/uio.h>
-#include <linux/blkdev.h>
-#include <linux/mm.h>
-#include <linux/aio.h>
-#include <linux/writeback.h>
-#include <asm/uaccess.h>
-#include <linux/compat.h>
-
-#include "gfs_ioctl.h"
-#include "gfs.h"
-#include "bmap.h"
-#include "dio.h"
-#include "dir.h"
-#include "file.h"
-#include "glock.h"
-#include "glops.h"
-#include "inode.h"
-#include "ioctl.h"
-#include "lm.h"
-#include "log.h"
-#include "ops_file.h"
-#include "ops_vm.h"
-#include "quota.h"
-#include "rgrp.h"
-#include "trans.h"
-
-/* "bad" is for NFS support */
-struct filldir_bad_entry {
-	char *fbe_name;
-	unsigned int fbe_length;
-	uint64_t fbe_offset;
-	struct gfs_inum fbe_inum;
-	unsigned int fbe_type;
-};
-
-struct filldir_bad {
-	struct gfs_sbd *fdb_sbd;
-
-	struct filldir_bad_entry *fdb_entry;
-	unsigned int fdb_entry_num;
-	unsigned int fdb_entry_off;
-
-	char *fdb_name;
-	unsigned int fdb_name_size;
-	unsigned int fdb_name_off;
-};
-
-/* For regular, non-NFS */
-struct filldir_reg {
-	struct gfs_sbd *fdr_sbd;
-	int fdr_prefetch;
-
-	filldir_t fdr_filldir;
-	void *fdr_opaque;
-};
-
-typedef ssize_t(*do_rw_t) (struct file * file,
-			   char *buf,
-			   size_t size, loff_t * offset,
-                           struct kiocb *iocb,
-			   unsigned int num_gh, struct gfs_holder * ghs);
-
-/**
- * gfs_llseek - seek to a location in a file
- * @file: the file
- * @offset: the offset
- * @origin: Where to seek from (SEEK_SET, SEEK_CUR, or SEEK_END)
- *
- * SEEK_END requires the glock for the file because it references the
- * file's size.
- *
- * Returns: The new offset, or errno
- */
-
-static loff_t
-gfs_llseek(struct file *file, loff_t offset, int origin)
-{
-	struct gfs_inode *ip = get_v2ip(file->f_mapping->host);
-	struct gfs_holder i_gh;
-	loff_t error;
-
-	atomic_inc(&ip->i_sbd->sd_ops_file);
-
-	if (origin == 2) {
-		error = gfs_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh);
-		if (!error) {
-			error = generic_file_llseek_unlocked(file, offset, origin);
-			gfs_glock_dq_uninit(&i_gh);
-		}
-	} else
-		error = generic_file_llseek_unlocked(file, offset, origin);
-
-	return error;
-}
-
-#define vma2state(vma) \
-((((vma)->vm_flags & (VM_MAYWRITE | VM_MAYSHARE)) == \
- (VM_MAYWRITE | VM_MAYSHARE)) ? \
- LM_ST_EXCLUSIVE : LM_ST_SHARED) \
-
-/**
- * functionname - summary
- * @param1: description
- * @param2: description
- * @param3: description
- *
- * Function description
- *
- * Returns: what is returned
- */
-
-static ssize_t
-walk_vm_hard(struct file *file, char *buf, size_t size, loff_t *offset,
-             struct kiocb *iocb, do_rw_t operation)
-{
-	struct gfs_holder *ghs;
-	unsigned int num_gh = 0;
-	ssize_t count;
-
-	{
-		struct super_block *sb = file->f_dentry->d_inode->i_sb;
-		struct mm_struct *mm = current->mm;
-		struct vm_area_struct *vma;
-		unsigned long start = (unsigned long)buf;
-		unsigned long end = start + size;
-		int dumping = (current->flags & PF_DUMPCORE);
-		unsigned int x = 0;
-
-		for (vma = find_vma(mm, start); vma; vma = vma->vm_next) {
-			if (end <= vma->vm_start)
-				break;
-			if (vma->vm_file &&
-			    vma->vm_file->f_dentry->d_inode->i_sb == sb) {
-				num_gh++;
-			}
-		}
-
-		ghs = kmalloc((num_gh + 1) * sizeof(struct gfs_holder), GFP_KERNEL);
-		if (!ghs) {
-			if (!dumping)
-				up_read(&mm->mmap_sem);
-			return -ENOMEM;
-		}
-
-		for (vma = find_vma(mm, start); vma; vma = vma->vm_next) {
-			if (end <= vma->vm_start)
-				break;
-			if (vma->vm_file) {
-				struct inode *inode = vma->vm_file->f_dentry->d_inode;
-				if (inode->i_sb == sb)
-					gfs_holder_init(get_v2ip(inode)->i_gl,
-							vma2state(vma),
-							0, &ghs[x++]);
-			}
-		}
-
-		if (!dumping)
-			up_read(&mm->mmap_sem);
-
-		gfs_assert(get_v2sdp(sb), x == num_gh,);
-	}
-
-	count = operation(file, buf, size, offset, iocb, num_gh, ghs);
-
-	while (num_gh--)
-		gfs_holder_uninit(&ghs[num_gh]);
-	kfree(ghs);
-
-	return count;
-}
-
-/**
- * walk_vm - Walk the vmas associated with a buffer for read or write.
- *    If any of them are gfs, pass the gfs inode down to the read/write
- *    worker function so that locks can be acquired in the correct order.
- * @file: The file to read/write from/to
- * @buf: The buffer to copy to/from
- * @size: The amount of data requested
- * @offset: The current file offset
- * @operation: The read or write worker function
- *
- * Outputs: Offset - updated according to number of bytes written
- *
- * Returns: The number of bytes written, errno on failure
- */
-
-static ssize_t
-walk_vm(struct file *file, char *buf, size_t size, loff_t *offset,
-	struct kiocb *iocb,	
-	do_rw_t operation)
-{
-	if (current->mm) {
-		struct super_block *sb = file->f_dentry->d_inode->i_sb;
-		struct mm_struct *mm = current->mm;
-		struct vm_area_struct *vma;
-		unsigned long start = (unsigned long)buf;
-		unsigned long end = start + size;
-		int dumping = (current->flags & PF_DUMPCORE);
-
-		if (!dumping)
-			down_read(&mm->mmap_sem);
-
-		for (vma = find_vma(mm, start); vma; vma = vma->vm_next) {
-			if (end <= vma->vm_start)
-				break;
-			if (vma->vm_file &&
-			    vma->vm_file->f_dentry->d_inode->i_sb == sb)
-				goto do_locks;
-		}
-
-		if (!dumping)
-			up_read(&mm->mmap_sem);
-	}
-
-	{
-		struct gfs_holder gh;
-		return operation(file, buf, size, offset, iocb, 0, &gh);
-	}
-
- do_locks:
-	return walk_vm_hard(file, buf, size, offset, iocb, operation);
-}
-
-/**
- * functionname - summary
- * @param1: description
- * @param2: description
- * @param3: description
- *
- * Function description
- *
- * Returns: what is returned
- */
-
-static ssize_t
-do_read_readi(struct file *file, char *buf, size_t size, loff_t *offset,
-              struct kiocb *iocb)
-{
-	struct gfs_inode *ip = get_v2ip(file->f_mapping->host);
-	ssize_t count = 0;
-
-	if (*offset < 0)
-		return -EINVAL;
-	if (!access_ok(VERIFY_WRITE, buf, size))
-		return -EFAULT;
-
-	if (!(file->f_flags & O_LARGEFILE)) {
-		if (*offset >= 0x7FFFFFFFull)
-			return -EFBIG;
-		if (*offset + size > 0x7FFFFFFFull)
-			size = 0x7FFFFFFFull - *offset;
-	}
-
-	/* ToDo: not sure about iocb .. wcheng
-	 */
-	count = gfs_readi(ip, buf, *offset, size, gfs_copy2user);
-
-	if (count > 0)
-		*offset += count;
-
-	return count;
-}
-
-/**
- * grope_mapping - feel up a mapping that needs to be written
- * @buf: the start of the memory to be written
- * @size: the size of the memory to be written
- *
- * We do this after acquiring the locks on the mapping,
- * but before starting the write transaction.  We need to make
- * sure that we don't cause recursive transactions if blocks
- * need to be allocated to the file backing the mapping.
- *
- * Returns: errno
- */
-
-static int
-grope_mapping(char *buf, size_t size)
-{
-	unsigned long start = (unsigned long)buf;
-	unsigned long stop = start + size;
-	char c;
-
-	while (start < stop) {
-		if (copy_from_user(&c, (char *)start, 1))
-			return -EFAULT;
-
-		start += PAGE_CACHE_SIZE;
-		start &= PAGE_CACHE_MASK;
-	}
-
-	return 0;
-}
-
-/**
- * do_read_direct - Read bytes from a file
- * @file: The file to read from
- * @buf: The buffer to copy into
- * @size: The amount of data requested
- * @offset: The current file offset
- * @num_gh: The number of other locks we need to do the read
- * @ghs: the locks we need plus one for our lock
- *
- * Outputs: Offset - updated according to number of bytes read
- *
- * Returns: The number of bytes read, errno on failure
- */
-
-static ssize_t
-do_read_direct(struct file *file, char *buf, size_t size, loff_t *offset,
-		struct kiocb *iocb,
-		unsigned int num_gh, struct gfs_holder *ghs)
-{
-	struct inode *inode = file->f_mapping->host;
-	struct gfs_inode *ip = get_v2ip(inode);
-	unsigned int state = LM_ST_DEFERRED;
-	int flags = 0;
-	unsigned int x;
-	ssize_t count = 0;
-	int error;
-
-	for (x = 0; x < num_gh; x++)
-		if (ghs[x].gh_gl == ip->i_gl) {
-			state = LM_ST_SHARED;
-			flags |= GL_LOCAL_EXCL;
-			break;
-		}
-
-	gfs_holder_init(ip->i_gl, state, flags, &ghs[num_gh]);
-
-	if (num_gh && atomic_read(&current->mm->mm_users) > 1) {
-		error = grope_mapping(buf, size);
-		if (error)
-			goto out;
-	}
-
-	error = gfs_glock_nq_m(num_gh + 1, ghs);
-	if (error)
-		goto out;
-
-	error = -EINVAL;
-	if (gfs_is_jdata(ip))
-		goto out_gunlock;
-
-	if (gfs_is_stuffed(ip)) {
-		size_t mask = bdev_hardsect_size(inode->i_sb->s_bdev) - 1;
-
-		if (((*offset) & mask) || (((unsigned long)buf) & mask))
-			goto out_gunlock;
-
-		count = do_read_readi(file, buf, size & ~mask, offset, iocb);
-        }
-        else {
-                if (!iocb) 
-                        count = do_sync_read(file, buf, size, offset);
-                else {
-                        struct iovec local_iov = { .iov_base = buf, .iov_len = size};
-
-                        count = generic_file_aio_read(iocb, &local_iov, 1, *offset);
-                        iocb->ki_pos = *offset;
-                }
-        }
-
-	error = 0;
-
- out_gunlock:
-	gfs_glock_dq_m(num_gh + 1, ghs);
-
- out:
-	gfs_holder_uninit(&ghs[num_gh]);
-
-	return (count) ? count : error;
-}
-
-/**
- * do_read_buf - Read bytes from a file
- * @file: The file to read from
- * @buf: The buffer to copy into
- * @size: The amount of data requested
- * @offset: The current file offset
- * @num_gh: The number of other locks we need to do the read
- * @ghs: the locks we need plus one for our lock
- *
- * Outputs: Offset - updated according to number of bytes read
- *
- * Returns: The number of bytes read, errno on failure
- */
-
-static ssize_t
-do_read_buf(struct file *file, char *buf, size_t size, loff_t *offset,
-		struct kiocb *iocb,
-		unsigned int num_gh, struct gfs_holder *ghs)
-{
-	struct gfs_inode *ip = get_v2ip(file->f_mapping->host);
-	ssize_t count = 0;
-	int error;
-
-	gfs_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &ghs[num_gh]);
-
-	if (num_gh && atomic_read(&current->mm->mm_users) > 1) {
-		error = grope_mapping(buf, size);
-		if (error)
-			goto out;
-	}
-
-	error = gfs_glock_nq_m_atime(num_gh + 1, ghs);
-	if (error)
-		goto out;
-
-	if (gfs_is_jdata(ip) ||
-	    (gfs_is_stuffed(ip) && !test_bit(GIF_PAGED, &ip->i_flags)))
-                count = do_read_readi(file, buf, size, offset, iocb);
-        else {
-                if (!iocb) {
-                        count = do_sync_read(file, buf, size, offset);
-                } else {
-                        struct iovec local_iov = { .iov_base = buf, .iov_len = size};
-
-                        count = generic_file_aio_read(iocb, &local_iov, 1, *offset);
-                        iocb->ki_pos = *offset;
-                }
-        }
-
-	gfs_glock_dq_m(num_gh + 1, ghs);
-
- out:
-	gfs_holder_uninit(&ghs[num_gh]);
-
-	return (count) ? count : error;
-}
-
-static ssize_t
-__gfs_read(struct file *file, char *buf, size_t size, loff_t *offset, struct kiocb *iocb)
-{
-	atomic_inc(&get_v2sdp(file->f_mapping->host->i_sb)->sd_ops_file);
-
-	if (file->f_flags & O_DIRECT)
-		return walk_vm(file, buf, size, offset, iocb, do_read_direct);
-	else
-		return walk_vm(file, buf, size, offset, iocb, do_read_buf);
-}
-
-/**
- * gfs_read - Read bytes from a file
- * @file: The file to read from
- * @buf: The buffer to copy into
- * @size: The amount of data requested
- * @offset: The current file offset
- *
- * Outputs: Offset - updated according to number of bytes read
- *
- * Returns: The number of bytes read, errno on failure
- */
-
-static ssize_t
-gfs_read(struct file *file, char *buf, size_t size, loff_t *offset)
-{
-	return(__gfs_read(file, buf, size, offset, NULL));
-}
-
-/*
- * gfs_aio_read: match with vfs generic_file_aio_read as:
- *	(struct kiocb *iocb, char __user *buf, size_t count, loff_t pos)
- */
-static ssize_t
-gfs_aio_read(struct kiocb *iocb, const struct iovec *iov, unsigned long count,
-		loff_t pos)
-{
-	struct file *filp = iocb->ki_filp;
-
-	BUG_ON(iocb->ki_pos != pos);
-	return(__gfs_read(filp, iov->iov_base, iov->iov_len, &iocb->ki_pos, iocb));
-}
-
-/**
- * gfs_file_aio_write_nolock - Call vfs aio layer to write bytes to a file
- * @file: The file to write to
- * @buf: The buffer to copy from
- * @size: The amount of data requested
- * @offset: The offset in the file to write
- * @iocb: The io control block.  If NULL, a temporary one will be used.
- *
- * Returns: The number of bytes written, errno on failure
- */
-static ssize_t
-gfs_file_aio_write_nolock(struct file *file, char *buf, size_t size,
-                                                  loff_t *offset, struct kiocb *iocb)
-{
-        struct iovec local_iov = { .iov_base = buf, .iov_len = size };
-        struct kiocb local_iocb, *kiocb = NULL;
-        ssize_t count;
-
-        if (!iocb) {
-                init_sync_kiocb(&local_iocb, file);
-                local_iocb.ki_nr_segs = 1;
-                kiocb = &local_iocb;
-        }
-        else
-                kiocb = iocb;
-        
-        kiocb->ki_pos = *offset;
-        count = generic_file_aio_write_nolock(kiocb, &local_iov, kiocb->ki_nr_segs,
-                                                                                  kiocb->ki_pos);
-        *offset = kiocb->ki_pos;
-        if (kiocb == &local_iocb && count == -EIOCBQUEUED)
-                count = wait_on_sync_kiocb(kiocb);
-        return count;
-}
-
-/**
- * do_write_direct_alloc - Write bytes to a file
- * @file: The file to write to
- * @buf: The buffer to copy from
- * @size: The amount of data requested
- * @offset: The current file offset
- *
- * Outputs: Offset - updated according to number of bytes written
- *
- * Returns: The number of bytes written, errno on failure
- */
-
-static ssize_t
-do_write_direct_alloc(struct file *file, char *buf, size_t size, loff_t *offset,
-			struct kiocb *iocb)
-{
-	struct inode *inode = file->f_mapping->host;
-	struct gfs_inode *ip = get_v2ip(inode);
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_alloc *al = NULL;
-	struct buffer_head *dibh;
-	unsigned int data_blocks, ind_blocks;
-	ssize_t count;
-	int error;
-
-	gfs_write_calc_reserv(ip, size, &data_blocks, &ind_blocks);
-
-	al = gfs_alloc_get(ip);
-
-	error = gfs_quota_lock_m(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
-	if (error)
-		goto fail;
-
-	error = gfs_quota_check(ip, ip->i_di.di_uid, ip->i_di.di_gid);
-	if (error)
-		goto fail_gunlock_q;
-
-	al->al_requested_meta = ind_blocks;
-	al->al_requested_data = data_blocks;
-
-	error = gfs_inplace_reserve(ip);
-	if (error)
-		goto fail_gunlock_q;
-
-	/* Trans may require:
-	   All blocks for a RG bitmap, whatever indirect blocks we
-	   need, a modified dinode, and a quota change. */
-
-	error = gfs_trans_begin(sdp,
-				1 + al->al_rgd->rd_ri.ri_length + ind_blocks,
-				1);
-	if (error)
-		goto fail_ipres;
-
-	if ((ip->i_di.di_mode & (S_ISUID | S_ISGID)) && !capable(CAP_FSETID)) {
-		error = gfs_get_inode_buffer(ip, &dibh);
-		if (error)
-			goto fail_end_trans;
-
-		ip->i_di.di_mode &= (ip->i_di.di_mode & S_IXGRP) ? (~(S_ISUID | S_ISGID)) : (~S_ISUID);
-
-		gfs_trans_add_bh(ip->i_gl, dibh);
-		gfs_dinode_out(&ip->i_di, dibh->b_data);
-		brelse(dibh);
-	}
-
-	if (gfs_is_stuffed(ip)) { error = gfs_unstuff_dinode(ip, gfs_unstuffer_sync, NULL); if (error)
-			goto fail_end_trans;
-	}
-
-	count = gfs_file_aio_write_nolock(file, buf, size, offset, iocb);
-	if (count < 0) {
-		error = count;
-		goto fail_end_trans;
-	}
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-	if (error)
-		goto fail_end_trans;
-
-	if (ip->i_di.di_size < inode->i_size)
-		ip->i_di.di_size = inode->i_size;
-	ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds();
-
-	gfs_trans_add_bh(ip->i_gl, dibh);
-	gfs_dinode_out(&ip->i_di, dibh->b_data);
-	brelse(dibh);
-
-	gfs_trans_end(sdp);
-
-	/* Question (wcheng)
-	 * 1. should IS_SYNC flush glock ?
-	 * 2. does gfs_log_flush_glock flush data ?
-	 */
-	if (file->f_flags & O_SYNC)
-		gfs_log_flush_glock(ip->i_gl);
-
-	gfs_inplace_release(ip);
-	gfs_quota_unlock_m(ip);
-	gfs_alloc_put(ip);
-
-	if (file->f_mapping->nrpages) {
-		error = filemap_fdatawrite(file->f_mapping);
-		if (!error)
-			error = filemap_fdatawait(file->f_mapping);
-	}
-	if (error)
-		return error;
-
-	return count;
-
- fail_end_trans:
-	gfs_trans_end(sdp);
-
- fail_ipres:
-	gfs_inplace_release(ip);
-
- fail_gunlock_q:
-	gfs_quota_unlock_m(ip);
-
- fail:
-	gfs_alloc_put(ip);
-
-	return error;
-}
-
-/**
- * do_write_direct - Write bytes to a file
- * @file: The file to write to
- * @buf: The buffer to copy from
- * @size: The amount of data requested
- * @offset: The current file offset
- * @num_gh: The number of other locks we need to do the read
- * @gh: the locks we need plus one for our lock
- *
- * Outputs: Offset - updated according to number of bytes written
- *
- * Returns: The number of bytes written, errno on failure
- */
-
-static ssize_t
-do_write_direct(struct file *file, char *buf, size_t size, loff_t *offset,
-		struct kiocb *iocb,
-		unsigned int num_gh, struct gfs_holder *ghs)
-{
-	struct gfs_inode *ip = get_v2ip(file->f_mapping->host);
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_file *fp = get_v2fp(file);
-	unsigned int state = LM_ST_DEFERRED;
-	int alloc_required;
-	unsigned int x;
-	size_t s;
-	ssize_t count = 0;
-	int error;
-
-	if (test_bit(GFF_DID_DIRECT_ALLOC, &fp->f_flags))
-		state = LM_ST_EXCLUSIVE;
-	else
-		for (x = 0; x < num_gh; x++)
-			if (ghs[x].gh_gl == ip->i_gl) {
-				state = LM_ST_EXCLUSIVE;
-				break;
-			}
-
- restart:
-	gfs_holder_init(ip->i_gl, state, 0, &ghs[num_gh]);
-
-	if (num_gh && atomic_read(&current->mm->mm_users) > 1) {
-		error = grope_mapping(buf, size);
-		if (error)
-			goto out;
-	}
-
-	error = gfs_glock_nq_m(num_gh + 1, ghs);
-	if (error)
-		goto out;
-
-	error = -EINVAL;
-	if (gfs_is_jdata(ip))
-		goto out_gunlock;
-
-	if (num_gh) {
-		error = grope_mapping(buf, size);
-		if (error)
-			goto out_gunlock;
-	}
-
-	if (file->f_flags & O_APPEND)
-		*offset = ip->i_di.di_size;
-
-	if (!(file->f_flags & O_LARGEFILE)) {
-		error = -EFBIG;
-		if (*offset >= 0x7FFFFFFFull)
-			goto out_gunlock;
-		if (*offset + size > 0x7FFFFFFFull)
-			size = 0x7FFFFFFFull - *offset;
-	}
-
-	if (gfs_is_stuffed(ip) ||
-	    *offset + size > ip->i_di.di_size ||
-	    ((ip->i_di.di_mode & (S_ISUID | S_ISGID)) && !capable(CAP_FSETID)))
-		alloc_required = TRUE;
-	else {
-		error = gfs_write_alloc_required(ip, *offset, size,
-						 &alloc_required);
-		if (error)
-			goto out_gunlock;
-	}
-
-	if (alloc_required && state != LM_ST_EXCLUSIVE) {
-		gfs_glock_dq_m(num_gh + 1, ghs);
-		gfs_holder_uninit(&ghs[num_gh]);
-		state = LM_ST_EXCLUSIVE;
-		goto restart;
-	}
-
-	if (alloc_required) {
-		set_bit(GFF_DID_DIRECT_ALLOC, &fp->f_flags);
-
-		/* for asynchronous IO, the buffer can not be splitted */
-		if (iocb) {
-			count = do_write_direct_alloc(file, buf, size, offset, iocb);
-			goto out_iocb_write;
-		}
-
-		/* split large writes into smaller atomic transactions */
-		while (size) {
-			s = gfs_tune_get(sdp, gt_max_atomic_write);
-			if (s > size)
-				s = size;
-
-			error = do_write_direct_alloc(file, buf, s, offset, iocb);
-			if (error < 0)
-				goto out_gunlock;
-
-			buf += error;
-			size -= error;
-			count += error;
-		}
-	} else {
-		struct gfs_holder t_gh;
-
-		clear_bit(GFF_DID_DIRECT_ALLOC, &fp->f_flags);
-
-		error = gfs_glock_nq_init(sdp->sd_trans_gl, LM_ST_SHARED, 0, &t_gh);
-		if (error)
-			goto out_gunlock;
-
-		/* Todo: It would be nice if init_sync_kiocb is exported.
-		 *  .. wcheng
-		 */
-		count = gfs_file_aio_write_nolock(file, buf, size, offset, iocb);
-		gfs_glock_dq_uninit(&t_gh);
-	}
-
-out_iocb_write:
-	error = 0;
-
-out_gunlock:
-	gfs_glock_dq_m(num_gh + 1, ghs);
-
-out:
-	gfs_holder_uninit(&ghs[num_gh]);
-
-	return (count) ? count : error;
-}
-
-/**
- * do_do_write_buf - Write bytes to a file
- * @file: The file to write to
- * @buf: The buffer to copy from
- * @size: The amount of data requested
- * @offset: The current file offset
- *
- * Outputs: Offset - updated according to number of bytes written
- *
- * Returns: The number of bytes written, errno on failure
- */
-
-static ssize_t
-do_do_write_buf(struct file *file, char *buf, size_t size, loff_t *offset,
-		struct kiocb *iocb)
-{
-	struct inode *inode = file->f_mapping->host;
-	struct gfs_inode *ip = get_v2ip(inode);
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_alloc *al = NULL;
-	struct buffer_head *dibh;
-	unsigned int data_blocks, ind_blocks;
-	int alloc_required, journaled;
-	ssize_t count;
-	int error;
-
-	journaled = gfs_is_jdata(ip);
-
-	gfs_write_calc_reserv(ip, size, &data_blocks, &ind_blocks);
-
-	error = gfs_write_alloc_required(ip, *offset, size, &alloc_required);
-	if (error)
-		return error;
-
-	if (alloc_required) {
-		al = gfs_alloc_get(ip);
-
-		error = gfs_quota_lock_m(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
-		if (error)
-			goto fail;
-
-		error = gfs_quota_check(ip, ip->i_di.di_uid, ip->i_di.di_gid);
-		if (error)
-			goto fail_gunlock_q;
-
-		if (journaled)
-			al->al_requested_meta = ind_blocks + data_blocks;
-		else {
-			al->al_requested_meta = ind_blocks;
-			al->al_requested_data = data_blocks;
-		}
-
-		error = gfs_inplace_reserve(ip);
-		if (error)
-			goto fail_gunlock_q;
-
-		/* Trans may require:
-		   All blocks for a RG bitmap, whatever indirect blocks we
-		   need, a modified dinode, and a quota change. */
-
-		error = gfs_trans_begin(sdp,
-					1 + al->al_rgd->rd_ri.ri_length +
-					ind_blocks +
-					((journaled) ? data_blocks : 0), 1);
-		if (error)
-			goto fail_ipres;
-	} else {
-		/* Trans may require:
-		   A modified dinode. */
-
-		error = gfs_trans_begin(sdp,
-					1 + ((journaled) ? data_blocks : 0), 0);
-		if (error)
-			goto fail_ipres;
-	}
-
-	if ((ip->i_di.di_mode & (S_ISUID | S_ISGID)) && !capable(CAP_FSETID)) {
-		error = gfs_get_inode_buffer(ip, &dibh);
-		if (error)
-			goto fail_end_trans;
-
-		ip->i_di.di_mode &= (ip->i_di.di_mode & S_IXGRP) ? (~(S_ISUID | S_ISGID)) : (~S_ISUID);
-
-		gfs_trans_add_bh(ip->i_gl, dibh);
-		gfs_dinode_out(&ip->i_di, dibh->b_data);
-		brelse(dibh);
-	}
-
-	if (journaled ||
-	    (gfs_is_stuffed(ip) && !test_bit(GIF_PAGED, &ip->i_flags) &&
-	     *offset + size <= sdp->sd_sb.sb_bsize - sizeof(struct gfs_dinode))) {
-
-		count = gfs_writei(ip, buf, *offset, size, gfs_copy_from_user, iocb);
-		if (count < 0) {
-			error = count;
-			goto fail_end_trans;
-		}
-		if (gfs_is_stuffed(ip)){
-			struct page *page;
-			page = find_get_page(file->f_mapping, 0);
-			if (page) {
-				ClearPageUptodate(page);
-				page_cache_release(page);
-			}
-		}
-		*offset += count;
-	} else {
-		count = gfs_file_aio_write_nolock(file, buf, size, offset, iocb);
-		if (count < 0) {
-			error = count;
-			goto fail_end_trans;
-		}
-
-		error = gfs_get_inode_buffer(ip, &dibh);
-		if (error)
-			goto fail_end_trans;
-
-		if (ip->i_di.di_size < inode->i_size)
-			ip->i_di.di_size = inode->i_size;
-		ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds();
-
-		gfs_trans_add_bh(ip->i_gl, dibh);
-		gfs_dinode_out(&ip->i_di, dibh->b_data);
-		brelse(dibh);
-	}
-
-	gfs_trans_end(sdp);
-
-	if (file->f_flags & O_SYNC || IS_SYNC(inode)) {
-		gfs_log_flush_glock(ip->i_gl);
-		error = filemap_fdatawrite(file->f_mapping);
-		if (error == 0)
-			error = filemap_fdatawait(file->f_mapping);
-		if (error)
-			goto fail_ipres;
-	}
-
-	if (alloc_required) {
-		gfs_assert_warn(sdp, count != size ||
-				al->al_alloced_meta ||
-				al->al_alloced_data);
-		gfs_inplace_release(ip);
-		gfs_quota_unlock_m(ip);
-		gfs_alloc_put(ip);
-	}
-
-	return count;
-
- fail_end_trans:
-	gfs_trans_end(sdp);
-
- fail_ipres:
-	if (alloc_required)
-		gfs_inplace_release(ip);
-
- fail_gunlock_q:
-	if (alloc_required)
-		gfs_quota_unlock_m(ip);
-
- fail:
-	if (alloc_required)
-		gfs_alloc_put(ip);
-
-	return error;
-}
-
-/**
- * do_write_buf - Write bytes to a file
- * @file: The file to write to
- * @buf: The buffer to copy from
- * @size: The amount of data requested
- * @offset: The current file offset
- * @num_gh: The number of other locks we need to do the read
- * @gh: the locks we need plus one for our lock
- *
- * Outputs: Offset - updated according to number of bytes written
- *
- * Returns: The number of bytes written, errno on failure
- */
-
-static ssize_t
-do_write_buf(struct file *file,
-		char *buf, size_t size, loff_t *offset,
-		struct kiocb *iocb,
-		unsigned int num_gh, struct gfs_holder *ghs)
-{
-	struct gfs_inode *ip = get_v2ip(file->f_mapping->host);
-	struct gfs_sbd *sdp = ip->i_sbd;
-	size_t s;
-	ssize_t count = 0;
-	int error;
-
-	gfs_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &ghs[num_gh]);
-
-	if (num_gh && atomic_read(&current->mm->mm_users) > 1) {
-		error = grope_mapping(buf, size);
-		if (error)
-			goto out;
-	}
-
-	error = gfs_glock_nq_m(num_gh + 1, ghs);
-	if (error)
-		goto out;
-
-	if (num_gh) {
-		error = grope_mapping(buf, size);
-		if (error)
-			goto out_gunlock;
-	}
-
-	if (file->f_flags & O_APPEND)
-		*offset = ip->i_di.di_size;
-
-	if (!(file->f_flags & O_LARGEFILE)) {
-		error = -EFBIG;
-		if (*offset >= 0x7FFFFFFFull)
-			goto out_gunlock;
-		if (*offset + size > 0x7FFFFFFFull)
-			size = 0x7FFFFFFFull - *offset;
-	}
-
-	/* split large writes into smaller atomic transactions */
-	while (size) {
-		s = gfs_tune_get(sdp, gt_max_atomic_write);
-		if (s > size)
-			s = size;
-
-		error = do_do_write_buf(file, buf, s, offset, iocb);
-		if (error < 0)
-			goto out_gunlock;
-
-		buf += error;
-		size -= error;
-		count += error;
-	}
-
-	error = 0;
-
- out_gunlock:
-	gfs_glock_dq_m(num_gh + 1, ghs);
-
- out:
-	gfs_holder_uninit(&ghs[num_gh]);
-
-	return (count) ? count : error;
-}
-
-/**
- * gfs_write - Write bytes to a file
- * @file: The file to write to
- * @buf: The buffer to copy from
- * @size: The amount of data requested
- * @offset: The current file offset
- *
- * Outputs: Offset - updated according to number of bytes written
- *
- * Returns: The number of bytes written, errno on failure
- */
-
-static ssize_t
-__gfs_write(struct file *file, const char *buf, size_t size, loff_t *offset, struct kiocb *iocb)
-{
-	struct inode *inode = file->f_mapping->host;
-	ssize_t count;
-
-	atomic_inc(&get_v2sdp(inode->i_sb)->sd_ops_file);
-
-	if (*offset < 0)
-		return -EINVAL;
-	if (!access_ok(VERIFY_READ, buf, size))
-		return -EFAULT;
-
-	mutex_lock(&inode->i_mutex);
-	if (file->f_flags & O_DIRECT)
-		count = walk_vm(file, (char *)buf, size, offset, iocb, do_write_direct);
-	else
-		count = walk_vm(file, (char *)buf, size, offset, iocb, do_write_buf);
-	mutex_unlock(&inode->i_mutex);
-
-	return count;
-}
-
-static ssize_t
-gfs_write(struct file *file, const char *buf, size_t size, loff_t *offset)
-{
-	return(__gfs_write(file, buf, size, offset, NULL));
-}
-
-static ssize_t
-gfs_aio_write(struct kiocb *iocb, const struct iovec *iov, unsigned long segs,
-			loff_t pos)
-{
-	struct file *file = iocb->ki_filp;
-
-	BUG_ON(iocb->ki_pos != pos);
-
-	return(__gfs_write(file, iov->iov_base, iov->iov_len, &iocb->ki_pos,
-					iocb));
-}
-
-/**
- * filldir_reg_func - Report a directory entry to the caller of gfs_dir_read()
- * @opaque: opaque data used by the function
- * @name: the name of the directory entry
- * @length: the length of the name
- * @offset: the entry's offset in the directory
- * @inum: the inode number the entry points to
- * @type: the type of inode the entry points to
- *
- * Returns: 0 on success, 1 if buffer full
- */
-
-static int
-filldir_reg_func(void *opaque,
-		 const char *name, unsigned int length,
-		 uint64_t offset,
-		 struct gfs_inum *inum, unsigned int type)
-{
-	struct filldir_reg *fdr = (struct filldir_reg *)opaque;
-	struct gfs_sbd *sdp = fdr->fdr_sbd;
-	unsigned int vfs_type;
-	int error;
-
-	switch (type) {
-	case GFS_FILE_NON:
-		vfs_type = DT_UNKNOWN;
-		break;
-	case GFS_FILE_REG:
-		vfs_type = DT_REG;
-		break;
-	case GFS_FILE_DIR:
-		vfs_type = DT_DIR;
-		break;
-	case GFS_FILE_LNK:
-		vfs_type = DT_LNK;
-		break;
-	case GFS_FILE_BLK:
-		vfs_type = DT_BLK;
-		break;
-	case GFS_FILE_CHR:
-		vfs_type = DT_CHR;
-		break;
-	case GFS_FILE_FIFO:
-		vfs_type = DT_FIFO;
-		break;
-	case GFS_FILE_SOCK:
-		vfs_type = DT_SOCK;
-		break;
-	default:
-		if (gfs_consist(sdp))
-			printk("GFS: fsid=%s: type = %u\n",
-			       sdp->sd_fsname, type);
-		return -EIO;
-	}
-
-	error = fdr->fdr_filldir(fdr->fdr_opaque, name, length, offset,
-				 inum->no_formal_ino, vfs_type);
-	if (error)
-		return 1;
-
-	/* Prefetch locks */
-	if (fdr->fdr_prefetch && !(length == 1 && *name == '.')) {
-		gfs_glock_prefetch_num(sdp,
-				       inum->no_formal_ino, &gfs_inode_glops,
-				       LM_ST_SHARED, LM_FLAG_TRY | LM_FLAG_ANY);
-		gfs_glock_prefetch_num(sdp,
-				       inum->no_addr, &gfs_iopen_glops,
-				       LM_ST_SHARED, LM_FLAG_TRY);
-	}
-
-	return 0;
-}
-
-static inline int
-high_stat_rate(struct gfs_inode *ip)
-{
-	struct timeval now, diff;
-	unsigned long milli = 0;
-	unsigned int rate = 0; /* stats per second in this dir */
-
-	do_gettimeofday(&now);
-	diff.tv_sec = now.tv_sec - ip->i_dir_stat_st.tv_sec;
-	diff.tv_usec = now.tv_usec - ip->i_dir_stat_st.tv_usec;
-	if (diff.tv_usec < 0) {
-		diff.tv_usec += 1000000;
-		diff.tv_sec--;
-	}
-	milli = (diff.tv_sec * 1000) + (diff.tv_usec / 1000);
-	if (milli)
-		rate = (ip->i_dir_stats * 1000) / milli;
-
-	if (rate > 10) /* More than 10 stats/sec */
-		return 1;
-	return 0;
-}
-
-/**
- * readdir_reg - Read directory entries from a directory
- * @file: The directory to read from
- * @dirent: Buffer for dirents
- * @filldir: Function used to do the copying
- *
- * Returns: errno
- */
-
-static int
-readdir_reg(struct file *file, void *dirent, filldir_t filldir)
-{
-	struct gfs_inode *dip = get_v2ip(file->f_mapping->host);
-	struct filldir_reg fdr;
-	struct gfs_holder d_gh;
-	uint64_t offset = file->f_pos;
-	int error;
-
-	fdr.fdr_sbd = dip->i_sbd;
-	fdr.fdr_prefetch = high_stat_rate(dip) ? TRUE : FALSE;
-	fdr.fdr_filldir = filldir;
-	fdr.fdr_opaque = dirent;
-
-	/* reset stat counter and timestamp */
-	dip->i_dir_stats = 0;
-	do_gettimeofday(&dip->i_dir_stat_st);
-
-	gfs_holder_init(dip->i_gl, LM_ST_SHARED, GL_ATIME, &d_gh);
-	error = gfs_glock_nq_atime(&d_gh);
-	if (error) {
-		gfs_holder_uninit(&d_gh);
-		return error;
-	}
-
-	error = gfs_dir_read(dip, &offset, &fdr, filldir_reg_func);
-
-	gfs_glock_dq_uninit(&d_gh);
-
-	file->f_pos = offset;
-
-	return error;
-}
-
-/**
- * filldir_bad_func - Report a directory entry to the caller of gfs_dir_read()
- * @opaque: opaque data used by the function
- * @name: the name of the directory entry
- * @length: the length of the name
- * @offset: the entry's offset in the directory
- * @inum: the inode number the entry points to
- * @type: the type of inode the entry points to
- *
- * For supporting NFS.
- *
- * Returns: 0 on success, 1 if buffer full
- */
-
-static int
-filldir_bad_func(void *opaque,
-		 const char *name, unsigned int length,
-		 uint64_t offset,
-		 struct gfs_inum *inum, unsigned int type)
-{
-	struct filldir_bad *fdb = (struct filldir_bad *)opaque;
-	struct gfs_sbd *sdp = fdb->fdb_sbd;
-	struct filldir_bad_entry *fbe;
-
-	if (fdb->fdb_entry_off == fdb->fdb_entry_num ||
-	    fdb->fdb_name_off + length > fdb->fdb_name_size)
-		return 1;
-
-	fbe = &fdb->fdb_entry[fdb->fdb_entry_off];
-	fbe->fbe_name = fdb->fdb_name + fdb->fdb_name_off;
-	memcpy(fbe->fbe_name, name, length);
-	fbe->fbe_length = length;
-	fbe->fbe_offset = offset;
-	fbe->fbe_inum = *inum;
-	fbe->fbe_type = type;
-
-	fdb->fdb_entry_off++;
-	fdb->fdb_name_off += length;
-
-	/* Prefetch locks */
-	if (!(length == 1 && *name == '.')) {
-		gfs_glock_prefetch_num(sdp,
-				       inum->no_formal_ino, &gfs_inode_glops,
-				       LM_ST_SHARED, LM_FLAG_TRY | LM_FLAG_ANY);
-		gfs_glock_prefetch_num(sdp,
-				       inum->no_addr, &gfs_iopen_glops,
-				       LM_ST_SHARED, LM_FLAG_TRY);
-	}
-
-	return 0;
-}
-
-/**
- * readdir_bad - Read directory entries from a directory
- * @file: The directory to read from
- * @dirent: Buffer for dirents
- * @filldir: Function used to do the copying
- *
- * For supporting NFS.
- *
- * Returns: errno
- */
-
-static int
-readdir_bad(struct file *file, void *dirent, filldir_t filldir)
-{
-	struct gfs_inode *dip = get_v2ip(file->f_mapping->host);
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct filldir_reg fdr;
-	unsigned int entries, size;
-	struct filldir_bad *fdb;
-	struct gfs_holder d_gh;
-	uint64_t offset = file->f_pos;
-	unsigned int x;
-	struct filldir_bad_entry *fbe;
-	int error;
-
-	entries = gfs_tune_get(sdp, gt_entries_per_readdir);
-	size = sizeof(struct filldir_bad) +
-	    entries * (sizeof(struct filldir_bad_entry) + GFS_FAST_NAME_SIZE);
-
-	fdb = kmalloc(size, GFP_KERNEL);
-	if (!fdb)
-		return -ENOMEM;
-	memset(fdb, 0, size);
-
-	fdb->fdb_sbd = sdp;
-	fdb->fdb_entry = (struct filldir_bad_entry *)(fdb + 1);
-	fdb->fdb_entry_num = entries;
-	fdb->fdb_name = ((char *)fdb) + sizeof(struct filldir_bad) +
-		entries * sizeof(struct filldir_bad_entry);
-	fdb->fdb_name_size = entries * GFS_FAST_NAME_SIZE;
-
-	gfs_holder_init(dip->i_gl, LM_ST_SHARED, GL_ATIME, &d_gh);
-	error = gfs_glock_nq_atime(&d_gh);
-	if (error) {
-		gfs_holder_uninit(&d_gh);
-		goto out;
-	}
-
-	error = gfs_dir_read(dip, &offset, fdb, filldir_bad_func);
-
-	gfs_glock_dq_uninit(&d_gh);
-
-	fdr.fdr_sbd = sdp;
-	fdr.fdr_prefetch = FALSE;
-	fdr.fdr_filldir = filldir;
-	fdr.fdr_opaque = dirent;
-
-	for (x = 0; x < fdb->fdb_entry_off; x++) {
-		fbe = &fdb->fdb_entry[x];
-
-		error = filldir_reg_func(&fdr,
-					 fbe->fbe_name, fbe->fbe_length,
-					 fbe->fbe_offset,
-					 &fbe->fbe_inum, fbe->fbe_type);
-		if (error) {
-			file->f_pos = fbe->fbe_offset;
-			error = 0;
-			goto out;
-		}
-	}
-
-	file->f_pos = offset;
-
- out:
-	kfree(fdb);
-
-	return error;
-}
-
-/**
- * gfs_readdir - Read directory entries from a directory
- * @file: The directory to read from
- * @dirent: Buffer for dirents
- * @filldir: Function used to do the copying
- *
- * Returns: errno
- */
-
-static int
-gfs_readdir(struct file *file, void *dirent, filldir_t filldir)
-{
-	int error;
-
-	atomic_inc(&get_v2sdp(file->f_mapping->host->i_sb)->sd_ops_file);
-
-	/* Use "bad" one if we're called from NFS daemon */
-	if (strcmp(current->comm, "nfsd") != 0)
-		error = readdir_reg(file, dirent, filldir);
-	else
-		error = readdir_bad(file, dirent, filldir);
-
-	return error;
-}
-
-/**
- * gfs_ioctl - do an ioctl on a file
- * @inode: the inode
- * @file: the file pointer
- * @cmd: the ioctl command
- * @arg: the argument
- *
- * Returns: errno
- */
-
-static int
-gfs_ioctl(struct inode *inode, struct file *file,
-	  unsigned int cmd, unsigned long arg)
-{
-	struct gfs_inode *ip = get_v2ip(inode);
-
-	atomic_inc(&ip->i_sbd->sd_ops_file);
-
-	switch (cmd) {
-	case GFS_IOCTL_IDENTIFY: {
-                unsigned int x = GFS_MAGIC;
-                if (copy_to_user((unsigned int *)arg, &x, sizeof(unsigned int)))
-                        return -EFAULT;
-		return 0;
-        }
-
-	case GFS_IOCTL_SUPER:
-		return gfs_ioctl_i(ip, (void *)arg);
-
-	default:
-		return -ENOTTY;
-	}
-}
-
-#ifdef CONFIG_COMPAT
-/**
- * gfs_compat_ioctl - do an ioctl on a file - compatible between 32-64 bit
- * @inode: the inode
- * @file: the file pointer
- * @cmd: the ioctl command
- * @arg: the argument
- *
- * Returns: errno
- */
-
-static long
-gfs_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg)
-{
-	struct gfs_inode *ip = get_v2ip(file->f_mapping->host);
-
-	atomic_inc(&ip->i_sbd->sd_ops_file);
-
-	switch (cmd) {
-	case GFS_IOCTL_IDENTIFY: {
-                unsigned int x = GFS_MAGIC;
-                if (copy_to_user((unsigned int *)arg, &x, sizeof(unsigned int)))
-                        return -EFAULT;
-		return 0;
-        }
-
-	case GFS_IOCTL_SUPER:
-		return gfs_ioctl_i_compat(ip, arg);
-
-	default:
-		return -ENOTTY;
-	}
-}
-#endif
-
-/**
- * gfs_mmap - We don't support shared writable mappings right now
- * @file: The file to map
- * @vma: The VMA which described the mapping
- *
- * Returns: 0 or error code
- */
-
-static int
-gfs_mmap(struct file *file, struct vm_area_struct *vma)
-{
-	struct gfs_inode *ip = get_v2ip(file->f_mapping->host);
-	struct gfs_holder i_gh;
-	int error;
-
-	atomic_inc(&ip->i_sbd->sd_ops_file);
-
-	gfs_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &i_gh);
-	error = gfs_glock_nq_atime(&i_gh);
-	if (error) {
-		gfs_holder_uninit(&i_gh);
-		return error;
-	}
-
-	if (gfs_is_jdata(ip)) {
-		if (vma->vm_flags & VM_MAYSHARE)
-			error = -ENOSYS;
-		else
-			vma->vm_ops = &gfs_vm_ops_private;
-	} else {
-		/* This is VM_MAYWRITE instead of VM_WRITE because a call
-		   to mprotect() can turn on VM_WRITE later. */
-
-		if ((vma->vm_flags & (VM_MAYSHARE | VM_MAYWRITE)) == (VM_MAYSHARE | VM_MAYWRITE))
-			vma->vm_ops = &gfs_vm_ops_sharewrite;
-		else
-			vma->vm_ops = &gfs_vm_ops_private;
-	}
-
-	gfs_glock_dq_uninit(&i_gh);
-
-	return error;
-}
-
-/**
- * gfs_open - open a file
- * @inode: the inode to open
- * @file: the struct file for this opening
- *
- * Returns: errno
- */
-
-static int
-gfs_open(struct inode *inode, struct file *file)
-{
-	struct gfs_inode *ip = get_v2ip(inode);
-	struct gfs_holder i_gh;
-	struct gfs_file *fp;
-	int error;
-
-	atomic_inc(&ip->i_sbd->sd_ops_file);
-
-	fp = kmalloc(sizeof(struct gfs_file), GFP_KERNEL);
-	if (!fp)
-		return -ENOMEM;
-	memset(fp, 0, sizeof(struct gfs_file));
-
-	init_MUTEX(&fp->f_fl_lock);
-
-	fp->f_inode = ip;
-	fp->f_vfile = file;
-
-	gfs_assert_warn(ip->i_sbd, !get_v2fp(file));
-	set_v2fp(file, fp);
-
-	if (ip->i_di.di_type == GFS_FILE_REG) {
-		error = gfs_glock_nq_init(ip->i_gl,
-					  LM_ST_SHARED, LM_FLAG_ANY,
-					  &i_gh);
-		if (error)
-			goto fail;
-
-		if (!(file->f_flags & O_LARGEFILE) &&
-		    ip->i_di.di_size > 0x7FFFFFFFull) {
-			error = -EFBIG;
-			goto fail_gunlock;
-		}
-
-		/* Listen to the Direct I/O flag */
-
-		if (ip->i_di.di_flags & GFS_DIF_DIRECTIO)
-			file->f_flags |= O_DIRECT;
-
-		/* Don't let the user open O_DIRECT on a jdata file */
-
-		if ((file->f_flags & O_DIRECT) && gfs_is_jdata(ip)) {
-			error = -EINVAL;
-			goto fail_gunlock;
-		}
-
-		gfs_glock_dq_uninit(&i_gh);
-	}
-
-	return 0;
-
- fail_gunlock:
-	gfs_glock_dq_uninit(&i_gh);
-
- fail:
-	set_v2fp(file, NULL);
-	kfree(fp);
-
-	return error;
-}
-
-/**
- * gfs_close - called to close a struct file
- * @inode: the inode the struct file belongs to
- * @file: the struct file being closed
- *
- * Returns: errno
- */
-
-static int
-gfs_close(struct inode *inode, struct file *file)
-{
-	struct gfs_sbd *sdp = get_v2sdp(inode->i_sb);
-	struct gfs_file *fp;
-
-	atomic_inc(&sdp->sd_ops_file);
-
-	fp = get_v2fp(file);
-	set_v2fp(file, NULL);
-
-	if (!gfs_assert_warn(sdp, fp))
-		kfree(fp);
-
-	return 0;
-}
-
-/**
- * gfs_fsync - sync the dirty data for a file (across the cluster)
- * @file: the file that points to the dentry (we ignore this)
- * @dentry: the dentry that points to the inode to sync
- *
- * Returns: errno
- *
- * Obtain a SHARED lock on the file, to force any node with an EXCLUSIVE lock
- *   to sync file's dirty data to disk, as it releases the EXCLUSIVE lock.
- */
-
-static int
-gfs_fsync(struct file *file, struct dentry *dentry, int datasync)
-{
-	struct gfs_inode *ip = get_v2ip(dentry->d_inode);
-	struct gfs_holder i_gh;
-	struct inode *inode = dentry->d_inode;
-	int error;
-
-	atomic_inc(&ip->i_sbd->sd_ops_file);
-
-	error = gfs_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh);
-	if (error)
-		return error;
-
-	if (gfs_is_jdata(ip))
-		gfs_log_flush_glock(ip->i_gl);
-	else {
-		if ((!datasync) || (inode->i_state & I_DIRTY_DATASYNC)) {
-			struct writeback_control wbc = {
-				.sync_mode = WB_SYNC_ALL,
-				.nr_to_write = 0,
-			};
-			error = sync_inode(inode, &wbc);
-		}
-	}
-
-	gfs_glock_dq_uninit(&i_gh);
-
-	return error;
-}
-
-/**
- * gfs_lock - acquire/release a posix lock on a file
- * @file: the file pointer
- * @cmd: either modify or retrieve lock state, possibly wait
- * @fl: type and range of lock
- *
- * Returns: errno
- */
-
-static int
-gfs_lock(struct file *file, int cmd, struct file_lock *fl)
-{
-	struct gfs_inode *ip = get_v2ip(file->f_mapping->host);
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct lm_lockname name =
-		{ .ln_number = ip->i_num.no_formal_ino,
-		  .ln_type = LM_TYPE_PLOCK };
-
-	atomic_inc(&sdp->sd_ops_file);
-
-	if (!(fl->fl_flags & FL_POSIX))
-		return -ENOLCK;
-	if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
-		return -ENOLCK;
-
-	if (cmd == F_CANCELLK) {
-		/* Hack: */
-		cmd = F_SETLK;
-		fl->fl_type = F_UNLCK;
-	}
-
-	if (IS_GETLK(cmd))
-		return gfs_lm_plock_get(sdp, &name, file, fl);
-	else if (fl->fl_type == F_UNLCK)
-		return gfs_lm_punlock(sdp, &name, file, fl);
-	else
-		return gfs_lm_plock(sdp, &name, file, cmd, fl);
-}
-
-/**
- * gfs_splice_read - Send bytes to a file or socket
- * @in_file: The file to read from
- * @out_file: The file to write to
- * @count: The amount of data
- * @ppos: The beginning file offset
- *
- * Outputs: offset - updated according to number of bytes read
- *
- * Returns: The number of bytes sent, errno on failure
- */
-
-static ssize_t
-gfs_splice_read(struct file *in_file, loff_t *ppos, struct pipe_inode_info *pipe, size_t count, unsigned int flags)
-{
-	struct gfs_inode *ip = get_v2ip(in_file->f_mapping->host);
-	struct gfs_holder gh;
-	ssize_t retval;
-
-	atomic_inc(&ip->i_sbd->sd_ops_file);
-
-	gfs_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &gh);
-
-	retval = gfs_glock_nq_atime(&gh);
-	if (retval)
-		goto out;
-
-	if (gfs_is_jdata(ip))
-		retval = -ENOSYS;
-	else 
-		retval = generic_file_splice_read(in_file, ppos, pipe, count, flags);
-
-	gfs_glock_dq(&gh);
-
- out:
-	gfs_holder_uninit(&gh);
-
-	return retval;
-}
-
-/**
- * do_flock - Acquire a flock on a file
- * @file:
- * @cmd:
- * @fl:
- *
- * Returns: errno
- */
-
-static int
-do_flock(struct file *file, int cmd, struct file_lock *fl)
-{
-	struct gfs_file *fp = get_v2fp(file);
-	struct gfs_holder *fl_gh = &fp->f_fl_gh;
-	struct gfs_inode *ip = fp->f_inode;
-	struct gfs_glock *gl;
-	unsigned int state;
-	int flags;
-	int error = 0;
-
-	state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED;
-	flags = ((IS_SETLKW(cmd)) ? 0 : LM_FLAG_TRY) | GL_EXACT | GL_NOCACHE;
-
-	down(&fp->f_fl_lock);
-
-	gl = fl_gh->gh_gl;
-	if (gl) {
-		if (fl_gh->gh_state == state)
-			goto out;
-		gfs_glock_hold(gl);
-		flock_lock_file_wait(file,
-				     &(struct file_lock){.fl_type = F_UNLCK});		
-		gfs_glock_dq_uninit(fl_gh);
-	} else {
-		error = gfs_glock_get(ip->i_sbd,
-				      ip->i_num.no_formal_ino, &gfs_flock_glops,
-				      CREATE, &gl);
-		if (error)
-			goto out;
-	}
-
-	gfs_holder_init(gl, state, flags, fl_gh);
-	gfs_glock_put(gl);
-
-	error = gfs_glock_nq(fl_gh);
-	if (error) {
-		gfs_holder_uninit(fl_gh);
-		if (error == GLR_TRYFAILED)
-			error = -EAGAIN;
-	} else {
-		error = flock_lock_file_wait(file, fl);
-		gfs_assert_warn(ip->i_sbd, !error);
-	}
-
- out:
-	up(&fp->f_fl_lock);
-
-	return error;
-}
-
-/**
- * do_unflock - Release a flock on a file
- * @file: the file
- * @fl:
- *
- */
-
-static void
-do_unflock(struct file *file, struct file_lock *fl)
-{
-	struct gfs_file *fp = get_v2fp(file);
-	struct gfs_holder *fl_gh = &fp->f_fl_gh;
-
-	down(&fp->f_fl_lock);
-	flock_lock_file_wait(file, fl);
-	if (fl_gh->gh_gl)
-		gfs_glock_dq_uninit(fl_gh);
-	up(&fp->f_fl_lock);
-}
-
-/**
- * gfs_flock - acquire/release a flock lock on a file
- * @file: the file pointer
- * @cmd: either modify or retrieve lock state, possibly wait
- * @fl: type and range of lock
- *
- * Returns: errno
- */
-
-static int
-gfs_flock(struct file *file, int cmd, struct file_lock *fl)
-{
-	struct gfs_inode *ip = get_v2ip(file->f_mapping->host);
-
-	atomic_inc(&ip->i_sbd->sd_ops_file);
-
-	if (!(fl->fl_flags & FL_FLOCK))
-		return -ENOLCK;
-	if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
-		return -ENOLCK;
-
-	if (fl->fl_type == F_UNLCK) {
-		do_unflock(file, fl);
-		return 0;
-	} else
-		return do_flock(file, cmd, fl);
-}
-
-struct file_operations gfs_file_fops = {
-	.llseek = gfs_llseek,
-	.read = gfs_read,
-	.write = gfs_write,
-	.aio_read = gfs_aio_read,
-	.aio_write = gfs_aio_write,
-	.ioctl = gfs_ioctl,
-#ifdef CONFIG_COMPAT
-	.compat_ioctl   = gfs_compat_ioctl,
-#endif
-	.mmap = gfs_mmap,
-	.open = gfs_open,
-	.release = gfs_close,
-	.fsync = gfs_fsync,
-	.lock = gfs_lock,
-	.splice_read = gfs_splice_read,
-	.flock = gfs_flock,
-};
-
-struct file_operations gfs_file_fops_jdata = {
-	.llseek = gfs_llseek,
-	.read = gfs_read,
-	.write = gfs_write,
-	.aio_read = gfs_aio_read,
-	.aio_write = gfs_aio_write,
-	.ioctl = gfs_ioctl,
-#ifdef CONFIG_COMPAT
-	.compat_ioctl   = gfs_compat_ioctl,
-#endif
-	.mmap = gfs_mmap,
-	.open = gfs_open,
-	.release = gfs_close,
-	.fsync = gfs_fsync,
-	.lock = gfs_lock,
-	.flock = gfs_flock,
-};
-
-struct file_operations gfs_dir_fops = {
-	.readdir = gfs_readdir,
-	.ioctl = gfs_ioctl,
-#ifdef CONFIG_COMPAT
-	.compat_ioctl   = gfs_compat_ioctl,
-#endif
-	.open = gfs_open,
-	.release = gfs_close,
-	.fsync = gfs_fsync,
-	.lock = gfs_lock,
-	.flock = gfs_flock,
-};
-
-struct file_operations gfs_file_fops_nolock = {
-	.llseek = gfs_llseek,
-	.read = gfs_read,
-	.write = gfs_write,
-	.aio_read = gfs_aio_read,
-	.aio_write = gfs_aio_write,
-	.ioctl = gfs_ioctl,
-#ifdef CONFIG_COMPAT
-	.compat_ioctl = gfs_compat_ioctl,
-#endif
-	.mmap = gfs_mmap,
-	.open = gfs_open,
-	.release = gfs_close,
-	.fsync = gfs_fsync,
-	.splice_read = gfs_splice_read,
-};
-
-struct file_operations gfs_file_fops_nolock_jdata = {
-	.llseek = gfs_llseek,
-	.read = gfs_read,
-	.write = gfs_write,
-	.aio_read = gfs_aio_read,
-	.aio_write = gfs_aio_write,
-	.ioctl = gfs_ioctl,
-#ifdef CONFIG_COMPAT
-	.compat_ioctl = gfs_compat_ioctl,
-#endif
-	.mmap = gfs_mmap,
-	.open = gfs_open,
-	.release = gfs_close,
-	.fsync = gfs_fsync,
-};
-
-struct file_operations gfs_dir_fops_nolock = {
-	.readdir = gfs_readdir,
-	.ioctl = gfs_ioctl,
-#ifdef CONFIG_COMPAT
-	.compat_ioctl = gfs_compat_ioctl,
-#endif
-	.open = gfs_open,
-	.release = gfs_close,
-	.fsync = gfs_fsync,
-};
diff --git a/gfs-kernel/src/gfs/ops_file.h b/gfs-kernel/src/gfs/ops_file.h
deleted file mode 100644
index 4e7e15f..0000000
--- a/gfs-kernel/src/gfs/ops_file.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __OPS_FILE_DOT_H__
-#define __OPS_FILE_DOT_H__
-
-extern struct file_operations gfs_file_fops;
-extern struct file_operations gfs_file_fops_jdata;
-extern struct file_operations gfs_dir_fops;
-extern struct file_operations gfs_file_fops_nolock;
-extern struct file_operations gfs_file_fops_nolock_jdata;
-extern struct file_operations gfs_dir_fops_nolock;
-
-#endif /* __OPS_FILE_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/ops_fstype.c b/gfs-kernel/src/gfs/ops_fstype.c
deleted file mode 100644
index 93bf4d1..0000000
--- a/gfs-kernel/src/gfs/ops_fstype.c
+++ /dev/null
@@ -1,816 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <linux/vmalloc.h>
-#include <linux/blkdev.h>
-#include <linux/kthread.h>
-
-#include "gfs.h"
-#include "daemon.h"
-#include "glock.h"
-#include "glops.h"
-#include "inode.h"
-#include "lm.h"
-#include "mount.h"
-#include "ops_export.h"
-#include "ops_fstype.h"
-#include "ops_super.h"
-#include "proc.h"
-#include "quota.h"
-#include "recovery.h"
-#include "rgrp.h"
-#include "super.h"
-#include "sys.h"
-#include "unlinked.h"
-
-#define DO 0
-#define UNDO 1
-
-extern struct dentry_operations gfs_dops;
-
-static struct gfs_sbd *init_sbd(struct super_block *sb)
-{
-	struct gfs_sbd *sdp;
-	unsigned int x;
-
-	sdp = vmalloc(sizeof(struct gfs_sbd));
-	if (!sdp)
-		return NULL;
-
-	memset(sdp, 0, sizeof(struct gfs_sbd));
-
-	set_v2sdp(sb, sdp);
-	sdp->sd_vfs = sb;
-	gfs_tune_init(&sdp->sd_tune);
-
-	/*  Init rgrp variables  */
-
-	INIT_LIST_HEAD(&sdp->sd_rglist);
-	init_MUTEX(&sdp->sd_rindex_lock);
-	INIT_LIST_HEAD(&sdp->sd_rg_mru_list);
-	spin_lock_init(&sdp->sd_rg_mru_lock);
-	INIT_LIST_HEAD(&sdp->sd_rg_recent);
-	spin_lock_init(&sdp->sd_rg_recent_lock);
-	spin_lock_init(&sdp->sd_rg_forward_lock);
-
-	spin_lock_init(&sdp->sd_statfs_spin);
-
-	for (x = 0; x < GFS_GL_HASH_SIZE; x++) {
-		sdp->sd_gl_hash[x].hb_lock = RW_LOCK_UNLOCKED;
-		INIT_LIST_HEAD(&sdp->sd_gl_hash[x].hb_list);
-	}
-
-	INIT_LIST_HEAD(&sdp->sd_reclaim_list);
-	spin_lock_init(&sdp->sd_reclaim_lock);
-	init_waitqueue_head(&sdp->sd_reclaim_wchan);
-
-	for (x = 0; x < GFS_MHC_HASH_SIZE; x++)
-		INIT_LIST_HEAD(&sdp->sd_mhc[x]);
-	INIT_LIST_HEAD(&sdp->sd_mhc_single);
-	spin_lock_init(&sdp->sd_mhc_lock);
-
-	for (x = 0; x < GFS_DEPEND_HASH_SIZE; x++)
-		INIT_LIST_HEAD(&sdp->sd_depend[x]);
-	spin_lock_init(&sdp->sd_depend_lock);
-
-	init_MUTEX(&sdp->sd_freeze_lock);
-
-	spin_lock_init(&sdp->sd_log_seg_lock);
-	INIT_LIST_HEAD(&sdp->sd_log_seg_list);
-	init_waitqueue_head(&sdp->sd_log_seg_wait);
-	INIT_LIST_HEAD(&sdp->sd_log_ail);
-	INIT_LIST_HEAD(&sdp->sd_log_incore);
-	init_rwsem(&sdp->sd_log_lock);
-	INIT_LIST_HEAD(&sdp->sd_unlinked_list);
-	spin_lock_init(&sdp->sd_unlinked_lock);
-	INIT_LIST_HEAD(&sdp->sd_quota_list);
-	spin_lock_init(&sdp->sd_quota_lock);
-
-	INIT_LIST_HEAD(&sdp->sd_dirty_j);
-	spin_lock_init(&sdp->sd_dirty_j_lock);
-
-	spin_lock_init(&sdp->sd_ail_lock);
-	INIT_LIST_HEAD(&sdp->sd_recovery_bufs);
-
-	return sdp;
-}
-
-static void init_vfs(struct super_block *sb, unsigned noatime)
-{
-	struct gfs_sbd *sdp = sb->s_fs_info;
-
-	/*  Set up Linux Virtual (VFS) Super Block  */
-
-	sb->s_magic = GFS_MAGIC;
-	sb->s_op = &gfs_super_ops;
-	sb->s_export_op = &gfs_export_ops;
-
-	/*  Don't let the VFS update atimes.  GFS handles this itself. */
-	sb->s_flags |= MS_NOATIME | MS_NODIRATIME;
-	sb->s_maxbytes = MAX_LFS_FILESIZE;
-
-	/*  If we were mounted with -o acl (to support POSIX access control
-	    lists), tell VFS */
-	if (sdp->sd_args.ar_posix_acls)
-		sb->s_flags |= MS_POSIXACL;
-}
-
-int init_names(struct gfs_sbd *sdp, int silent)
-{
-	struct gfs_sb *sb = NULL;
-	char *proto, *table;
-	int error = 0;
-
-	proto = sdp->sd_args.ar_lockproto;
-	table = sdp->sd_args.ar_locktable;
-
-	/*  Try to autodetect  */
-
-	if (!proto[0] || !table[0]) {
-		struct buffer_head *bh;
-
-		bh = sb_getblk(sdp->sd_vfs,
-			       GFS_SB_ADDR >> sdp->sd_fsb2bb_shift);
-		lock_buffer(bh);
-		clear_buffer_uptodate(bh);
-		clear_buffer_dirty(bh);
-		unlock_buffer(bh);
-		ll_rw_block(READ, 1, &bh);
-		wait_on_buffer(bh);
-
-		if (!buffer_uptodate(bh)) {
-			brelse(bh);
-			return -EIO;
-		}
-
-		sb = kmalloc(sizeof(struct gfs_sb), GFP_KERNEL);
-		if (!sb) {
-			brelse(bh);
-			return -ENOMEM;
-		}
-		gfs_sb_in(sb, bh->b_data); 
-		brelse(bh);
-
-		error = gfs_check_sb(sdp, sb, silent);
-		if (error)
-			goto out;
-
-		if (!proto[0])
-			proto = sb->sb_lockproto;
-		if (!table[0])
-			table = sb->sb_locktable;
-	}
-
-	if (!table[0])
-		table = sdp->sd_vfs->s_id;
-
-	snprintf(sdp->sd_proto_name, 256, "%s", proto);
-	snprintf(sdp->sd_table_name, 256, "%s", table);
-
-	while ((table = strchr(sdp->sd_table_name, '/')))
-		*table = '_';
-
- out:
-	kfree(sb);
-
-	return error;
-}
-
-static int init_locking(struct gfs_sbd *sdp, struct gfs_holder *mount_gh,
-						int undo)
-{
-	struct task_struct *p;
-	int error = 0;
-
-	if (undo)
-		goto fail_live;
-
-	if ((sdp->sd_lockstruct.ls_flags & LM_LSFLAG_LOCAL) &&
-	    !sdp->sd_args.ar_ignore_local_fs) {
-		/* Force local [p|f]locks */
-		sdp->sd_args.ar_localflocks = TRUE;
-
-		/* Force local read ahead and caching */
-		sdp->sd_args.ar_localcaching = TRUE;
-
-		/* Allow the machine to oops */
-		sdp->sd_args.ar_oopses_ok = TRUE;
-	}
-
-	/*  Start up the scand thread  */
-
-	p = kthread_run(gfs_scand, sdp, "gfs_scand");
-	error = IS_ERR(p);
-	if (error) {
-		printk("GFS: fsid=%s: can't start scand thread: %d\n",
-		       sdp->sd_fsname, error);
-		return error;
-	}
-	sdp->sd_scand_process = p;
-
-	/*  Start up the glockd thread  */
-
-	for (sdp->sd_glockd_num = 0;
-	     sdp->sd_glockd_num < sdp->sd_args.ar_num_glockd;
-	     sdp->sd_glockd_num++) {
-		p = kthread_run(gfs_glockd, sdp, "gfs_glockd");
-		error = IS_ERR(p);
-		if (error) {
-			printk("GFS: fsid=%s: can't start glockd thread: %d\n",
-			       sdp->sd_fsname, error);
-			goto fail;
-		}
-		sdp->sd_glockd_process[sdp->sd_glockd_num] = p;
-	}
-
-	/*  Only one node may mount at a time */
-	error = gfs_glock_nq_num(sdp,
-				 GFS_MOUNT_LOCK, &gfs_nondisk_glops,
-				 LM_ST_EXCLUSIVE, LM_FLAG_NOEXP | GL_NOCACHE,
-				 mount_gh);
-	if (error) {
-		printk("GFS: fsid=%s: can't acquire mount glock: %d\n",
-		       sdp->sd_fsname, error);
-		goto fail;
-	}
-
-	/*  Show that cluster is alive */
-	error = gfs_glock_nq_num(sdp,
-				 GFS_LIVE_LOCK, &gfs_nondisk_glops,
-				 LM_ST_SHARED, LM_FLAG_NOEXP | GL_EXACT,
-				 &sdp->sd_live_gh);
-	if (error) {
-		printk("GFS: fsid=%s: can't acquire live glock: %d\n",
-		       sdp->sd_fsname, error);
-		goto fail_mount;
-	}
-
-	sdp->sd_live_gh.gh_owner = NULL;
-	return 0;
-
-fail_live:
-	gfs_glock_dq_uninit(&sdp->sd_live_gh);
-
-fail_mount:
-	gfs_glock_dq_uninit(mount_gh);
-
-fail:
-	while (sdp->sd_glockd_num--)
-		kthread_stop(sdp->sd_glockd_process[sdp->sd_glockd_num]);
-
-	kthread_stop(sdp->sd_scand_process);
-
-	return error;
-}
-
-static int init_sb(struct gfs_sbd *sdp, int silent, int undo)
-{
-	struct super_block *sb = sdp->sd_vfs;
-	struct gfs_holder sb_gh;
-	int error = 0;
-	struct inode *inode;
-
-	if (undo)
-		goto fail_dput;
-
-	/*  Read the SuperBlock from disk, get enough info to enable us
-	    to read-in the journal index and replay all journals. */
-
-	error = gfs_glock_nq_num(sdp,
-				 GFS_SB_LOCK, &gfs_meta_glops,
-				 (sdp->sd_args.ar_upgrade) ? LM_ST_EXCLUSIVE : LM_ST_SHARED,
-				 0, &sb_gh);
-	if (error) {
-		printk("GFS: fsid=%s: can't acquire superblock glock: %d\n",
-		       sdp->sd_fsname, error);
-		return error;
-	}
-
-	error = gfs_read_sb(sdp, sb_gh.gh_gl, silent);
-	if (error) {
-		printk("GFS: fsid=%s: can't read superblock: %d\n",
-		       sdp->sd_fsname, error);
-		goto out;
-	}
-
-	/*  Set up the buffer cache and SB for real, now that we know block
-	      sizes, version #s, locations of important on-disk inodes, etc.  */
-
-	error = -EINVAL;
-	if (sdp->sd_sb.sb_bsize < bdev_hardsect_size(sb->s_bdev)) {
-		printk("GFS: fsid=%s: FS block size (%u) is too small for device block size (%u)\n",
-		       sdp->sd_fsname, sdp->sd_sb.sb_bsize, bdev_hardsect_size(sb->s_bdev));
-		goto fail;
-	}
-	if (sdp->sd_sb.sb_bsize > PAGE_SIZE) {
-		printk("GFS: fsid=%s: FS block size (%u) is too big for machine page size (%u)\n",
-		       sdp->sd_fsname, sdp->sd_sb.sb_bsize,
-		       (unsigned int)PAGE_SIZE);
-		goto fail;
-	}
-
-	/*  Get rid of buffers from the original block size  */
-	sb_gh.gh_gl->gl_ops->go_inval(sb_gh.gh_gl, DIO_METADATA | DIO_DATA);
-	sb_gh.gh_gl->gl_aspace->i_blkbits = sdp->sd_sb.sb_bsize_shift;
-
-	sb_set_blocksize(sb, sdp->sd_sb.sb_bsize);
-
-	/*  Read in the resource index inode  */
-
-	error = gfs_get_riinode(sdp);
-	if (error) {
-		printk("GFS: fsid=%s: can't get resource index inode: %d\n",
-		       sdp->sd_fsname, error);
-		goto fail;
-	}
-
-	/*  Get the root inode  */
-	error = gfs_get_rootinode(sdp);
-	if (error) {
-		printk("GFS: fsid=%s: can't read in root inode: %d\n",
-		       sdp->sd_fsname, error);
-		goto fail_ri_free;
-	}
-	/*  Get the root inode/dentry  */
-
-	inode = gfs_iget(sdp->sd_rooti, CREATE);
-	if (!inode) {
-		printk("GFS: fsid=%s: can't get root inode\n", sdp->sd_fsname);
-		error = -ENOMEM;
-		goto fail_ri_free;
-	}
-	sb->s_root = d_alloc_root(inode);
-	if (!sb->s_root) {
-		iput(inode);
-		printk("GFS: fsid=%s: can't get root dentry\n", sdp->sd_fsname);
-		error = -ENOMEM;
-		goto fail_root_free;
-	}
-	sb->s_root->d_op = &gfs_dops;
-
-	/*  Read in the quota inode  */
-	error = gfs_get_qinode(sdp);
-	if (error) {
-		printk("GFS: fsid=%s: can't get quota file inode: %d\n",
-		       sdp->sd_fsname, error);
-		goto fail_root_free;
-	}
-
-	/* Implement fast statfs on the unused license inode location.
-	 * sb->sb_quota_di.no_formal_ino = jindex_dinode + 2;
-	 * sb->sb_quota_di.no_addr = jindex_dinode + 2;
-	 * sb->sb_license_di.no_formal_ino = jindex_dinode + 3;
-	 * sb->sb_license_di.no_addr = jindex_dinode + 3;
-	 */
-	error = gfs_get_linode(sdp);
-	if (error) {
-		printk("GFS: fsid=%s: can't get statfs file inode: %d\n",
-				sdp->sd_fsname, error);
-		goto fail_qi_free;
-	}
-
-	/*  We're through with the superblock lock  */
-out:
-	gfs_glock_dq_uninit(&sb_gh);
-	return error;
-
-fail_dput:
-	gfs_inode_put(sdp->sd_linode);
-	if (sb->s_root) {
-		dput(sb->s_root);
-		sb->s_root = NULL;
-	}
-fail_qi_free:
-	gfs_inode_put(sdp->sd_qinode);
-fail_root_free:
-	gfs_inode_put(sdp->sd_rooti);
-fail_ri_free:
-	gfs_inode_put(sdp->sd_riinode);
-	gfs_clear_rgrpd(sdp);
-fail:
-	if (!undo)
-		gfs_glock_dq_uninit(&sb_gh);
-	return error;
-}
-
-static int init_journal(struct gfs_sbd *sdp, int undo)
-{
-	struct gfs_holder ji_gh;
-	int error = 0;
-	unsigned int x;
-	int jindex = TRUE;
-	struct task_struct *p;
-
-	if (undo) {
-		jindex = 0;
-		goto fail_recoverd;
-	}
-
-	init_MUTEX(&sdp->sd_jindex_lock);
-
-	/*  Get a handle on the transaction glock; we need this for disk format
-	    upgrade and journal replays, as well as normal operation.  */
-
-	error = gfs_glock_get(sdp, GFS_TRANS_LOCK, &gfs_trans_glops,
-			      CREATE, &sdp->sd_trans_gl);
-	if (error)
-		return error;
-	set_bit(GLF_STICKY, &sdp->sd_trans_gl->gl_flags);
-
-	/*  Load in the journal index special file */
-
-	error = gfs_jindex_hold(sdp, &ji_gh);
-	if (error) {
-		printk("GFS: fsid=%s: can't read journal index: %d\n",
-		       sdp->sd_fsname, error);
-		goto fail_jhold;
-	}
-
-	if (sdp->sd_args.ar_spectator) {
-		sdp->sd_jdesc = sdp->sd_jindex[0];
-		sdp->sd_log_seg_free = sdp->sd_jdesc.ji_nsegment;
-		sdp->sd_log_seg_ail2 = 0;
-	}
-	else {
-		/*  Discover this node's journal number (lock module tells us
-		    which one to use), and lock it */
-		error = -EINVAL;
-		if (sdp->sd_lockstruct.ls_jid >= sdp->sd_journals) {
-			printk("GFS: fsid=%s: can't mount journal #%u\n",
-			       sdp->sd_fsname, sdp->sd_lockstruct.ls_jid);
-			printk("GFS: fsid=%s: there are only %u journals (0 - %u)\n",
-			       sdp->sd_fsname, sdp->sd_journals, sdp->sd_journals - 1);
-			goto fail_jindex;
-		}
-		sdp->sd_jdesc = sdp->sd_jindex[sdp->sd_lockstruct.ls_jid];
-		sdp->sd_log_seg_free = sdp->sd_jdesc.ji_nsegment;
-		sdp->sd_log_seg_ail2 = 0;
-
-		error = gfs_glock_nq_num(sdp,
-					 sdp->sd_jdesc.ji_addr, &gfs_meta_glops,
-					 LM_ST_EXCLUSIVE, LM_FLAG_NOEXP,
-					 &sdp->sd_journal_gh);
-		if (error) {
-			printk("GFS: fsid=%s: can't acquire the journal glock: %d\n",
-			       sdp->sd_fsname, error);
-			goto fail_jindex;
-		}
-	}
-
-	if (sdp->sd_lockstruct.ls_first) {
-		/*  We're first node within cluster to mount this filesystem,
-		    replay ALL of the journals, then let lock module know
-		    that we're done. */
-		for (x = 0; x < sdp->sd_journals; x++) {
-			error = gfs_recover_journal(sdp,
-						    x, sdp->sd_jindex + x,
-						    FALSE);
-			if (error) {
-				printk("GFS: fsid=%s: error recovering journal %u: %d\n",
-				       sdp->sd_fsname, x, error);
-				goto fail_journal_gh;
-			}
-		}
-
-		gfs_lm_others_may_mount(sdp);
-	} else if (!sdp->sd_args.ar_spectator) {
-		/*  We're not the first; replay only our own journal. */
-		error = gfs_recover_journal(sdp, sdp->sd_lockstruct.ls_jid,
-									&sdp->sd_jdesc, TRUE);
-		if (error) {
-			printk("GFS: fsid=%s: error recovering my journal: %d\n",
-			       sdp->sd_fsname, error);
-			goto fail_journal_gh;
-		}
-	}
-
-	gfs_glock_dq_uninit(&ji_gh);
-	jindex = FALSE;
-
-	/*  Disown my Journal glock  */
-	sdp->sd_journal_gh.gh_owner = NULL;
-
-	/*  Make the FS read/write  */
-
-	if (!test_bit(SDF_ROFS, &sdp->sd_flags)) {
-		error = gfs_make_fs_rw(sdp);
-		if (error) {
-			printk("GFS: fsid=%s: can't make file system RW: %d\n",
-			       sdp->sd_fsname, error);
-			goto fail_journal_gh;
-		}
-	}
-
-	/*  Start up the journal recovery thread  */
-
-	p = kthread_run(gfs_recoverd, sdp, "gfs_recoverd");
-	error = IS_ERR(p);
-	if (error) {
-		printk("GFS: fsid=%s: can't start recoverd thread: %d\n",
-		       sdp->sd_fsname, error);
-		goto fail_journal_gh;
-	}
-	sdp->sd_recoverd_process = p;
-
-	return 0;
-
-fail_recoverd:
-	kthread_stop(sdp->sd_recoverd_process);
-	sdp->sd_recoverd_process = NULL;
-
-fail_journal_gh:
-	if (!sdp->sd_args.ar_spectator)
-		gfs_glock_dq_uninit(&sdp->sd_journal_gh);
-
-fail_jindex:
-	if (jindex)
-		gfs_glock_dq_uninit(&ji_gh);
-
-fail_jhold:
-	gfs_glock_put(sdp->sd_trans_gl);
-	return error;
-}
-
-static int init_threads(struct gfs_sbd *sdp, int undo)
-{
-	struct task_struct *p;
-	int error = 0;
-
-	if (undo)
-		goto fail_logd;
-
-	sdp->sd_jindex_refresh_time = jiffies;
-
-	/*  Start up the logd thread  */
-	p = kthread_run(gfs_logd, sdp, "gfs_logd");
-	error = IS_ERR(p);
-	if (error) {
-		printk("GFS: fsid=%s: can't start logd thread: %d\n",
-		       sdp->sd_fsname, error);
-		goto fail;
-	}
-	sdp->sd_logd_process = p;
-
-	/*  Start up the quotad thread  */
-
-	p = kthread_run(gfs_quotad, sdp, "gfs_quotad");
-	if (error < 0) {
-		printk("GFS: fsid=%s: can't start quotad thread: %d\n",
-		       sdp->sd_fsname, error);
-		goto fail_quotad;
-	}
-	sdp->sd_quotad_process = p;
-
-	/*  Start up the inoded thread  */
-
-	p = kthread_run(gfs_inoded, sdp, "gfs_inoded");
-	if (error < 0) {
-		printk("GFS: fsid=%s: can't start inoded thread: %d\n",
-		       sdp->sd_fsname, error);
-		goto fail_inoded;
-	}
-	sdp->sd_inoded_process = p;
-	return 0;
-
-fail_logd:
-	kthread_stop(sdp->sd_inoded_process);
-fail_inoded:
-	kthread_stop(sdp->sd_quotad_process);
-fail_quotad:
-	kthread_stop(sdp->sd_logd_process);
-fail:
-	return error;
-}
-
-/**
- * fill_super - Read in superblock
- * @sb: The VFS superblock
- * @data: Mount options
- * @silent: Don't complain if it's not a GFS filesystem
- *
- * Returns: errno
- *
- * After cross-linking Linux VFS incore superblock and our GFS incore
- *   superblock (filesystem instance structures) to one another, we:
- * -- Init some of our GFS incore superblock, including some temporary
- *       block-size values (enough to read on-disk superblock).
- * -- Set up some things in Linux VFS superblock.
- * -- Mount a lock module, init glock system (incl. glock reclaim daemons),
- *       and init some important inter-node locks (MOUNT, LIVE, SuperBlock).
- * -- Read-in the GFS on-disk superblock (1st time, to get enough info
- *       to do filesystem upgrade and journal replay, incl. journal index).
- * -- Upgrade on-disk filesystem format (rarely needed).
- * -- Replay journals (always; replay *all* journals if we're first-to-mount).
- * -- Read-in on-disk superblock and journal index special file again
- *       (2nd time, assumed 100% valid now after journal replay).
- * -- Read-in info on other special (hidden) files (root inode, resource index,
- *       quota inode, license inode).
- * -- Start other daemons (journal/log recovery, log tail, quota updates, inode
- *       reclaim) for periodic maintenance.
- * 
- */
-
-static int fill_super(struct super_block *sb, void *data, int silent)
-{
-	struct gfs_sbd *sdp;
-	struct gfs_holder mount_gh;
-	int error;
-
-	sdp = init_sbd(sb);
-	if (!sdp) {
-		printk(KERN_WARNING "GFS: can't alloc struct gfs_sbd\n");
-		return -ENOMEM;
-	}
-
-	error = gfs_make_args((char *)data, &sdp->sd_args, FALSE);
-	if (error) {
-		printk("GFS: can't parse mount arguments\n");
-		goto fail;
-	}
-
-	if (sdp->sd_args.ar_spectator) {
-		sb->s_flags |= MS_RDONLY;
-		set_bit(SDF_ROFS, &sdp->sd_flags);
-	}
-
-	/*  Copy VFS mount flags  */
-
-	if (sdp->sd_args.ar_noatime)
-		set_bit(SDF_NOATIME, &sdp->sd_flags);
-	if (sb->s_flags & MS_RDONLY)
-		set_bit(SDF_ROFS, &sdp->sd_flags);
-
-	init_vfs(sb, SDF_NOATIME);
-
-	/*  Turn off quota stuff if we get the noquota mount option, don't 
-	    need to grab the sd_tune lock here since its before anything 
-	    touches the sd_tune values */
-	if (sdp->sd_args.ar_noquota) {
-		sdp->sd_tune.gt_quota_enforce = 0;
-		sdp->sd_tune.gt_quota_account = 0;
-	}
-
-	/*  Set up the buffer cache and fill in some fake block size values
-	   to allow us to read-in the on-disk superblock.  */
-
-	sdp->sd_sb.sb_bsize = sb_min_blocksize(sb, GFS_BASIC_BLOCK);
-	sdp->sd_sb.sb_bsize_shift = sb->s_blocksize_bits;
-	sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift - GFS_BASIC_BLOCK_SHIFT;
-	sdp->sd_fsb2bb = 1 << sdp->sd_fsb2bb_shift;
-
-	if (sizeof(struct gfs_sb) > sdp->sd_sb.sb_bsize) {
-		printk("GFS: sizeof(struct gfs_sb) > sdp->sd_sb.sb_bsize\n"
-		       "GFS: %u > %u\n",
-		       (unsigned int)sizeof(struct gfs_sb), sdp->sd_sb.sb_bsize);
-		error = -EINVAL;
-		goto fail;
-	}
-	error = init_names(sdp, silent);
-	if (error)
-		goto fail;
-
-	error = gfs_sys_fs_add(sdp);
-	if (error)
-		goto fail;
-
-	/*  Mount an inter-node lock module, check for local optimizations */
-
-	error = gfs_lm_mount(sdp, silent);
-	if (error)
-		goto fail_sys;
-
-	error = init_locking(sdp, &mount_gh, DO);
-	if (error)
-		goto fail_lm;
-
-	error = init_sb(sdp, silent, DO);
-	if (error)
-		goto fail_locking;
-
-	/*  Read-in journal index inode (but not the file contents, yet)  */
-
-	error = gfs_get_jiinode(sdp);
-	if (error) {
-		printk("GFS: fsid=%s: can't get journal index inode: %d\n",
-		       sdp->sd_fsname, error);
-		goto fail_jiinode;
-	}
-
-	error = init_journal(sdp, DO);
-	if (error)
-		goto fail_sb;
-	/*  Get a handle on the rename lock  */
-
-	error = gfs_glock_get(sdp, GFS_RENAME_LOCK, &gfs_nondisk_glops,
-						  CREATE, &sdp->sd_rename_gl);
-	if (error)
-		goto fail_journal;
-
-	error = init_threads(sdp, DO);
-	if (error)
-		goto fail_journal;
-
-	gfs_proc_fs_add(sdp);
-	gfs_glock_dq_uninit(&mount_gh);
-
-	return 0;
-
-fail_journal:
-	init_journal(sdp, UNDO);
-
-fail_sb:
-	gfs_inode_put(sdp->sd_jiinode);
-
-fail_jiinode:
-	init_sb(sdp, 0, UNDO);
-
-fail_locking:
-	init_locking(sdp, &mount_gh, UNDO);
-
-fail_lm:
-	gfs_gl_hash_clear(sdp, TRUE);
-	gfs_lm_unmount(sdp);
-	gfs_clear_dirty_j(sdp);
-	while (invalidate_inodes(sb))
-		yield();
-
-fail_sys:
-	gfs_sys_fs_del(sdp);
-
-fail:
-	vfree(sdp);
-	sb->s_fs_info = NULL;
-
-	return error;
-}
-
-/**
- * gfs_test_bdev_super - 
- * @sb:
- * @data:
- *
- */
-
-int
-gfs_test_bdev_super(struct super_block *sb, void *data)
-{
-	return (void *)sb->s_bdev == data;
-}
-
-/**
- * gfs_test_bdev_super -
- * @sb:
- * @data:
- *
- */
-
-int
-gfs_set_bdev_super(struct super_block *sb, void *data)
-{
-	sb->s_bdev = data;
-	sb->s_dev = sb->s_bdev->bd_dev;
-	return 0;
-}
-
-/**
- * gfs_get_sb - 
- * @fs_type:
- * @flags:
- * @dev_name:
- * @data:
- *
- * Rip off of get_sb_bdev().
- *
- * Returns: the new superblock
- */
-
-static int gfs_get_sb(struct file_system_type *fs_type, int flags,
-					  const char *dev_name, void *data, struct vfsmount *mnt)
-{
-	return get_sb_bdev(fs_type, flags, dev_name, data, fill_super, mnt);
-}
-
-/**
- * gfs_kill_sb - 
- * @sb:
- *
- * Rip off of kill_block_super().
- *
- */
-
-void
-gfs_kill_sb(struct super_block *sb)
-{
-	kill_block_super(sb);
-}
-
-struct file_system_type gfs_fs_type = {
-	.name = "gfs",
-	.fs_flags = FS_REQUIRES_DEV,
-	.get_sb = gfs_get_sb,
-	.kill_sb = gfs_kill_sb,
-	.owner = THIS_MODULE,
-};
diff --git a/gfs-kernel/src/gfs/ops_fstype.h b/gfs-kernel/src/gfs/ops_fstype.h
deleted file mode 100644
index 6d97022..0000000
--- a/gfs-kernel/src/gfs/ops_fstype.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef __OPS_FSTYPE_DOT_H__
-#define __OPS_FSTYPE_DOT_H__
-
-int gfs_sys_init(void);
-void gfs_sys_uninit(void);
-void gfs_sys_fs_del(struct gfs_sbd *sdp);
-int gfs_test_bdev_super(struct super_block *sb, void *data);
-int gfs_set_bdev_super(struct super_block *sb, void *data);
-int init_names(struct gfs_sbd *sdp, int silent);
-
-extern struct file_system_type gfs_fs_type;
-
-#endif /* __OPS_FSTYPE_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/ops_inode.c b/gfs-kernel/src/gfs/ops_inode.c
deleted file mode 100644
index 433fce6..0000000
--- a/gfs-kernel/src/gfs/ops_inode.c
+++ /dev/null
@@ -1,1679 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <linux/namei.h>
-#include <linux/utsname.h>
-#include <asm/uaccess.h>
-#include <linux/mm.h>
-#include <linux/xattr.h>
-#include <linux/posix_acl.h>
-#include <linux/security.h>
-
-#include "gfs.h"
-#include "acl.h"
-#include "bmap.h"
-#include "dio.h"
-#include "dir.h"
-#include "eaops.h"
-#include "eattr.h"
-#include "glock.h"
-#include "inode.h"
-#include "ops_dentry.h"
-#include "ops_inode.h"
-#include "page.h"
-#include "quota.h"
-#include "rgrp.h"
-#include "trans.h"
-#include "unlinked.h"
-
-/**
- * gfs_security_init -
- * @dip:
- * @ip:
- *
- * Returns: errno
- */
-
-static int
-gfs_security_init(struct gfs_inode *dip, struct gfs_inode *ip)
-{
-	int err;
-	size_t len;
-	void *value;
-	char *name;
-	struct gfs_ea_request er;
-
-	err = security_inode_init_security(ip->i_vnode, dip->i_vnode,
-					   &name, &value, &len);
-
-	if (err) {
-		if (err == -EOPNOTSUPP)
-			return 0;
-		return err;
-	}
-
-	memset(&er, 0, sizeof(struct gfs_ea_request));
-
-	er.er_type = GFS_EATYPE_SECURITY;
-	er.er_name = name;
-	er.er_data = value;
-	er.er_name_len = strlen(name);
-	er.er_data_len = len;
-
-	err = gfs_ea_set_i(ip, &er);
-
-	kfree(value);
-	kfree(name);
-
-	return err;
-}
-
-/**
- * gfs_create - Create a file
- * @dir: The directory in which to create the file
- * @dentry: The dentry of the new file
- * @mode: The mode of the new file
- *
- * Returns: errno
- */
-
-static int
-gfs_create(struct inode *dir, struct dentry *dentry,
-	   int mode, struct nameidata *nd)
-{
-	struct gfs_inode *dip = get_v2ip(dir), *ip;
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct gfs_holder d_gh, i_gh;
-	struct inode *inode;
-	int new = TRUE;
-	int error;
-
-	atomic_inc(&sdp->sd_ops_inode);
-
-	gfs_unlinked_limit(sdp);
-
-	gfs_holder_init(dip->i_gl, 0, 0, &d_gh);
-
-	for (;;) {
-		error = gfs_createi(&d_gh, &dentry->d_name,
-				    GFS_FILE_REG, mode,
-				    &i_gh);
-		if (!error)
-			break;
-		else if (error != -EEXIST ||
-			 (nd && (nd->intent.open.flags & O_EXCL))) {
-			gfs_holder_uninit(&d_gh);
-			return error;
-		}
-
-		error = gfs_lookupi(&d_gh, &dentry->d_name,
-				    FALSE, &i_gh);
-		if (!error) {
-			if (i_gh.gh_gl) {
-				new = FALSE;
-				break;
-			}
-		} else {
-			gfs_holder_uninit(&d_gh);
-			return error;
-		}
-	}
-
-	ip = get_gl2ip(i_gh.gh_gl);
-
-	if (new) {
-		gfs_trans_end(sdp);
-		if (dip->i_alloc->al_rgd)
-			gfs_inplace_release(dip);
-		gfs_quota_unlock_m(dip);
-		gfs_unlinked_unlock(sdp, dip->i_alloc->al_ul);
-		gfs_alloc_put(dip);
-	}
-
-	inode = gfs_iget(ip, CREATE);
-	gfs_inode_put(ip);
-
-	if (!inode)
-		error = -ENOMEM;
-	else
-		error = gfs_security_init(dip, ip);
-
-	gfs_glock_dq_uninit(&d_gh);
-	gfs_glock_dq_uninit(&i_gh);
-
-	if (error)
-		return error;
-
-	d_instantiate(dentry, inode);
-	if (new)
-		mark_inode_dirty(inode);
-
-	return 0;
-}
-
-/**
- * lookup_cdpn_sub_at - Maybe lookup a Context Dependent Pathname
- * @sdp: the filesystem
- * @dentry: the original dentry to lookup
- * @new_dentry: the new dentry, if this was a substitutable path.
- *
- * Returns: the new dentry, a ERR_PTR, or NULL
- */
-
-static struct dentry *
-lookup_cdpn_sub_at(struct gfs_sbd *sdp, struct dentry *dentry)
-{
-	struct dentry *parent, *new = NULL;
-	char *buf;
-
-	buf = kmalloc(2 * __NEW_UTS_LEN + 2, GFP_KERNEL);
-	if (!buf)
-		return ERR_PTR(-ENOMEM);
-
-	parent = dget_parent(dentry);
-
-	if (gfs_filecmp(&dentry->d_name, "@hostname", 9))
-		new = lookup_one_len(init_utsname()->nodename,
-				     parent,
-				     strlen(init_utsname()->nodename));
-	else if (gfs_filecmp(&dentry->d_name, "@mach", 5))
-		new = lookup_one_len(init_utsname()->machine,
-				     parent,
-				     strlen(init_utsname()->machine));
-	else if (gfs_filecmp(&dentry->d_name, "@os", 3))
-		new = lookup_one_len(init_utsname()->sysname,
-				     parent,
-				     strlen(init_utsname()->sysname));
-	else if (gfs_filecmp(&dentry->d_name, "@uid", 4))
-		new = lookup_one_len(buf,
-				     parent,
-				     sprintf(buf, "%u", current->fsuid));
-	else if (gfs_filecmp(&dentry->d_name, "@gid", 4))
-		new = lookup_one_len(buf,
-				     parent,
-				     sprintf(buf, "%u", current->fsgid));
-	else if (gfs_filecmp(&dentry->d_name, "@sys", 4))
-		new = lookup_one_len(buf,
-				     parent,
-				     sprintf(buf, "%s_%s",
-					     init_utsname()->machine,
-					     init_utsname()->sysname));
-	else if (gfs_filecmp(&dentry->d_name, "@jid", 4))
-		new = lookup_one_len(buf,
-				     parent,
-				     sprintf(buf, "%u",
-					     sdp->sd_lockstruct.ls_jid));
-
-	dput(parent);
-	kfree(buf);
-
-	return new;
-}
-
-/**
- * lookup_cdpn_sub_brace - Maybe lookup a Context Dependent Pathname
- * @sdp: the filesystem
- * @dentry: the original dentry to lookup
- * @new_dentry: the new dentry, if this was a substitutable path.
- *
- * Returns: the new dentry, a ERR_PTR, or NULL
- */
-
-static struct dentry *
-lookup_cdpn_sub_brace(struct gfs_sbd *sdp, struct dentry *dentry)
-{
-	struct dentry *parent, *new = NULL;
-	char *buf;
-
-	buf = kmalloc(2 * __NEW_UTS_LEN + 2, GFP_KERNEL);
-	if (!buf)
-		return ERR_PTR(-ENOMEM);
-
-	parent = dget_parent(dentry);
-
-	if (gfs_filecmp(&dentry->d_name, "{hostname}", 10))
-		new = lookup_one_len(init_utsname()->nodename,
-				     parent,
-				     strlen(init_utsname()->nodename));
-	else if (gfs_filecmp(&dentry->d_name, "{mach}", 6))
-		new = lookup_one_len(init_utsname()->machine,
-				     parent,
-				     strlen(init_utsname()->machine));
-	else if (gfs_filecmp(&dentry->d_name, "{os}", 4))
-		new = lookup_one_len(init_utsname()->sysname,
-				     parent,
-				     strlen(init_utsname()->sysname));
-	else if (gfs_filecmp(&dentry->d_name, "{uid}", 5))
-		new = lookup_one_len(buf,
-				     parent,
-				     sprintf(buf, "%u", current->fsuid));
-	else if (gfs_filecmp(&dentry->d_name, "{gid}", 5))
-		new = lookup_one_len(buf,
-				     parent,
-				     sprintf(buf, "%u", current->fsgid));
-	else if (gfs_filecmp(&dentry->d_name, "{sys}", 5))
-		new = lookup_one_len(buf,
-				     parent,
-				     sprintf(buf, "%s_%s",
-					     init_utsname()->machine,
-					     init_utsname()->sysname));
-	else if (gfs_filecmp(&dentry->d_name, "{jid}", 5))
-		new = lookup_one_len(buf,
-				     parent,
-				     sprintf(buf, "%u",
-					     sdp->sd_lockstruct.ls_jid));
-
-	dput(parent);
-	kfree(buf);
-
-	return new;
-}
-
-/**
- * gfs_lookup - Look up a filename in a directory and return its inode
- * @dir: The directory inode
- * @dentry: The dentry of the new inode
- * @nd: passed from Linux VFS, ignored by us
- *
- * Called by the VFS layer. Lock dir and call gfs_lookupi()
- *
- * Returns: errno
- */
-
-static struct dentry *
-gfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
-{
-	struct gfs_inode *dip = get_v2ip(dir), *ip;
-	struct gfs_holder d_gh, i_gh;
-	struct inode *inode = NULL;
-	int error;
-
-	atomic_inc(&dip->i_sbd->sd_ops_inode);
-
-	/*  Do Context Dependent Path Name expansion  */
-
-	if (*dentry->d_name.name == '@' && dentry->d_name.len > 1) {
-		struct dentry *new_dentry;
-		new_dentry = lookup_cdpn_sub_at(dip->i_sbd, dentry);
-		if (new_dentry)
-			return new_dentry;
-	} else if (*dentry->d_name.name == '{' && dentry->d_name.len > 2) {
-		struct dentry *new_dentry;
-		new_dentry = lookup_cdpn_sub_brace(dip->i_sbd, dentry);
-		if (new_dentry)
-			return new_dentry;
-	}
-
-	dentry->d_op = &gfs_dops;
-
-	gfs_holder_init(dip->i_gl, 0, 0, &d_gh);
-
-	error = gfs_lookupi(&d_gh, &dentry->d_name, FALSE, &i_gh);
-	if (error) {
-		gfs_holder_uninit(&d_gh);
-		return ERR_PTR(error);
-	}
-
-	if (i_gh.gh_gl) {
-		ip = get_gl2ip(i_gh.gh_gl);
-
-		inode = gfs_iget(ip, CREATE);
-		gfs_inode_put(ip);
-
-		gfs_glock_dq_uninit(&d_gh);
-		gfs_glock_dq_uninit(&i_gh);
-
-		if (!inode)
-			return ERR_PTR(-ENOMEM);
-	} else
-		gfs_holder_uninit(&d_gh);
-
-	if (inode)
-		return d_splice_alias(inode, dentry);
-	d_add(dentry, inode);
-
-	return NULL;
-}
-
-/**
- * gfs_link - Link to a file
- * @old_dentry: The inode to link
- * @dir: Add link to this directory
- * @dentry: The name of the link
- *
- * Link the inode in "old_dentry" into the directory "dir" with the
- * name in "dentry".
- *
- * Returns: errno
- */
-
-static int
-gfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
-{
-	struct gfs_inode *dip = get_v2ip(dir);
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct inode *inode = old_dentry->d_inode;
-	struct gfs_inode *ip = get_v2ip(inode);
-	struct gfs_alloc *al = NULL;
-	struct gfs_holder ghs[2];
-	int alloc_required;
-	int error;
-
-	atomic_inc(&sdp->sd_ops_inode);
-
-	if (ip->i_di.di_type == GFS_FILE_DIR)
-		return -EPERM;
-
-	gfs_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, &ghs[0]);
-	gfs_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &ghs[1]);
-
-	error = gfs_glock_nq_m(2, ghs);
-	if (error)
-		goto fail;
-
-	error = inode_permission(dir, MAY_WRITE | MAY_EXEC);
-	if (error)
-		goto fail_gunlock;
-
-	error = gfs_dir_search(dip, &dentry->d_name, NULL, NULL);
-	switch (error) {
-	case -ENOENT:
-		break;
-	case 0:
-		error = -EEXIST;
-	default:
-		goto fail_gunlock;
-	}
-
-	if (!dip->i_di.di_nlink) {
-		error = -EINVAL;
-		goto fail_gunlock;
-	}
-	if (dip->i_di.di_entries == (uint32_t)-1) {
-		error = -EFBIG;
-		goto fail_gunlock;
-	}
-	if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) {
-		error = -EPERM;
-		goto fail_gunlock;
-	}
-	if (!ip->i_di.di_nlink) {
-		error = -EINVAL;
-		goto fail_gunlock;
-	}
-	if (ip->i_di.di_nlink == (uint32_t)-1) {
-		error = -EMLINK;
-		goto fail_gunlock;
-	}
-
-	error = gfs_diradd_alloc_required(dip, &dentry->d_name, &alloc_required);
-	if (error)
-		goto fail_gunlock;
-
-	if (alloc_required) {
-		al = gfs_alloc_get(dip);
-
-		error = gfs_quota_lock_m(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
-		if (error)
-			goto fail_alloc;
-
-		error = gfs_quota_check(dip, dip->i_di.di_uid, dip->i_di.di_gid);
-		if (error)
-			goto fail_gunlock_q;
-
-		al->al_requested_meta = sdp->sd_max_dirres;
-
-		error = gfs_inplace_reserve(dip);
-		if (error)
-			goto fail_gunlock_q;
-
-		/* Trans may require:
-		   two dinode blocks, directory modifications to add an entry,
-		   RG bitmap blocks to allocate from, and quota change */
-
-		error = gfs_trans_begin(sdp,
-					2 + sdp->sd_max_dirres +
-					al->al_rgd->rd_ri.ri_length,
-					1);
-		if (error)
-			goto fail_ipres;
-	} else {
-		/*  Trans may require:
-		    Two dinode blocks and a leaf block.  */
-
-		error = gfs_trans_begin(sdp, 3, 0);
-		if (error)
-			goto fail_ipres;
-	}
-
-	error = gfs_dir_add(dip, &dentry->d_name, &ip->i_num, ip->i_di.di_type);
-	if (error)
-		goto fail_end_trans;
-
-	error = gfs_change_nlink(ip, +1);
-	if (error)
-		goto fail_end_trans;
-
-	gfs_trans_end(sdp);
-
-	if (alloc_required) {
-		gfs_assert_warn(sdp, al->al_alloced_meta);
-		gfs_inplace_release(dip);
-		gfs_quota_unlock_m(dip);
-		gfs_alloc_put(dip);
-	}
-
-	gfs_glock_dq_m(2, ghs);
-
-	gfs_holder_uninit(&ghs[0]);
-	gfs_holder_uninit(&ghs[1]);
-
-	atomic_inc(&inode->i_count);
-
-	d_instantiate(dentry, inode);
-	mark_inode_dirty(inode);
-
-	return 0;
-
- fail_end_trans:
-	gfs_trans_end(sdp);
-
- fail_ipres:
-	if (alloc_required)
-		gfs_inplace_release(dip);
-
- fail_gunlock_q:
-	if (alloc_required)
-		gfs_quota_unlock_m(dip);
-
- fail_alloc:
-	if (alloc_required)
-		gfs_alloc_put(dip);
-
- fail_gunlock:
-	gfs_glock_dq_m(2, ghs);
-
- fail:
-	gfs_holder_uninit(&ghs[0]);
-	gfs_holder_uninit(&ghs[1]);
-
-	return error;
-}
-
-/**
- * gfs_unlink - Unlink a file
- * @dir: The inode of the directory containing the file to unlink
- * @dentry: The file itself
- *
- * Unlink a file.  Call gfs_unlinki()
- *
- * Returns: errno
- */
-
-static int
-gfs_unlink(struct inode *dir, struct dentry *dentry)
-{
-	struct gfs_inode *dip = get_v2ip(dir);
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct gfs_inode *ip = get_v2ip(dentry->d_inode);
-	struct gfs_holder ghs[2];
-	int error;
-
-	atomic_inc(&sdp->sd_ops_inode);
-
-	gfs_unlinked_limit(sdp);
-
-	gfs_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, &ghs[0]);
-	gfs_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &ghs[1]);
-
-	error = gfs_glock_nq_m(2, ghs);
-	if (error)
-		goto fail;
-
-	error = gfs_unlink_ok(dip, &dentry->d_name, ip);
-	if (error)
-		goto fail_gunlock;
-
-	/*  Trans may require:
-	    Two dinode blocks and one modified directory leaf block
-	    and one unlinked tag.  */
-
-	error = gfs_trans_begin(sdp, 3, 1);
-	if (error)
-		goto fail_gunlock;
-
-	error = gfs_unlinki(dip, &dentry->d_name, ip);
-	if (error)
-		goto fail_end_trans;
-
-	gfs_trans_end(sdp);
-
-	gfs_glock_dq_m(2, ghs);
-
-	gfs_holder_uninit(&ghs[0]);
-	gfs_holder_uninit(&ghs[1]);
-
-	return 0;
-
- fail_end_trans:
-	gfs_trans_end(sdp);
-
- fail_gunlock:
-	gfs_glock_dq_m(2, ghs);
-
- fail:
-	gfs_holder_uninit(&ghs[0]);
-	gfs_holder_uninit(&ghs[1]);
-
-	return error;
-}
-
-/**
- * gfs_symlink - Create a symlink
- * @dir: The directory to create the symlink in
- * @dentry: The dentry to put the symlink in
- * @symname: The thing which the link points to
- *
- * Returns: errno
- */
-
-static int
-gfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
-{
-	struct gfs_inode *dip = get_v2ip(dir), *ip;
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct gfs_holder d_gh, i_gh;
-	struct inode *inode;
-	struct buffer_head *dibh;
-	int size;
-	int error;
-
-	atomic_inc(&sdp->sd_ops_inode);
-
-	gfs_unlinked_limit(sdp);
-
-	/* Must be stuffed with a null terminator for gfs_follow_link() */
-	size = strlen(symname);
-	if (size > sdp->sd_sb.sb_bsize - sizeof(struct gfs_dinode) - 1)
-	        return -ENAMETOOLONG;
-
-	gfs_holder_init(dip->i_gl, 0, 0, &d_gh);
-
-	error = gfs_createi(&d_gh, &dentry->d_name,
-			    GFS_FILE_LNK, S_IFLNK | S_IRWXUGO,
-			    &i_gh);
-	if (error) {
-		gfs_holder_uninit(&d_gh);
-		return error;
-	}
-
-	ip = get_gl2ip(i_gh.gh_gl);
-
-	ip->i_di.di_size = size;
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-
-	if (!gfs_assert_withdraw(sdp, !error)) {
-		gfs_dinode_out(&ip->i_di, dibh->b_data);
-		memcpy(dibh->b_data + sizeof(struct gfs_dinode), symname, size);
-		brelse(dibh);
-	}
-
-	gfs_trans_end(sdp);
-	if (dip->i_alloc->al_rgd)
-		gfs_inplace_release(dip);
-	gfs_quota_unlock_m(dip);
-	gfs_unlinked_unlock(sdp, dip->i_alloc->al_ul);
-	gfs_alloc_put(dip);
-
-	inode = gfs_iget(ip, CREATE);
-	gfs_inode_put(ip);
-
-	error = gfs_security_init(dip, ip);
-
-	gfs_glock_dq_uninit(&d_gh);
-	gfs_glock_dq_uninit(&i_gh);
-
-	if (error)
-		return error;
-
-	if (!inode)
-		return -ENOMEM;
-
-	d_instantiate(dentry, inode);
-	mark_inode_dirty(inode);
-
-	return 0;
-}
-
-/**
- * gfs_mkdir - Make a directory
- * @dir: The parent directory of the new one
- * @dentry: The dentry of the new directory
- * @mode: The mode of the new directory
- *
- * Returns: errno
- */
-
-static int
-gfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
-{
-	struct gfs_inode *dip = get_v2ip(dir), *ip;
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct gfs_holder d_gh, i_gh;
-	struct inode *inode;
-	struct buffer_head *dibh;
-	int error;
-
-	atomic_inc(&sdp->sd_ops_inode);
-
-	gfs_unlinked_limit(sdp);
-
-	gfs_holder_init(dip->i_gl, 0, 0, &d_gh);
-
-	error = gfs_createi(&d_gh, &dentry->d_name,
-			    GFS_FILE_DIR, S_IFDIR | mode,
-			    &i_gh);
-	if (error) {
-		gfs_holder_uninit(&d_gh);
-		return error;
-	}
-
-	ip = get_gl2ip(i_gh.gh_gl);
-
-	ip->i_di.di_nlink = 2;
-	ip->i_di.di_size = sdp->sd_sb.sb_bsize - sizeof(struct gfs_dinode);
-	ip->i_di.di_flags |= GFS_DIF_JDATA;
-	ip->i_di.di_payload_format = GFS_FORMAT_DE;
-	ip->i_di.di_entries = 2;
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-
-	if (!gfs_assert_withdraw(sdp, !error)) {
-		struct gfs_dinode *di = (struct gfs_dinode *)dibh->b_data;
-		struct gfs_dirent *dent;
-
-		gfs_dirent_alloc(ip, dibh, 1, &dent);
-
-		dent->de_inum = di->di_num; /* already GFS endian */
-		dent->de_hash = gfs_dir_hash(".", 1);
-		dent->de_hash = cpu_to_gfs32(dent->de_hash);
-		dent->de_type = cpu_to_gfs16(GFS_FILE_DIR);
-		memcpy((char *) (dent + 1), ".", 1);
-		di->di_entries = cpu_to_gfs32(1);
-
-		gfs_dirent_alloc(ip, dibh, 2, &dent);
-
-		gfs_inum_out(&dip->i_num, (char *) &dent->de_inum);
-		dent->de_hash = gfs_dir_hash("..", 2);
-		dent->de_hash = cpu_to_gfs32(dent->de_hash);
-		dent->de_type = cpu_to_gfs16(GFS_FILE_DIR);
-		memcpy((char *) (dent + 1), "..", 2);
-
-		gfs_dinode_out(&ip->i_di, (char *)di);
-
-		brelse(dibh);
-	}
-
-	error = gfs_change_nlink(dip, +1);
-	gfs_assert_withdraw(sdp, !error); /* dip already pinned */
-
-	gfs_trans_end(sdp);
-	if (dip->i_alloc->al_rgd)
-		gfs_inplace_release(dip);
-	gfs_quota_unlock_m(dip);
-	gfs_unlinked_unlock(sdp, dip->i_alloc->al_ul);
-	gfs_alloc_put(dip);
-
-	inode = gfs_iget(ip, CREATE);
-	gfs_inode_put(ip);
-
-	if (!inode)
-		return -ENOMEM;
-
-	error = gfs_security_init(dip, ip);
-
-	gfs_glock_dq_uninit(&d_gh);
-	gfs_glock_dq_uninit(&i_gh);
-
-	if (error)
-		return error;
-
-	d_instantiate(dentry, inode);
-	mark_inode_dirty(inode);
-
-	return 0;
-}
-
-/**
- * gfs_rmdir - Remove a directory
- * @dir: The parent directory of the directory to be removed
- * @dentry: The dentry of the directory to remove
- *
- * Remove a directory. Call gfs_rmdiri()
- *
- * Returns: errno
- */
-
-static int
-gfs_rmdir(struct inode *dir, struct dentry *dentry)
-{
-	struct gfs_inode *dip = get_v2ip(dir);
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct gfs_inode *ip = get_v2ip(dentry->d_inode);
-	struct gfs_holder ghs[2];
-	int error;
-
-	atomic_inc(&sdp->sd_ops_inode);
-
-	gfs_unlinked_limit(sdp);
-
-	gfs_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, &ghs[0]);
-	gfs_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &ghs[1]);
-
-	error = gfs_glock_nq_m(2, ghs);
-	if (error)
-		goto fail;
-
-	error = gfs_unlink_ok(dip, &dentry->d_name, ip);
-	if (error)
-		goto fail_gunlock;
-
-	if (ip->i_di.di_entries < 2) {
-		if (gfs_consist_inode(ip))
-			gfs_dinode_print(&ip->i_di);
-		error = -EIO;
-		goto fail_gunlock;
-	}
-	if (ip->i_di.di_entries > 2) {
-		error = -ENOTEMPTY;
-		goto fail_gunlock;
-	}
-
-	/* Trans may require:
-	   Two dinode blocks, one directory leaf block containing the
-	   entry to be rmdired, two leaf blocks containing . and .. of
-	   the directory being rmdired, and one unlinked tag */
-
-	error = gfs_trans_begin(sdp, 5, 1);
-	if (error)
-		goto fail_gunlock;
-
-	error = gfs_rmdiri(dip, &dentry->d_name, ip);
-	if (error)
-		goto fail_end_trans;
-
-	gfs_trans_end(sdp);
-
-	gfs_glock_dq_m(2, ghs);
-
-	gfs_holder_uninit(&ghs[0]);
-	gfs_holder_uninit(&ghs[1]);
-
-	return 0;
-
- fail_end_trans:
-	gfs_trans_end(sdp);
-
- fail_gunlock:
-	gfs_glock_dq_m(2, ghs);
-
- fail:
-	gfs_holder_uninit(&ghs[0]);
-	gfs_holder_uninit(&ghs[1]);
-
-	return error;
-}
-
-/**
- * gfs_mknod - Make a special file
- * @dir: The directory in which the special file will reside
- * @dentry: The dentry of the special file
- * @mode: The mode of the special file
- * @rdev: The device specification of the special file
- *
- */
-
-static int
-gfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
-{
-	struct gfs_inode *dip = get_v2ip(dir), *ip;
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct gfs_holder d_gh, i_gh;
-	struct inode *inode;
-	struct buffer_head *dibh;
-	uint16_t type = 0;
-	uint32_t major = 0, minor = 0;
-	int error;
-
-	atomic_inc(&sdp->sd_ops_inode);
-
-	gfs_unlinked_limit(sdp);
-
-	switch (mode & S_IFMT) {
-	case S_IFBLK:
-		type = GFS_FILE_BLK;
-		major = MAJOR(dev);
-		minor = MINOR(dev);
-		break;
-	case S_IFCHR:
-		type = GFS_FILE_CHR;
-		major = MAJOR(dev);
-		minor = MINOR(dev);
-		break;
-	case S_IFIFO:
-		type = GFS_FILE_FIFO;
-		break;
-	case S_IFSOCK:
-		type = GFS_FILE_SOCK;
-		break;
-	default:
-		printk("GFS: fsid=%s: mknod() with invalid type (%d)\n",
-		       sdp->sd_fsname, mode);
-		return -EINVAL;
-	};
-
-	gfs_holder_init(dip->i_gl, 0, 0, &d_gh);
-
-	error = gfs_createi(&d_gh, &dentry->d_name,
-			    type, mode,
-			    &i_gh);
-	if (error) {
-		gfs_holder_uninit(&d_gh);
-		return error;
-	}
-
-	ip = get_gl2ip(i_gh.gh_gl);
-
-	ip->i_di.di_major = major;
-	ip->i_di.di_minor = minor;
-
-	error = gfs_get_inode_buffer(ip, &dibh);
-
-	if (!gfs_assert_withdraw(sdp, !error)) {
-		gfs_dinode_out(&ip->i_di, dibh->b_data);
-		brelse(dibh);
-	}
-
-	gfs_trans_end(sdp);
-	if (dip->i_alloc->al_rgd)
-		gfs_inplace_release(dip);
-	gfs_quota_unlock_m(dip);
-	gfs_unlinked_unlock(sdp, dip->i_alloc->al_ul);
-	gfs_alloc_put(dip);
-
-	inode = gfs_iget(ip, CREATE);
-	gfs_inode_put(ip);
-
-	error = gfs_security_init(dip, ip);
-
-	gfs_glock_dq_uninit(&d_gh);
-	gfs_glock_dq_uninit(&i_gh);
-
-	if (error)
-		return error;
-
-	if (!inode)
-		return -ENOMEM;
-
-	d_instantiate(dentry, inode);
-	mark_inode_dirty(inode);
-
-	return 0;
-}
-
-/**
- * gfs_rename - Rename a file
- * @odir: Parent directory of old file name
- * @odentry: The old dentry of the file
- * @ndir: Parent directory of new file name
- * @ndentry: The new dentry of the file
- *
- * Returns: errno
- */
-
-static int
-gfs_rename(struct inode *odir, struct dentry *odentry,
-	   struct inode *ndir, struct dentry *ndentry)
-{
-	struct gfs_inode *odip = get_v2ip(odir);
-	struct gfs_inode *ndip = get_v2ip(ndir);
-	struct gfs_inode *ip = get_v2ip(odentry->d_inode);
-	struct gfs_inode *nip = NULL;
-	struct gfs_sbd *sdp = odip->i_sbd;
-	struct qstr name;
-	struct gfs_alloc *al;
-	struct gfs_holder ghs[4], r_gh;
-	unsigned int num_gh;
-	int dir_rename = FALSE;
-	int alloc_required;
-	unsigned int x;
-	int error;
-
-	atomic_inc(&sdp->sd_ops_inode);
-
-	gfs_unlinked_limit(sdp);
-
-	if (ndentry->d_inode) {
-		nip = get_v2ip(ndentry->d_inode);
-		if (ip == nip)
-			return 0;
-	}
-
-	/*  Make sure we aren't trying to move a dirctory into it's subdir  */
-
-	if (ip->i_di.di_type == GFS_FILE_DIR && odip != ndip) {
-		dir_rename = TRUE;
-
-		error = gfs_glock_nq_init(sdp->sd_rename_gl,
-					  LM_ST_EXCLUSIVE, 0,
-					  &r_gh);
-		if (error)
-			return error;
-
-		error = gfs_ok_to_move(ip, ndip);
-		if (error)
-			goto fail;
-	}
-
-	gfs_holder_init(odip->i_gl, LM_ST_EXCLUSIVE, 0, &ghs[0]);
-	gfs_holder_init(ndip->i_gl, LM_ST_EXCLUSIVE, 0, &ghs[1]);
-	num_gh = 2;
-
-	if (nip)
-		gfs_holder_init(nip->i_gl, LM_ST_EXCLUSIVE, 0, &ghs[num_gh++]);
-
-	if (dir_rename)
-		gfs_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &ghs[num_gh++]);
-
-	error = gfs_glock_nq_m(num_gh, ghs);
-	if (error)
-		goto fail_uninit;
-
-	/*  Check out the old directory  */
-
-	error = gfs_unlink_ok(odip, &odentry->d_name, ip);
-	if (error)
-		goto fail_gunlock;
-
-	/*  Check out the new directory  */
-
-	if (nip) {
-		error = gfs_unlink_ok(ndip, &ndentry->d_name, nip);
-		if (error)
-			goto fail_gunlock;
-
-		if (nip->i_di.di_type == GFS_FILE_DIR) {
-			if (nip->i_di.di_entries < 2) {
-				if (gfs_consist_inode(nip))
-					gfs_dinode_print(&nip->i_di);
-				error = -EIO;
-				goto fail_gunlock;
-			}
-			if (nip->i_di.di_entries > 2) {
-				error = -ENOTEMPTY;
-				goto fail_gunlock;
-			}
-		}
-	} else {
-		error = inode_permission(ndir, MAY_WRITE | MAY_EXEC);
-		if (error)
-			goto fail_gunlock;
-
-		error = gfs_dir_search(ndip, &ndentry->d_name, NULL, NULL);
-		switch (error) {
-		case -ENOENT:
-			error = 0;
-			break;
-		case 0:
-			error = -EEXIST;
-		default:
-			goto fail_gunlock;
-		};
-
-		if (odip != ndip) {
-			if (!ndip->i_di.di_nlink) {
-				error = -EINVAL;
-				goto fail_gunlock;
-			}
-			if (ndip->i_di.di_entries == (uint32_t)-1) {
-				error = -EFBIG;
-				goto fail_gunlock;
-			}
-			if (ip->i_di.di_type == GFS_FILE_DIR &&
-			    ndip->i_di.di_nlink == (uint32_t)-1) {
-				error = -EMLINK;
-				goto fail_gunlock;
-			}
-		}
-	}
-
-	error = gfs_diradd_alloc_required(ndip, &ndentry->d_name, &alloc_required);
-	if (error)
-		goto fail_gunlock;
-
-	if (alloc_required) {
-		al = gfs_alloc_get(ndip);
-
-		error = gfs_quota_lock_m(ndip,
-					    NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
-		if (error)
-			goto fail_alloc;
-
-		error = gfs_quota_check(ndip, ndip->i_di.di_uid, ndip->i_di.di_gid);
-		if (error)
-			goto fail_gunlock_q;
-
-		al->al_requested_meta = sdp->sd_max_dirres;
-
-		error = gfs_inplace_reserve(ndip);
-		if (error)
-			goto fail_gunlock_q;
-
-		/* Trans may require:
-		   Dinodes for the srcdir, srcino, dstdir, dstino.  Blocks for
-		   adding the entry to dstdir.  RG bitmaps for that allocation.
-		   One leaf block in the srcdir for removal of the entry.
-		   One leaf block for changing .. in srcino (if it's a directory).
-		   Two leaf blocks for removing . and .. from dstino (if it exists
-		   and it's a directory), one unlinked tag, and one quota block. */
-
-		error = gfs_trans_begin(sdp,
-					8 + sdp->sd_max_dirres +
-					al->al_rgd->rd_ri.ri_length,
-					2);
-		if (error)
-			goto fail_ipres;
-	} else {
-		/* Trans may require:
-		   Dinodes for the srcdir, srcino, dstdir, dstino.  One block for
-		   adding the entry to dstdir.
-		   One leaf block in the srcdir for removal of the entry.
-		   One leaf block for changing .. in srcino (if it's a directory).
-		   Two leaf blocks for removing . and .. from dstino (if it exists
-		   and it's a directory), and one unlinked tag. */
-
-		error = gfs_trans_begin(sdp, 9, 1);
-		if (error)
-			goto fail_ipres;
-	}
-
-	/*  Remove the target file, if it exists  */
-
-	if (nip) {
-		if (nip->i_di.di_type == GFS_FILE_DIR)
-			error = gfs_rmdiri(ndip, &ndentry->d_name, nip);
-		else
-			error = gfs_unlinki(ndip, &ndentry->d_name, nip);
-
-		if (error)
-			goto fail_end_trans;
-	}
-
-	if (dir_rename) {
-		error = gfs_change_nlink(ndip, +1);
-		if (error)
-			goto fail_end_trans;
-		error = gfs_change_nlink(odip, -1);
-		if (error)
-			goto fail_end_trans;
-
-		name.len = 2;
-		name.name = "..";
-
-		error = gfs_dir_mvino(ip, &name, &ndip->i_num, GFS_FILE_DIR);
-		if (error)
-			goto fail_end_trans;
-	}
-
-	error = gfs_dir_del(odip, &odentry->d_name);
-	if (error)
-		goto fail_end_trans;
-
-	error = gfs_dir_add(ndip, &ndentry->d_name, &ip->i_num, ip->i_di.di_type);
-	if (error)
-		goto fail_end_trans;
-
-	if (dir_rename)
-		gfs_trans_add_gl(sdp->sd_rename_gl);
-
-	gfs_trans_end(sdp);
-
-	if (alloc_required) {
-		/*  Don't check al->al_alloced_meta and friends.  */
-		gfs_inplace_release(ndip);
-		gfs_quota_unlock_m(ndip);
-		gfs_alloc_put(ndip);
-	}
-
-	gfs_glock_dq_m(num_gh, ghs);
-
-	for (x = 0; x < num_gh; x++)
-		gfs_holder_uninit(&ghs[x]);
-
-	if (dir_rename)
-		gfs_glock_dq_uninit(&r_gh);
-
-	return 0;
-
- fail_end_trans:
-	gfs_trans_end(sdp);
-
- fail_ipres:
-	if (alloc_required)
-		gfs_inplace_release(ndip);
-
- fail_gunlock_q:
-	if (alloc_required)
-		gfs_quota_unlock_m(ndip);
-
- fail_alloc:
-	if (alloc_required)
-		gfs_alloc_put(ndip);
-
- fail_gunlock:
-	gfs_glock_dq_m(num_gh, ghs);
-
- fail_uninit:
-	for (x = 0; x < num_gh; x++)
-		gfs_holder_uninit(&ghs[x]);
-
- fail:
-	if (dir_rename)
-		gfs_glock_dq_uninit(&r_gh);
-
-	return error;
-}
-
-/**
- * gfs_readlink - Read the value of a symlink
- * @dentry: the symlink
- * @buf: the buffer to read the symlink data into
- * @size: the size of the buffer
- *
- * Returns: errno
- */
-
-static int
-gfs_readlink(struct dentry *dentry, char *user_buf, int user_size)
-{
-	struct gfs_inode *ip = get_v2ip(dentry->d_inode);
-	char array[GFS_FAST_NAME_SIZE], *buf = array;
-	unsigned int len = GFS_FAST_NAME_SIZE;
-	int error;
-
-	atomic_inc(&ip->i_sbd->sd_ops_inode);
-
-	error = gfs_readlinki(ip, &buf, &len);
-	if (error)
-		return error;
-
-	if (user_size > len - 1)
-		user_size = len - 1;
-
-	if (copy_to_user(user_buf, buf, user_size))
-		error = -EFAULT;
-	else
-		error = user_size;
-
-	if (buf != array)
-		kfree(buf);
-
-	return error;
-}
-
-/**
- * gfs_follow_link - Follow a symbolic link
- * @dentry: The dentry of the link
- * @nd: Data that we pass to vfs_follow_link()
- *
- * This can handle symlinks of any size. It is optimised for symlinks
- * under GFS_FAST_NAME_SIZE.
- *
- * Returns: 0 on success or error code
- */
-
-static void *
-gfs_follow_link(struct dentry *dentry, struct nameidata *nd)
-{
-	struct gfs_inode *ip = get_v2ip(dentry->d_inode);
-	char array[GFS_FAST_NAME_SIZE], *buf = array;
-	unsigned int len = GFS_FAST_NAME_SIZE;
-	int error;
-
-	atomic_inc(&ip->i_sbd->sd_ops_inode);
-
-	error = gfs_readlinki(ip, &buf, &len);
-	if (!error) {
-		error = vfs_follow_link(nd, buf);
-		if (buf != array)
-			kfree(buf);
-	}
-
-	return ERR_PTR(error);
-}
-
-/**
- * gfs_permission_i -
- * @inode:
- * @mask:
- *
- * Shamelessly ripped from ext3
- *
- * Returns: errno
- */
-
-static int
-gfs_permission_i(struct inode *inode, int mask)
-{
-	return generic_permission(inode, mask, gfs_check_acl);
-}
-
-/**
- * gfs_permission -
- * @inode:
- * @mask:
- *
- * Returns: errno
- */
-
-static int
-gfs_permission(struct inode *inode, int mask)
-{
-	struct gfs_inode *ip = get_v2ip(inode);
-	struct gfs_holder i_gh;
-	int error;
-
-	atomic_inc(&ip->i_sbd->sd_ops_inode);
-
-	error = gfs_glock_nq_init(ip->i_gl,
-				  LM_ST_SHARED, LM_FLAG_ANY,
-				  &i_gh);
-	if (error)
-		return error;
-
-	error = gfs_permission_i(inode, mask);
-
-	gfs_glock_dq_uninit(&i_gh);
-
-	return error;
-}
-
-/**
- * gfs_setattr - Change attributes on an inode
- * @dentry: The dentry which is changing
- * @attr: The structure describing the change
- *
- * The VFS layer wants to change one or more of an inodes attributes.  Write
- * that change out to disk.
- *
- * Returns: errno
- */
-
-static int
-gfs_setattr(struct dentry *dentry, struct iattr *attr)
-{
-	struct inode *inode = dentry->d_inode;
-	struct gfs_inode *ip = get_v2ip(inode);
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_holder i_gh;
-	int error;
-
-	atomic_inc(&sdp->sd_ops_inode);
-
-	/* Bugzilla 203170: we'll have the same deadlock as described 
-	 * in bugzilla 173912 if
-	 * 1. without RHEL4's DIO_CLUSTER_LOCKING, and
-	 * 2. we come down to this line of code from do_truncate()
-	 *    where i_sem(i_mutex) and i_alloc_sem have been taken, and
-	 * 3. grab the exclusive glock here.
-	 * To avoid this to happen, i_alloc_sem must be dropped and trust
-	 * be put into glock that it can carry the same protection. 
-	 *
-	 * One issue with dropping i_alloc_sem is that the gfs_setattr() 
-	 * can be invoked from other code path without this sempaphore. 
-	 * We'll need a new rwsem function that can "up" the semaphore 
-	 * only when it is needed. Before that happens (will research the 
-	 * possibility), i_alloc_sem (now) is a meaningless lock within 
-	 * GFS. If it is ever been used by other non-directIO code, this
-	 * hack will fall apart.
-	 *
-	 * wcheng@redhat.com 10/14/06  
-	 */ 
-	if (attr->ia_valid & ATTR_SIZE) {
-		up_write(&dentry->d_inode->i_alloc_sem); 
-	}
-	
-	error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh);
-
-	if (attr->ia_valid & ATTR_SIZE) {
-		down_write(&dentry->d_inode->i_alloc_sem); 
-	}
-	
-	if (error)
-		return error;
-
-	if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) {
-		error = -EPERM;
-		goto fail;
-	}
-
-	error = inode_change_ok(inode, attr);
-	if (error)
-		goto fail;
-
-	if (attr->ia_valid & ATTR_SIZE) {
-		error = inode_permission(inode, MAY_WRITE);
-		if (error)
-			goto fail;
-
-		if (attr->ia_size != ip->i_di.di_size) {
-			error = vmtruncate(inode, attr->ia_size);
-			if (error)
-				goto fail;
-		}
-
-		error = gfs_truncatei(ip, attr->ia_size, gfs_truncator_page);
-		if (error) {
-			if (inode->i_size != ip->i_di.di_size)
-				i_size_write(inode, ip->i_di.di_size);
-			goto fail;
-		}
-
-		if ((sdp->sd_vfs->s_flags & MS_SYNCHRONOUS) &&
-		    !gfs_is_jdata(ip))
-			i_gh.gh_flags |= GL_SYNC;
-	}
-
-	else if (attr->ia_valid & (ATTR_UID | ATTR_GID)) {
-		struct gfs_alloc *al;
-		struct buffer_head *dibh;
-		uint32_t ouid, ogid, nuid, ngid;
-
-		ouid = ip->i_di.di_uid;
-		ogid = ip->i_di.di_gid;
-		nuid = attr->ia_uid;
-		ngid = attr->ia_gid;
-
-		if (!(attr->ia_valid & ATTR_UID) || ouid == nuid)
-			ouid = nuid = NO_QUOTA_CHANGE;
-		if (!(attr->ia_valid & ATTR_GID) || ogid == ngid)
-			ogid = ngid = NO_QUOTA_CHANGE;
-
-		al = gfs_alloc_get(ip);
-
-		error = gfs_quota_lock_m(ip, nuid, ngid);
-		if (error)
-			goto fail_alloc;
-
-		if (ouid != NO_QUOTA_CHANGE || ogid != NO_QUOTA_CHANGE) {
-			error = gfs_quota_check(ip, nuid, ngid);
-			if (error)
-				goto fail_gunlock_q;
-		}
-
-		/* Trans may require:
-		   one dinode block and one quota change block */
-
-		error = gfs_trans_begin(sdp, 1, 1);
-		if (error)
-			goto fail_gunlock_q;
-
-		error = gfs_get_inode_buffer(ip, &dibh);
-		if (error)
-			goto fail_end_trans;
-
-		if (ouid != NO_QUOTA_CHANGE || ogid != NO_QUOTA_CHANGE) {
-			gfs_trans_add_quota(sdp, -ip->i_di.di_blocks,
-					    ouid, ogid);
-			gfs_trans_add_quota(sdp, ip->i_di.di_blocks,
-					    nuid, ngid);
-		}
-
-		error = inode_setattr(inode, attr);
-		gfs_assert_warn(sdp, !error);
-		gfs_inode_attr_out(ip);
-
-		gfs_trans_add_bh(ip->i_gl, dibh);
-		gfs_dinode_out(&ip->i_di, dibh->b_data);
-		brelse(dibh);
-
-		gfs_trans_end(sdp);
-
-		gfs_quota_unlock_m(ip);
-		gfs_alloc_put(ip);
-	}
-
-	else if ((attr->ia_valid & ATTR_MODE) && IS_POSIXACL(inode)) {
-		error = gfs_acl_chmod(ip, attr);
-		if (error)
-			goto fail;
-	}
-
-	else {
-		error = gfs_setattr_simple(ip, attr);
-		if (error)
-			goto fail;
-	}
-
-	gfs_glock_dq_uninit(&i_gh);
-
-	mark_inode_dirty(inode);
-
-	return error;
-
- fail_end_trans:
-	gfs_trans_end(sdp);
-
- fail_gunlock_q:
-	gfs_quota_unlock_m(ip);
-
- fail_alloc:
-	gfs_alloc_put(ip);
-
- fail:
-	gfs_glock_dq_uninit(&i_gh);
-
-	return error;
-}
-
-/**
- * gfs_getattr - Read out an inode's attributes
- * @mnt: ?
- * @dentry: The dentry to stat
- * @stat: The inode's stats
- *
- * Returns: errno
- */
-
-static int
-gfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
-{
-	struct inode *inode = dentry->d_inode, *p_inode = NULL;
-	struct gfs_inode *ip = get_v2ip(inode), *pi = NULL;
-	struct gfs_holder gh;
-	int error;
-
-	atomic_inc(&ip->i_sbd->sd_ops_inode);
-
-	error = gfs_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &gh);
-	if (!error) {
-		generic_fillattr(inode, stat);
-		if (S_ISREG(inode->i_mode) && dentry->d_parent 
-		    && dentry->d_parent->d_inode) {
-			p_inode = igrab(dentry->d_parent->d_inode);
-			if (p_inode) {
-				pi = get_v2ip(p_inode);
-				pi->i_dir_stats++;
-				iput(p_inode);
-			}
-		}
-		gfs_glock_dq_uninit(&gh);
-	}
-
-	return error;
-}
-
-/**
- * gfs_setxattr - Set (or create or replace) an inode's extended attribute
- * @dentry: 
- * @name: 
- * @data: 
- * @size: 
- * @flags: 
- *
- * Returns: errno
- */
-
-int
-gfs_setxattr(struct dentry *dentry, const char *name,
-	     const void *data, size_t size,
-	     int flags)
-{
-	struct gfs_ea_request er;
-
-	atomic_inc(&get_v2sdp(dentry->d_inode->i_sb)->sd_ops_inode);
-
-	memset(&er, 0, sizeof(struct gfs_ea_request));
-	er.er_type = gfs_ea_name2type(name, &er.er_name);
-	if (er.er_type == GFS_EATYPE_UNUSED)
-	        return -EOPNOTSUPP;
-	er.er_data = (char *)data;
-	er.er_name_len = strlen(er.er_name);
-	er.er_data_len = size;
-	er.er_flags = flags;
-
-	return gfs_ea_set(get_v2ip(dentry->d_inode), &er);
-}
-
-/**
- * gfs_getxattr -
- * @dentry:
- * @name:
- * @data:
- * @size:
- *
- * Returns: The number of bytes put into data, or -errno
- */
-
-ssize_t
-gfs_getxattr(struct dentry *dentry, const char *name,
-	     void *data, size_t size)
-{
-	struct gfs_ea_request er;
-
-	atomic_inc(&get_v2sdp(dentry->d_inode->i_sb)->sd_ops_inode);
-
-	memset(&er, 0, sizeof(struct gfs_ea_request));
-	er.er_type = gfs_ea_name2type(name, &er.er_name);
-	if (er.er_type == GFS_EATYPE_UNUSED)
-	        return -EOPNOTSUPP;
-	er.er_data = data;
-	er.er_name_len = strlen(er.er_name);
-	er.er_data_len = size;
-
-	return gfs_ea_get(get_v2ip(dentry->d_inode), &er);
-}
-
-/**
- * gfs_listxattr - 
- * @dentry:
- * @buffer:
- * @size:
- *
- * Returns: The number of bytes put into data, or -errno
- */
-
-ssize_t
-gfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
-{
-	struct gfs_ea_request er;
-
-	atomic_inc(&get_v2sdp(dentry->d_inode->i_sb)->sd_ops_inode);
-
-	memset(&er, 0, sizeof(struct gfs_ea_request));
-	er.er_data = (size) ? buffer : NULL;
-	er.er_data_len = size;
-
-	return gfs_ea_list(get_v2ip(dentry->d_inode), &er);
-}
-
-/**
- * gfs_removexattr -
- * @dentry:
- * @name:
- *
- * Returns: errno
- */
-
-int
-gfs_removexattr(struct dentry *dentry, const char *name)
-{
-	struct gfs_ea_request er;
-
-	atomic_inc(&get_v2sdp(dentry->d_inode->i_sb)->sd_ops_inode);
-
-	memset(&er, 0, sizeof(struct gfs_ea_request));
-	er.er_type = gfs_ea_name2type(name, &er.er_name);
-	if (er.er_type == GFS_EATYPE_UNUSED)
-	        return -EOPNOTSUPP;
-	er.er_name_len = strlen(er.er_name);
-
-	return gfs_ea_remove(get_v2ip(dentry->d_inode), &er);
-}
-
-struct inode_operations gfs_file_iops = {
-	.permission = gfs_permission,
-	.setattr = gfs_setattr,
-	.getattr = gfs_getattr,
-	.setxattr = gfs_setxattr,
-	.getxattr = gfs_getxattr,
-	.listxattr = gfs_listxattr,
-	.removexattr = gfs_removexattr,
-};
-
-struct inode_operations gfs_dev_iops = {
-	.permission = gfs_permission,
-	.setattr = gfs_setattr,
-	.getattr = gfs_getattr,
-	.setxattr = gfs_setxattr,
-	.getxattr = gfs_getxattr,
-	.listxattr = gfs_listxattr,
-	.removexattr = gfs_removexattr,
-};
-
-struct inode_operations gfs_dir_iops = {
-	.create = gfs_create,
-	.lookup = gfs_lookup,
-	.link = gfs_link,
-	.unlink = gfs_unlink,
-	.symlink = gfs_symlink,
-	.mkdir = gfs_mkdir,
-	.rmdir = gfs_rmdir,
-	.mknod = gfs_mknod,
-	.rename = gfs_rename,
-	.permission = gfs_permission,
-	.setattr = gfs_setattr,
-	.getattr = gfs_getattr,
-	.setxattr = gfs_setxattr,
-	.getxattr = gfs_getxattr,
-	.listxattr = gfs_listxattr,
-	.removexattr = gfs_removexattr,
-};
-
-struct inode_operations gfs_symlink_iops = {
-	.readlink = gfs_readlink,
-	.follow_link = gfs_follow_link,
-	.permission = gfs_permission,
-	.setattr = gfs_setattr,
-	.getattr = gfs_getattr,
-	.setxattr = gfs_setxattr,
-	.getxattr = gfs_getxattr,
-	.listxattr = gfs_listxattr,
-	.removexattr = gfs_removexattr,
-};
-
diff --git a/gfs-kernel/src/gfs/ops_inode.h b/gfs-kernel/src/gfs/ops_inode.h
deleted file mode 100644
index a753396..0000000
--- a/gfs-kernel/src/gfs/ops_inode.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __OPS_INODE_DOT_H__
-#define __OPS_INODE_DOT_H__
-
-extern struct inode_operations gfs_file_iops;
-extern struct inode_operations gfs_dir_iops;
-extern struct inode_operations gfs_symlink_iops;
-extern struct inode_operations gfs_dev_iops;
-
-#endif /* __OPS_INODE_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/ops_super.c b/gfs-kernel/src/gfs/ops_super.c
deleted file mode 100644
index afac554..0000000
--- a/gfs-kernel/src/gfs/ops_super.c
+++ /dev/null
@@ -1,455 +0,0 @@
-#include <linux/kthread.h>
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/buffer_head.h>
-#include <linux/vmalloc.h>
-#include <linux/statfs.h>
-#include <linux/seq_file.h>
-#include <linux/mount.h>
-
-#include "gfs.h"
-#include "dio.h"
-#include "glock.h"
-#include "inode.h"
-#include "lm.h"
-#include "log.h"
-#include "ops_fstype.h"
-#include "ops_super.h"
-#include "page.h"
-#include "proc.h"
-#include "quota.h"
-#include "recovery.h"
-#include "rgrp.h"
-#include "super.h"
-#include "sys.h"
-#include "mount.h"
-
-/**
- * gfs_write_inode - Make sure the inode is stable on the disk
- * @inode: The inode
- * @sync: synchronous write flag
- *
- * Returns: errno
- */
-
-static int
-gfs_write_inode(struct inode *inode, int sync)
-{
-	struct gfs_inode *ip = get_v2ip(inode);
-
-	atomic_inc(&ip->i_sbd->sd_ops_super);
-
-	if (ip && sync)
-		gfs_log_flush_glock(ip->i_gl);
-
-	return 0;
-}
-
-/**
- * gfs_drop_inode - drop an inode
- * @inode: The inode
- *
- * If i_nlink is zero, any dirty data for the inode is thrown away.
- * If a process on another machine has the file open, it may need that
- * data.  So, sync it out.
- */
-
-static void
-gfs_drop_inode(struct inode *inode)
-{
-	struct gfs_sbd *sdp = get_v2sdp(inode->i_sb);
-	struct gfs_inode *ip = get_v2ip(inode);
-
-	atomic_inc(&sdp->sd_ops_super);
-
-	if (ip &&
-	    !inode->i_nlink &&
-	    S_ISREG(inode->i_mode) &&
-	    !sdp->sd_args.ar_localcaching)
-		gfs_sync_page_i(inode, DIO_START | DIO_WAIT);
-	generic_drop_inode(inode);
-}
-
-/**
- * gfs_put_super - Unmount the filesystem
- * @sb: The VFS superblock
- *
- */
-
-static void
-gfs_put_super(struct super_block *sb)
-{
-	struct gfs_sbd *sdp = get_v2sdp(sb);
-	int error;
-
-        if (!sdp)
-                return;
-
-	atomic_inc(&sdp->sd_ops_super);
-
-	gfs_proc_fs_del(sdp);
-
-	/*  Unfreeze the filesystem, if we need to  */
-
-	down(&sdp->sd_freeze_lock);
-	if (sdp->sd_freeze_count)
-		gfs_glock_dq_uninit(&sdp->sd_freeze_gh);
-	up(&sdp->sd_freeze_lock);
-
-	/*  Kill off the inode thread  */
-	kthread_stop(sdp->sd_inoded_process);
-
-	/*  Kill off the quota thread  */
-	kthread_stop(sdp->sd_quotad_process);
-
-	/*  Kill off the log thread  */
-	kthread_stop(sdp->sd_logd_process);
-
-	/*  Kill off the recoverd thread  */
-	kthread_stop(sdp->sd_recoverd_process);
-
-	/*  Kill off the glockd threads  */
-	while (sdp->sd_glockd_num--)
-		kthread_stop(sdp->sd_glockd_process[sdp->sd_glockd_num]);
-
-	/*  Kill off the scand thread  */
-	kthread_stop(sdp->sd_scand_process);
-
-	if (!test_bit(SDF_ROFS, &sdp->sd_flags)) {
-		error = gfs_make_fs_ro(sdp);
-		if (error)
-			gfs_io_error(sdp);
-	}
-
-	/*  At this point, we're through modifying the disk  */
-
-	/*  Release stuff  */
-
-	gfs_inode_put(sdp->sd_riinode);
-	gfs_inode_put(sdp->sd_jiinode);
-	gfs_inode_put(sdp->sd_rooti);
-	gfs_inode_put(sdp->sd_qinode);
-	gfs_inode_put(sdp->sd_linode);
-	gfs_glock_put(sdp->sd_trans_gl);
-	gfs_glock_put(sdp->sd_rename_gl);
-
-	if (!sdp->sd_args.ar_spectator)
-		gfs_glock_dq_uninit(&sdp->sd_journal_gh);
-
-	gfs_glock_dq_uninit(&sdp->sd_live_gh);
-
-	/*  Get rid of rgrp bitmap structures  */
-	gfs_clear_rgrpd(sdp);
-	gfs_clear_journals(sdp);
-
-	/*  Take apart glock structures and buffer lists  */
-	gfs_gl_hash_clear(sdp, TRUE);
-
-	/*  Unmount the locking protocol  */
-	gfs_lm_unmount(sdp);
-
-	/*  At this point, we're through participating in the lockspace  */
-
-	gfs_sys_fs_del(sdp);
-
-	gfs_clear_dirty_j(sdp);
-
-	/*  Get rid of any extra inodes  */
-	while (invalidate_inodes(sb))
-		yield();
-
-	vfree(sdp);
-
-	set_v2sdp(sb, NULL);
-}
-
-/**
- * gfs_write_super - disk commit all incore transactions
- * @sb: the filesystem
- *
- * This function is called every time sync(2) is called.
- * After this exits, all dirty buffers and synced.
- */
-
-static void
-gfs_write_super(struct super_block *sb)
-{
-	struct gfs_sbd *sdp = get_v2sdp(sb);
-	atomic_inc(&sdp->sd_ops_super);
-	gfs_log_flush(sdp);
-}
-
-/**
- * gfs_write_super_lockfs - prevent further writes to the filesystem
- * @sb: the VFS structure for the filesystem
- *
- */
-
-static void
-gfs_write_super_lockfs(struct super_block *sb)
-{
-	struct gfs_sbd *sdp = get_v2sdp(sb);
-	int error;
-
-	if (test_bit(SDF_SHUTDOWN, &sdp->sd_flags))
-		return;
-
-	atomic_inc(&sdp->sd_ops_super);
-
-	for (;;) {
-		error = gfs_freeze_fs(sdp);
-		if (!error)
-			break;
-
-		switch (error) {
-		case -EBUSY:
-			printk("GFS: fsid=%s: waiting for recovery before freeze\n",
-			       sdp->sd_fsname);
-			break;
-
-		default:
-			printk("GFS: fsid=%s: error freezing FS: %d\n",
-			       sdp->sd_fsname, error);
-			break;
-		}
-
-		printk("GFS: fsid=%s: retrying...\n", sdp->sd_fsname);
-
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(HZ);
-	}
-}
-
-/**
- * gfs_unlockfs - reallow writes to the filesystem
- * @sb: the VFS structure for the filesystem
- *
- */
-
-static void
-gfs_unlockfs(struct super_block *sb)
-{
-	struct gfs_sbd *sdp = get_v2sdp(sb);
-
-	atomic_inc(&sdp->sd_ops_super);
-
-	gfs_unfreeze_fs(sdp);
-}
-
-/**
- * gfs_statfs - Gather and return stats about the filesystem
- * @sb: The superblock
- * @statfsbuf: The buffer
- *
- * Returns: 0 on success or error code
- */
-
-static int gfs_statfs(struct dentry *dentry, struct kstatfs *buf)
-{
-	struct super_block *sb = dentry->d_inode->i_sb;
-	struct gfs_sbd *sdp = get_v2sdp(sb);
-	struct gfs_stat_gfs sg;
-	int error;
-
-	atomic_inc(&sdp->sd_ops_super);
-
-	if (gfs_tune_get(sdp, gt_statfs_fast))
-		return(gfs_statfs_fast(sdp, (void *)buf));
-
-	error = gfs_stat_gfs(sdp, &sg, TRUE);
-	if (error)
-		return error;
-
-	memset(buf, 0, sizeof(struct kstatfs));
-
-	buf->f_type = GFS_MAGIC;
-	buf->f_bsize = sdp->sd_sb.sb_bsize;
-	buf->f_blocks = sg.sg_total_blocks;
-	buf->f_bfree = sg.sg_free + sg.sg_free_dinode + sg.sg_free_meta;
-	buf->f_bavail = sg.sg_free + sg.sg_free_dinode + sg.sg_free_meta;
-	buf->f_files = sg.sg_used_dinode + sg.sg_free_dinode +
-		sg.sg_free_meta + sg.sg_free;
-	buf->f_ffree = sg.sg_free_dinode + sg.sg_free_meta + sg.sg_free;
-	buf->f_namelen = GFS_FNAMESIZE;
-
-	return 0;
-}
-
-/**
- * gfs_remount_fs - called when the FS is remounted
- * @sb:  the filesystem
- * @flags:  the remount flags
- * @data:  extra data passed in (not used right now)
- *
- * Returns: errno
- */
-
-static int
-gfs_remount_fs(struct super_block *sb, int *flags, char *data)
-{
-	struct gfs_sbd *sdp = get_v2sdp(sb);
-	struct gfs_tune *gt = &sdp->sd_tune;
-	int error = 0;
-	struct gfs_args *args;
-
-	atomic_inc(&sdp->sd_ops_super);
-
-	args = kmalloc(sizeof(struct gfs_args), GFP_KERNEL);
-	if (!args)
-		return -ENOMEM;
-
-	error = gfs_make_args(data, args, TRUE);
-	if (error) {
-		printk("GFS: can't parse remount arguments\n");
-		goto out;
-	}
-	if (args->ar_posix_acls) {
-		sdp->sd_args.ar_posix_acls = TRUE;
-		sb->s_flags |= MS_POSIXACL;
-	}
-	else {
-		sdp->sd_args.ar_posix_acls = FALSE;
-		sb->s_flags &= ~MS_POSIXACL;
-	}
-
-	if (*flags & (MS_NOATIME | MS_NODIRATIME))
-		set_bit(SDF_NOATIME, &sdp->sd_flags);
-	else
-		clear_bit(SDF_NOATIME, &sdp->sd_flags);
-
-	if (sdp->sd_args.ar_spectator)
-		*flags |= MS_RDONLY;
-	else {
-		if (*flags & MS_RDONLY) {
-			if (!test_bit(SDF_ROFS, &sdp->sd_flags))
-				error = gfs_make_fs_ro(sdp);
-		} else if (!(*flags & MS_RDONLY) &&
-			   test_bit(SDF_ROFS, &sdp->sd_flags)) {
-			error = gfs_make_fs_rw(sdp);
-		}
-	}
-
-	if (args->ar_noquota) {
-		if (sdp->sd_args.ar_noquota == FALSE)
-			printk("GFS: remounting without quota\n");
-		sdp->sd_args.ar_noquota = TRUE;
-		spin_lock(&gt->gt_spin);
-		gt->gt_quota_enforce = 0;
-		gt->gt_quota_account = 0;
-		spin_unlock(&gt->gt_spin);
-	}
-	else {
-		if (sdp->sd_args.ar_noquota == TRUE)
-			printk("GFS: remounting with quota\n");
-		sdp->sd_args.ar_noquota = FALSE;
-		spin_lock(&gt->gt_spin);
-		gt->gt_quota_enforce = 1;
-		gt->gt_quota_account = 1;
-		spin_unlock(&gt->gt_spin);
-	}
-
-	/*  Don't let the VFS update atimes.  GFS handles this itself. */
-	*flags |= MS_NOATIME | MS_NODIRATIME;
-
-out:
-	kfree(args);
-	return error;
-}
-
-/**
- * gfs_clear_inode - Deallocate an inode when VFS is done with it
- * @inode: The VFS inode
- *
- * If there's a GFS incore inode structure attached to the VFS inode:
- * --  Detach them from one another.
- * --  Schedule reclaim of GFS inode struct, the glock protecting it, and
- *     the associated iopen glock.
- */
-
-static void
-gfs_clear_inode(struct inode *inode)
-{
-	struct gfs_inode *ip = get_v2ip(inode);
-
-	atomic_inc(&get_v2sdp(inode->i_sb)->sd_ops_super);
-
-	if (ip) {
-		spin_lock(&ip->i_spin);
-		ip->i_vnode = NULL;
-		set_v2ip(inode, NULL);
-		spin_unlock(&ip->i_spin);
-
-		gfs_glock_schedule_for_reclaim(ip->i_gl);
-		gfs_inode_put(ip);
-	}
-}
-
-/**
- * gfs_show_options - Show mount options for /proc/mounts
- * @s: seq_file structure
- * @mnt: vfsmount
- *
- * Returns: 0 on success or error code
- */
-
-static int
-gfs_show_options(struct seq_file *s, struct vfsmount *mnt)
-{
-	struct gfs_sbd *sdp = get_v2sdp(mnt->mnt_sb);
-	struct gfs_args *args = &sdp->sd_args;
-
-	atomic_inc(&sdp->sd_ops_super);
-
-	if (args->ar_lockproto[0]) {
-		seq_printf(s, ",lockproto=");
-		seq_puts(s, args->ar_lockproto);
-	}
-	if (args->ar_locktable[0]) {
-		seq_printf(s, ",locktable=");
-		seq_puts(s, args->ar_locktable);
-	}
-	if (args->ar_hostdata[0]) {
-		seq_printf(s, ",hostdata=");
-		seq_puts(s, args->ar_hostdata);
-	}
-	if (args->ar_spectator)
-		seq_printf(s, ",spectator");
-	if (args->ar_ignore_local_fs)
-		seq_printf(s, ",ignore_local_fs");
-	if (args->ar_localflocks)
-		seq_printf(s, ",localflocks");
-	if (args->ar_localcaching)
-		seq_printf(s, ",localcaching");
-	if (args->ar_oopses_ok)
-		seq_printf(s, ",oopses_ok");
-	if (args->ar_debug)
-		seq_printf(s, ",debug");
-	if (args->ar_upgrade)
-		seq_printf(s, ",upgrade");
-	if (args->ar_num_glockd != GFS_GLOCKD_DEFAULT)
-		seq_printf(s, ",num_glockd=%u", args->ar_num_glockd);
-	if (args->ar_posix_acls)
-		seq_printf(s, ",acl");
-	if (args->ar_noquota)
-		seq_printf(s, ",noquota");
-	if (args->ar_suiddir)
-		seq_printf(s, ",suiddir");
-
-	return 0;
-}
-
-struct super_operations gfs_super_ops = {
-	.write_inode = gfs_write_inode,
-	.drop_inode = gfs_drop_inode,
-	.put_super = gfs_put_super,
-	.write_super = gfs_write_super,
-	.write_super_lockfs = gfs_write_super_lockfs,
-	.unlockfs = gfs_unlockfs,
-	.statfs = gfs_statfs,
-	.remount_fs = gfs_remount_fs,
-	.clear_inode = gfs_clear_inode,
-	.show_options = gfs_show_options,
-};
diff --git a/gfs-kernel/src/gfs/ops_super.h b/gfs-kernel/src/gfs/ops_super.h
deleted file mode 100644
index d3dad88..0000000
--- a/gfs-kernel/src/gfs/ops_super.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __OPS_SUPER_DOT_H__
-#define __OPS_SUPER_DOT_H__
-
-extern struct super_operations gfs_super_ops;
-
-#endif /* __OPS_SUPER_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/ops_vm.c b/gfs-kernel/src/gfs/ops_vm.c
deleted file mode 100644
index 423435e..0000000
--- a/gfs-kernel/src/gfs/ops_vm.c
+++ /dev/null
@@ -1,233 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <linux/mm.h>
-#include <linux/pagemap.h>
-
-#include "gfs.h"
-#include "bmap.h"
-#include "glock.h"
-#include "inode.h"
-#include "ops_vm.h"
-#include "page.h"
-#include "quota.h"
-#include "rgrp.h"
-#include "trans.h"
-
-/**
- * pfault_be_greedy -
- * @ip:
- *
- */
-
-static void
-pfault_be_greedy(struct gfs_inode *ip)
-{
-	unsigned int time;
-
-	spin_lock(&ip->i_spin);
-	time = ip->i_greedy;
-	ip->i_last_pfault = jiffies;
-	spin_unlock(&ip->i_spin);
-
-	gfs_inode_hold(ip);
-	if (gfs_glock_be_greedy(ip->i_gl, time))
-		gfs_inode_put(ip);
-}
-
-/**
- * gfs_private_fault -
- * @area:
- * @address:
- * @type:
- *
- * Returns: the page
- */
-
-static int gfs_private_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
-{
-	struct gfs_inode *ip = get_v2ip(vma->vm_file->f_mapping->host);
-	struct gfs_holder i_gh;
-	int error;
-	int ret = 0;
-
-	atomic_inc(&ip->i_sbd->sd_ops_vm);
-
-	error = gfs_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &i_gh);
-	if (error)
-		goto out;
-
-	set_bit(GIF_PAGED, &ip->i_flags);
-
-	ret = filemap_fault(vma, vmf);
-
-	if (ret && ret != VM_FAULT_OOM)
-		pfault_be_greedy(ip);
-
-	gfs_glock_dq_uninit(&i_gh);
- out:
-	return ret;
-}
-
-/**
- * alloc_page_backing -
- * @ip:
- * @index:
- *
- * Returns: errno
- */
-
-static int
-alloc_page_backing(struct gfs_inode *ip, struct page *page)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	unsigned long index = page->index;
-	uint64_t lblock = index << (PAGE_CACHE_SHIFT - sdp->sd_sb.sb_bsize_shift);
-	unsigned int blocks = PAGE_CACHE_SIZE >> sdp->sd_sb.sb_bsize_shift;
-	struct gfs_alloc *al;
-	unsigned int x;
-	int error;
-
-	al = gfs_alloc_get(ip);
-
-	error = gfs_quota_lock_m(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
-	if (error)
-		goto out;
-
-	error = gfs_quota_check(ip, ip->i_di.di_uid, ip->i_di.di_gid);
-	if (error)
-		goto out_gunlock_q;
-
-	gfs_write_calc_reserv(ip, PAGE_CACHE_SIZE,
-			      &al->al_requested_data, &al->al_requested_meta);
-
-	error = gfs_inplace_reserve(ip);
-	if (error)
-		goto out_gunlock_q;
-
-	/* Trans may require:
-	   a dinode block, RG bitmaps to allocate from,
-	   indirect blocks, and a quota block */
-
-	error = gfs_trans_begin(sdp,
-				1 + al->al_rgd->rd_ri.ri_length +
-				al->al_requested_meta, 1);
-	if (error)
-		goto out_ipres;
-
-	if (gfs_is_stuffed(ip)) {
-		error = gfs_unstuff_dinode(ip, gfs_unstuffer_page, NULL);
-		if (error)
-			goto out_trans;
-	}
-
-	for (x = 0; x < blocks; ) {
-		uint64_t dblock;
-		unsigned int extlen;
-		int new = TRUE;
-
-		error = gfs_block_map(ip, lblock, &new, &dblock, &extlen);
-		if (error)
-			goto out_trans;
-
-		lblock += extlen;
-		x += extlen;
-	}
-
-	gfs_assert_warn(sdp, al->al_alloced_meta || al->al_alloced_data);
-
- out_trans:
-	gfs_trans_end(sdp);
-
- out_ipres:
-	gfs_inplace_release(ip);
-
- out_gunlock_q:
-	gfs_quota_unlock_m(ip);
-
- out:
-	gfs_alloc_put(ip);
-
-	return error;
-}
-
-/**
- * gfs_sharewrite_fault -
- * @area:
- * @address:
- * @type:
- *
- * Returns: the page
- */
-
-static int gfs_sharewrite_fault(struct vm_area_struct *vma,
-				struct vm_fault *vmf)
-{
-	struct file *file = vma->vm_file;
-	struct gfs_inode *ip = get_v2ip(file->f_mapping->host);
-	struct gfs_holder i_gh;
-	int alloc_required;
-	int error;
-	int ret = 0;
-
-	atomic_inc(&ip->i_sbd->sd_ops_vm);
-
-	error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh);
-	if (error)
-		goto out;
-
-	if (gfs_is_jdata(ip))
-		goto out_unlock;
-
-	set_bit(GIF_PAGED, &ip->i_flags);
-	set_bit(GIF_SW_PAGED, &ip->i_flags);
-
-	error = gfs_write_alloc_required(ip,
-					 (u64)vmf->pgoff << PAGE_CACHE_SHIFT,
-					 PAGE_CACHE_SIZE, &alloc_required);
-	if (error) {
-		ret = VM_FAULT_OOM; /* XXX: are these right? */
-		goto out_unlock;
-	}
-
-	ret = filemap_fault(vma, vmf);
-	if (ret & VM_FAULT_ERROR)
-		goto out_unlock;
-
-	if (alloc_required) {
-		/* XXX: do we need to drop page lock around alloc_page_backing?*/
-		error = alloc_page_backing(ip, vmf->page);
-		if (error) {
-                        /*
-                         * VM_FAULT_LOCKED should always be the case for
-                         * filemap_fault, but it may not be in a future
-                         * implementation.
-                         */
-			if (ret & VM_FAULT_LOCKED)
-				unlock_page(vmf->page);
-			page_cache_release(vmf->page);
-			ret = VM_FAULT_OOM;
-			goto out_unlock;
-		}
-		set_page_dirty(vmf->page);
-	}
-
-	pfault_be_greedy(ip);
-
- out_unlock:
-	gfs_glock_dq_uninit(&i_gh);
- out:
-	return ret;
-}
-
-struct vm_operations_struct gfs_vm_ops_private = {
-	.fault = gfs_private_fault,
-};
-
-struct vm_operations_struct gfs_vm_ops_sharewrite = {
-	.fault = gfs_sharewrite_fault,
-};
-
diff --git a/gfs-kernel/src/gfs/ops_vm.h b/gfs-kernel/src/gfs/ops_vm.h
deleted file mode 100644
index 0361c97..0000000
--- a/gfs-kernel/src/gfs/ops_vm.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef __OPS_VM_DOT_H__
-#define __OPS_VM_DOT_H__
-
-extern struct vm_operations_struct gfs_vm_ops_private;
-extern struct vm_operations_struct gfs_vm_ops_sharewrite;
-
-#endif /* __OPS_VM_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/page.c b/gfs-kernel/src/gfs/page.c
deleted file mode 100644
index 4c5cdb3..0000000
--- a/gfs-kernel/src/gfs/page.c
+++ /dev/null
@@ -1,266 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <linux/pagemap.h>
-#include <linux/mm.h>
-
-#include "gfs.h"
-#include "bmap.h"
-#include "inode.h"
-#include "page.h"
-
-/**
- * gfs_inval_pte - Sync and invalidate all PTEs associated with a glock
- * @gl: the glock
- *
- */
-
-void
-gfs_inval_pte(struct gfs_glock *gl)
-{
-	struct gfs_inode *ip;
-	struct inode *inode;
-
-	ip = get_gl2ip(gl);
-	if (!ip ||
-	    ip->i_di.di_type != GFS_FILE_REG)
-		return;
-
-	if (!test_bit(GIF_PAGED, &ip->i_flags))
-		return;
-
-	inode = gfs_iget(ip, NO_CREATE);
-	if (inode) {
-		unmap_shared_mapping_range(inode->i_mapping, 0, 0);
-		iput(inode);
-
-		if (test_bit(GIF_SW_PAGED, &ip->i_flags))
-			set_bit(GLF_DIRTY, &gl->gl_flags);
-	}
-
-	clear_bit(GIF_SW_PAGED, &ip->i_flags);
-}
-
-/**
- * gfs_inval_page - Invalidate all pages associated with a glock
- * @gl: the glock
- *
- */
-
-void
-gfs_inval_page(struct gfs_glock *gl)
-{
-	struct gfs_inode *ip;
-	struct inode *inode;
-
-	ip = get_gl2ip(gl);
-	if (!ip ||
-	    ip->i_di.di_type != GFS_FILE_REG)
-		return;
-
-	inode = gfs_iget(ip, NO_CREATE);
-	if (inode) {
-		struct address_space *mapping = inode->i_mapping;
-
-		truncate_inode_pages(mapping, 0);
-		gfs_assert_withdraw(ip->i_sbd, !mapping->nrpages);
-
-		iput(inode);
-	}
-
-	clear_bit(GIF_PAGED, &ip->i_flags);
-}
-
-/**
- * gfs_sync_page_i - Sync the data pages (not metadata) for a struct inode
- * @inode: the inode
- * @flags: DIO_START | DIO_WAIT
- *
- */
-
-void
-gfs_sync_page_i(struct inode *inode, int flags)
-{
-	struct address_space *mapping = inode->i_mapping;
-	int error = 0;
-
-	if (flags & DIO_START)
-		error = filemap_fdatawrite(mapping);
-	if (!error && (flags & DIO_WAIT))
-		error = filemap_fdatawait(mapping);
-
-	/* Find a better way to report this to the user. */
-	if (error)
-		gfs_io_error_inode(get_v2ip(inode));
-}
-
-/**
- * gfs_sync_page - Sync the data pages (not metadata) associated with a glock
- * @gl: the glock
- * @flags: DIO_START | DIO_WAIT
- *
- * Syncs data (not metadata) for a regular file.
- * No-op for all other types.
- */
-
-void
-gfs_sync_page(struct gfs_glock *gl, int flags)
-{
-	struct gfs_inode *ip;
-	struct inode *inode;
-
-	ip = get_gl2ip(gl);
-	if (!ip ||
-	    ip->i_di.di_type != GFS_FILE_REG)
-		return;
-
-	inode = gfs_iget(ip, NO_CREATE);
-	if (inode) {
-		gfs_sync_page_i(inode, flags);
-		iput(inode);
-	}
-}
-
-/**
- * gfs_unstuffer_page - unstuff a stuffed inode into a block cached by a page
- * @ip: the inode
- * @dibh: the dinode buffer
- * @block: the block number that was allocated
- * @private: any locked page held by the caller process
- *
- * Returns: errno
- */
-
-int
-gfs_unstuffer_page(struct gfs_inode *ip, struct buffer_head *dibh,
-		   uint64_t block, void *private)
-{
-	struct inode *inode = ip->i_vnode;
-	struct page *page = (struct page *)private;
-	struct buffer_head *bh;
-	int release = FALSE;
-
-	if (!page || page->index) {
-		page = grab_cache_page(inode->i_mapping, 0);
-		if (!page)
-			return -ENOMEM;
-		release = TRUE;
-	}
-
-	if (!PageUptodate(page)) {
-		void *kaddr = kmap(page);
-
-		memcpy(kaddr,
-		       dibh->b_data + sizeof(struct gfs_dinode),
-		       ip->i_di.di_size);
-		memset(kaddr + ip->i_di.di_size,
-		       0,
-		       PAGE_CACHE_SIZE - ip->i_di.di_size);
-		kunmap(page);
-
-		SetPageUptodate(page);
-	}
-
-	if (!page_has_buffers(page))
-		create_empty_buffers(page, 1 << inode->i_blkbits,
-				     (1 << BH_Uptodate));
-
-	bh = page_buffers(page);
-
-	if (!buffer_mapped(bh))
-		map_bh(bh, inode->i_sb, block);
-	else if (gfs_assert_warn(ip->i_sbd,
-				 bh->b_bdev == inode->i_sb->s_bdev &&
-				 bh->b_blocknr == block))
-                map_bh(bh, inode->i_sb, block);
-
-	set_buffer_uptodate(bh);
-	mark_buffer_dirty(bh);
-
-	if (release) {
-		unlock_page(page);
-		page_cache_release(page);
-	}
-
-	return 0;
-}
-
-/**
- * gfs_truncator_page - truncate a partial data block in the page cache
- * @ip: the inode
- * @size: the size the file should be
- *
- * Returns: errno
- */
-
-int
-gfs_truncator_page(struct gfs_inode *ip, uint64_t size)
-{
-	struct inode *inode = ip->i_vnode;
-	struct page *page;
-	struct buffer_head *bh;
-	void *kaddr;
-	uint64_t lbn, dbn;
-	unsigned long index;
-	unsigned int offset;
-	unsigned int bufnum;
-	int not_new = 0;
-	int error;
-
-	lbn = size >> inode->i_blkbits;
-	error = gfs_block_map(ip,
-			      lbn, &not_new,
-			      &dbn, NULL);
-	if (error || !dbn)
-		return error;
-
-	index = size >> PAGE_CACHE_SHIFT;
-	offset = size & (PAGE_CACHE_SIZE - 1);
-	bufnum = lbn - (index << (PAGE_CACHE_SHIFT - inode->i_blkbits));
-
-	/* Not in a transaction here -- a non-disk-I/O error is ok. */
-
-	page = read_cache_page(inode->i_mapping, index,
-			       (filler_t *)inode->i_mapping->a_ops->readpage,
-			       NULL);
-	if (IS_ERR(page))
-		return PTR_ERR(page);
-
-	lock_page(page);
-
-	if (!PageUptodate(page) || PageError(page)) {
-		error = -EIO;
-		goto out;
-	}
-
-	kaddr = kmap(page);
-	memset(kaddr + offset, 0, PAGE_CACHE_SIZE - offset);
-	kunmap(page);
-
-	if (!page_has_buffers(page))
-		create_empty_buffers(page, 1 << inode->i_blkbits,
-				     (1 << BH_Uptodate));
-
-	for (bh = page_buffers(page); bufnum--; bh = bh->b_this_page)
-		/* Do nothing */;
-
-	if (!buffer_mapped(bh))
-		map_bh(bh, inode->i_sb, dbn);
-	else if (gfs_assert_warn(ip->i_sbd,
-				 bh->b_bdev == inode->i_sb->s_bdev &&
-				 bh->b_blocknr == dbn))
-		map_bh(bh, inode->i_sb, dbn);
-
-	set_buffer_uptodate(bh);
-	mark_buffer_dirty(bh);
-
- out:
-	unlock_page(page);
-	page_cache_release(page);
-
-	return error;
-}
diff --git a/gfs-kernel/src/gfs/page.h b/gfs-kernel/src/gfs/page.h
deleted file mode 100644
index c9e0d55..0000000
--- a/gfs-kernel/src/gfs/page.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef __PAGE_DOT_H__
-#define __PAGE_DOT_H__
-
-void gfs_inval_pte(struct gfs_glock *gl);
-void gfs_inval_page(struct gfs_glock *gl);
-void gfs_sync_page_i(struct inode *inode, int flags);
-void gfs_sync_page(struct gfs_glock *gl, int flags);
-
-int gfs_unstuffer_page(struct gfs_inode *ip, struct buffer_head *dibh,
-		       uint64_t block, void *private);
-int gfs_truncator_page(struct gfs_inode *ip, uint64_t size);
-
-#endif /* __PAGE_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/proc.c b/gfs-kernel/src/gfs/proc.c
deleted file mode 100644
index b25cd1c..0000000
--- a/gfs-kernel/src/gfs/proc.c
+++ /dev/null
@@ -1,491 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <linux/proc_fs.h>
-#include <linux/module.h>
-#include <asm/uaccess.h>
-
-#include "gfs.h"
-#include "glock.h"
-#include "lm.h"
-#include "proc.h"
-#include "super.h"
-
-struct list_head gfs_fs_list;
-struct semaphore gfs_fs_lock;
-char *gfs_proc_margs;
-spinlock_t gfs_proc_margs_lock;
-spinlock_t gfs_req_lock;
-
-/**
- * gfs_proc_fs_add - Add a FS to the list of mounted FSs
- * @sdp:
- *
- */
-
-void
-gfs_proc_fs_add(struct gfs_sbd *sdp)
-{
-	down(&gfs_fs_lock);
-	list_add(&sdp->sd_list, &gfs_fs_list);
-	up(&gfs_fs_lock);
-}
-
-/**
- * gfs_proc_fs_del - Remove a FS from the list of mounted FSs
- * @sdp:
- *
- */
-
-void
-gfs_proc_fs_del(struct gfs_sbd *sdp)
-{
-	down(&gfs_fs_lock);
-	list_del(&sdp->sd_list);
-	up(&gfs_fs_lock);
-}
-
-/**
- * do_list - Copy the list of mountes FSs to userspace
- * @user_buf:
- * @size:
- *
- * @Returns: -errno, or the number of bytes copied to userspace
- */
-
-static ssize_t
-do_list(char *user_buf, size_t size)
-{
-	struct list_head *tmp;
-	struct gfs_sbd *sdp = NULL;
-	unsigned int x;
-	char num[21];
-	char device_id[32];
-	char *buf;
-	int error = 0;
-
-	down(&gfs_fs_lock);
-
-	x = 0;
-	for (tmp = gfs_fs_list.next; tmp != &gfs_fs_list; tmp = tmp->next) {
-		sdp = list_entry(tmp, struct gfs_sbd, sd_list);
-		sprintf(device_id, "%u:%u", MAJOR(sdp->sd_vfs->s_dev),
-			MINOR(sdp->sd_vfs->s_dev));
-		x += sprintf(num, "%lu", (unsigned long)sdp) +
-			strlen(device_id) +
-			strlen(sdp->sd_fsname) + 3;
-	}
-
-	if (!x)
-		goto out;
-
-	error = -EFBIG;
-	if (x > size)
-		goto out;
-
-	error = -ENOMEM;
-	buf = kmalloc(x + 1, GFP_KERNEL);
-	if (!buf)
-		goto out;
-
-	x = 0;
-	for (tmp = gfs_fs_list.next; tmp != &gfs_fs_list; tmp = tmp->next) {
-		sdp = list_entry(tmp, struct gfs_sbd, sd_list);
-		sprintf(device_id, "%u:%u", MAJOR(sdp->sd_vfs->s_dev),
-			MINOR(sdp->sd_vfs->s_dev));
-		x += sprintf(buf + x, "%lu %s %s\n",
-			     (unsigned long)sdp, device_id, sdp->sd_fsname);
-	}
-
-	if (copy_to_user(user_buf, buf, x))
-		error = -EFAULT;
-	else
-		error = x;
-
-	kfree(buf);
-
- out:
-	up(&gfs_fs_lock);
-
-	return error;
-}
-
-/**
- * find_argument - 
- * @p:
- *
- * Returns:
- */
-
-static char *
-find_argument(char *p)
-{
-	char *p2;
-
-	while (*p == ' ' || *p == '\n')
-		p++;
-	if (!*p)
-		return NULL;
-	for (p2 = p; *p2; p2++) /* do nothing */;
-	p2--;
-	while (*p2 == ' ' || *p2 == '\n')
-		*p2-- = 0;
-
-	return p;
-}
-
-/**
- * do_freeze - freeze a filesystem
- * @p: the freeze command
- *
- * Returns: errno
- */
-
-static int
-do_freeze(char *p)
-{
-	struct list_head *tmp;
-	struct gfs_sbd *sdp;
-	char num[21];
-	int error = 0;
-
-	p = find_argument(p + 6);
-	if (!p)
-		return -ENOENT;
-
-	down(&gfs_fs_lock);
-
-	for (tmp = gfs_fs_list.next; tmp != &gfs_fs_list; tmp = tmp->next) {
-		sdp = list_entry(tmp, struct gfs_sbd, sd_list);
-		sprintf(num, "%lu", (unsigned long)sdp);
-		if (strcmp(num, p) == 0)
-			break;
-	}
-
-	if (tmp == &gfs_fs_list)
-		error = -ENOENT;
-	else
-		error = gfs_freeze_fs(sdp);
-
-	up(&gfs_fs_lock);
-
-	return error;
-}
-
-/**
- * do_unfreeze - unfreeze a filesystem
- * @p: the unfreeze command
- *
- * Returns: errno
- */
-
-static int
-do_unfreeze(char *p)
-{
-	struct list_head *tmp;
-	struct gfs_sbd *sdp;
-	char num[21];
-	int error = 0;
-
-	p = find_argument(p + 8);
-	if (!p)
-		return -ENOENT;
-
-	down(&gfs_fs_lock);
-
-	for (tmp = gfs_fs_list.next; tmp != &gfs_fs_list; tmp = tmp->next) {
-		sdp = list_entry(tmp, struct gfs_sbd, sd_list);
-		sprintf(num, "%lu", (unsigned long)sdp);
-		if (strcmp(num, p) == 0)
-			break;
-	}
-
-	if (tmp == &gfs_fs_list)
-		error = -ENOENT;
-	else
-		gfs_unfreeze_fs(sdp);
-
-	up(&gfs_fs_lock);
-
-	return error;
-}
-
-/**
- * do_margs - Pass in mount arguments
- * @p: the margs command
- *
- * Returns: errno
- */
-
-static int
-do_margs(char *p)
-{
-	char *new_buf, *old_buf;
-
-	p = find_argument(p + 5);
-	if (!p)
-		return -ENOENT;
-
-	new_buf = kmalloc(strlen(p) + 1, GFP_KERNEL);
-	if (!new_buf)
-		return -ENOMEM;
-	strcpy(new_buf, p);
-
-	spin_lock(&gfs_proc_margs_lock);
-	old_buf = gfs_proc_margs;
-	gfs_proc_margs = new_buf;
-	spin_unlock(&gfs_proc_margs_lock);
-
-	if (old_buf)
-		kfree(old_buf);
-
-	return 0;
-}
-
-/**
- * do_withdraw - withdraw a from the cluster for one filesystem
- * @p: the cookie of the filesystem
- *
- * Returns: errno
- */
-
-static int
-do_withdraw(char *p)
-{
-	struct list_head *tmp;
-	struct gfs_sbd *sdp;
-	char num[21];
-	int error = 0;
-
-	p = find_argument(p + 8);
-	if (!p)
-		return -ENOENT;
-
-	down(&gfs_fs_lock);
-
-	for (tmp = gfs_fs_list.next; tmp != &gfs_fs_list; tmp = tmp->next) {
-		sdp = list_entry(tmp, struct gfs_sbd, sd_list);
-		sprintf(num, "%lu", (unsigned long)sdp);
-		if (strcmp(num, p) == 0)
-			break;
-	}
-
-	if (tmp == &gfs_fs_list)
-		error = -ENOENT;
-	else 
-		gfs_lm_withdraw(sdp,
-				"GFS: fsid=%s: withdrawing from cluster at user's request\n",
-				sdp->sd_fsname);
-
-	up(&gfs_fs_lock);
-
-	return error;
-}
-
-/**
- * do_lockdump - Copy out the lock hash table to userspace
- * @p: the cookie of the filesystem
- * @buf:
- * @size:
- *
- * Returns: errno
- */
-
-static int
-do_lockdump(char *p, char *buf, size_t size)
-{
-	struct list_head *tmp;
-	struct gfs_sbd *sdp;
-	char num[21];
-	struct gfs_user_buffer ub;
-	int error = 0;
-
-	p = find_argument(p + 8);
-	if (!p)
-		return -ENOENT;
-
-	down(&gfs_fs_lock);
-
-	for (tmp = gfs_fs_list.next; tmp != &gfs_fs_list; tmp = tmp->next) {
-		sdp = list_entry(tmp, struct gfs_sbd, sd_list);
-		sprintf(num, "%lu", (unsigned long)sdp);
-		if (strcmp(num, p) == 0)
-			break;
-	}
-
-	if (tmp == &gfs_fs_list)
-		error = -ENOENT;
-	else {
-		ub.ub_data = buf;
-		ub.ub_size = size;
-		ub.ub_count = 0;
-
-		error = gfs_dump_lockstate(sdp, &ub);
-		if (!error)
-			error = ub.ub_count;
-	}
-
-	up(&gfs_fs_lock);
-
-	return error;
-}
-
-/**
- * gfs_proc_write - take a command from userspace
- * @file:
- * @buf:
- * @size:
- * @offset:
- *
- * Returns: -errno or the number of bytes taken
- */
-
-static ssize_t
-gfs_proc_write(struct file *file, const char *buf, size_t size, loff_t *offset)
-{
-	char *p;
-
-	spin_lock(&gfs_req_lock);
-	p = file->private_data;
-	file->private_data = NULL;
-	spin_unlock(&gfs_req_lock);
-
-	if (p)
-		kfree(p);
-
-	if (!size)
-		return -EINVAL;
-
-	p = kmalloc(size + 1, GFP_KERNEL);
-	if (!p)
-		return -ENOMEM;
-	p[size] = 0;
-
-	if (copy_from_user(p, buf, size)) {
-		kfree(p);
-		return -EFAULT;
-	}
-
-	spin_lock(&gfs_req_lock);
-	file->private_data = p;
-	spin_unlock(&gfs_req_lock);
-
-	return size;
-}
-
-/**
- * gfs_proc_read - return the results of a command
- * @file:
- * @buf:
- * @size:
- * @offset:
- *
- * Returns: -errno or the number of bytes returned
- */
-
-static ssize_t
-gfs_proc_read(struct file *file, char *buf, size_t size, loff_t *offset)
-{
-	char *p;
-	int error;
-
-	spin_lock(&gfs_req_lock);
-	p = file->private_data;
-	file->private_data = NULL;
-	spin_unlock(&gfs_req_lock);
-
-	if (!p)
-		return -ENOENT;
-
-	if (!size) {
-		kfree(p);
-		return -EINVAL;
-	}
-
-	if (strncmp(p, "list", 4) == 0)
-		error = do_list(buf, size);
-	else if (strncmp(p, "freeze", 6) == 0)
-		error = do_freeze(p);
-	else if (strncmp(p, "unfreeze", 8) == 0)
-		error = do_unfreeze(p);
-	else if (strncmp(p, "margs", 5) == 0)
-		error = do_margs(p);
-	else if (strncmp(p, "withdraw", 8) == 0)
-		error = do_withdraw(p);
-	else if (strncmp(p, "lockdump", 8) == 0)
-		error = do_lockdump(p, buf, size);
-	else
-		error = -ENOSYS;
-
-	kfree(p);
-
-	return error;
-}
-
-/**
- * gfs_proc_close - free any mismatches writes
- * @inode:
- * @file:
- *
- * Returns: 0
- */
-
-static int
-gfs_proc_close(struct inode *inode, struct file *file)
-{
-	if (file->private_data)
-		kfree(file->private_data);
-	return 0;
-}
-
-static struct file_operations gfs_proc_fops =
-{
-	.owner = THIS_MODULE,
-	.write = gfs_proc_write,
-	.read = gfs_proc_read,
-	.release = gfs_proc_close,
-};
-
-/**
- * gfs_proc_init - initialize GFS' proc interface
- *
- */
-
-int
-gfs_proc_init(void)
-{
-	struct proc_dir_entry *pde;
-
-	INIT_LIST_HEAD(&gfs_fs_list);
-	init_MUTEX(&gfs_fs_lock);
-	gfs_proc_margs = NULL;
-	spin_lock_init(&gfs_proc_margs_lock);
-	spin_lock_init(&gfs_req_lock);
-
-	pde = create_proc_entry("fs/gfs", S_IFREG | 0600, NULL);
-	if (!pde)
-		return -ENOMEM;
-
-	pde->owner = THIS_MODULE;
-	pde->proc_fops = &gfs_proc_fops;
-
-	return 0;
-}
-
-/**
- * gfs_proc_uninit - uninitialize GFS' proc interface
- *
- */
-
-void
-gfs_proc_uninit(void)
-{
-	if (gfs_proc_margs)
-		kfree(gfs_proc_margs);
-	remove_proc_entry("fs/gfs", NULL);
-}
-
diff --git a/gfs-kernel/src/gfs/proc.h b/gfs-kernel/src/gfs/proc.h
deleted file mode 100644
index ea8c261..0000000
--- a/gfs-kernel/src/gfs/proc.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __PROC_DOT_H__
-#define __PROC_DOT_H__
-
-/* Allow args to be passed to GFS when using an initial ram disk */
-extern char *gfs_proc_margs;
-extern spinlock_t gfs_proc_margs_lock;
-
-void gfs_proc_fs_add(struct gfs_sbd *sdp);
-void gfs_proc_fs_del(struct gfs_sbd *sdp);
-
-int gfs_proc_init(void);
-void gfs_proc_uninit(void);
-
-#endif /* __PROC_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/quota.c b/gfs-kernel/src/gfs/quota.c
deleted file mode 100644
index 4e2bee6..0000000
--- a/gfs-kernel/src/gfs/quota.c
+++ /dev/null
@@ -1,1139 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <linux/tty.h>
-
-#include "gfs.h"
-#include "bmap.h"
-#include "file.h"
-#include "glock.h"
-#include "glops.h"
-#include "log.h"
-#include "quota.h"
-#include "rgrp.h"
-#include "super.h"
-#include "trans.h"
-
-/**
- * gfs_quota_get - Get a structure to represent a quota change
- * @sdp: the filesystem
- * @user: TRUE if this is a user quota
- * @id: the uid or gid
- * @create: if TRUE, create the structure, otherwise return NULL
- * @qdp: the returned quota structure
- *
- * Returns: errno
- */
-
-int
-gfs_quota_get(struct gfs_sbd *sdp, int user, uint32_t id, int create,
-	      struct gfs_quota_data **qdp)
-{
-	struct gfs_quota_data *qd = NULL, *new_qd = NULL;
-	struct list_head *tmp, *head;
-	int error;
-
-	*qdp = NULL;
-
-	for (;;) {
-		spin_lock(&sdp->sd_quota_lock);
-
-		for (head = &sdp->sd_quota_list, tmp = head->next;
-		     tmp != head;
-		     tmp = tmp->next) {
-			qd = list_entry(tmp, struct gfs_quota_data, qd_list);
-			if (qd->qd_id == id &&
-			    !test_bit(QDF_USER, &qd->qd_flags) == !user) {
-				qd->qd_count++;
-				break;
-			}
-		}
-
-		if (tmp == head)
-			qd = NULL;
-
-		if (!qd && new_qd) {
-			qd = new_qd;
-			list_add(&qd->qd_list, &sdp->sd_quota_list);
-			new_qd = NULL;
-		}
-
-		spin_unlock(&sdp->sd_quota_lock);
-
-		if (qd || !create) {
-			if (new_qd) {
-				gfs_lvb_unhold(new_qd->qd_gl);
-				kfree(new_qd);
-				atomic_dec(&sdp->sd_quota_count);
-			}
-			*qdp = qd;
-			return 0;
-		}
-
-		new_qd = kmalloc(sizeof(struct gfs_quota_data), GFP_KERNEL);
-		if (!new_qd)
-			return -ENOMEM;
-		memset(new_qd, 0, sizeof(struct gfs_quota_data));
-
-		new_qd->qd_count = 1;
-
-		new_qd->qd_id = id;
-		if (user)
-			set_bit(QDF_USER, &new_qd->qd_flags);
-
-		INIT_LIST_HEAD(&new_qd->qd_le_list);
-
-		error = gfs_glock_get(sdp, 2 * (uint64_t)id + ((user) ? 0 : 1),
-				      &gfs_quota_glops, CREATE,
-				      &new_qd->qd_gl);
-		if (error) {
-			kfree(new_qd);
-			return error;
-		}
-
-		error = gfs_lvb_hold(new_qd->qd_gl);
-
-		gfs_glock_put(new_qd->qd_gl);
-
-		if (error) {
-			kfree(new_qd);
-			return error;
-		}
-
-		atomic_inc(&sdp->sd_quota_count);
-	}
-}
-
-/**
- * gfs_quota_hold - increment the usage count on a struct gfs_quota_data
- * @sdp: the filesystem
- * @qd: the structure
- *
- */
-
-void
-gfs_quota_hold(struct gfs_sbd *sdp, struct gfs_quota_data *qd)
-{
-	spin_lock(&sdp->sd_quota_lock);
-	gfs_assert(sdp, qd->qd_count,);
-	qd->qd_count++;
-	spin_unlock(&sdp->sd_quota_lock);
-}
-
-/**
- * gfs_quota_put - decrement the usage count on a struct gfs_quota_data
- * @sdp: the filesystem
- * @qd: the structure
- *
- * Free the structure if its reference count hits zero.
- *
- */
-
-void
-gfs_quota_put(struct gfs_sbd *sdp, struct gfs_quota_data *qd)
-{
-	spin_lock(&sdp->sd_quota_lock);
-	gfs_assert(sdp, qd->qd_count,);
-	qd->qd_count--;
-	spin_unlock(&sdp->sd_quota_lock);
-}
-
-/**
- * quota_find - Find a quota change to sync to the quota file
- * @sdp: the filesystem
- *
- * The returned structure is locked and needs to be unlocked
- * with quota_unlock().
- *
- * Returns: A quota structure, or NULL
- */
-
-static struct gfs_quota_data *
-quota_find(struct gfs_sbd *sdp)
-{
-	struct list_head *tmp, *head;
-	struct gfs_quota_data *qd = NULL;
-
-	if (test_bit(SDF_ROFS, &sdp->sd_flags))
-		return NULL;
-
-	gfs_log_lock(sdp);
-	spin_lock(&sdp->sd_quota_lock);
-
-	if (!atomic_read(&sdp->sd_quota_od_count))
-		goto out;
-
-	for (head = &sdp->sd_quota_list, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		qd = list_entry(tmp, struct gfs_quota_data, qd_list);
-
-		if (test_bit(QDF_LOCK, &qd->qd_flags))
-			continue;
-		if (!test_bit(QDF_OD_LIST, &qd->qd_flags))
-			continue;
-		if (qd->qd_sync_gen >= sdp->sd_quota_sync_gen)
-			continue;
-
-		list_move_tail(&qd->qd_list, &sdp->sd_quota_list);
-
-		set_bit(QDF_LOCK, &qd->qd_flags);
-		qd->qd_count++;
-		qd->qd_change_sync = qd->qd_change_od;
-
-		goto out;
-	}
-
-	qd = NULL;
-
- out:
-	spin_unlock(&sdp->sd_quota_lock);
-	gfs_log_unlock(sdp);
-
-	return qd;
-}
-
-/**
- * quota_trylock - Try to lock a given quota entry
- * @sdp: the filesystem
- * @qd: the quota data structure
- *
- * Returns: TRUE if the lock was successful, FALSE, otherwise
- */
-
-static int
-quota_trylock(struct gfs_sbd *sdp, struct gfs_quota_data *qd)
-{
-	int ret = FALSE;
-
-	if (test_bit(SDF_ROFS, &sdp->sd_flags))
-		return FALSE;
-
-	gfs_log_lock(sdp);
-	spin_lock(&sdp->sd_quota_lock);
-
-	if (test_bit(QDF_LOCK, &qd->qd_flags))
-		goto out;
-	if (!test_bit(QDF_OD_LIST, &qd->qd_flags))
-		goto out;
-
-	list_move_tail(&qd->qd_list, &sdp->sd_quota_list);
-
-	set_bit(QDF_LOCK, &qd->qd_flags);
-	qd->qd_count++;
-	qd->qd_change_sync = qd->qd_change_od;
-
-	ret = TRUE;
-
- out:
-	spin_unlock(&sdp->sd_quota_lock);
-	gfs_log_unlock(sdp);
-
-	return ret;
-}
-
-/**
- * quota_unlock - drop and a reference on a quota structure
- * @sdp: the filesystem
- * @qd: the quota inode structure
- *
- */
-
-static void
-quota_unlock(struct gfs_sbd *sdp, struct gfs_quota_data *qd)
-{
-	spin_lock(&sdp->sd_quota_lock);
-
-	gfs_assert_warn(sdp, test_bit(QDF_LOCK, &qd->qd_flags));
-	clear_bit(QDF_LOCK, &qd->qd_flags);
-
-	gfs_assert(sdp, qd->qd_count,);
-	qd->qd_count--;
-
-	spin_unlock(&sdp->sd_quota_lock);
-}
-
-/**
- * gfs_quota_merge - add/remove a quota change from the in-memory list
- * @sdp: the filesystem
- * @tag: the quota change tag
- *
- * Returns: errno
- */
-
-int
-gfs_quota_merge(struct gfs_sbd *sdp, struct gfs_quota_tag *tag)
-{
-	struct gfs_quota_data *qd;
-	int error;
-
-	error = gfs_quota_get(sdp,
-			      tag->qt_flags & GFS_QTF_USER, tag->qt_id,
-			      CREATE, &qd);
-	if (error)
-		return error;
-
-	gfs_assert(sdp, qd->qd_change_ic == qd->qd_change_od,);
-
-	gfs_log_lock(sdp);
-
-	qd->qd_change_ic += tag->qt_change;
-	qd->qd_change_od += tag->qt_change;
-
-	if (qd->qd_change_od) {
-		if (!test_bit(QDF_OD_LIST, &qd->qd_flags)) {
-			gfs_quota_hold(sdp, qd);
-			set_bit(QDF_OD_LIST, &qd->qd_flags);
-			atomic_inc(&sdp->sd_quota_od_count);
-		}
-	} else {
-		gfs_assert_warn(sdp, test_bit(QDF_OD_LIST, &qd->qd_flags));
-		clear_bit(QDF_OD_LIST, &qd->qd_flags);
-		gfs_quota_put(sdp, qd);
-		gfs_assert(sdp, atomic_read(&sdp->sd_quota_od_count) > 0,);
-		atomic_dec(&sdp->sd_quota_od_count);
-	}
-
-	gfs_log_unlock(sdp);
-
-	gfs_quota_put(sdp, qd);
-
-	return 0;
-}
-
-/**
- * gfs_quota_scan - Look for unused struct gfs_quota_data structures to throw away
- * @sdp: the filesystem
- *
- */
-
-void
-gfs_quota_scan(struct gfs_sbd *sdp)
-{
-	struct list_head *head, *tmp, *next;
-	struct gfs_quota_data *qd;
-	LIST_HEAD(dead);
-
-	spin_lock(&sdp->sd_quota_lock);
-
-	for (head = &sdp->sd_quota_list, tmp = head->next, next = tmp->next;
-	     tmp != head;
-	     tmp = next, next = next->next) {
-		qd = list_entry(tmp, struct gfs_quota_data, qd_list);
-		if (!qd->qd_count)
-			list_move(&qd->qd_list, &dead);
-	}
-
-	spin_unlock(&sdp->sd_quota_lock);
-
-	while (!list_empty(&dead)) {
-		qd = list_entry(dead.next, struct gfs_quota_data, qd_list);
-
-		gfs_assert_warn(sdp, !qd->qd_count);
-		gfs_assert_warn(sdp, !test_bit(QDF_OD_LIST, &qd->qd_flags) &&
-				!test_bit(QDF_LOCK, &qd->qd_flags));
-		gfs_assert_warn(sdp, !qd->qd_change_new && !qd->qd_change_ic &&
-				!qd->qd_change_od);
-
-		list_del(&qd->qd_list);
-		gfs_lvb_unhold(qd->qd_gl);
-		kfree(qd);
-		atomic_dec(&sdp->sd_quota_count);
-	}
-}
-
-/**
- * gfs_quota_cleanup - get rid of any extra struct gfs_quota_data structures
- * @sdp: the filesystem
- *
- */
-
-void
-gfs_quota_cleanup(struct gfs_sbd *sdp)
-{
-	struct gfs_quota_data *qd;
-
- restart:
-	gfs_log_lock(sdp);
-
-	spin_lock(&sdp->sd_quota_lock);
-
-	while (!list_empty(&sdp->sd_quota_list)) {
-		qd = list_entry(sdp->sd_quota_list.next,
-				struct gfs_quota_data,
-				qd_list);
-
-		if (qd->qd_count > 1) {
-			spin_unlock(&sdp->sd_quota_lock);
-			gfs_log_unlock(sdp);
-			set_current_state(TASK_UNINTERRUPTIBLE);
-			schedule_timeout(HZ);
-			goto restart;
-
-		} else if (qd->qd_count) {
-			gfs_assert_warn(sdp,
-					test_bit(QDF_OD_LIST, &qd->qd_flags) &&
-					!test_bit(QDF_LOCK, &qd->qd_flags));
-			gfs_assert_warn(sdp, qd->qd_change_od &&
-					qd->qd_change_od == qd->qd_change_ic);
-			gfs_assert_warn(sdp, !qd->qd_change_new);
-
-			list_del(&qd->qd_list);
-			atomic_dec(&sdp->sd_quota_od_count);
-
-			spin_unlock(&sdp->sd_quota_lock);
-			gfs_lvb_unhold(qd->qd_gl);
-			kfree(qd);
-			atomic_dec(&sdp->sd_quota_count);
-			spin_lock(&sdp->sd_quota_lock);
-
-		} else {
-			gfs_assert_warn(sdp,
-					!test_bit(QDF_OD_LIST, &qd->qd_flags) &&
-					!test_bit(QDF_LOCK, &qd->qd_flags));
-			gfs_assert_warn(sdp, !qd->qd_change_new &&
-					!qd->qd_change_ic &&
-					!qd->qd_change_od);
-
-			list_del(&qd->qd_list);
-
-			spin_unlock(&sdp->sd_quota_lock);
-			gfs_lvb_unhold(qd->qd_gl);
-			kfree(qd);
-			atomic_dec(&sdp->sd_quota_count);
-			spin_lock(&sdp->sd_quota_lock);
-		}
-	}
-
-	spin_unlock(&sdp->sd_quota_lock);
-
-	gfs_assert(sdp, !atomic_read(&sdp->sd_quota_od_count),);
-
-	gfs_log_unlock(sdp);
-}
-
-/**
- * sort_qd - figure out the order between two quota data structures
- * @a: first quota data structure
- * @b: second quota data structure
- *
- * Returns: -1 if @a comes before @b, 0 if @a equals @b, 1 if @b comes before @a
- */
-
-static int
-sort_qd(const void *a, const void *b)
-{
-	struct gfs_quota_data *qd_a = *(struct gfs_quota_data **)a;
-	struct gfs_quota_data *qd_b = *(struct gfs_quota_data **)b;
-	int ret = 0;
-
-	if (!test_bit(QDF_USER, &qd_a->qd_flags) !=
-	    !test_bit(QDF_USER, &qd_b->qd_flags)) {
-		if (test_bit(QDF_USER, &qd_a->qd_flags))
-			ret = -1;
-		else
-			ret = 1;
-	} else {
-		if (qd_a->qd_id < qd_b->qd_id)
-			ret = -1;
-		else if (qd_a->qd_id > qd_b->qd_id)
-			ret = 1;
-	}
-
-	return ret;
-}
-
-/**
- * do_quota_sync - Sync a bunch quota changes to the quota file
- * @sdp: the filesystem
- * @qda: an array of struct gfs_quota_data structures to be synced
- * @num_qd: the number of elements in @qda
- *
- * Returns: errno
- */
-
-static int
-do_quota_sync(struct gfs_sbd *sdp, struct gfs_quota_data **qda,
-	      unsigned int num_qd)
-{
-	struct gfs_inode *ip = sdp->sd_qinode;
-	struct gfs_alloc *al = NULL;
-	struct gfs_holder i_gh, *ghs;
-	struct gfs_quota q;
-	char buf[sizeof(struct gfs_quota)];
-	uint64_t offset;
-	unsigned int qx, x;
-	int ar;
-	unsigned int nalloc = 0;
-	unsigned int data_blocks, ind_blocks;
-	int error;
-
-	gfs_write_calc_reserv(ip, sizeof(struct gfs_quota), &data_blocks,
-			      &ind_blocks);
-
-	ghs = kmalloc(num_qd * sizeof(struct gfs_holder), GFP_KERNEL);
-	if (!ghs)
-		return -ENOMEM;
-
-	gfs_sort(qda, num_qd, sizeof (struct gfs_quota_data *), sort_qd);
-	for (qx = 0; qx < num_qd; qx++) {
-		error = gfs_glock_nq_init(qda[qx]->qd_gl,
-					  LM_ST_EXCLUSIVE,
-					  GL_NOCACHE, &ghs[qx]);
-		if (error)
-			goto fail;
-	}
-
-	error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh);
-	if (error)
-		goto fail;
-
-	for (x = 0; x < num_qd; x++) {
-		offset = (2 * (uint64_t)qda[x]->qd_id +
-			  ((test_bit(QDF_USER, &qda[x]->qd_flags)) ? 0 : 1)) *
-			sizeof(struct gfs_quota);
-
-		error = gfs_write_alloc_required(ip, offset,
-						 sizeof(struct gfs_quota),
-						 &ar);
-		if (error)
-			goto fail_gunlock;
-
-		if (ar)
-			nalloc++;
-	}
-
-	if (nalloc) {
-		al = gfs_alloc_get(ip);
-
-		error =
-		    gfs_quota_hold_m(ip, NO_QUOTA_CHANGE,
-					   NO_QUOTA_CHANGE);
-		if (error)
-			goto fail_alloc;
-
-		al->al_requested_meta = nalloc * (data_blocks + ind_blocks);
-
-		error = gfs_inplace_reserve(ip);
-		if (error)
-			goto fail_qs;
-
-		/* Trans may require:
-		   two (journaled) data blocks, a dinode block, RG bitmaps to allocate from,
-		   indirect blocks, and a quota block */
-
-		error = gfs_trans_begin(sdp,
-					1 + al->al_rgd->rd_ri.ri_length +
-					num_qd * data_blocks +
-					nalloc * ind_blocks,
-					gfs_struct2blk(sdp, num_qd + 2,
-						       sizeof(struct gfs_quota_tag)));
-		if (error)
-			goto fail_ipres;
-	} else {
-		/* Trans may require:
-		   Data blocks, a dinode block, and quota blocks */
-
-		error = gfs_trans_begin(sdp,
-					1 + data_blocks * num_qd,
-					gfs_struct2blk(sdp, num_qd,
-						       sizeof(struct gfs_quota_tag)));
-		if (error)
-			goto fail_gunlock;
-	}
-
-	for (x = 0; x < num_qd; x++) {
-		offset = (2 * (uint64_t)qda[x]->qd_id +
-			  ((test_bit(QDF_USER, &qda[x]->qd_flags)) ? 0 : 1)) *
-			sizeof(struct gfs_quota);
-
-		/*  The quota file may not be a multiple of sizeof(struct gfs_quota) bytes.  */
-		memset(buf, 0, sizeof(struct gfs_quota));
-
-		error = gfs_internal_read(ip, buf, offset,
-					  sizeof(struct gfs_quota));
-		if (error < 0)
-			goto fail_end_trans;
-
-		gfs_quota_in(&q, buf);
-		q.qu_value += qda[x]->qd_change_sync;
-		gfs_quota_out(&q, buf);
-
-		error = gfs_internal_write(ip, buf, offset,
-					   sizeof(struct gfs_quota));
-		if (error < 0)
-			goto fail_end_trans;
-		else if (error != sizeof(struct gfs_quota)) {
-			error = -EIO;
-			goto fail_end_trans;
-		}
-
-		if (test_bit(QDF_USER, &qda[x]->qd_flags))
-			gfs_trans_add_quota(sdp, -qda[x]->qd_change_sync,
-					    qda[x]->qd_id, NO_QUOTA_CHANGE);
-		else
-			gfs_trans_add_quota(sdp, -qda[x]->qd_change_sync,
-					    NO_QUOTA_CHANGE, qda[x]->qd_id);
-
-		memset(&qda[x]->qd_qb, 0, sizeof(struct gfs_quota_lvb));
-		qda[x]->qd_qb.qb_magic = GFS_MAGIC;
-		qda[x]->qd_qb.qb_limit = q.qu_limit;
-		qda[x]->qd_qb.qb_warn = q.qu_warn;
-		qda[x]->qd_qb.qb_value = q.qu_value;
-
-		gfs_quota_lvb_out(&qda[x]->qd_qb, qda[x]->qd_gl->gl_lvb);
-	}
-
-	gfs_trans_end(sdp);
-
-	if (nalloc) {
-		gfs_assert_warn(sdp, al->al_alloced_meta);
-		gfs_inplace_release(ip);
-		gfs_quota_unhold_m(ip);
-		gfs_alloc_put(ip);
-	}
-
-	gfs_glock_dq_uninit(&i_gh);
-
-	for (x = 0; x < num_qd; x++)
-		gfs_glock_dq_uninit(&ghs[x]);
-
-	kfree(ghs);
-
-	gfs_log_flush_glock(ip->i_gl);
-
-	return 0;
-
- fail_end_trans:
-	gfs_trans_end(sdp);
-
- fail_ipres:
-	if (nalloc)
-		gfs_inplace_release(ip);
-
- fail_qs:
-	if (nalloc)
-		gfs_quota_unhold_m(ip);
-
- fail_alloc:
-	if (nalloc)
-		gfs_alloc_put(ip);
-
- fail_gunlock:
-	gfs_glock_dq_uninit(&i_gh);
-
- fail:
-	while (qx--)
-		gfs_glock_dq_uninit(&ghs[qx]);
-
-	kfree(ghs);
-
-	return error;
-}
-
-/**
- * glock_q - Acquire a lock for a quota entry
- * @sdp: the filesystem
- * @qd: the quota data structure to glock
- * @force_refresh: If TRUE, always read from the quota file
- * @q_gh: the glock holder for the quota lock
- *
- * Returns: errno
- */
-
-static int
-glock_q(struct gfs_sbd *sdp, struct gfs_quota_data *qd, int force_refresh,
-	struct gfs_holder *q_gh)
-{
-	struct gfs_holder i_gh;
-	struct gfs_quota q;
-	char buf[sizeof(struct gfs_quota)];
-	int error;
-
- restart:
-	error = gfs_glock_nq_init(qd->qd_gl, LM_ST_SHARED, 0, q_gh);
-	if (error)
-		return error;
-
-	gfs_quota_lvb_in(&qd->qd_qb, qd->qd_gl->gl_lvb);
-
-	if (force_refresh ||
-	    qd->qd_qb.qb_magic != GFS_MAGIC) {
-		gfs_glock_dq_uninit(q_gh);
-		error = gfs_glock_nq_init(qd->qd_gl,
-					  LM_ST_EXCLUSIVE, GL_NOCACHE,
-					  q_gh);
-		if (error)
-			return error;
-
-		error = gfs_glock_nq_init(sdp->sd_qinode->i_gl,
-					  LM_ST_SHARED, 0,
-					  &i_gh);
-		if (error)
-			goto fail;
-
-		memset(buf, 0, sizeof(struct gfs_quota));
-
-		error = gfs_internal_read(sdp->sd_qinode, buf,
-					  (2 * (uint64_t)qd->qd_id +
-					   ((test_bit(QDF_USER, &qd->qd_flags)) ? 0 : 1)) *
-					  sizeof(struct gfs_quota),
-					  sizeof(struct gfs_quota));
-		if (error < 0)
-			goto fail_gunlock;
-
-		gfs_glock_dq_uninit(&i_gh);
-
-		gfs_quota_in(&q, buf);
-
-		memset(&qd->qd_qb, 0, sizeof(struct gfs_quota_lvb));
-		qd->qd_qb.qb_magic = GFS_MAGIC;
-		qd->qd_qb.qb_limit = q.qu_limit;
-		qd->qd_qb.qb_warn = q.qu_warn;
-		qd->qd_qb.qb_value = q.qu_value;
-
-		gfs_quota_lvb_out(&qd->qd_qb, qd->qd_gl->gl_lvb);
-
-		gfs_glock_dq_uninit(q_gh);
-		force_refresh = FALSE;
-		goto restart;
-	}
-
-	return 0;
-
- fail_gunlock:
-	gfs_glock_dq_uninit(&i_gh);
-
- fail:
-	gfs_glock_dq_uninit(q_gh);
-
-	return error;
-}
-
-/**
- * gfs_quota_hold_m - Hold the quota structures for up to 4 IDs
- * @ip: Two of the IDs are the UID and GID from this file
- * @uid: a UID or the constant NO_QUOTA_CHANGE
- * @gid: a GID or the constant NO_QUOTA_CHANGE
- *
- * The struct gfs_quota_data structures representing the locks are
- * stored in the ip->i_alloc->al_qd array.
- * 
- * Returns:  errno
- */
-
-int
-gfs_quota_hold_m(struct gfs_inode *ip, uint32_t uid, uint32_t gid)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_alloc *al = ip->i_alloc;
-	unsigned int x = 0;
-	int error;
-
-	if (gfs_assert_warn(sdp, !al->al_qd_num &&
-			    !test_bit(GIF_QD_LOCKED, &ip->i_flags)))
-		return -EIO;
-
-	if (!gfs_tune_get(sdp, gt_quota_account))
-		return 0;
-
-	error = gfs_quota_get(sdp, TRUE, ip->i_di.di_uid,
-			      CREATE, &al->al_qd[x]);
-	if (error)
-		goto fail;
-	x++;
-
-	error = gfs_quota_get(sdp, FALSE, ip->i_di.di_gid,
-			      CREATE, &al->al_qd[x]);
-	if (error)
-		goto fail;
-	x++;
-
-	if (uid != NO_QUOTA_CHANGE) {
-		error = gfs_quota_get(sdp, TRUE, uid,
-				      CREATE, &al->al_qd[x]);
-		if (error)
-			goto fail;
-		x++;
-	}
-
-	if (gid != NO_QUOTA_CHANGE) {
-		error = gfs_quota_get(sdp, FALSE, gid,
-				      CREATE, &al->al_qd[x]);
-		if (error)
-			goto fail;
-		x++;
-	}
-
-	al->al_qd_num = x;
-
-	return 0;
-
- fail:
-	if (x) {
-		al->al_qd_num = x;
-		gfs_quota_unhold_m(ip);
-	}
-
-	return error;
-}
-
-/**
- * gfs_quota_unhold_m - throw away some quota locks
- * @ip: the inode who's ip->i_alloc->al_qd array holds the structures
- *
- */
-
-void
-gfs_quota_unhold_m(struct gfs_inode *ip)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_alloc *al = ip->i_alloc;
-	unsigned int x;
-
-	gfs_assert_warn(sdp, !test_bit(GIF_QD_LOCKED, &ip->i_flags));
-
-	for (x = 0; x < al->al_qd_num; x++) {
-		gfs_quota_put(sdp, al->al_qd[x]);
-		al->al_qd[x] = NULL;
-	}
-	al->al_qd_num = 0;
-}
-
-/**
- * gfs_quota_lock_m - Acquire the quota locks for up to 4 IDs
- * @ip: Two of the IDs are the UID and GID from this file
- * @uid: a UID or the constant NO_QUOTA_CHANGE
- * @gid: a GID or the constant NO_QUOTA_CHANGE
- *
- * The struct gfs_quota_data structures representing the locks are
- * stored in the ip->i_alloc->al_qd array.
- * 
- * Returns:  errno
- */
-
-int
-gfs_quota_lock_m(struct gfs_inode *ip, uint32_t uid, uint32_t gid)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_alloc *al = ip->i_alloc;
-	unsigned int x;
-	int error;
-
-	gfs_quota_hold_m(ip, uid, gid);
-
-	if (!gfs_tune_get(sdp, gt_quota_enforce))
-		return 0;
-	if (capable(CAP_SYS_RESOURCE))
-		return 0;
-
-	gfs_sort(al->al_qd, al->al_qd_num,
-		 sizeof(struct gfs_quota_data *), sort_qd);
-
-	for (x = 0; x < al->al_qd_num; x++) {
-		error = glock_q(sdp, al->al_qd[x], FALSE, &al->al_qd_ghs[x]);
-		if (error)
-			goto fail;
-	}
-
-	set_bit(GIF_QD_LOCKED, &ip->i_flags);
-
-	return 0;
-
-      fail:
-	while (x--)
-		gfs_glock_dq_uninit(&al->al_qd_ghs[x]);
-
-	return error;
-}
-
-/**
- * gfs_quota_unlock_m - drop some quota locks
- * @ip: the inode who's ip->i_alloc->al_qd array holds the locks
- *
- */
-
-void
-gfs_quota_unlock_m(struct gfs_inode *ip)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_alloc *al = ip->i_alloc;
-	struct gfs_quota_data *qd, *qda[4];
-	int64_t value;
-	unsigned int count = 0;
-	unsigned int x;
-	int do_sync;
-
-	if (!test_and_clear_bit(GIF_QD_LOCKED, &ip->i_flags))
-		goto out;
-
-	for (x = 0; x < al->al_qd_num; x++) {
-		qd = al->al_qd[x];
-
-		spin_lock(&sdp->sd_quota_lock);
-		value = qd->qd_change_new + qd->qd_change_ic;
-		spin_unlock(&sdp->sd_quota_lock);
-
-		do_sync = TRUE;
-		if (!qd->qd_qb.qb_limit)
-			do_sync = FALSE;
-		else if (qd->qd_qb.qb_value >= (int64_t)qd->qd_qb.qb_limit)
-			do_sync = FALSE;
-		else {
-			struct gfs_tune *gt = &sdp->sd_tune;
-			unsigned int num, den;
-			int64_t v;
-
-			spin_lock(&gt->gt_spin);
-			num = gt->gt_quota_scale_num;
-			den = gt->gt_quota_scale_den;
-			spin_unlock(&gt->gt_spin);
-
-			v = value * gfs_num_journals(sdp) * num;
-			do_div(v, den);
-			v += qd->qd_qb.qb_value;
-			if (v < (int64_t)qd->qd_qb.qb_limit)
-				do_sync = FALSE;
-		}
-
-		gfs_glock_dq_uninit(&al->al_qd_ghs[x]);
-
-		if (do_sync) {
-			gfs_log_flush(sdp);
-			if (quota_trylock(sdp, qd))
-				qda[count++] = qd;
-		}
-	}
-
-	if (count) {
-		do_quota_sync(sdp, qda, count);
-
-		for (x = 0; x < count; x++)
-			quota_unlock(sdp, qda[x]);
-	}
-
- out:
-	gfs_quota_unhold_m(ip);
-}
-
-/**
- * print_quota_message - print a message to the user's tty about quotas
- * @sdp: the filesystem
- * @qd: the quota ID that the message is about
- * @type: the type of message ("exceeded" or "warning")
- *
- * Returns: errno
- */
-
-static int
-print_quota_message(struct gfs_sbd *sdp, struct gfs_quota_data *qd, char *type)
-{
-	struct tty_struct *tty;
-	char *line;
-	int len;
-
-	line = kmalloc(256, GFP_KERNEL);
-	if (!line)
-		return -ENOMEM;
-
-	len = snprintf(line, 256, "GFS: fsid=%s: quota %s for %s %u\r\n",
-		       sdp->sd_fsname, type,
-		       (test_bit(QDF_USER, &qd->qd_flags)) ? "user" : "group",
-		       qd->qd_id);
-
-	if (current->signal) {
-		tty = current->signal->tty;
-		if (tty && tty->ops->write)
-			tty->ops->write(tty, line, len);
-	}
-
-	kfree(line);
-
-	return 0;
-}
-
-/**
- * gfs_quota_check - Check to see if a block allocation is possible
- * @ip: the inode who's ip->i_res.ir_qd array holds the quota locks
- * @uid: the UID the block is allocated for
- * @gid: the GID the block is allocated for
- *
- */
-
-int
-gfs_quota_check(struct gfs_inode *ip, uint32_t uid, uint32_t gid)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_alloc *al = ip->i_alloc;
-	struct gfs_quota_data *qd;
-	int64_t value;
-	unsigned int x;
-	int error = 0;
-
-	if (!al)
-		return 0;
-
-	if (!gfs_tune_get(sdp, gt_quota_enforce))
-		return 0;
-
-	for (x = 0; x < al->al_qd_num; x++) {
-		qd = al->al_qd[x];
-
-		if (!((qd->qd_id == uid && test_bit(QDF_USER, &qd->qd_flags)) ||
-		      (qd->qd_id == gid && !test_bit(QDF_USER, &qd->qd_flags))))
-			continue;
-
-		spin_lock(&sdp->sd_quota_lock);
-		value = qd->qd_change_new + qd->qd_change_ic;
-		spin_unlock(&sdp->sd_quota_lock);
-		value += qd->qd_qb.qb_value;
-
-		if (qd->qd_qb.qb_limit && (int64_t)qd->qd_qb.qb_limit < value) {
-			print_quota_message(sdp, qd, "exceeded");
-			error = -EDQUOT;
-			break;
-		} else if (qd->qd_qb.qb_warn &&
-			   (int64_t)qd->qd_qb.qb_warn < value &&
-			   time_after_eq(jiffies,
-					 qd->qd_last_warn +
-					 gfs_tune_get(sdp, gt_quota_warn_period) * HZ)) {
-			error = print_quota_message(sdp, qd, "warning");
-			qd->qd_last_warn = jiffies;
-		}
-	}
-
-	return error;
-}
-
-/**
- * gfs_quota_sync - Sync quota changes to the quota file
- * @sdp: the filesystem
- *
- * Returns: errno
- */
-
-int
-gfs_quota_sync(struct gfs_sbd *sdp)
-{
-	struct gfs_quota_data **qda;
-	unsigned int max_qd = gfs_tune_get(sdp, gt_quota_simul_sync);
-	unsigned int num_qd;
-	unsigned int x;
-	int error = 0;
-
-	sdp->sd_quota_sync_gen++;
-
-	qda = kmalloc(max_qd * sizeof(struct gfs_quota_data *), GFP_KERNEL);
-	if (!qda)
-		return -ENOMEM;
-	memset(qda, 0, max_qd * sizeof(struct gfs_quota_data *));
-
-	do {
-		num_qd = 0;
-
-		for (;;) {
-			qda[num_qd] = quota_find(sdp);
-			if (!qda[num_qd])
-				break;
-
-			if (++num_qd == max_qd)
-				break;
-		}
-
-		if (num_qd) {
-			error = do_quota_sync(sdp, qda, num_qd);
-			if (!error)
-				for (x = 0; x < num_qd; x++)
-					qda[x]->qd_sync_gen =
-						sdp->sd_quota_sync_gen;
-
-			for (x = 0; x < num_qd; x++)
-				quota_unlock(sdp, qda[x]);
-		}
-	}
-	while (!error && num_qd == max_qd);
-
-	kfree(qda);
-
-	return error;
-}
-
-/**
- * gfs_quota_refresh - Refresh the LVB for a given quota ID
- * @sdp: the filesystem
- * @user:
- * @id:
- *
- * Returns: errno
- */
-
-int
-gfs_quota_refresh(struct gfs_sbd *sdp, int user, uint32_t id)
-{
-	struct gfs_quota_data *qd;
-	struct gfs_holder q_gh;
-	int error;
-
-	error = gfs_quota_get(sdp, user, id, CREATE, &qd);
-	if (error)
-		return error;
-
-	error = glock_q(sdp, qd, TRUE, &q_gh);
-	if (!error)
-		gfs_glock_dq_uninit(&q_gh);
-
-	gfs_quota_put(sdp, qd);
-
-	return error;
-}
-
-/**
- * gfs_quota_read - Read the info a given quota ID
- * @sdp: the filesystem
- * @user:
- * @id:
- * @q:
- *
- * Returns: errno
- */
-
-int
-gfs_quota_read(struct gfs_sbd *sdp, int user, uint32_t id,
-	       struct gfs_quota *q)
-{
-	struct gfs_quota_data *qd;
-	struct gfs_holder q_gh;
-	int error;
-
-	if (((user) ? (id != current->fsuid) : (!in_group_p(id))) &&
-	    !capable(CAP_SYS_ADMIN))
-		return -EACCES;
-
-	error = gfs_quota_get(sdp, user, id, CREATE, &qd);
-	if (error)
-		return error;
-
-	error = glock_q(sdp, qd, FALSE, &q_gh);
-	if (error)
-		goto out;
-
-	memset(q, 0, sizeof(struct gfs_quota));
-	q->qu_limit = qd->qd_qb.qb_limit;
-	q->qu_warn = qd->qd_qb.qb_warn;
-	q->qu_value = qd->qd_qb.qb_value;
-
-	spin_lock(&sdp->sd_quota_lock);
-	q->qu_value += qd->qd_change_new + qd->qd_change_ic;
-	spin_unlock(&sdp->sd_quota_lock);
-
-	gfs_glock_dq_uninit(&q_gh);
-
- out:
-	gfs_quota_put(sdp, qd);
-
-	return error;
-}
diff --git a/gfs-kernel/src/gfs/quota.h b/gfs-kernel/src/gfs/quota.h
deleted file mode 100644
index 62620ec..0000000
--- a/gfs-kernel/src/gfs/quota.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef __QUOTA_DOT_H__
-#define __QUOTA_DOT_H__
-
-#define NO_QUOTA_CHANGE ((uint32_t)-1)
-
-int gfs_quota_get(struct gfs_sbd *sdp, int user, uint32_t id, int create,
-		     struct gfs_quota_data **qdp);
-void gfs_quota_hold(struct gfs_sbd *sdp, struct gfs_quota_data *qd);
-void gfs_quota_put(struct gfs_sbd *sdp, struct gfs_quota_data *qd);
-
-int gfs_quota_merge(struct gfs_sbd *sdp, struct gfs_quota_tag *tag);
-void gfs_quota_scan(struct gfs_sbd *sdp);
-void gfs_quota_cleanup(struct gfs_sbd *sdp);
-
-int gfs_quota_hold_m(struct gfs_inode *ip, uint32_t uid, uint32_t gid);
-void gfs_quota_unhold_m(struct gfs_inode *ip);
-
-int gfs_quota_lock_m(struct gfs_inode *ip, uint32_t uid, uint32_t gid);
-void gfs_quota_unlock_m(struct gfs_inode *ip);
-
-int gfs_quota_check(struct gfs_inode *ip, uint32_t uid, uint32_t gid);
-
-int gfs_quota_sync(struct gfs_sbd *sdp);
-int gfs_quota_refresh(struct gfs_sbd *sdp, int user, uint32_t id);
-int gfs_quota_read(struct gfs_sbd *sdp, int user, uint32_t id,
-		   struct gfs_quota *q);
-
-#endif /* __QUOTA_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/recovery.c b/gfs-kernel/src/gfs/recovery.c
deleted file mode 100644
index ba5f34d..0000000
--- a/gfs-kernel/src/gfs/recovery.c
+++ /dev/null
@@ -1,780 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-
-#include "gfs.h"
-#include "dio.h"
-#include "glock.h"
-#include "glops.h"
-#include "lm.h"
-#include "lops.h"
-#include "recovery.h"
-
-#define bn2seg(bn) (((uint32_t)((bn) - jdesc->ji_addr)) / sdp->sd_sb.sb_seg_size)
-#define seg2bn(seg) ((seg) * sdp->sd_sb.sb_seg_size + jdesc->ji_addr)
-
-struct dirty_j {
-	struct list_head dj_list;
-	unsigned int dj_jid;
-	struct gfs_jindex dj_desc;
-};
-
-/**
- * gfs_add_dirty_j - add a jid to the list of dirty journals
- * @sdp: the filesystem
- * @jid: the journal ID number
- *
- */
-
-void
-gfs_add_dirty_j(struct gfs_sbd *sdp, unsigned int jid)
-{
-	struct dirty_j *dj;
-
-	dj = gmalloc(sizeof(struct dirty_j));
-	memset(dj, 0, sizeof(struct dirty_j));
-
-	dj->dj_jid = jid;
-
-	spin_lock(&sdp->sd_dirty_j_lock);
-	list_add(&dj->dj_list, &sdp->sd_dirty_j);
-	spin_unlock(&sdp->sd_dirty_j_lock);
-}
-
-/**
- * get_dirty_j - return a dirty journal from the list
- * @sdp: the filesystem
- *
- * Returns: a struct dirty_j or NULL
- */
-
-static struct dirty_j *
-get_dirty_j(struct gfs_sbd *sdp)
-{
-	struct dirty_j *dj = NULL;
-
-	spin_lock(&sdp->sd_dirty_j_lock);
-	if (!list_empty(&sdp->sd_dirty_j)) {
-		dj = list_entry(sdp->sd_dirty_j.prev, struct dirty_j, dj_list);
-		list_del(&dj->dj_list);
-	}
-	spin_unlock(&sdp->sd_dirty_j_lock);
-
-	return dj;
-}
-
-/**
- * gfs_clear_dirty_j - destroy the list of dirty journals
- * @sdp: the filesystem
- *
- */
-
-void
-gfs_clear_dirty_j(struct gfs_sbd *sdp)
-{
-	struct dirty_j *dj;
-	for (;;) {
-		dj = get_dirty_j(sdp);
-		if (!dj)
-			break;
-		kfree(dj);
-	}
-}
-
-/**
- * gfs_log_header - read the log header for a given segment
- * @sdp: the filesystem
- * @jdesc: the journal
- * @gl: the journal's glock
- * @seg: the segment 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 and, errno on error
- */
-
-static int
-get_log_header(struct gfs_sbd *sdp, struct gfs_jindex *jdesc,
-	       struct gfs_glock *gl, uint32_t seg, struct gfs_log_header *lh)
-{
-	struct buffer_head *bh;
-	struct gfs_log_header lh2;
-	int error;
-
-	error = gfs_dread(gl, seg2bn(seg), DIO_START | DIO_WAIT, &bh);
-	if (error)
-		return error;
-
-	gfs_log_header_in(lh, bh->b_data);
-	gfs_log_header_in(&lh2,
-			  bh->b_data + GFS_BASIC_BLOCK -
-			  sizeof(struct gfs_log_header));
-
-	brelse(bh);
-
-	if (memcmp(lh, &lh2, sizeof(struct gfs_log_header)) != 0 ||
-	    lh->lh_header.mh_magic != GFS_MAGIC ||
-	    lh->lh_header.mh_type != GFS_METATYPE_LH)
-		error = 1;
-
-	return error;
-}
-
-/**
- * find_good_lh - find a good log header
- * @sdp: the filesystem
- * @jdesc: the journal
- * @gl: the journal's glock
- * @seg: the segment to start searching from (it's also filled in with a new value.) 
- * @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
- */
-
-static int
-find_good_lh(struct gfs_sbd *sdp, struct gfs_jindex *jdesc,
-	     struct gfs_glock *gl, uint32_t *seg, struct gfs_log_header *lh,
-	     int forward)
-{
-	int error;
-	uint32_t orig_seg = *seg;
-
-	for (;;) {
-		error = get_log_header(sdp, jdesc, gl, *seg, lh);
-		if (error <= 0)
-			return error;
-
-		if (forward) {
-			if (++*seg == jdesc->ji_nsegment)
-				*seg = 0;
-		} else {
-			if ((*seg)-- == 0)
-				*seg = jdesc->ji_nsegment - 1;
-		}
-
-		if (*seg == orig_seg) {
-			gfs_consist(sdp);
-			return -EIO;
-		}
-	}
-}
-
-/**
- * verify_jhead - make sure we've found the head of the log
- * @sdp: the filesystem
- * @jdesc: the journal
- * @gl: the journal's glock
- * @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
- */
-
-static int
-verify_jhead(struct gfs_sbd *sdp, struct gfs_jindex *jdesc,
-	     struct gfs_glock *gl, struct gfs_log_header *head)
-{
-	struct gfs_log_header lh;
-	uint32_t seg;
-	int error;
-
-	seg = bn2seg(head->lh_first);
-
-	for (;;) {
-		if (++seg == jdesc->ji_nsegment)
-			seg = 0;
-
-		error = get_log_header(sdp, jdesc, gl, seg, &lh);
-		if (error < 0)
-			return error;
-
-		if (error == 1)
-			continue;
-		if (lh.lh_sequence == head->lh_sequence)
-			continue;
-
-		if (lh.lh_sequence < head->lh_sequence)
-			break;
-
-		memcpy(head, &lh, sizeof(struct gfs_log_header));
-	}
-
-	return 0;
-}
-
-/**
- * gfs_find_jhead - find the head of a log
- * @sdp: the filesystem
- * @jdesc: the journal
- * @gl: the journal's glock
- * @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
-gfs_find_jhead(struct gfs_sbd *sdp, struct gfs_jindex *jdesc,
-	       struct gfs_glock *gl, struct gfs_log_header *head)
-{
-	struct gfs_log_header lh;
-	uint32_t seg1, seg2, seg_m;
-	int error;
-	uint64_t lh1_sequence;
-
-	seg1 = 0;
-	seg2 = jdesc->ji_nsegment - 1;
-
-	for (;;) {
-		seg_m = (seg1 + seg2) / 2;
-
-		error = find_good_lh(sdp, jdesc, gl, &seg1, &lh, TRUE);
-		if (error)
-			break;
-
-		if (seg1 == seg_m) {
-			error = verify_jhead(sdp, jdesc, gl, &lh);
-			if (unlikely(error)) 
-				printk("GFS: verify_jhead error=%d\n", error);
-			else
-				memcpy(head, &lh, sizeof(struct gfs_log_header));
-			break;
-		}
-
-		lh1_sequence = lh.lh_sequence;
-
-		error = find_good_lh(sdp, jdesc, gl, &seg_m, &lh, FALSE);
-		if (error)
-			break;
-
-		if (lh1_sequence <= lh.lh_sequence)
-			seg1 = seg_m;
-		else
-			seg2 = seg_m;
-	}
-
-	return error;
-}
-
-/**
- * gfs_increment_blkno - move to the next block in a journal
- * @sdp: the filesystem
- * @jdesc: the journal
- * @gl: the journal's glock
- * @addr: the block number to increment
- * @skip_header: if this is TRUE, skip log headers
- *
- * Replace @addr with the location of the next block in the log.
- * Take care of journal wrap and skip of log header if necessary.
- *
- * Returns: errno
- */
-
-int
-gfs_increment_blkno(struct gfs_sbd *sdp, struct gfs_jindex *jdesc,
-		    struct gfs_glock *gl, uint64_t *addr, int skip_headers)
-{
-	struct gfs_log_header header;
-	int error;
-
-	(*addr)++;
-
-	/* Handle journal wrap */
-
-	if (*addr == seg2bn(jdesc->ji_nsegment))
-		*addr -= jdesc->ji_nsegment * sdp->sd_sb.sb_seg_size;
-
-	gfs_start_ra(gl, *addr,
-		     jdesc->ji_addr +
-		     jdesc->ji_nsegment * sdp->sd_sb.sb_seg_size - *addr);
-
-	/* Handle landing on a header block */
-
-	if (skip_headers && !do_mod(*addr, sdp->sd_sb.sb_seg_size)) {
-		error = get_log_header(sdp, jdesc, gl, bn2seg(*addr), &header);
-		if (error < 0)
-			return error;
-
-		if (error) { /* Corrupt headers here are bad */
-			if (gfs_consist(sdp))
-				printk("GFS: fsid=%s: *addr = %"PRIu64"\n",
-				       sdp->sd_fsname, *addr);
-			return -EIO;
-		}
-		if (header.lh_first == *addr) {
-			if (gfs_consist(sdp))
-				printk("GFS: fsid=%s: *addr = %"PRIu64"\n",
-				       sdp->sd_fsname, *addr);
-			gfs_log_header_print(&header);
-			return -EIO;
-		}
-
-		(*addr)++;
-		/* Can't wrap here */
-	}
-
-	return 0;
-}
-
-/**
- * foreach_descriptor - go through the active part of the log
- * @sdp: the filesystem
- * @jdesc: the journal
- * @gl: the journal's glock
- * @start: the first log header in the active region
- * @end: the last log header (don't process the contents of this entry))
- * @pass: the recovery pass
- *
- * Call a given function once for every log descriptor in the active
- * portion of the log.
- *
- * Returns: errno
- */
-
-static int
-foreach_descriptor(struct gfs_sbd *sdp, struct gfs_jindex *jdesc,
-		   struct gfs_glock *gl, uint64_t start, uint64_t end,
-		   unsigned int pass)
-{
-	struct gfs_log_header header;
-	struct gfs_log_descriptor desc;
-	struct buffer_head *bh;
-	int error = 0;
-
-	while (start != end) {
-		if (do_mod(start, sdp->sd_sb.sb_seg_size)) {
-			gfs_consist(sdp);
-			return -EIO;
-		}
-
-		error = get_log_header(sdp, jdesc, gl, bn2seg(start), &header);
-		if (error < 0)
-			return error;
-
-		if (error) { /* Corrupt headers here are bad */
-			if (gfs_consist(sdp))
-				printk("GFS: fsid=%s: start = %"PRIu64"\n",
-				       sdp->sd_fsname, start);
-			return -EIO;
-		}
-		if (header.lh_first != start) {
-			if (gfs_consist(sdp))
-				printk("GFS: fsid=%s: start = %"PRIu64"\n",
-				       sdp->sd_fsname, start);
-			gfs_log_header_print(&header);
-			return -EIO;
-		}
-
-		start++;
-
-		for (;;) {
-			error = gfs_dread(gl, start, DIO_START | DIO_WAIT, &bh);
-			if (error)
-				return error;
-
-			if (gfs_metatype_check(sdp, bh, GFS_METATYPE_LD)) {
-				brelse(bh);
-				return -EIO;
-			}
-
-			gfs_desc_in(&desc, bh->b_data);
-			brelse(bh);
-
-			if (desc.ld_type != GFS_LOG_DESC_LAST) {
-				error = LO_SCAN_ELEMENTS(sdp, jdesc, gl, start,
-							 &desc, pass);
-				if (error)
-					return error;
-
-				while (desc.ld_length--) {
-					error = gfs_increment_blkno(sdp, jdesc, gl,
-								    &start, TRUE);
-					if (error)
-						return error;
-				}
-			} else {
-				while (desc.ld_length--) {
-					error = gfs_increment_blkno(sdp, jdesc, gl,
-								    &start,
-								    !!desc.ld_length);
-					if (error)
-						return error;
-				}
-
-				break;
-			}
-		}
-	}
-
-	return error;
-}
-
-/**
- * clean_journal - mark a dirty journal as being clean
- * @sdp: the filesystem
- * @jdesc: the journal
- * @gl: the journal's glock
- * @head: the head journal to start from
- *
- * Returns: errno
- */
-
-static int noinline
-clean_journal(struct gfs_sbd *sdp, struct gfs_jindex *jdesc,
-	      struct gfs_glock *gl, struct gfs_log_header *head)
-{
-	struct gfs_log_header lh;
-	struct gfs_log_descriptor desc;
-	struct buffer_head *bh;
-	uint32_t seg;
-	uint64_t blkno;
-	int error;
-
-	seg = bn2seg(head->lh_first);
-
-	for (;;) {
-		if (++seg == jdesc->ji_nsegment)
-			seg = 0;
-
-		error = get_log_header(sdp, jdesc, gl, seg, &lh);
-		if (error < 0)
-			return error;
-
-		/* Rewrite corrupt header blocks */
-
-		if (error == 1) {
-			bh = gfs_dgetblk(gl, seg2bn(seg));
-
-			gfs_prep_new_buffer(bh);
-			gfs_buffer_clear(bh);
-			gfs_log_header_out(head, bh->b_data);
-			gfs_log_header_out(head,
-					   bh->b_data + GFS_BASIC_BLOCK -
-					   sizeof(struct gfs_log_header));
-
-			error = gfs_dwrite(sdp, bh, DIO_DIRTY | DIO_START | DIO_WAIT);
-			brelse(bh);
-			if (error)
-				return error;
-		}
-
-		/* Stop when we get to the end of the log. */
-
-		if (lh.lh_sequence < head->lh_sequence)
-			break;
-	}
-
-	/*  Build a "last" descriptor for the transaction we are
-	   about to commit by writing the shutdown header.  */
-
-	memset(&desc, 0, sizeof(struct gfs_log_descriptor));
-	desc.ld_header.mh_magic = GFS_MAGIC;
-	desc.ld_header.mh_type = GFS_METATYPE_LD;
-	desc.ld_header.mh_format = GFS_FORMAT_LD;
-	desc.ld_type = GFS_LOG_DESC_LAST;
-	desc.ld_length = 0;
-
-	for (blkno = head->lh_first + 1; blkno != seg2bn(seg);) {
-		if (do_mod(blkno, sdp->sd_sb.sb_seg_size))
-			desc.ld_length++;
-		if (++blkno == seg2bn(jdesc->ji_nsegment))
-			blkno -= jdesc->ji_nsegment * sdp->sd_sb.sb_seg_size;
-	}
-
-	/*  Write the descriptor  */
-
-	bh = gfs_dgetblk(gl, head->lh_first + 1);
-
-	gfs_prep_new_buffer(bh);
-	gfs_buffer_clear(bh);
-	gfs_desc_out(&desc, bh->b_data);
-
-	error = gfs_dwrite(sdp, bh, DIO_DIRTY | DIO_START | DIO_WAIT);
-	brelse(bh);
-	if (error)
-		return error;
-
-	/*  Build a log header that says the journal is clean  */
-
-	memset(&lh, 0, sizeof(struct gfs_log_header));
-	lh.lh_header.mh_magic = GFS_MAGIC;
-	lh.lh_header.mh_type = GFS_METATYPE_LH;
-	lh.lh_header.mh_format = GFS_FORMAT_LH;
-	lh.lh_flags = GFS_LOG_HEAD_UNMOUNT;
-	lh.lh_first = seg2bn(seg);
-	lh.lh_sequence = head->lh_sequence + 1;
-	/*  Don't care about tail  */
-	lh.lh_last_dump = head->lh_last_dump;
-
-	/*  Write the header  */
-
-	bh = gfs_dgetblk(gl, lh.lh_first);
-
-	gfs_prep_new_buffer(bh);
-	gfs_buffer_clear(bh);
-	gfs_log_header_out(&lh, bh->b_data);
-	gfs_log_header_out(&lh,
-			   bh->b_data + GFS_BASIC_BLOCK -
-			   sizeof(struct gfs_log_header));
-
-	error = gfs_dwrite(sdp, bh, DIO_DIRTY | DIO_START | DIO_WAIT);
-	brelse(bh);
-
-	return error;
-}
-
-/**
- * gfs_recover_journal - recover a given journal
- * @sdp: the filesystem
- * @jid: the number of the journal to recover
- * @jdesc: the struct gfs_jindex describing the journal
- * @wait: Don't return until the journal is clean (or an error is encountered)
- *
- * Acquire the journal's lock, check to see if the journal is clean, and
- * do recovery if necessary.
- *
- * Returns: errno
- */
-
-int
-gfs_recover_journal(struct gfs_sbd *sdp,
-		    unsigned int jid, struct gfs_jindex *jdesc,
-		    int wait)
-{
-	struct gfs_log_header *head;
-	struct gfs_holder j_gh, t_gh;
-	unsigned long t;
-	int error;
-
-	printk("GFS: fsid=%s: jid=%u: Trying to acquire journal lock...\n",
-	       sdp->sd_fsname, jid);
-
-	/*  Acquire the journal lock so we can do recovery  */
-
-	error = gfs_glock_nq_num(sdp,
-				 jdesc->ji_addr, &gfs_meta_glops,
-				 LM_ST_EXCLUSIVE,
-				 LM_FLAG_NOEXP |
-				 ((wait) ? 0 : LM_FLAG_TRY) |
-				 GL_NOCACHE, &j_gh);
-	switch (error) {
-	case 0:
-		break;
-
-	case GLR_TRYFAILED:
-		printk("GFS: fsid=%s: jid=%u: Busy\n", sdp->sd_fsname, jid);
-		error = 0;
-
-	default:
-		goto fail;
-	};
-
-	printk("GFS: fsid=%s: jid=%u: Looking at journal...\n",
-	       sdp->sd_fsname, jid);
-
-	head = kmalloc(sizeof(struct gfs_log_header), GFP_KERNEL);
-	if (!head) {
-		printk("GFS: fsid=%s jid=%u: Can't replay: Not enough memory",
-		       sdp->sd_fsname, jid);
-		goto fail_gunlock;
-	}
-
-	error = gfs_find_jhead(sdp, jdesc, j_gh.gh_gl, head);
-	if (error)
-		goto fail_header;
-
-	if (!(head->lh_flags & GFS_LOG_HEAD_UNMOUNT)) {
-		if (test_bit(SDF_ROFS, &sdp->sd_flags)) {
-			printk("GFS: fsid=%s: jid=%u: Can't replay: read-only FS\n",
-			       sdp->sd_fsname, jid);
-			error = -EROFS;
-			goto fail_header;
-		}
-
-		printk("GFS: fsid=%s: jid=%u: Acquiring the transaction lock...\n",
-		       sdp->sd_fsname, jid);
-
-		t = jiffies;
-
-		/*  Acquire an exclusive hold on the transaction lock  */
-
-		error = gfs_glock_nq_init(sdp->sd_trans_gl,
-					  LM_ST_EXCLUSIVE,
-					  LM_FLAG_NOEXP |
-					  LM_FLAG_PRIORITY |
-					  GL_NOCANCEL |
-					  GL_NOCACHE,
-					  &t_gh);
-		if (error)
-			goto fail_header;
-
-		if (test_bit(SDF_ROFS, &sdp->sd_flags)) {
-			printk("GFS: fsid=%s: jid=%u: Can't replay: read-only FS\n",
-			       sdp->sd_fsname, jid);
-			error = -EROFS;
-			goto fail_gunlock_tr;
-		}
-
-		printk("GFS: fsid=%s: jid=%u: Replaying journal...\n",
-		       sdp->sd_fsname, jid);
-
-		set_bit(GLF_DIRTY, &j_gh.gh_gl->gl_flags);
-
-		LO_BEFORE_SCAN(sdp, jid, head, GFS_RECPASS_A1);
-
-		error = foreach_descriptor(sdp, jdesc, j_gh.gh_gl,
-					   head->lh_tail, head->lh_first,
-					   GFS_RECPASS_A1);
-		if (error)
-			goto fail_gunlock_tr;
-
-		LO_AFTER_SCAN(sdp, jid, GFS_RECPASS_A1);
-
-		gfs_replay_wait(sdp);
-
-		error = clean_journal(sdp, jdesc, j_gh.gh_gl, head);
-		if (error)
-			goto fail_gunlock_tr;
-
-		gfs_glock_dq_uninit(&t_gh);
-
-		t = DIV_RU(jiffies - t, HZ);
-		
-		printk("GFS: fsid=%s: jid=%u: Journal replayed in %lus\n",
-		       sdp->sd_fsname, jid, t);
-	}
-
-	gfs_lm_recovery_done(sdp, jid, LM_RD_SUCCESS);
-
-	kfree(head);
-
-	gfs_glock_dq_uninit(&j_gh);
-
-	printk("GFS: fsid=%s: jid=%u: Done\n", sdp->sd_fsname, jid);
-
-	return 0;
-
- fail_gunlock_tr:
-	gfs_replay_wait(sdp);
-	gfs_glock_dq_uninit(&t_gh);
-
- fail_header:
-	kfree(head);
-
- fail_gunlock:
-	gfs_glock_dq_uninit(&j_gh);
-
-	printk("GFS: fsid=%s: jid=%u: %s\n",
-	       sdp->sd_fsname, jid, (error) ? "Failed" : "Done");
-
- fail:
-	gfs_lm_recovery_done(sdp, jid, LM_RD_GAVEUP);
-
-	return error;
-}
-
-/**
- * gfs_check_journals - Recover any dirty journals
- * @sdp: the filesystem
- *
- */
-
-void
-gfs_check_journals(struct gfs_sbd *sdp)
-{
-	struct dirty_j *dj;
-
-	for (;;) {
-		dj = get_dirty_j(sdp);
-		if (!dj)
-			break;
-
-		down(&sdp->sd_jindex_lock);
-
-		if (dj->dj_jid != sdp->sd_lockstruct.ls_jid &&
-		    dj->dj_jid < sdp->sd_journals) {
-			memcpy(&dj->dj_desc,
-			       sdp->sd_jindex + dj->dj_jid,
-			       sizeof(struct gfs_jindex));
-			up(&sdp->sd_jindex_lock);
-
-			gfs_recover_journal(sdp,
-					    dj->dj_jid, &dj->dj_desc,
-					    FALSE);
-			
-		} else {
-			up(&sdp->sd_jindex_lock);
-			gfs_lm_recovery_done(sdp, dj->dj_jid, LM_RD_GAVEUP);
-		}
-
-		kfree(dj);
-	}
-}
-
-/**
- * gfs_recover_dump - recover the log elements in this machine's journal
- * @sdp: the filesystem
- *
- * Returns: errno
- */
-
-int
-gfs_recover_dump(struct gfs_sbd *sdp)
-{
-	struct gfs_log_header head;
-	int error;
-
-	error = gfs_find_jhead(sdp, &sdp->sd_jdesc, sdp->sd_journal_gh.gh_gl,
-			       &head);
-	if (error)
-		goto fail;
-
-	if (!(head.lh_flags & GFS_LOG_HEAD_UNMOUNT)) {
-		gfs_consist(sdp);
-		return -EIO;
-	}
-	if (!head.lh_last_dump)
-		return error;
-
-	printk("GFS: fsid=%s: Scanning for log elements...\n",
-	       sdp->sd_fsname);
-
-	LO_BEFORE_SCAN(sdp, sdp->sd_lockstruct.ls_jid, &head, GFS_RECPASS_B1);
-
-	error = foreach_descriptor(sdp, &sdp->sd_jdesc, sdp->sd_journal_gh.gh_gl,
-				   head.lh_last_dump, head.lh_first,
-				   GFS_RECPASS_B1);
-	if (error)
-		goto fail;
-
-	LO_AFTER_SCAN(sdp, sdp->sd_lockstruct.ls_jid, GFS_RECPASS_B1);
-
-	/* We need to make sure if we crash during the next log dump that
-	   all intermediate headers in the transaction point to the last
-	   log dump before the one we're making so we don't lose it. */
-
-	sdp->sd_log_dump_last = head.lh_last_dump;
-
-	printk("GFS: fsid=%s: Done\n", sdp->sd_fsname);
-
-	return 0;
-
- fail:
-	printk("GFS: fsid=%s: Failed\n", sdp->sd_fsname);
-
-	return error;
-}
diff --git a/gfs-kernel/src/gfs/recovery.h b/gfs-kernel/src/gfs/recovery.h
deleted file mode 100644
index 369cb38..0000000
--- a/gfs-kernel/src/gfs/recovery.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __RECOVERY_DOT_H__
-#define __RECOVERY_DOT_H__
-
-#define GFS_RECPASS_A1  (12)
-#define GFS_RECPASS_B1  (14)
-
-void gfs_add_dirty_j(struct gfs_sbd *sdp, unsigned int jid);
-void gfs_clear_dirty_j(struct gfs_sbd *sdp);
-
-int gfs_find_jhead(struct gfs_sbd *sdp, struct gfs_jindex *jdesc,
-		   struct gfs_glock *gl, struct gfs_log_header *head);
-int gfs_increment_blkno(struct gfs_sbd *sdp, struct gfs_jindex *jdesc,
-			struct gfs_glock *gl, uint64_t *addr,
-			int skip_headers);
-
-int gfs_recover_journal(struct gfs_sbd *sdp,
-			unsigned int jid, struct gfs_jindex *jdesc,
-			int wait);
-void gfs_check_journals(struct gfs_sbd *sdp);
-
-int gfs_recover_dump(struct gfs_sbd *sdp);
-
-#endif /* __RECOVERY_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/rgrp.c b/gfs-kernel/src/gfs/rgrp.c
deleted file mode 100644
index e0c670f..0000000
--- a/gfs-kernel/src/gfs/rgrp.c
+++ /dev/null
@@ -1,2152 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-
-#include "gfs.h"
-#include "bits.h"
-#include "dio.h"
-#include "file.h"
-#include "glock.h"
-#include "glops.h"
-#include "rgrp.h"
-#include "super.h"
-#include "trans.h"
-
-/**
- * mhc_hash: find the mhc hash bucket for a buffer
- * @bh: the buffer
- *
- * Returns: The bucket number
- */
-
-static unsigned int
-mhc_hash(struct buffer_head *bh)
-{
-	uint64_t blkno;
-	unsigned int h;
-
-	blkno = bh->b_blocknr;
-	h = gfs_hash(&blkno, sizeof(uint64_t)) & GFS_MHC_HASH_MASK;
-
-	return h;
-}
-
-/**
- * mhc_trim - Throw away cached meta-headers, if there are too many of them
- * @sdp:  The filesystem instance
- * @max:  Max # of cached meta-headers allowed to survive
- *
- * Walk filesystem's list of cached meta-headers, in least-recently-used order,
- *   and keep throwing them away until we're under the max threshold. 
- */
-
-static void
-mhc_trim(struct gfs_sbd *sdp, unsigned int max)
-{
-	struct gfs_meta_header_cache *mc;
-
-	for (;;) {
-		spin_lock(&sdp->sd_mhc_lock);
-		if (list_empty(&sdp->sd_mhc_single)) {
-			spin_unlock(&sdp->sd_mhc_lock);
-			return;
-		} else {
-			mc = list_entry(sdp->sd_mhc_single.prev,
-					struct gfs_meta_header_cache,
-					mc_list_single);
-			list_del(&mc->mc_list_hash);
-			list_del(&mc->mc_list_single);
-			list_del(&mc->mc_list_rgd);
-			spin_unlock(&sdp->sd_mhc_lock);
-
-			kmem_cache_free(gfs_mhc_cachep, mc);
-			atomic_dec(&sdp->sd_mhc_count);
-
-			if (atomic_read(&sdp->sd_mhc_count) <= max)
-				return;
-		}
-	}
-}
-
-/**
- * gfs_mhc_add - add buffer(s) to the cache of metadata headers
- * @rgd: Resource Group in which the buffered block(s) reside
- * @bh: an array of buffer_head pointers
- * @num: the number of bh pointers in the array
- *
- * Increment each meta-header's generation # by 2.
- * Alloc and add each gfs_meta-header_cache to 3 lists/caches:
- *   Filesystem's meta-header cache (hash)
- *   Filesystem's list of cached meta-headers
- *   Resource Group's list of cached meta-headers
- * If we now have too many cached, throw some older ones away
- */
-
-void
-gfs_mhc_add(struct gfs_rgrpd *rgd,
-	    struct buffer_head **bh, unsigned int num)
-{
-	struct gfs_sbd *sdp = rgd->rd_sbd;
-	unsigned int x;
-
-	for (x = 0; x < num; x++) {
-		struct gfs_meta_header_cache *mc;
-		struct list_head *head;
-		uint64_t gen;
-
-		if (gfs_meta_check(sdp, bh[x]))
-			return;
-
-		mc = kmem_cache_alloc(gfs_mhc_cachep, GFP_KERNEL);
-		if (!mc)
-			return;
-		memset(mc, 0, sizeof(struct gfs_meta_header_cache));
-
-		mc->mc_block = bh[x]->b_blocknr;
-		memcpy(&mc->mc_mh, bh[x]->b_data,
-		       sizeof(struct gfs_meta_header));
-
-		gen = gfs64_to_cpu(mc->mc_mh.mh_generation) + 2;
-		mc->mc_mh.mh_generation = cpu_to_gfs64(gen);
-
-		head = &sdp->sd_mhc[mhc_hash(bh[x])];
-
-		spin_lock(&sdp->sd_mhc_lock);
-		list_add(&mc->mc_list_hash, head);
-		list_add(&mc->mc_list_single, &sdp->sd_mhc_single);
-		list_add(&mc->mc_list_rgd, &rgd->rd_mhc);
-		spin_unlock(&sdp->sd_mhc_lock);
-
-		atomic_inc(&sdp->sd_mhc_count);
-	}
-
-	x = gfs_tune_get(sdp, gt_max_mhc);
-
-	/* If we've got too many cached, throw some older ones away */
-	if (atomic_read(&sdp->sd_mhc_count) > x)
-		mhc_trim(sdp, x);
-}
-
-/**
- * gfs_mhc_fish - Try to fill in a meta buffer with meta-header from the cache
- * @sdp: the filesystem
- * @bh: the buffer to fill in
- *
- * Returns: TRUE if the buffer was cached, FALSE otherwise
- *
- * If buffer is referenced in meta-header cache (search using hash):
- *   Copy the cached meta-header into the buffer (instead of reading from disk).
- *     Note that only the meta-header portion of the buffer will have valid data
- *     (as would be on disk), rest of buffer does *not* reflect disk contents.
- *   Remove cached gfs_meta_header_cache from all cache lists, free its memory.
- */
-
-int
-gfs_mhc_fish(struct gfs_sbd *sdp, struct buffer_head *bh)
-{
-	struct list_head *tmp, *head;
-	struct gfs_meta_header_cache *mc;
-
-	head = &sdp->sd_mhc[mhc_hash(bh)];
-
-	spin_lock(&sdp->sd_mhc_lock);
-
-	for (tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		mc = list_entry(tmp, struct gfs_meta_header_cache, mc_list_hash);
-		if (mc->mc_block != bh->b_blocknr)
-			continue;
-
-		list_del(&mc->mc_list_hash);
-		list_del(&mc->mc_list_single);
-		list_del(&mc->mc_list_rgd);
-		spin_unlock(&sdp->sd_mhc_lock);
-
-		gfs_prep_new_buffer(bh);
-		memcpy(bh->b_data, &mc->mc_mh,
-		       sizeof(struct gfs_meta_header));
-
-		kmem_cache_free(gfs_mhc_cachep, mc);
-		atomic_dec(&sdp->sd_mhc_count);
-
-		return TRUE;
-	}
-
-	spin_unlock(&sdp->sd_mhc_lock);
-
-	return FALSE;
-}
-
-/**
- * gfs_mhc_zap - Throw away an RG's list of cached metadata headers
- * @rgd: The resource group whose list we want to clear
- *
- * Simply throw away all cached metadata headers on RG's list,
- *   and free their memory.
- */
-
-void
-gfs_mhc_zap(struct gfs_rgrpd *rgd)
-{
-	struct gfs_sbd *sdp = rgd->rd_sbd;
-	struct gfs_meta_header_cache *mc;
-
-	spin_lock(&sdp->sd_mhc_lock);
-
-	while (!list_empty(&rgd->rd_mhc)) {
-		mc = list_entry(rgd->rd_mhc.next,
-				struct gfs_meta_header_cache,
-				mc_list_rgd);
-
-		list_del(&mc->mc_list_hash);
-		list_del(&mc->mc_list_single);
-		list_del(&mc->mc_list_rgd);
-		spin_unlock(&sdp->sd_mhc_lock);
-
-		kmem_cache_free(gfs_mhc_cachep, mc);
-		atomic_dec(&sdp->sd_mhc_count);
-
-		spin_lock(&sdp->sd_mhc_lock);
-	}
-
-	spin_unlock(&sdp->sd_mhc_lock);
-}
-
-/**
- * depend_hash() - Turn glock number into hash bucket number
- * @formal_ino:
- *
- * Returns: The number of the corresponding hash bucket
- */
-
-static unsigned int
-depend_hash(uint64_t formal_ino)
-{
-	unsigned int h;
-
-	h = gfs_hash(&formal_ino, sizeof(uint64_t));
-	h &= GFS_DEPEND_HASH_MASK;
-
-	return h;
-}
-
-/**
- * depend_sync_one - Sync metadata (not data) for a dependency inode
- * @sdp: filesystem instance
- * @gd: dependency descriptor
- *
- * Remove dependency from superblock's hash table and rgrp's list.
- * Sync dependency inode's metadata to log and in-place location.
- */
-
-static void
-depend_sync_one(struct gfs_sbd *sdp, struct gfs_depend *gd)
-{
-	struct gfs_glock *gl;
-
-	spin_lock(&sdp->sd_depend_lock);
-	list_del(&gd->gd_list_hash);
-	spin_unlock(&sdp->sd_depend_lock);
-	list_del(&gd->gd_list_rgd);
-
-	gl = gfs_glock_find(sdp,
-			    &(struct lm_lockname){gd->gd_formal_ino,
-						  LM_TYPE_INODE});
-	if (gl) {
-		if (gl->gl_ops->go_sync)
-			gl->gl_ops->go_sync(gl,
-					    DIO_METADATA |
-					    DIO_INVISIBLE);
-		gfs_glock_put(gl);
-	}
-
-	kfree(gd);
-	atomic_dec(&sdp->sd_depend_count);
-}
-
-/**
- * depend_sync_old - Sync older rgrp-dependent inodes to disk.
- * @rgd: Resource group containing dependent inodes
- *
- * Look at oldest entries in resource group's dependency list,
- *   sync 'em if they're older than timeout threshold.
- */
-
-static void
-depend_sync_old(struct gfs_rgrpd *rgd)
-{
-	struct gfs_sbd *sdp = rgd->rd_sbd;
-	struct gfs_depend *gd;
-
-	while (!list_empty(&rgd->rd_depend)) {
-		/* Oldest entries are in prev direction */
-		gd = list_entry(rgd->rd_depend.prev,
-				struct gfs_depend,
-				gd_list_rgd);
-
-		if (time_before(jiffies,
-				gd->gd_time +
-				gfs_tune_get(sdp, gt_depend_secs) * HZ))
-			return;
-
-		depend_sync_one(sdp, gd);
-	}
-}
-
-/**
- * gfs_depend_add - Add a dependent inode to rgrp's and filesystem's list
- * @rgd: Resource group containing blocks associated with inode
- * @formal_ino: inode
- *
- * Dependent inodes must be flushed to log and in-place blocks before
- *   releasing an EXCLUSIVE rgrp lock.
- * Find pre-existing dependency for this inode/rgrp combination in
- *   incore superblock struct's sd_depend hash table, or create a new one.
- * Either way, move or attach dependency to head of superblock's hash bucket
- *   and top of rgrp's list.
- * If we create a new one, take a moment to sync older dependencies to disk.
- */
-
-void
-gfs_depend_add(struct gfs_rgrpd *rgd, uint64_t formal_ino)
-{
-	struct gfs_sbd *sdp = rgd->rd_sbd;
-	struct list_head *head, *tmp;
-	struct gfs_depend *gd;
-
-	head = &sdp->sd_depend[depend_hash(formal_ino)];
-
-	spin_lock(&sdp->sd_depend_lock);
-
-	for (tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		gd = list_entry(tmp, struct gfs_depend, gd_list_hash);
-		if (gd->gd_rgd == rgd &&
-		    gd->gd_formal_ino == formal_ino) {
-			list_move(&gd->gd_list_hash, head);
-			spin_unlock(&sdp->sd_depend_lock);
-			list_move(&gd->gd_list_rgd, &rgd->rd_depend);
-			gd->gd_time = jiffies;
-			return;
-		}
-	}
-
-	spin_unlock(&sdp->sd_depend_lock);
-
-	gd = gmalloc(sizeof(struct gfs_depend));
-	memset(gd, 0, sizeof(struct gfs_depend));
-
-	gd->gd_rgd = rgd;
-	gd->gd_formal_ino = formal_ino;
-	gd->gd_time = jiffies;
-
-	spin_lock(&sdp->sd_depend_lock);
-	list_add(&gd->gd_list_hash, head);
-	spin_unlock(&sdp->sd_depend_lock);
-	list_add(&gd->gd_list_rgd, &rgd->rd_depend);
-
-	atomic_inc(&sdp->sd_depend_count);
-
-	depend_sync_old(rgd);
-}
-
-/**
- * gfs_depend_sync - Sync metadata (not data) for an rgrp's dependent inodes
- * @rgd: Resource group containing the dependent inodes
- *
- * As long as this node owns an EXCLUSIVE lock on the rgrp, we can keep
- *   rgrp's modified metadata blocks in buffer cache.
- *
- * When this node releases the EX lock, we must flush metadata, so other
- *   nodes can read the modified content from disk.
- */
-
-void
-gfs_depend_sync(struct gfs_rgrpd *rgd)
-{
-	struct gfs_sbd *sdp = rgd->rd_sbd;
-	struct gfs_depend *gd;
-
-	while (!list_empty(&rgd->rd_depend)) {
-		gd = list_entry(rgd->rd_depend.next,
-				struct gfs_depend,
-				gd_list_rgd);
-		depend_sync_one(sdp, gd);
-	}
-}
-
-/**
- * rgrp_verify - Verify that a resource group is consistent
- * @sdp: the filesystem
- * @rgd: the rgrp
- *
- * Somebody should have already called gfs_glock_rg() on this RG.
- */
-
-static void
-rgrp_verify(struct gfs_rgrpd *rgd)
-{
-	struct gfs_sbd *sdp = rgd->rd_sbd;
-	struct gfs_bitmap *bits = NULL;
-	uint32_t length = rgd->rd_ri.ri_length;
-	uint32_t count[4], tmp;
-	int buf, x;
-
-	memset(count, 0, 4 * sizeof(uint32_t));
-
-	/* Count # blocks in each of 4 possible allocation states */
-	for (buf = 0; buf < length; buf++) {
-		bits = &rgd->rd_bits[buf];
-		for (x = 0; x < 4; x++)
-			count[x] += gfs_bitcount(rgd,
-						 rgd->rd_bh[buf]->b_data +
-						 bits->bi_offset,
-						 bits->bi_len, x);
-	}
-
-	if (count[0] != rgd->rd_rg.rg_free) {
-		if (gfs_consist_rgrpd(rgd))
-			printk("GFS: fsid=%s: free data mismatch:  %u != %u\n",
-			       sdp->sd_fsname, count[0], rgd->rd_rg.rg_free);
-		return;
-	}
-
-	tmp = rgd->rd_ri.ri_data -
-		(rgd->rd_rg.rg_usedmeta + rgd->rd_rg.rg_freemeta) -
-		(rgd->rd_rg.rg_useddi + rgd->rd_rg.rg_freedi) -
-		rgd->rd_rg.rg_free;
-	if (count[1] != tmp) {
-		if (gfs_consist_rgrpd(rgd))
-			printk("GFS: fsid=%s: used data mismatch:  %u != %u\n",
-			       sdp->sd_fsname, count[1], tmp);
-		return;
-	}
-
-	if (count[2] != rgd->rd_rg.rg_freemeta) {
-		if (gfs_consist_rgrpd(rgd))
-			printk("GFS: fsid=%s: free metadata mismatch:  %u != %u\n",
-			       sdp->sd_fsname, count[2], rgd->rd_rg.rg_freemeta);
-		return;
-	}
-
-	tmp = rgd->rd_rg.rg_usedmeta +
-		(rgd->rd_rg.rg_useddi + rgd->rd_rg.rg_freedi);
-	if (count[3] != tmp) {
-		if (gfs_consist_rgrpd(rgd))
-			printk("GFS: fsid=%s: used metadata mismatch:  %u != %u\n",
-			       sdp->sd_fsname, count[3], tmp);
-		return;
-	}
-}
-
-/**
- * gfs_blk2rgrpd - Find resource group for a given data/meta block number
- * @sdp: The GFS superblock
- * @n: The data block number
- *
- * Returns: The resource group, or NULL if not found
- *
- * Don't try to use this for non-allocatable block numbers (i.e. rgrp header
- *   or bitmap blocks); it's for allocatable (data/meta) blocks only.
- */
-
-struct gfs_rgrpd *
-gfs_blk2rgrpd(struct gfs_sbd *sdp, uint64_t blk)
-{
-	struct list_head *tmp, *head;
-	struct gfs_rgrpd *rgd = NULL;
-	struct gfs_rindex *ri;
-
-	spin_lock(&sdp->sd_rg_mru_lock);
-
-	for (head = &sdp->sd_rg_mru_list, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		rgd = list_entry(tmp, struct gfs_rgrpd, rd_list_mru);
-		ri = &rgd->rd_ri;
-
-		if (ri->ri_data1 <= blk && blk < ri->ri_data1 + ri->ri_data) {
-			list_move(&rgd->rd_list_mru, &sdp->sd_rg_mru_list);
-			spin_unlock(&sdp->sd_rg_mru_lock);
-			return rgd;
-		}
-	}
-
-	spin_unlock(&sdp->sd_rg_mru_lock);
-
-	return NULL;
-}
-
-/**
- * gfs_rgrpd_get_first - get the first Resource Group in the filesystem
- * @sdp: The GFS superblock
- *
- * Returns: The first rgrp in the filesystem
- */
-
-struct gfs_rgrpd *
-gfs_rgrpd_get_first(struct gfs_sbd *sdp)
-{
-	gfs_assert(sdp, !list_empty(&sdp->sd_rglist),);
-	return list_entry(sdp->sd_rglist.next, struct gfs_rgrpd, rd_list);
-}
-
-/**
- * gfs_rgrpd_get_next - get the next RG
- * @rgd: A RG
- *
- * Returns: The next rgrp
- */
-
-struct gfs_rgrpd *
-gfs_rgrpd_get_next(struct gfs_rgrpd *rgd)
-{
-	if (rgd->rd_list.next == &rgd->rd_sbd->sd_rglist)
-		return NULL;
-	return list_entry(rgd->rd_list.next, struct gfs_rgrpd, rd_list);
-}
-
-/**
- * clear_rgrpdi - Clear up rgrps
- * @sdp: The GFS superblock
- *
- */
-
-void
-clear_rgrpdi(struct gfs_sbd *sdp)
-{
-	struct gfs_rgrpd *rgd;
-	struct gfs_glock *gl;
-
-	spin_lock(&sdp->sd_rg_forward_lock);
-	sdp->sd_rg_forward = NULL;
-	spin_unlock(&sdp->sd_rg_forward_lock);
-
-	spin_lock(&sdp->sd_rg_recent_lock);
-	while (!list_empty(&sdp->sd_rg_recent)) {
-		rgd = list_entry(sdp->sd_rg_recent.next,
-				 struct gfs_rgrpd, rd_recent);
-		list_del(&rgd->rd_recent);
-	}
-	spin_unlock(&sdp->sd_rg_recent_lock);
-
-	while (!list_empty(&sdp->sd_rglist)) {
-		rgd = list_entry(sdp->sd_rglist.next,
-				 struct gfs_rgrpd, rd_list);
-		gl = rgd->rd_gl;
-
-		list_del(&rgd->rd_list);
-		list_del(&rgd->rd_list_mru);
-
-		if (gl) {
-			gfs_glock_force_drop(gl);
-			if (atomic_read(&gl->gl_lvb_count))
-				gfs_lvb_unhold(gl);
-			set_gl2rgd(gl, NULL);
-			gfs_glock_put(gl);
-		}
-
-		if (rgd->rd_bits)
-			kfree(rgd->rd_bits);
-		if (rgd->rd_bh)
-			kfree(rgd->rd_bh);
-
-		kfree(rgd);
-	}
-}
-
-/**
- * gfs_clear_rgrpd - Clear up rgrps
- * @sdp: The GFS superblock
- *
- */
-
-void
-gfs_clear_rgrpd(struct gfs_sbd *sdp)
-{
-	down(&sdp->sd_rindex_lock);
-	clear_rgrpdi(sdp);
-	up(&sdp->sd_rindex_lock);
-}
-
-/**
- * gfs_compute_bitstructs - Compute the bitmap sizes
- * @rgd: The resource group descriptor
- *
- * Calculates bitmap descriptors, one for each block that contains bitmap data
- *
- * Returns: errno
- */
-
-static int
-compute_bitstructs(struct gfs_rgrpd *rgd)
-{
-	struct gfs_sbd *sdp = rgd->rd_sbd;
-	struct gfs_bitmap *bits;
-	uint32_t length = rgd->rd_ri.ri_length; /* # blocks in hdr & bitmap */
-	uint32_t bytes_left, bytes;
-	int x;
-
-	rgd->rd_bits = kmalloc(length * sizeof(struct gfs_bitmap), GFP_KERNEL);
-	if (!rgd->rd_bits)
-		return -ENOMEM;
-	memset(rgd->rd_bits, 0, length * sizeof(struct gfs_bitmap));
-
-	bytes_left = rgd->rd_ri.ri_bitbytes;
-
-	for (x = 0; x < length; x++) {
-		bits = &rgd->rd_bits[x];
-
-		/* small rgrp; bitmap stored completely in header block */
-		if (length == 1) {
-			bytes = bytes_left;
-			bits->bi_offset = sizeof(struct gfs_rgrp);
-			bits->bi_start = 0;
-			bits->bi_len = bytes;
-		/* header block */
-		} else if (x == 0) {
-			bytes = sdp->sd_sb.sb_bsize - sizeof(struct gfs_rgrp);
-			bits->bi_offset = sizeof(struct gfs_rgrp);
-			bits->bi_start = 0;
-			bits->bi_len = bytes;
-		/* last block */
-		} else if (x + 1 == length) {
-			bytes = bytes_left;
-			bits->bi_offset = sizeof(struct gfs_meta_header);
-			bits->bi_start = rgd->rd_ri.ri_bitbytes - bytes_left;
-			bits->bi_len = bytes;
-		/* other blocks */
-		} else {
-			bytes = sdp->sd_sb.sb_bsize - sizeof(struct gfs_meta_header);
-			bits->bi_offset = sizeof(struct gfs_meta_header);
-			bits->bi_start = rgd->rd_ri.ri_bitbytes - bytes_left;
-			bits->bi_len = bytes;
-		}
-
-		bytes_left -= bytes;
-	}
-
-	if (bytes_left) {
-		gfs_consist_rgrpd(rgd);
-		return -EIO;
-	}
-        if ((rgd->rd_bits[length - 1].bi_start +
-	     rgd->rd_bits[length - 1].bi_len) * GFS_NBBY !=
-	    rgd->rd_ri.ri_data) {
-		if (gfs_consist_rgrpd(rgd)) {
-			gfs_rindex_print(&rgd->rd_ri);
-			printk("GFS: fsid=%s: start=%u len=%u offset=%u\n",
-			       sdp->sd_fsname,
-			       rgd->rd_bits[length - 1].bi_start,
-			       rgd->rd_bits[length - 1].bi_len,
-			       rgd->rd_bits[length - 1].bi_offset);
-		}
-		return -EIO;
-	}
-
-	rgd->rd_bh = kmalloc(length * sizeof(struct buffer_head *), GFP_KERNEL);
-	if (!rgd->rd_bh) {
-		kfree(rgd->rd_bits);
-		rgd->rd_bits = NULL;
-		return -ENOMEM;
-	}
-	memset(rgd->rd_bh, 0, length * sizeof(struct buffer_head *));
-
-	return 0;
-}
-
-/**
- * gfs_ri_update - Pull in a new resource index from the disk
- * @gl: The glock covering the rindex inode
- *
- * Returns: 0 on successful update, error code otherwise
- */
-
-static int
-gfs_ri_update(struct gfs_inode *ip)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_rgrpd *rgd;
-	char buf[sizeof(struct gfs_rindex)];
-	int error;
-
-	if (do_mod(ip->i_di.di_size, sizeof(struct gfs_rindex))) {
-		gfs_consist_inode(ip);
-		return -EIO;
-	}
-
-	clear_rgrpdi(sdp);
-
-	for (sdp->sd_rgcount = 0;; sdp->sd_rgcount++) {
-		error = gfs_internal_read(ip, buf,
-					  sdp->sd_rgcount *
-					  sizeof(struct gfs_rindex),
-					  sizeof(struct gfs_rindex));
-		if (!error)
-			break;
-		if (error != sizeof(struct gfs_rindex)) {
-			if (error > 0)
-				error = -EIO;
-			goto fail;
-		}
-
-		rgd = kmalloc(sizeof(struct gfs_rgrpd), GFP_KERNEL);
-		error = -ENOMEM;
-		if (!rgd)
-			goto fail;
-		memset(rgd, 0, sizeof(struct gfs_rgrpd));
-
-		INIT_LIST_HEAD(&rgd->rd_mhc);
-		INIT_LIST_HEAD(&rgd->rd_depend);
-		rgd->rd_sbd = sdp;
-
-		list_add_tail(&rgd->rd_list, &sdp->sd_rglist);
-		list_add_tail(&rgd->rd_list_mru, &sdp->sd_rg_mru_list);
-
-		gfs_rindex_in(&rgd->rd_ri, buf);
-
-		error = compute_bitstructs(rgd);
-		if (error)
-			goto fail;
-
-		error = gfs_glock_get(sdp, rgd->rd_ri.ri_addr, &gfs_rgrp_glops,
-				      CREATE, &rgd->rd_gl);
-		if (error)
-			goto fail;
-
-		error = gfs_lvb_hold(rgd->rd_gl);
-		if (error)
-			goto fail;
-
-		set_gl2rgd(rgd->rd_gl, rgd);
-		rgd->rd_rg_vn = rgd->rd_gl->gl_vn - 1;
-	}
-
-	sdp->sd_riinode_vn = ip->i_gl->gl_vn;
-
-	return 0;
-
- fail:
-	clear_rgrpdi(sdp);
-
-	return error;
-}
-
-/**
- * gfs_rindex_hold - Grab a lock on the rindex
- * @sdp: The GFS superblock
- * @ri_gh: the glock holder
- *
- * We grab a lock on the rindex inode to make sure that it doesn't
- * change whilst we are performing an operation. We keep this lock
- * for quite long periods of time compared to other locks. This
- * doesn't matter, since it is shared and it is very, very rarely
- * accessed in the exclusive mode (i.e. only when expanding the filesystem).
- *
- * This makes sure that we're using the latest copy of the resource index
- *   special file, which might have been updated if someone expanded the
- *   filesystem (via gfs_grow utility), which adds new resource groups.
- *
- * Returns: 0 on success, error code otherwise
- */
-
-int
-gfs_rindex_hold(struct gfs_sbd *sdp, struct gfs_holder *ri_gh)
-{
-	struct gfs_inode *ip = sdp->sd_riinode;
-	struct gfs_glock *gl = ip->i_gl;
-	int error;
-
-	error = gfs_glock_nq_init(gl, LM_ST_SHARED, 0, ri_gh);
-	if (error)
-		return error;
-
-	/* Read new copy from disk if we don't have the latest */
-	if (sdp->sd_riinode_vn != gl->gl_vn) {
-		down(&sdp->sd_rindex_lock);
-		if (sdp->sd_riinode_vn != gl->gl_vn) {
-			error = gfs_ri_update(ip);
-			if (error)
-				gfs_glock_dq_uninit(ri_gh);
-		}
-		up(&sdp->sd_rindex_lock);
-	}
-
-	return error;
-}
-
-/**
- * gfs_rgrp_read - Read in a RG's header and bitmaps
- * @rgd: the struct gfs_rgrpd describing the RG to read in
- *
- * Read in all of a Resource Group's header and bitmap blocks.
- * Caller must eventually call gfs_rgrp_relse() to free the bitmaps.
- *
- * Returns: errno
- */
-
-int
-gfs_rgrp_read(struct gfs_rgrpd *rgd)
-{
-	struct gfs_sbd *sdp = rgd->rd_sbd;
-	struct gfs_glock *gl = rgd->rd_gl;
-	unsigned int x, length = rgd->rd_ri.ri_length;
-	int error;
-
-	for (x = 0; x < length; x++) {
-		gfs_assert_warn(sdp, !rgd->rd_bh[x]);
-		rgd->rd_bh[x] = gfs_dgetblk(gl, rgd->rd_ri.ri_addr + x);
-	}
-
-	for (x = 0; x < length; x++) {
-		error = gfs_dreread(sdp, rgd->rd_bh[x], DIO_START);
-		if (error)
-			goto fail;
-	}
-
-	for (x = length; x--;) {
-		error = gfs_dreread(sdp, rgd->rd_bh[x], DIO_WAIT);
-		if (error)
-			goto fail;
-		if (gfs_metatype_check(sdp, rgd->rd_bh[x],
-				       (x) ? GFS_METATYPE_RB : GFS_METATYPE_RG)) {
-			error = -EIO;
-			goto fail;
-		}
-	}
-
-	if (rgd->rd_rg_vn != gl->gl_vn) {
-		gfs_rgrp_in(&rgd->rd_rg, (rgd->rd_bh[0])->b_data);
-		rgd->rd_rg_vn = gl->gl_vn;
-	}
-
-	return 0;
-
- fail:
-	for (x = 0; x < length; x++) {
-		brelse(rgd->rd_bh[x]);
-		rgd->rd_bh[x] = NULL;
-	}
-
-	return error;
-}
-
-/**
- * gfs_rgrp_relse - Release RG bitmaps read in with gfs_rgrp_read()
- * @rgd: the struct gfs_rgrpd describing the RG to read in
- *
- */
-
-void
-gfs_rgrp_relse(struct gfs_rgrpd *rgd)
-{
-	int x, length = rgd->rd_ri.ri_length;
-
-	for (x = 0; x < length; x++) {
-		brelse(rgd->rd_bh[x]);
-		rgd->rd_bh[x] = NULL;
-	}
-}
-
-/**
- * gfs_rgrp_lvb_fill - copy RG usage data out of the struct gfs_rgrp into the struct gfs_rgrp_lvb
- * @rgd: the resource group data structure
- *
- */
-
-void
-gfs_rgrp_lvb_fill(struct gfs_rgrpd *rgd)
-{
-	struct gfs_rgrp *rg = &rgd->rd_rg;
-	struct gfs_rgrp_lvb *rb = (struct gfs_rgrp_lvb *)rgd->rd_gl->gl_lvb;
-
-	rb->rb_magic = cpu_to_gfs32(GFS_MAGIC);
-	rb->rb_free = cpu_to_gfs32(rg->rg_free);
-	rb->rb_useddi = cpu_to_gfs32(rg->rg_useddi);
-	rb->rb_freedi = cpu_to_gfs32(rg->rg_freedi);
-	rb->rb_usedmeta = cpu_to_gfs32(rg->rg_usedmeta);
-	rb->rb_freemeta = cpu_to_gfs32(rg->rg_freemeta);
-}
-
-/**
- * gfs_rgrp_lvb_init - Init the data of a RG LVB
- * @rgd: the resource group data structure
- *
- * Returns:  errno
- */
-
-int
-gfs_rgrp_lvb_init(struct gfs_rgrpd *rgd)
-{
-	struct gfs_glock *gl = rgd->rd_gl;
-	struct gfs_holder rgd_gh;
-	int error;
-
-	error = gfs_glock_nq_init(gl, LM_ST_EXCLUSIVE, 0, &rgd_gh);
-	if (!error) {
-		gfs_rgrp_lvb_fill(rgd);
-		gfs_glock_dq_uninit(&rgd_gh);
-	}
-
-	return error;
-}
-
-/**
- * gfs_alloc_get - allocate a struct gfs_alloc structure for an inode
- * @ip: the incore GFS inode structure
- *
- * Alloc and zero an in-place reservation structure,
- *   and attach it to the GFS incore inode.
- *
- * FIXME: Don't use gmalloc()
- *
- * Returns: the struct gfs_alloc
- */
-
-struct gfs_alloc *
-gfs_alloc_get(struct gfs_inode *ip)
-{
-	struct gfs_alloc *al = ip->i_alloc;
-
-	gfs_assert_warn(ip->i_sbd, !al);
-
-	al = gmalloc(sizeof(struct gfs_alloc));
-	memset(al, 0, sizeof(struct gfs_alloc));
-
-	ip->i_alloc = al;
-
-	return al;
-}
-
-/**
- * gfs_alloc_put - throw away the struct gfs_alloc for an inode
- * @ip: the inode
- *
- */
-
-void
-gfs_alloc_put(struct gfs_inode *ip)
-{
-	struct gfs_alloc *al = ip->i_alloc;
-
-	if (gfs_assert_warn(ip->i_sbd, al))
-		return;
-
-	ip->i_alloc = NULL;
-	kfree(al);
-}
-
-/**
- * try_rgrp_fit - See if a given reservation will fit in a given RG
- * @rgd: the RG data
- * @al: the struct gfs_alloc structure describing the reservation
- *
- * If there's room for the requested blocks to be allocated from the RG:
- *   Sets the $al_reserved_data field in @al.
- *   Sets the $al_reserved_meta field in @al.
- *   Sets the $al_rgd field in @al.
- *
- * Returns: 1 on success (it fits), 0 on failure (it doesn't fit)
- */
-
-static int
-try_rgrp_fit(struct gfs_rgrpd *rgd, struct gfs_alloc *al)
-{
-	uint32_t freeblks = rgd->rd_rg.rg_free;
-	uint32_t freemeta = rgd->rd_rg.rg_freemeta;
-	uint32_t metares = al->al_requested_meta;
-	uint32_t datares = al->al_requested_data;
-
-	/* First take care of the data blocks required */
-
-	if (freeblks < al->al_requested_data)
-		return 0;
-
-	freeblks -= al->al_requested_data;
-
-	/* Then take care of the dinodes */
-
-	metares += al->al_requested_di;
-
-	/* Then take care of the metadata blocks */
-
-	while (freemeta < metares) {
-		if (freeblks < GFS_META_CLUMP)
-			return 0;
-
-		freeblks -= GFS_META_CLUMP;
-		freemeta += GFS_META_CLUMP;
-
-		datares += GFS_META_CLUMP;
-	}
-
-	al->al_rgd = rgd;
-	al->al_reserved_meta = metares;
-	al->al_reserved_data = datares;
-
-	return 1;
-}
-
-/**
- * recent_rgrp_first - get first RG from "recent" list
- * @sdp: The GFS superblock
- * @rglast: address of the rgrp used last
- *
- * Returns: The first rgrp in the recent list
- */
-
-static struct gfs_rgrpd *
-recent_rgrp_first(struct gfs_sbd *sdp, uint64_t rglast)
-{
-	struct list_head *tmp, *head;
-	struct gfs_rgrpd *rgd = NULL;
-
-	spin_lock(&sdp->sd_rg_recent_lock);
-
-	if (list_empty(&sdp->sd_rg_recent))
-		goto out;
-
-	if (!rglast)
-		goto first;
-
-	for (head = &sdp->sd_rg_recent, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		rgd = list_entry(tmp, struct gfs_rgrpd, rd_recent);
-		if (rgd->rd_ri.ri_addr == rglast)
-			goto out;
-	}
-
- first:
-	rgd = list_entry(sdp->sd_rg_recent.next, struct gfs_rgrpd, rd_recent);
-
- out:
-	spin_unlock(&sdp->sd_rg_recent_lock);
-
-	return rgd;
-}
-
-/**
- * recent_rgrp_next - get next RG from "recent" list
- * @cur_rgd: current rgrp
- * @remove:
- *
- * Returns: The next rgrp in the recent list
- */
-
-static struct gfs_rgrpd *
-recent_rgrp_next(struct gfs_rgrpd *cur_rgd, int remove)
-{
-	struct gfs_sbd *sdp = cur_rgd->rd_sbd;
-	struct list_head *tmp, *head;
-	struct gfs_rgrpd *rgd;
-
-	spin_lock(&sdp->sd_rg_recent_lock);
-
-	for (head = &sdp->sd_rg_recent, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		rgd = list_entry(tmp, struct gfs_rgrpd, rd_recent);
-		if (rgd == cur_rgd) {
-			if (cur_rgd->rd_recent.next != head)
-				rgd = list_entry(cur_rgd->rd_recent.next,
-						 struct gfs_rgrpd, rd_recent);
-			else
-				rgd = NULL;
-
-			if (remove)
-				list_del(&cur_rgd->rd_recent);
-
-			goto out;
-		}
-	}
-
-	rgd = NULL;
-	if (!list_empty(head))
-		rgd = list_entry(head->next, struct gfs_rgrpd, rd_recent);
-
- out:
-	spin_unlock(&sdp->sd_rg_recent_lock);
-
-	return rgd;
-}
-
-/**
- * recent_rgrp_add - add an RG to tail of "recent" list
- * @new_rgd: The rgrp to add
- *
- * Before adding, make sure that:
- *   1) it's not already on the list
- *   2) there's still room for more entries
- * The capacity limit imposed on the "recent" list is basically a node's "share"
- *   of rgrps within a cluster, i.e. (total # rgrps) / (# nodes (journals))
- */
-
-static void
-recent_rgrp_add(struct gfs_rgrpd *new_rgd)
-{
-	struct gfs_sbd *sdp = new_rgd->rd_sbd;
-	struct list_head *tmp, *head;
-	struct gfs_rgrpd *rgd = NULL;
-	unsigned int count = 0;
-	unsigned int max = sdp->sd_rgcount / gfs_num_journals(sdp);
-
-	spin_lock(&sdp->sd_rg_recent_lock);
-
-	for (head = &sdp->sd_rg_recent, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		rgd = list_entry(tmp, struct gfs_rgrpd, rd_recent);
-		if (rgd == new_rgd)
-			goto out;
-
-		if (++count >= max)
-			goto out;
-	}
-	new_rgd->rd_try_counter = 0;
-	list_add_tail(&new_rgd->rd_recent, &sdp->sd_rg_recent);
-
- out:
-	spin_unlock(&sdp->sd_rg_recent_lock);
-}
-
-/**
- * forward_rgrp_get - get an rgrp to try next from full list
- * @sdp: The GFS superblock
- *
- * Returns: The rgrp to try next
- */
-
-static struct gfs_rgrpd *
-forward_rgrp_get(struct gfs_sbd *sdp)
-{
-	struct gfs_rgrpd *rgd;
-	unsigned int journals = gfs_num_journals(sdp);
-	unsigned int rg = 0, x;
-
-	spin_lock(&sdp->sd_rg_forward_lock);
-
-	rgd = sdp->sd_rg_forward;
-	if (!rgd) {
-		if (sdp->sd_rgcount >= journals)
-			rg = sdp->sd_rgcount *
-				sdp->sd_lockstruct.ls_jid /
-				journals;
-
-		for (x = 0, rgd = gfs_rgrpd_get_first(sdp);
-		     x < rg;
-		     x++, rgd = gfs_rgrpd_get_next(rgd))
-			/* Do Nothing */;
-
-		sdp->sd_rg_forward = rgd;
-	}
-
-	spin_unlock(&sdp->sd_rg_forward_lock);
-
-	return rgd;
-}
-
-/**
- * forward_rgrp_set - set the forward rgrp pointer
- * @sdp: the filesystem
- * @rgd: The new forward rgrp
- *
- */
-
-static void
-forward_rgrp_set(struct gfs_sbd *sdp, struct gfs_rgrpd *rgd)
-{
-	spin_lock(&sdp->sd_rg_forward_lock);
-	sdp->sd_rg_forward = rgd;
-	spin_unlock(&sdp->sd_rg_forward_lock);
-}
-
-/**
- * get_local_rgrp - Choose and lock a rgrp for allocation
- * @ip: the inode to reserve space for
- * @rgp: the chosen and locked rgrp
- *
- * Try to acquire rgrp in way which avoids contending with others.
- *
- * Returns: errno
- */
-
-static int
-get_local_rgrp(struct gfs_inode *ip)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_rgrpd *rgd, *begin = NULL;
-	struct gfs_alloc *al = ip->i_alloc;
-	int flags = LM_FLAG_TRY;
-	int skipped = 0;
-	int loops = 0;
-	int error;
-	int try_flag;
-	unsigned int try_threshold = gfs_tune_get(sdp, gt_rgrp_try_threshold);
-
-	/* Try recently successful rgrps */
-
-	rgd = recent_rgrp_first(sdp, ip->i_last_rg_alloc);
-
-	while (rgd) {
-		try_flag = (rgd->rd_try_counter >= try_threshold) ?
-			0: LM_FLAG_TRY;
-		error = gfs_glock_nq_init(rgd->rd_gl,
-					  LM_ST_EXCLUSIVE, try_flag,
-					  &al->al_rgd_gh);
-		switch (error) {
-		case 0:
-			if (try_rgrp_fit(rgd, al)) {
-				rgd->rd_try_counter = 0;
-				goto out;
-			}
-			gfs_glock_dq_uninit(&al->al_rgd_gh);
-			rgd = recent_rgrp_next(rgd, TRUE);
-			break;
-
-		case GLR_TRYFAILED:
-			rgd->rd_try_counter++;
-			rgd = recent_rgrp_next(rgd, FALSE);
-			break;
-
-		default:
-			return error;
-		}
-	}
-
-	/* Go through full list of rgrps */
-
-	begin = rgd = forward_rgrp_get(sdp);
-
-	for (;;) {
-		error = gfs_glock_nq_init(rgd->rd_gl,
-					  LM_ST_EXCLUSIVE, flags,
-					  &al->al_rgd_gh);
-		switch (error) {
-		case 0:
-			if (try_rgrp_fit(rgd, al))
-				goto out;
-			gfs_glock_dq_uninit(&al->al_rgd_gh);
-			break;
-
-		case GLR_TRYFAILED:
-			skipped++;
-			break;
-
-		default:
-			return error;
-		}
-
-		rgd = gfs_rgrpd_get_next(rgd);
-		if (!rgd)
-			rgd = gfs_rgrpd_get_first(sdp);
-
-		if (rgd == begin) {
-			if (++loops >= 2 || !skipped)
-				return -ENOSPC;
-			flags = 0;
-		}
-	}
-
- out:
-	ip->i_last_rg_alloc = rgd->rd_ri.ri_addr;
-
-	if (begin) {
-		recent_rgrp_add(rgd);
-		rgd = gfs_rgrpd_get_next(rgd);
-		if (!rgd)
-			rgd = gfs_rgrpd_get_first(sdp);
-		forward_rgrp_set(sdp, rgd);
-	}
-
-	return 0;
-}
-
-/**
- * gfs_inplace_reserve_i - Reserve space in the filesystem
- * @ip: the inode to reserve space for
- *
- * Acquire resource group locks to allow for the maximum allocation
- * described by "res".
- *
- * This should probably become more complex again, but for now, let's go
- * for simple (one resource group) reservations.
- *
- * Returns: errno
- */
-
-int
-gfs_inplace_reserve_i(struct gfs_inode *ip,
-		     char *file, unsigned int line)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_alloc *al = ip->i_alloc;
-	int error;
-
-        if (gfs_assert_warn(sdp,
-			    al->al_requested_di ||
-			    al->al_requested_data ||
-			    al->al_requested_meta))
-		return -EINVAL;
-
-	error = gfs_rindex_hold(sdp, &al->al_ri_gh);
-	if (error)
-		return error;
-
-	error = get_local_rgrp(ip);
-	if (error) {
-		gfs_glock_dq_uninit(&al->al_ri_gh);
-		return error;
-	}
-
-	gfs_depend_sync(al->al_rgd);
-
-	al->al_file = file;
-	al->al_line = line;
-
-	return 0;
-}
-
-/**
- * gfs_inplace_release - release an inplace reservation
- * @ip: the inode the reservation was taken out on
- *
- * Release a reservation made by gfs_inplace_reserve().
- */
-
-void
-gfs_inplace_release(struct gfs_inode *ip)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_alloc *al = ip->i_alloc;
-
-	if (gfs_assert_warn(sdp, al->al_alloced_di <= al->al_requested_di) == -1)
-		printk("GFS: fsid=%s: al_alloced_di = %u, al_requested_di = %u\n"
-		       "GFS: fsid=%s: al_file = %s, al_line = %u\n",
-		       sdp->sd_fsname, al->al_alloced_di, al->al_requested_di,
-		       sdp->sd_fsname, al->al_file, al->al_line);
-	if (gfs_assert_warn(sdp, al->al_alloced_meta <= al->al_reserved_meta) == -1)
-		printk("GFS: fsid=%s: al_alloced_meta = %u, al_reserved_meta = %u\n"
-		       "GFS: fsid=%s: al_file = %s, al_line = %u\n",
-		       sdp->sd_fsname, al->al_alloced_meta, al->al_reserved_meta,
-		       sdp->sd_fsname, al->al_file, al->al_line);
-	if (gfs_assert_warn(sdp, al->al_alloced_data <= al->al_reserved_data) == -1)
-		printk("GFS: fsid=%s: al_alloced_data = %u, al_reserved_data = %u\n"
-		       "GFS: fsid=%s: al_file = %s, al_line = %u\n",
-		       sdp->sd_fsname, al->al_alloced_data, al->al_reserved_data,
-		       sdp->sd_fsname, al->al_file, al->al_line);
-
-	al->al_rgd = NULL;
-	gfs_glock_dq_uninit(&al->al_rgd_gh);
-	gfs_glock_dq_uninit(&al->al_ri_gh);
-}
-
-/**
- * gfs_get_block_type - Check a block in a RG is of given type
- * @rgd: the resource group holding the block
- * @block: the block number
- *
- * Returns: The block type (GFS_BLKST_*)
- */
-
-unsigned char
-gfs_get_block_type(struct gfs_rgrpd *rgd, uint64_t block)
-{
-	struct gfs_bitmap *bits = NULL;
-	uint32_t length, rgrp_block, buf_block;
-	unsigned int buf;
-	unsigned char type;
-
-	length = rgd->rd_ri.ri_length;
-	rgrp_block = block - rgd->rd_ri.ri_data1;
-
-	for (buf = 0; buf < length; buf++) {
-		bits = &rgd->rd_bits[buf];
-		if (rgrp_block < (bits->bi_start + bits->bi_len) * GFS_NBBY)
-			break;
-	}
-
-	gfs_assert(rgd->rd_sbd, buf < length,);
-	buf_block = rgrp_block - bits->bi_start * GFS_NBBY;
-
-	type = gfs_testbit(rgd,
-			   rgd->rd_bh[buf]->b_data + bits->bi_offset,
-			   bits->bi_len, buf_block);
-
-	return type;
-}
-
-/**
- * blkalloc_internal - find a block in @old_state, change allocation
- *           state to @new_state
- * @rgd: the resource group descriptor
- * @goal: the goal block within the RG (start here to search for avail block)
- * @old_state: GFS_BLKST_XXX the before-allocation state to find
- * @new_state: GFS_BLKST_XXX the after-allocation block state
- *
- * Walk rgrp's bitmap to find bits that represent a block in @old_state.
- * Add the found bitmap buffer to the transaction.
- * Set the found bits to @new_state to change block's allocation state.
- *
- * This function never fails, because we wouldn't call it unless we
- *   know (from reservation results, etc.) that a block is available.
- *
- * Scope of @goal and returned block is just within rgrp (32-bit),
- *   not the whole filesystem (64-bit).
- *
- * Returns:  the block # allocated (32-bit rgrp scope)
- */
-
-static uint32_t
-blkalloc_internal(struct gfs_rgrpd *rgd,
-		  uint32_t goal,
-		  unsigned char old_state, unsigned char new_state)
-{
-	struct gfs_bitmap *bits = NULL;
-	uint32_t length = rgd->rd_ri.ri_length;
-	uint32_t blk = 0;
-	unsigned int buf, x;
-
-	/* Find bitmap block that contains bits for goal block */
-	for (buf = 0; buf < length; buf++) {
-		bits = &rgd->rd_bits[buf];
-		if (goal < (bits->bi_start + bits->bi_len) * GFS_NBBY)
-			break;
-	}
-
-	gfs_assert(rgd->rd_sbd, buf < length,);
-
-	/* Convert scope of "goal" from rgrp-wide to within found bit block */
-	goal -= bits->bi_start * GFS_NBBY;
-
-	/* Search (up to entire) bitmap in this rgrp for allocatable block.
-	   "x <= length", instead of "x < length", because we typically start
-	   the search in the middle of a bit block, but if we can't find an
-	   allocatable block anywhere else, we want to be able wrap around and
-	   search in the first part of our first-searched bit block.  */
-	for (x = 0; x <= length; x++) {
-		blk = gfs_bitfit(rgd->rd_bh[buf]->b_data + bits->bi_offset,
-				 bits->bi_len, goal, old_state);
-		if (blk != BFITNOENT)
-			break;
-
-		/* Try next bitmap block (wrap back to rgrp header if at end) */
-		buf = (buf + 1) % length;
-		bits = &rgd->rd_bits[buf];
-		goal = 0;
-	}
-
-	if (unlikely(x > length)) {
-		printk("GFS error: possible RG corruption\n");
-		printk("    please run gfs_fsck after withdraw\n");
-		dump_stack();
-		if (gfs_assert_withdraw(rgd->rd_sbd, x <= length))
-			blk = 0;
-	}
-
-	/* Attach bitmap buffer to trans, modify bits to do block alloc */
-	gfs_trans_add_bh(rgd->rd_gl, rgd->rd_bh[buf]);
-	gfs_setbit(rgd,
-		   rgd->rd_bh[buf]->b_data + bits->bi_offset,
-		   bits->bi_len, blk, new_state);
-
-	/* Return allocated block #, rgrp scope (32-bit) */
-	return bits->bi_start * GFS_NBBY + blk;
-}
-
-/**
- * blkfree_internal - Change alloc state of given block(s)
- * @sdp: the filesystem
- * @bstart: first block (64-bit filesystem scope) of a run of contiguous blocks
- * @blen: the length of the block run (all must lie within ONE RG!)
- * @new_state: GFS_BLKST_XXX the after-allocation block state
- *
- * Returns:  Resource group containing the block(s)
- *
- * Find rgrp containing @bstart.
- * For each block in run:
- *   Find allocation bitmap buffer.
- *   Add bitmap buffer to transaction.
- *   Set bits to new state.
- * Typically used to free blocks to GFS_BLKST_FREE or GFS_BLKST_FREEMETA,
- *   but @new_state can be any GFS_BLKST_XXX
- * 
- */
-
-static struct gfs_rgrpd *
-blkfree_internal(struct gfs_sbd *sdp, uint64_t bstart, uint32_t blen,
-		 unsigned char new_state)
-{
-	struct gfs_rgrpd *rgd;
-	struct gfs_bitmap *bits = NULL;
-	uint32_t length, rgrp_blk, buf_blk;
-	unsigned int buf;
-
-	/* Find rgrp */
-	rgd = gfs_blk2rgrpd(sdp, bstart);
-	if (!rgd) {
-		if (gfs_consist(sdp))
-			printk("GFS: fsid=%s: block = %llu\n",
-			       sdp->sd_fsname, bstart);
-		return NULL;
-	}
-
-	length = rgd->rd_ri.ri_length;
-
-	/* Convert blk # from filesystem scope (64-bit) to RG scope (32-bit) */
-	rgrp_blk = bstart - rgd->rd_ri.ri_data1;
-
-	while (blen--) {
-		/* Find bitmap buffer for this block */
-		for (buf = 0; buf < length; buf++) {
-			bits = &rgd->rd_bits[buf];
-			if (rgrp_blk < (bits->bi_start + bits->bi_len) * GFS_NBBY)
-				break;
-		}
-
-		gfs_assert(rgd->rd_sbd, buf < length,);
-
-		/* Find bits and set 'em */
-		buf_blk = rgrp_blk - bits->bi_start * GFS_NBBY;
-		rgrp_blk++;
-
-		gfs_trans_add_bh(rgd->rd_gl, rgd->rd_bh[buf]);
-		gfs_setbit(rgd,
-			   rgd->rd_bh[buf]->b_data + bits->bi_offset,
-			   bits->bi_len, buf_blk, new_state);
-	}
-
-	return rgd;
-}
-
-/**
- * clump_alloc - Allocate a clump of metadata blocks
- * @rgd: the resource group in which to allocate
- * @first: returns the first block allocated
- *
- * Returns: errno
- *
- * Bitmap-allocate a clump of metadata blocks
- * Write metadata blocks to disk with dummy meta-headers
- * Add meta-headers to incore meta-header cache
- */
-
-static int
-clump_alloc(struct gfs_rgrpd *rgd, uint32_t *first)
-{
-	struct gfs_sbd *sdp = rgd->rd_sbd;
-	struct gfs_meta_header mh;
-	struct buffer_head **bh;
-	uint32_t goal, blk;
-	unsigned int x;
-	int error = 0;
-
-	/* Dummy meta-header template */
-	memset(&mh, 0, sizeof(struct gfs_meta_header));
-	mh.mh_magic = GFS_MAGIC;
-	mh.mh_type = GFS_METATYPE_NONE;
-
-	/* Array of bh pointers used in several steps */
-	bh = gmalloc(GFS_META_CLUMP * sizeof(struct buffer_head *));
-	memset(bh, 0, GFS_META_CLUMP * sizeof(struct buffer_head *));
-
-	/* Since we're looking for data blocks to change into meta blocks,
-	   use last alloc'd *data* (not meta) block as start point */
-	goal = rgd->rd_last_alloc_data;
-
-	for (x = 0; x < GFS_META_CLUMP; x++) {
-		blk = blkalloc_internal(rgd, goal, GFS_BLKST_FREE,
-					GFS_BLKST_FREEMETA);
-		if (!x)
-			*first = blk;
-
-		bh[x] = gfs_dgetblk(rgd->rd_gl, rgd->rd_ri.ri_data1 + blk);
-
-		gfs_prep_new_buffer(bh[x]);
-
-		gfs_meta_header_out(&mh, bh[x]->b_data);
-		((struct gfs_meta_header *)bh[x]->b_data)->mh_generation = 0;
-
-		/* start write of new meta-buffer to disk */
-		error = gfs_dwrite(sdp, bh[x], DIO_DIRTY | DIO_START);
-		if (error)
-			goto out;
-
-		goal = blk;
-	}
-
-	/* Block alloc start point for next time */
-	rgd->rd_last_alloc_data = goal;
-
-	/* Wait for all new meta-buffers to get on-disk */
-	for (x = 0; x < GFS_META_CLUMP; x++) {
-		error = gfs_dwrite(sdp, bh[x], DIO_WAIT);
-		if (error)
-			goto out;
-	}
-
-	/* Add all new meta-headers to meta-header cache */
-	gfs_mhc_add(rgd, bh, GFS_META_CLUMP);
-
-	gfs_assert_withdraw(sdp, rgd->rd_rg.rg_free >= GFS_META_CLUMP);
-	rgd->rd_rg.rg_free -= GFS_META_CLUMP;
-	rgd->rd_rg.rg_freemeta += GFS_META_CLUMP;
-
- out:
-	for (x = 0; x < GFS_META_CLUMP; x++)
-		if (bh[x]) {
-			gfs_dwrite(sdp, bh[x], DIO_WAIT);
-			brelse(bh[x]);
-		}
-	kfree(bh);
-
-	return error;
-}
-
-/**
- * gfs_blkalloc - Allocate a data block
- * @ip: the inode to allocate the data block for
- * @block: the block allocated
- *
- */
-
-void
-gfs_blkalloc(struct gfs_inode *ip, uint64_t *block)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_alloc *al = ip->i_alloc;
-	struct gfs_rgrpd *rgd = al->al_rgd;
-	uint32_t goal, blk;
-	int same;
-
-	same = (rgd->rd_ri.ri_addr == ip->i_di.di_goal_rgrp);
-	goal = (same) ? ip->i_di.di_goal_dblk : rgd->rd_last_alloc_data;
-
-	blk = blkalloc_internal(rgd, goal,
-				GFS_BLKST_FREE, GFS_BLKST_USED);
-	rgd->rd_last_alloc_data = blk;
-
-	if (!same) {
-		ip->i_di.di_goal_rgrp = rgd->rd_ri.ri_addr;
-		ip->i_di.di_goal_mblk = 0;
-	}
-	ip->i_di.di_goal_dblk = blk;
-
-	*block = rgd->rd_ri.ri_data1 + blk;
-
-	gfs_assert_withdraw(sdp, rgd->rd_rg.rg_free);
-	rgd->rd_rg.rg_free--;
-
-	gfs_trans_add_bh(rgd->rd_gl, rgd->rd_bh[0]);
-	gfs_rgrp_out(&rgd->rd_rg, rgd->rd_bh[0]->b_data);
-
-	al->al_alloced_data++;
-
-	gfs_trans_add_quota(sdp, +1, ip->i_di.di_uid, ip->i_di.di_gid);
-
-	/* total=0, free=-1, dinodes=0 */
-	gfs_statfs_modify(sdp, 0, -1, 0);
-}
-
-/**
- * gfs_metaalloc - Allocate a metadata block to a file
- * @ip:  the file
- * @block: the block allocated
- *
- * Returns: errno
- */
-
-int
-gfs_metaalloc(struct gfs_inode *ip, uint64_t *block)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_alloc *al = ip->i_alloc;
-	struct gfs_rgrpd *rgd = al->al_rgd;
-	uint32_t goal, blk;
-	int same;
-	int error;
-
-	same = (rgd->rd_ri.ri_addr == ip->i_di.di_goal_rgrp);
-
-	if (!rgd->rd_rg.rg_freemeta) {
-		error = clump_alloc(rgd, &goal);
-		if (error)
-			return error;
-
-		al->al_alloced_data += GFS_META_CLUMP;
-	} else
-		goal = (same) ? ip->i_di.di_goal_mblk : rgd->rd_last_alloc_meta;
-
-	blk = blkalloc_internal(rgd, goal,
-				GFS_BLKST_FREEMETA, GFS_BLKST_USEDMETA);
-	rgd->rd_last_alloc_meta = blk;
-
-	if (!same) {
-		ip->i_di.di_goal_rgrp = rgd->rd_ri.ri_addr;
-		ip->i_di.di_goal_dblk = 0;
-	}
-	ip->i_di.di_goal_mblk = blk;
-
-	*block = rgd->rd_ri.ri_data1 + blk;
-
-	gfs_assert_withdraw(sdp, rgd->rd_rg.rg_freemeta);
-	rgd->rd_rg.rg_freemeta--;
-	rgd->rd_rg.rg_usedmeta++;
-
-	gfs_trans_add_bh(rgd->rd_gl, rgd->rd_bh[0]);
-	gfs_rgrp_out(&rgd->rd_rg, rgd->rd_bh[0]->b_data);
-
-	al->al_alloced_meta++;
-
-	gfs_trans_add_quota(sdp, +1, ip->i_di.di_uid, ip->i_di.di_gid);
-
-	/* total=0, free=-1, dinode=0 */
-	gfs_statfs_modify(sdp, 0, -1, 0);
-
-	return 0;
-}
-
-/**
- * gfs_dialloc - Allocate a dinode
- * @dip: the directory that the inode is going in
- * @block: the block (result) which this function allocates as the dinode
- *     (64-bit filesystem scope)
- *
- * Returns: errno
- */
-
-int
-gfs_dialloc(struct gfs_inode *dip, uint64_t *block)
-{
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct gfs_alloc *al = dip->i_alloc;
-	struct gfs_rgrpd *rgd = al->al_rgd;
-	uint32_t goal, blk;
-	int error = 0;
-
-	if (rgd->rd_rg.rg_freemeta)
-		/* pick up where we left off last time */
-		goal = rgd->rd_last_alloc_meta;
-	else {
-		/* no free meta blocks, allocate a bunch more */
-		error = clump_alloc(rgd, &goal);
-		if (error)
-			return error;
-
-		al->al_alloced_data += GFS_META_CLUMP;
-	}
-
-	/* Alloc the dinode; 32-bit "blk" is block offset within rgrp */
-	blk = blkalloc_internal(rgd, goal,
-				GFS_BLKST_FREEMETA, GFS_BLKST_USEDMETA);
-
-	/* remember where we left off, for next time */
-	rgd->rd_last_alloc_meta = blk;
-
-	/* convert from rgrp scope (32-bit) to filesystem scope (64-bit) */
-	*block = rgd->rd_ri.ri_data1 + blk;
-
-	gfs_assert_withdraw(rgd->rd_sbd, rgd->rd_rg.rg_freemeta);
-	rgd->rd_rg.rg_freemeta--;
-	rgd->rd_rg.rg_useddi++;
-
-	/* Attach rgrp header to trans, update freemeta and useddi stats */
-	gfs_trans_add_bh(rgd->rd_gl, rgd->rd_bh[0]);
-	gfs_rgrp_out(&rgd->rd_rg, rgd->rd_bh[0]->b_data);
-
-	/* Update stats in in-place reservation struct */
-	al->al_alloced_di++;
-	al->al_alloced_meta++;
-
-	/* total=0, free=-1, dinodes=1 */
-	gfs_statfs_modify(sdp, 0, -1, +1);
-
-	return error;
-}
-
-/**
- * gfs_blkfree - free a contiguous run of data block(s)
- * @ip: the inode these blocks are being freed from
- * @bstart: first block (64-bit filesystem scope) of a run of contiguous blocks
- * @blen: the length of the block run (all must lie within ONE RG!)
- *
- * Bitmap-deallocate the blocks (to FREE data state), add bitmap blks to trans
- * Update rgrp alloc statistics in rgrp header, add rgrp header buf to trans
- * Update quotas, add to trans.
- */
-
-void
-gfs_blkfree(struct gfs_inode *ip, uint64_t bstart, uint32_t blen)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_rgrpd *rgd;
-
-	rgd = blkfree_internal(sdp, bstart, blen, GFS_BLKST_FREE);
-	if (!rgd)
-		return;
-
-	rgd->rd_rg.rg_free += blen;
-
-	gfs_trans_add_bh(rgd->rd_gl, rgd->rd_bh[0]);
-	gfs_rgrp_out(&rgd->rd_rg, rgd->rd_bh[0]->b_data);
-
-	gfs_trans_add_quota(sdp, -(int64_t)blen,
-			    ip->i_di.di_uid,
-			    ip->i_di.di_gid);
-
-	/* total=0, free=+blen, dinodes=0 */
-	gfs_statfs_modify(sdp, 0, blen, 0);
-}
-
-/**
- * gfs_metafree - free a contiguous run of metadata block(s)
- * @ip: the inode these blocks are being freed from
- * @bstart: first block (64-bit filesystem scope) of a run of contiguous blocks
- * @blen: the length of the block run (all must lie within ONE RG!)
- *
- * Bitmap-deallocate the blocks (to FREEMETA state), add bitmap blks to trans.
- * Update rgrp alloc statistics in rgrp header, add rgrp header to trans.
- * Update quotas (quotas include metadata, not just data block usage),
- *    add to trans.
- * Release deallocated buffers, add to meta-header cache (we save these in-core
- *    so we don't need to re-read meta blocks if/when they are re-alloc'd).
- */
-
-void
-gfs_metafree(struct gfs_inode *ip, uint64_t bstart, uint32_t blen)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_rgrpd *rgd;
-
-	rgd = blkfree_internal(sdp, bstart, blen, GFS_BLKST_FREEMETA);
-	if (!rgd)
-		return;
-
-	if (rgd->rd_rg.rg_usedmeta < blen)
-		gfs_consist_rgrpd(rgd);
-	rgd->rd_rg.rg_usedmeta -= blen;
-	rgd->rd_rg.rg_freemeta += blen;
-
-	gfs_trans_add_bh(rgd->rd_gl, rgd->rd_bh[0]);
-	gfs_rgrp_out(&rgd->rd_rg, rgd->rd_bh[0]->b_data);
-
-	/* total=0, free=blen, dinode=0 */
-	gfs_statfs_modify(sdp, 0, blen, 0);
-
-	gfs_trans_add_quota(sdp, -(int64_t)blen,
-			    ip->i_di.di_uid,
-			    ip->i_di.di_gid);
-	gfs_wipe_buffers(ip, rgd, bstart, blen);
-}
-
-/**
- * gfs_difree_uninit - free a dinode block
- * @rgd: the resource group that contains the dinode
- * @addr: the dinode address
- *
- * De-allocate the dinode to FREEMETA using block alloc bitmap.
- * Update rgrp's block usage statistics (used dinode--, free meta++).
- * Add rgrp header to transaction.
- */
-
-void
-gfs_difree_uninit(struct gfs_rgrpd *rgd, uint64_t addr)
-{
-	struct gfs_rgrpd *tmp_rgd;
-
-	tmp_rgd = blkfree_internal(rgd->rd_sbd, addr, 1,
-				   GFS_BLKST_FREEMETA);
-	if (!tmp_rgd)
-		return;
-	gfs_assert_withdraw(rgd->rd_sbd, rgd == tmp_rgd);
-
-	if (!rgd->rd_rg.rg_useddi)
-		gfs_consist_rgrpd(rgd);
-	rgd->rd_rg.rg_useddi--;
-	rgd->rd_rg.rg_freemeta++;
-
-	gfs_trans_add_bh(rgd->rd_gl, rgd->rd_bh[0]);
-	gfs_rgrp_out(&rgd->rd_rg, rgd->rd_bh[0]->b_data);
-
-	/* total=0, free=1, dinodes=-1 */
-	gfs_statfs_modify(rgd->rd_sbd, 0, +1, -1);
-}
-
-/**
- * gfs_difree - free a dinode block
- * @rgd: the resource group that contains the dinode
- * @ip: the inode representing the dinode to free
- *
- * Free the dinode block to FREEMETA, update rgrp's block usage stats.
- * Update quotas (quotas include metadata, not just data block usage),
- *    add to trans.
- * Release deallocated buffers, add to meta-header cache (we save these in-core
- *    so we don't need to re-read meta blocks if/when they are re-alloc'd).
- */
-
-void
-gfs_difree(struct gfs_rgrpd *rgd, struct gfs_inode *ip)
-{
-	gfs_difree_uninit(rgd, ip->i_num.no_addr);
-	gfs_trans_add_quota(ip->i_sbd, -1, ip->i_di.di_uid, ip->i_di.di_gid);
-	gfs_wipe_buffers(ip, rgd, ip->i_num.no_addr, 1);
-}
-
-/**
- * gfs_rlist_add - add a RG to a list of RGs
- * @sdp: the filesystem
- * @rlist: the list of resource groups
- * @block: the block
- *
- * Figure out what RG a block belongs to and add that RG to the list
- *
- * FIXME: Don't use gmalloc()
- *
- */
-
-void
-gfs_rlist_add(struct gfs_sbd *sdp, struct gfs_rgrp_list *rlist, uint64_t block)
-{
-	struct gfs_rgrpd *rgd;
-	struct gfs_rgrpd **tmp;
-	unsigned int new_space;
-	unsigned int x;
-
-	if (gfs_assert_warn(sdp, !rlist->rl_ghs))
-		return;
-
-	rgd = gfs_blk2rgrpd(sdp, block);
-	if (!rgd) {
-		if (gfs_consist(sdp))
-			printk("GFS: fsid=%s: block = %llu\n",
-			       sdp->sd_fsname, block);
-		return;
-	}
-
-	for (x = 0; x < rlist->rl_rgrps; x++)
-		if (rlist->rl_rgd[x] == rgd)
-			return;
-
-	if (rlist->rl_rgrps == rlist->rl_space) {
-		new_space = rlist->rl_space + 10;
-
-		tmp = gmalloc(new_space * sizeof(struct gfs_rgrpd *));
-
-		if (rlist->rl_rgd) {
-			memcpy(tmp, rlist->rl_rgd,
-			       rlist->rl_space * sizeof(struct gfs_rgrpd *));
-			kfree(rlist->rl_rgd);
-		}
-
-		rlist->rl_space = new_space;
-		rlist->rl_rgd = tmp;
-	}
-
-	rlist->rl_rgd[rlist->rl_rgrps++] = rgd;
-}
-
-/**
- * gfs_rlist_alloc - all RGs have been added to the rlist, now allocate
- *      and initialize an array of glock holders for them
- * @rlist: the list of resource groups
- * @state: the lock state to acquire the RG lock in
- * @flags: the modifier flags for the holder structures
- *
- * FIXME: Don't use gmalloc()
- *
- */
-
-void
-gfs_rlist_alloc(struct gfs_rgrp_list *rlist, unsigned int state, int flags)
-{
-	unsigned int x;
-
-	rlist->rl_ghs = gmalloc(rlist->rl_rgrps * sizeof(struct gfs_holder));
-	for (x = 0; x < rlist->rl_rgrps; x++)
-		gfs_holder_init(rlist->rl_rgd[x]->rd_gl,
-				state, flags,
-				&rlist->rl_ghs[x]);
-}
-
-/**
- * gfs_rlist_free - free a resource group list
- * @list: the list of resource groups
- *
- */
-
-void
-gfs_rlist_free(struct gfs_rgrp_list *rlist)
-{
-	unsigned int x;
-
-	if (rlist->rl_rgd)
-		kfree(rlist->rl_rgd);
-
-	if (rlist->rl_ghs) {
-		for (x = 0; x < rlist->rl_rgrps; x++)
-			gfs_holder_uninit(&rlist->rl_ghs[x]);
-		kfree(rlist->rl_ghs);
-	}
-}
-
-/**
- * gfs_reclaim_metadata - reclaims unused metadata
- * @sdp: the file system
- * @inodes:
- * @metadata:
- *
- * This function will look through the resource groups and
- * free the unused metadata.
- *
- * Returns: errno
- */
-
-int
-gfs_reclaim_metadata(struct gfs_sbd *sdp, 
-		     uint64_t *inodes,
-		     uint64_t *metadata)
-{
-	struct gfs_holder ji_gh, ri_gh, rgd_gh, t_gh;
-	struct gfs_rgrpd *rgd;
-	struct gfs_rgrp *rg;
-	struct gfs_dinode *di;
-	struct gfs_inum next;
-	struct buffer_head *bh;
-	uint32_t flags;
-	uint32_t goal;
-	unsigned int x;
-	int error = 0;
-
-	*inodes = *metadata = 0;
-
-	/* Acquire the jindex lock here so we don't deadlock with a
-	   process writing the the jindex inode. :-( */
-
-	error = gfs_jindex_hold(sdp, &ji_gh);
-	if (error)
-		goto fail;
-
-	error = gfs_rindex_hold(sdp, &ri_gh);
-	if (error)
-		goto fail_jindex_relse;
-
-	for (rgd = gfs_rgrpd_get_first(sdp);
-	     rgd;
-	     rgd = gfs_rgrpd_get_next(rgd)) {
-		error = gfs_glock_nq_init(rgd->rd_gl,
-					  LM_ST_EXCLUSIVE, GL_NOCACHE,
-					  &rgd_gh);
-		if (error)
-			goto fail_rindex_relse;
-
-		rgrp_verify(rgd);
-
-		rg = &rgd->rd_rg;
-
-		if (!rg->rg_freedi && !rg->rg_freemeta) {
-			gfs_glock_dq_uninit(&rgd_gh);
-			continue;
-		}
-
-		gfs_mhc_zap(rgd);
-		gfs_depend_sync(rgd);
-
-		error = gfs_lock_fs_check_clean(sdp, LM_ST_EXCLUSIVE, &t_gh);
-		if (error)
-			goto fail_gunlock_rg;
-
-		error = gfs_trans_begin(sdp, rgd->rd_ri.ri_length, 0);
-		if (error)
-			goto fail_unlock_fs;
-
-		next = rg->rg_freedi_list;
-
-		for (x = rg->rg_freedi; x--;) {
-			if (!next.no_formal_ino || !next.no_addr) {
-				gfs_consist_rgrpd(rgd);
-				error = -EIO;
-				goto fail_end_trans;
-			}
-
-			blkfree_internal(sdp, next.no_addr, 1, GFS_BLKST_FREE);
-
-			error = gfs_dread(rgd->rd_gl, next.no_addr,
-					  DIO_FORCE | DIO_START | DIO_WAIT, &bh);
-			if (error)
-				goto fail_end_trans;
-
-			di = (struct gfs_dinode *)bh->b_data;
-			flags = di->di_flags;
-			flags = gfs32_to_cpu(flags);
-			if (!(flags & GFS_DIF_UNUSED)) {
-				gfs_consist_rgrpd(rgd);
-				brelse(bh);
-				error = -EIO;
-				goto fail_end_trans;
-			}
-
-			gfs_inum_in(&next, (char *)&di->di_next_unused);
-
-			brelse(bh);
-
-			rg->rg_freedi--;
-			rg->rg_free++;
-			(*inodes)++;
-		}
-
-		if (next.no_formal_ino || next.no_addr) {
-			gfs_consist_rgrpd(rgd);
-			error = -EIO;
-			goto fail_end_trans;
-		}
-		rg->rg_freedi_list = next;
-
-		goal = 0;
-		for (x = rg->rg_freemeta; x--;) {
-			goal = blkalloc_internal(rgd, goal,
-						 GFS_BLKST_FREEMETA, GFS_BLKST_FREE);
-			rg->rg_freemeta--;
-			rg->rg_free++;
-			(*metadata)++;
-		}
-
-		gfs_trans_add_bh(rgd->rd_gl, rgd->rd_bh[0]);
-		gfs_rgrp_out(rg, rgd->rd_bh[0]->b_data);
-
-		gfs_trans_end(sdp);
-
-		gfs_glock_dq_uninit(&t_gh);
-
-		gfs_glock_dq_uninit(&rgd_gh);
-	}
-
-	gfs_glock_dq_uninit(&ri_gh);
-
-	gfs_glock_dq_uninit(&ji_gh);
-
-	return 0;
-
- fail_end_trans:
-	gfs_trans_end(sdp);
-
- fail_unlock_fs:
-	gfs_glock_dq_uninit(&t_gh);
-
- fail_gunlock_rg:
-	gfs_glock_dq_uninit(&rgd_gh);
-
- fail_rindex_relse:
-	gfs_glock_dq_uninit(&ri_gh);
-
- fail_jindex_relse:
-	gfs_glock_dq_uninit(&ji_gh);
-
- fail:
-	return error;
-}
diff --git a/gfs-kernel/src/gfs/rgrp.h b/gfs-kernel/src/gfs/rgrp.h
deleted file mode 100644
index 0f5c620..0000000
--- a/gfs-kernel/src/gfs/rgrp.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef __RGRP_DOT_H__
-#define __RGRP_DOT_H__
-
-void gfs_mhc_add(struct gfs_rgrpd *rgd, struct buffer_head **bh,
-			 unsigned int num);
-int gfs_mhc_fish(struct gfs_sbd *sdp, struct buffer_head *bh);
-void gfs_mhc_zap(struct gfs_rgrpd *rgd);
-
-void gfs_depend_add(struct gfs_rgrpd *rgd, uint64_t formal_ino);
-void gfs_depend_sync(struct gfs_rgrpd *rgd);
-
-struct gfs_rgrpd *gfs_blk2rgrpd(struct gfs_sbd *sdp, uint64_t blk);
-struct gfs_rgrpd *gfs_rgrpd_get_first(struct gfs_sbd *sdp);
-struct gfs_rgrpd *gfs_rgrpd_get_next(struct gfs_rgrpd *rgd);
-
-void gfs_clear_rgrpd(struct gfs_sbd *sdp);
-
-int gfs_rindex_hold(struct gfs_sbd *sdp, struct gfs_holder *ri_gh);
-
-int gfs_rgrp_read(struct gfs_rgrpd *rgd);
-void gfs_rgrp_relse(struct gfs_rgrpd *rgd);
-
-void gfs_rgrp_lvb_fill(struct gfs_rgrpd *rgd);
-int gfs_rgrp_lvb_init(struct gfs_rgrpd *rgd);
-
-struct gfs_alloc *gfs_alloc_get(struct gfs_inode *ip);
-void gfs_alloc_put(struct gfs_inode *ip);
-
-int gfs_inplace_reserve_i(struct gfs_inode *ip,
-			 char *file, unsigned int line);
-#define gfs_inplace_reserve(ip) \
-gfs_inplace_reserve_i((ip), __FILE__, __LINE__)
-
-void gfs_inplace_release(struct gfs_inode *ip);
-
-unsigned char gfs_get_block_type(struct gfs_rgrpd *rgd, uint64_t block);
-
-void gfs_blkalloc(struct gfs_inode *ip, uint64_t *block);
-int gfs_metaalloc(struct gfs_inode *ip, uint64_t *block);
-int gfs_dialloc(struct gfs_inode *dip, uint64_t *block);
-
-void gfs_blkfree(struct gfs_inode *ip, uint64_t bstart, uint32_t blen);
-void gfs_metafree(struct gfs_inode *ip, uint64_t bstart, uint32_t blen);
-void gfs_difree_uninit(struct gfs_rgrpd *rgd, uint64_t addr);
-void gfs_difree(struct gfs_rgrpd *rgd, struct gfs_inode *ip);
-
-extern void gfs_statfs_modify(struct gfs_sbd *sdp,
-                                int64_t total,
-                                int64_t free,
-                                int64_t dinodes);
-
-/*
- * gfs_rgrp_list
- *
- * Used to collect a list of all resource groups spanned by a given
- *   inode/file/directory
- */
-struct gfs_rgrp_list {
-	unsigned int rl_rgrps;      /* # (qty) of rgrps in list (array) */
-	unsigned int rl_space;      /* Current capacity in list for rgrps */
-	struct gfs_rgrpd **rl_rgd;  /* Array of ptrs to rgrp descriptors */
-	struct gfs_holder *rl_ghs;  /* Array of glock holders for rgrps */
-};
-
-void gfs_rlist_add(struct gfs_sbd *sdp, struct gfs_rgrp_list *rlist,
-		   uint64_t block);
-void gfs_rlist_alloc(struct gfs_rgrp_list *rlist, unsigned int state,
-		     int flags);
-void gfs_rlist_free(struct gfs_rgrp_list *rlist);
-
-int gfs_reclaim_metadata(struct gfs_sbd *sdp,
-			 uint64_t *inodes,
-			 uint64_t *metadata);
-
-#endif /* __RGRP_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/super.c b/gfs-kernel/src/gfs/super.c
deleted file mode 100644
index 781350e..0000000
--- a/gfs-kernel/src/gfs/super.c
+++ /dev/null
@@ -1,1274 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <linux/vmalloc.h>
-#include <linux/statfs.h>
-
-#include "gfs.h"
-#include "dio.h"
-#include "file.h"
-#include "format.h"
-#include "glock.h"
-#include "glops.h"
-#include "inode.h"
-#include "log.h"
-#include "quota.h"
-#include "recovery.h"
-#include "rgrp.h"
-#include "super.h"
-#include "unlinked.h"
-#include "trans.h"
-
-/**
- * gfs_tune_init - Fill a gfs_tune structure with default values
- * @gt: tune
- *
- */
-
-void
-gfs_tune_init(struct gfs_tune *gt)
-{
-	spin_lock_init(&gt->gt_spin);
-
-	gt->gt_ilimit1 = 100;
-	gt->gt_ilimit1_tries = 3;
-	gt->gt_ilimit1_min = 1;
-	gt->gt_ilimit2 = 500;
-	gt->gt_ilimit2_tries = 10;
-	gt->gt_ilimit2_min = 3;
-	gt->gt_demote_secs = 300;
-	gt->gt_incore_log_blocks = 1024;
-	gt->gt_jindex_refresh_secs = 60;
-	gt->gt_depend_secs = 60;
-	gt->gt_scand_secs = 5;
-	gt->gt_recoverd_secs = 60;
-	gt->gt_logd_secs = 1;
-	gt->gt_quotad_secs = 5;
-	gt->gt_inoded_secs = 15;
-	gt->gt_glock_purge = 0;
-	gt->gt_quota_simul_sync = 64;
-	gt->gt_quota_warn_period = 10;
-	gt->gt_atime_quantum = 3600;
-	gt->gt_quota_quantum = 60;
-	gt->gt_quota_scale_num = 1;
-	gt->gt_quota_scale_den = 1;
-	gt->gt_quota_enforce = 1;
-	gt->gt_quota_account = 1;
-	gt->gt_new_files_jdata = 0;
-	gt->gt_new_files_directio = 0;
-	gt->gt_max_atomic_write = 4 << 20;
-	gt->gt_max_readahead = 1 << 18;
-	gt->gt_lockdump_size = 131072;
-	gt->gt_stall_secs = 600;
-	gt->gt_complain_secs = 10;
-	gt->gt_reclaim_limit = 5000;
-	gt->gt_entries_per_readdir = 32;
-	gt->gt_prefetch_secs = 10;
-	gt->gt_statfs_slots = 64;
-	gt->gt_max_mhc = 10000;
-	gt->gt_greedy_default = HZ / 10;
-	gt->gt_greedy_quantum = HZ / 40;
-	gt->gt_greedy_max = HZ / 4;
-	gt->gt_rgrp_try_threshold = 100;
-	gt->gt_statfs_fast = 0;
-}
-
-/**
- * gfs_check_sb - Check superblock
- * @sdp: the filesystem
- * @sb: The superblock
- * @silent: Don't print a message if the check fails
- *
- * 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.
- */
-
-int
-gfs_check_sb(struct gfs_sbd *sdp, struct gfs_sb *sb, int silent)
-{
-	unsigned int x;
-
-	if (sb->sb_header.mh_magic != GFS_MAGIC ||
-	    sb->sb_header.mh_type != GFS_METATYPE_SB) {
-		if (!silent)
-			printk("GFS: not a GFS filesystem\n");
-		return -EINVAL;
-	}
-
-	/*  If format numbers match exactly, we're done.  */
-
-	if (sb->sb_fs_format == GFS_FORMAT_FS &&
-	    sb->sb_multihost_format == GFS_FORMAT_MULTI)
-		return 0;
-
-	if (sb->sb_fs_format != GFS_FORMAT_FS) {
-		for (x = 0; gfs_old_fs_formats[x]; x++)
-			if (gfs_old_fs_formats[x] == sb->sb_fs_format)
-				break;
-
-		if (!gfs_old_fs_formats[x]) {
-			printk("GFS: code version (%u, %u) is incompatible with ondisk format (%u, %u)\n",
-			       GFS_FORMAT_FS, GFS_FORMAT_MULTI,
-			       sb->sb_fs_format, sb->sb_multihost_format);
-			printk("GFS: I don't know how to upgrade this FS\n");
-			return -EINVAL;
-		}
-	}
-
-	if (sb->sb_multihost_format != GFS_FORMAT_MULTI) {
-		for (x = 0; gfs_old_multihost_formats[x]; x++)
-			if (gfs_old_multihost_formats[x] == sb->sb_multihost_format)
-				break;
-
-		if (!gfs_old_multihost_formats[x]) {
-			printk("GFS: code version (%u, %u) is incompatible with ondisk format (%u, %u)\n",
-			     GFS_FORMAT_FS, GFS_FORMAT_MULTI,
-			       sb->sb_fs_format, sb->sb_multihost_format);
-			printk("GFS: I don't know how to upgrade this FS\n");
-			return -EINVAL;
-		}
-	}
-
-	if (!sdp->sd_args.ar_upgrade) {
-		printk("GFS: code version (%u, %u) is incompatible with ondisk format (%u, %u)\n",
-		       GFS_FORMAT_FS, GFS_FORMAT_MULTI,
-		       sb->sb_fs_format, sb->sb_multihost_format);
-		printk("GFS: Use the \"upgrade\" mount option to upgrade the FS\n");
-		printk("GFS: See the manual for more details\n");
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
-/**
- * gfs_read_sb - Read super block
- * @sdp: The GFS superblock
- * @gl: the glock for the superblock (assumed to be held)
- * @silent: Don't print message if mount fails
- *
- */
-
-int
-gfs_read_sb(struct gfs_sbd *sdp, struct gfs_glock *gl, int silent)
-{
-	struct buffer_head *bh;
-	uint32_t hash_blocks, ind_blocks, leaf_blocks;
-	uint32_t tmp_blocks;
-	unsigned int x;
-	int error;
-
-	error = gfs_dread(gl, GFS_SB_ADDR >> sdp->sd_fsb2bb_shift,
-			  DIO_FORCE | DIO_START | DIO_WAIT, &bh);
-	if (error) {
-		if (!silent)
-			printk("GFS: fsid=%s: can't read superblock\n",
-			       sdp->sd_fsname);
-		return error;
-	}
-
-	gfs_assert(sdp, sizeof(struct gfs_sb) <= bh->b_size,);
-	gfs_sb_in(&sdp->sd_sb, bh->b_data);
-	brelse(bh);
-
-	error = gfs_check_sb(sdp, &sdp->sd_sb, silent);
-	if (error)
-		return error;
-
-	sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift -
-		GFS_BASIC_BLOCK_SHIFT;
-	sdp->sd_fsb2bb = 1 << sdp->sd_fsb2bb_shift;
-	sdp->sd_diptrs = (sdp->sd_sb.sb_bsize - sizeof(struct gfs_dinode)) /
-		sizeof(uint64_t);
-	sdp->sd_inptrs = (sdp->sd_sb.sb_bsize - sizeof(struct gfs_indirect)) /
-		sizeof(uint64_t);
-	sdp->sd_jbsize = sdp->sd_sb.sb_bsize - sizeof(struct gfs_meta_header);
-	sdp->sd_hash_bsize = sdp->sd_sb.sb_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 << GFS_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 + GFS_DIR_MAX_DEPTH;
-
-	sdp->sd_max_dirres = hash_blocks + ind_blocks + leaf_blocks;
-
-	sdp->sd_heightsize[0] = sdp->sd_sb.sb_bsize - sizeof(struct gfs_dinode);
-	sdp->sd_heightsize[1] = sdp->sd_sb.sb_bsize * sdp->sd_diptrs;
-	for (x = 2;; x++) {
-		uint64_t space, d;
-		uint32_t m;
-
-		space = sdp->sd_heightsize[x - 1] * sdp->sd_inptrs;
-		d = space;
-		m = do_div(d, sdp->sd_inptrs);
-
-		if (d != sdp->sd_heightsize[x - 1] || m)
-			break;
-		sdp->sd_heightsize[x] = space;
-	}
-	sdp->sd_max_height = x;
-	gfs_assert(sdp, sdp->sd_max_height <= GFS_MAX_META_HEIGHT,);
-
-	sdp->sd_jheightsize[0] = sdp->sd_sb.sb_bsize - sizeof(struct gfs_dinode);
-	sdp->sd_jheightsize[1] = sdp->sd_jbsize * sdp->sd_diptrs;
-	for (x = 2;; x++) {
-		uint64_t space, d;
-		uint32_t m;
-
-		space = sdp->sd_jheightsize[x - 1] * sdp->sd_inptrs;
-		d = space;
-		m = do_div(d, sdp->sd_inptrs);
-
-		if (d != sdp->sd_jheightsize[x - 1] || m)
-			break;
-		sdp->sd_jheightsize[x] = space;
-	}
-	sdp->sd_max_jheight = x;
-	gfs_assert(sdp, sdp->sd_max_jheight <= GFS_MAX_META_HEIGHT,);
-
-	return 0;
-}
-
-/**
- * gfs_do_upgrade - upgrade a filesystem
- * @sdp: The GFS superblock
- *
- */
-
-int
-gfs_do_upgrade(struct gfs_sbd *sdp, struct gfs_glock *sb_gl)
-{
-	struct gfs_holder ji_gh, t_gh, j_gh;
-	struct gfs_log_header lh;
-	struct buffer_head *bh;
-	unsigned int x;
-	int error;
-
-	/*  If format numbers match exactly, we're done.  */
-
-	if (sdp->sd_sb.sb_fs_format == GFS_FORMAT_FS &&
-	    sdp->sd_sb.sb_multihost_format == GFS_FORMAT_MULTI) {
-		printk("GFS: fsid=%s: no upgrade necessary\n",
-		       sdp->sd_fsname);
-		sdp->sd_args.ar_upgrade = FALSE;
-		return 0;
-	}
-
-	error = gfs_jindex_hold(sdp, &ji_gh);
-	if (error)
-		goto fail;
-
-	error = gfs_glock_nq_init(sdp->sd_trans_gl,
-				  LM_ST_EXCLUSIVE, GL_NOCACHE,
-				  &t_gh);
-	if (error)
-		goto fail_ji_relse;
-
-	if (test_bit(SDF_ROFS, &sdp->sd_flags)) {
-		printk("GFS: fsid=%s: can't upgrade: read-only FS\n",
-		       sdp->sd_fsname);
-		error = -EROFS;
-		goto fail_gunlock_tr;
-	}
-
-	for (x = 0; x < sdp->sd_journals; x++) {
-		error = gfs_glock_nq_num(sdp,
-					 sdp->sd_jindex[x].ji_addr,
-					 &gfs_meta_glops, LM_ST_SHARED,
-					 LM_FLAG_TRY | GL_NOCACHE, &j_gh);
-		switch (error) {
-		case 0:
-			break;
-
-		case GLR_TRYFAILED:
-			printk("GFS: fsid=%s: journal %u is busy\n",
-			       sdp->sd_fsname, x);
-			error = -EBUSY;
-
-		default:
-			goto fail_gunlock_tr;
-		}
-
-		error = gfs_find_jhead(sdp, &sdp->sd_jindex[x],
-				       j_gh.gh_gl, &lh);
-
-		gfs_glock_dq_uninit(&j_gh);
-
-		if (error)
-			goto fail_gunlock_tr;
-
-		if (!(lh.lh_flags & GFS_LOG_HEAD_UNMOUNT) || lh.lh_last_dump) {
-			printk("GFS: fsid=%s: journal %u is busy\n",
-			       sdp->sd_fsname, x);
-			error = -EBUSY;
-			goto fail_gunlock_tr;
-		}
-	}
-
-	/* We don't need to journal this change because we're changing
-	   only one sector of one block.  We definitely don't want to have
-	   the journaling code running at this point. */
-
-	error = gfs_dread(sb_gl, GFS_SB_ADDR >> sdp->sd_fsb2bb_shift,
-			  DIO_START | DIO_WAIT, &bh);
-	if (error)
-		goto fail_gunlock_tr;
-
-	gfs_sb_in(&sdp->sd_sb, bh->b_data);
-
-	error = gfs_check_sb(sdp, &sdp->sd_sb, FALSE);
-	if (error) {
-		gfs_consist(sdp);
-		brelse(bh);
-		goto fail_gunlock_tr;
-	}
-
-	sdp->sd_sb.sb_fs_format = GFS_FORMAT_FS;
-	sdp->sd_sb.sb_multihost_format = GFS_FORMAT_MULTI;
-
-	gfs_sb_out(&sdp->sd_sb, bh->b_data);
-
-	set_bit(GLF_DIRTY, &sb_gl->gl_flags);
-	error = gfs_dwrite(sdp, bh, DIO_DIRTY | DIO_START | DIO_WAIT);
-
-	brelse(bh);
-
-	gfs_glock_dq_uninit(&t_gh);
-
-	gfs_glock_dq_uninit(&ji_gh);
-
-	if (!error) {
-		printk("GFS: fsid=%s: upgrade successful\n",
-		       sdp->sd_fsname);
-		sdp->sd_args.ar_upgrade = FALSE;
-	}
-
-	return error;
-
- fail_gunlock_tr:
-	gfs_glock_dq_uninit(&t_gh);
-
- fail_ji_relse:
-	gfs_glock_dq_uninit(&ji_gh);
-
- fail:
-	if (error == -EBUSY)
-		printk("GFS: fsid=%s: can't upgrade: the FS is still busy or contains dirty journals\n",
-		       sdp->sd_fsname);
-	else
-		printk("GFS: fsid=%s: can't upgrade: %d\n",
-		       sdp->sd_fsname, error);
-
-	return error;
-}
-
-/**
- * clear_journalsi - Clear all the journal index information (without locking)
- * @sdp: The GFS superblock
- *
- */
-
-static void
-clear_journalsi(struct gfs_sbd *sdp)
-{
-	if (sdp->sd_jindex) {
-		kfree(sdp->sd_jindex);
-		sdp->sd_jindex = NULL;
-	}
-	sdp->sd_journals = 0;
-}
-
-/**
- * gfs_clear_journals - Clear all the journal index information
- * @sdp: The GFS superblock
- *
- */
-
-void
-gfs_clear_journals(struct gfs_sbd *sdp)
-{
-	down(&sdp->sd_jindex_lock);
-	clear_journalsi(sdp);
-	up(&sdp->sd_jindex_lock);
-}
-
-/**
- * gfs_ji_update - Update the journal index information
- * @ip: The journal index inode
- *
- * Returns: errno
- */
-
-static int
-gfs_ji_update(struct gfs_inode *ip)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	char buf[sizeof(struct gfs_jindex)];
-	unsigned int j;
-	int error;
-
-	if (do_mod(ip->i_di.di_size, sizeof(struct gfs_jindex))) {
-		gfs_consist_inode(ip);
-		return -EIO;
-	}
-
-	clear_journalsi(sdp);
-
-	sdp->sd_jindex = kmalloc(ip->i_di.di_size, GFP_KERNEL);
-	if (!sdp->sd_jindex)
-		return -ENOMEM;
-	memset(sdp->sd_jindex, 0, ip->i_di.di_size);
-
-	for (j = 0;; j++) {
-		error = gfs_internal_read(ip, buf,
-					  j * sizeof(struct gfs_jindex),
-					  sizeof(struct gfs_jindex));
-		if (!error)
-			break;
-		if (error != sizeof(struct gfs_jindex)) {
-			if (error > 0)
-				error = -EIO;
-			goto fail;
-		}
-
-		gfs_jindex_in(sdp->sd_jindex + j, buf);
-	}
-
-	sdp->sd_journals = j;
-	sdp->sd_jiinode_vn = ip->i_gl->gl_vn;
-
-	return 0;
-
- fail:
-	clear_journalsi(sdp);
-	return error;
-}
-
-/**
- * gfs_jindex_hold - Grab a lock on the jindex
- * @sdp: The GFS superblock
- * @ji_gh: the holder for the jindex glock
- *
- * This makes sure that we're using the latest copy of the journal index
- *   special file (this describes all of the journals for this filesystem),
- *   which might have been updated if someone added journals
- *   (via gfs_jadd utility).
- *
- * This is very similar to the gfs_rindex_hold() function, except that
- * in general we hold the jindex lock for longer periods of time and
- * we grab it far less frequently (in general) then the rgrp lock.
- *
- * Returns: errno
- */
-
-int
-gfs_jindex_hold(struct gfs_sbd *sdp, struct gfs_holder *ji_gh)
-{
-	struct gfs_inode *ip = sdp->sd_jiinode;
-	struct gfs_glock *gl = ip->i_gl;
-	int error;
-
-	error = gfs_glock_nq_init(gl, LM_ST_SHARED, 0, ji_gh);
-	if (error)
-		return error;
-
-	/* Read new copy from disk if we don't have the latest */
-	if (sdp->sd_jiinode_vn != gl->gl_vn) {
-		down(&sdp->sd_jindex_lock);
-		if (sdp->sd_jiinode_vn != gl->gl_vn)
-			error = gfs_ji_update(ip);
-		up(&sdp->sd_jindex_lock);
-	}
-
-	if (error)
-		gfs_glock_dq_uninit(ji_gh);
-
-	return error;
-}
-
-/**
- * gfs_get_jiinode - Read-in the special (hidden) journal index inode
- * @sdp: The GFS superblock
- *
- * Returns: errno
- *
- * This reads-in just the dinode, not the special file contents that describe
- *   the journals themselves (see gfs_jindex_hold()).
- */
-
-int
-gfs_get_jiinode(struct gfs_sbd *sdp)
-{
-	struct gfs_holder ji_gh;
-	int error;
-
-	error = gfs_glock_nq_num(sdp,
-				 sdp->sd_sb.sb_jindex_di.no_formal_ino,
-				 &gfs_inode_glops,
-				 LM_ST_SHARED, GL_LOCAL_EXCL,
-				 &ji_gh);
-	if (error)
-		return error;
-
-	error = gfs_inode_get(ji_gh.gh_gl, &sdp->sd_sb.sb_jindex_di,
-			      CREATE, &sdp->sd_jiinode);
-	if (!error) {
-		sdp->sd_jiinode_vn = ji_gh.gh_gl->gl_vn - 1;
-		set_bit(GLF_STICKY, &ji_gh.gh_gl->gl_flags);
-	}
-
-	gfs_glock_dq_uninit(&ji_gh);
-
-	return error;
-}
-
-/**
- * gfs_get_riinode - Read in the special (hidden) resource group index inode
- * @sdp: The GFS superblock
- *
- * Returns: errno
- *
- * This reads-in just the dinode, not the special file contents that describe
- *   the resource groups themselves (see gfs_rindex_hold()).
- */
-
-int
-gfs_get_riinode(struct gfs_sbd *sdp)
-{
-	struct gfs_holder ri_gh;
-	int error;
-
-	error = gfs_glock_nq_num(sdp,
-				 sdp->sd_sb.sb_rindex_di.no_formal_ino,
-				 &gfs_inode_glops,
-				 LM_ST_SHARED, GL_LOCAL_EXCL,
-				 &ri_gh);
-	if (error)
-		return error;
-
-	error = gfs_inode_get(ri_gh.gh_gl, &sdp->sd_sb.sb_rindex_di,
-			      CREATE, &sdp->sd_riinode);
-	if (!error) {
-		sdp->sd_riinode_vn = ri_gh.gh_gl->gl_vn - 1;
-		set_bit(GLF_STICKY, &ri_gh.gh_gl->gl_flags);
-	}
-
-	gfs_glock_dq_uninit(&ri_gh);
-
-	return error;
-}
-
-/**
- * gfs_get_rootinode - Read in the filesystem's root inode
- * @sdp: The GFS superblock
- *
- * Returns: errno
- */
-
-int
-gfs_get_rootinode(struct gfs_sbd *sdp)
-{
-	struct gfs_holder i_gh;
-	int error;
-
-	error = gfs_glock_nq_num(sdp,
-				 sdp->sd_sb.sb_root_di.no_formal_ino,
-				 &gfs_inode_glops,
-				 LM_ST_SHARED, GL_LOCAL_EXCL,
-				 &i_gh);
-	if (error)
-		return error;
-
-	error = gfs_inode_get(i_gh.gh_gl, &sdp->sd_sb.sb_root_di,
-			      CREATE, &sdp->sd_rooti);
-
-	gfs_glock_dq_uninit(&i_gh);
-
-	return error;
-}
-
-/**
- * gfs_get_qinode - Read in the special (hidden) quota inode
- * @sdp: The GFS superblock
- *
- * If one is not on-disk already, create a new one.
- * Does not read in file contents, just the dinode.
- *
- * Returns: errno
- */
-
-int
-gfs_get_qinode(struct gfs_sbd *sdp)
-{
-	struct gfs_holder i_gh;
-	int error;
-
-	/* Create, if not on-disk already */
-	if (!sdp->sd_sb.sb_quota_di.no_formal_ino) {
-		error = gfs_alloc_qinode(sdp);
-		if (error)
-			return error;
-	}
-
-	error = gfs_glock_nq_num(sdp,
-				 sdp->sd_sb.sb_quota_di.no_formal_ino,
-				 &gfs_inode_glops,
-				 LM_ST_SHARED, GL_LOCAL_EXCL,
-				 &i_gh);
-	if (error)
-		return error;
-
-	error = gfs_inode_get(i_gh.gh_gl, &sdp->sd_sb.sb_quota_di,
-			      CREATE, &sdp->sd_qinode);
-
-	gfs_glock_dq_uninit(&i_gh);
-
-	return error;
-}
-
-/**
- * gfs_get_linode - Read in the special (hidden) license inode
- * @sdp: The GFS superblock
- *
- * If one is not on-disk already, create a new one.
- * Does not read in file contents, just the dinode.
- *
- * Returns: errno
- */
-
-int
-gfs_get_linode(struct gfs_sbd *sdp)
-{
-	struct gfs_holder i_gh;
-	int error;
-
-	/* Create, if not on-disk already */
-	if (!sdp->sd_sb.sb_license_di.no_formal_ino) {
-		error = gfs_alloc_linode(sdp);
-		if (error)
-			return error;
-	}
-
-	error = gfs_glock_nq_num(sdp,
-				 sdp->sd_sb.sb_license_di.no_formal_ino,
-				 &gfs_inode_glops,
-				 LM_ST_SHARED, GL_LOCAL_EXCL,
-				 &i_gh);
-	if (error)
-		return error;
-
-	/* iopen obtained in via  gfs_glock_get(..gfs_iopen_glops) */
-	error = gfs_inode_get(i_gh.gh_gl, &sdp->sd_sb.sb_license_di,
-			      CREATE, &sdp->sd_linode);
-
-	gfs_glock_dq_uninit(&i_gh);
-
-	return error;
-}
-
-/**
- * gfs_make_fs_rw - Turn a Read-Only FS into a Read-Write one
- * @sdp: the filesystem
- *
- * Returns: errno
- */
-
-int
-gfs_make_fs_rw(struct gfs_sbd *sdp)
-{
-	struct gfs_glock *j_gl = sdp->sd_journal_gh.gh_gl;
-	struct gfs_holder t_gh;
-	struct gfs_log_header head;
-	int error;
-
-	error = gfs_glock_nq_init(sdp->sd_trans_gl,
-				  LM_ST_SHARED,
-				  GL_LOCAL_EXCL | GL_EXACT,
-				  &t_gh);
-	if (error)
-		return error;
-
-	j_gl->gl_ops->go_inval(j_gl, DIO_METADATA | DIO_DATA);
-
-	error = gfs_find_jhead(sdp, &sdp->sd_jdesc, j_gl, &head);
-	if (error)
-		goto fail;
-
-	if (!(head.lh_flags & GFS_LOG_HEAD_UNMOUNT)) {
-		gfs_consist(sdp);
-		error = -EIO;
-		goto fail;
-	}
-
-	/*  Initialize some head of the log stuff  */
-	sdp->sd_sequence = head.lh_sequence;
-	sdp->sd_log_head = head.lh_first + 1;
-
-	error = gfs_recover_dump(sdp);
-	if (error)
-		goto fail;
-
-	set_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
-	clear_bit(SDF_ROFS, &sdp->sd_flags);
-
-	set_bit(GLF_DIRTY, &j_gl->gl_flags);
-	gfs_log_dump(sdp, TRUE);
-
-	gfs_glock_dq_uninit(&t_gh);
-
-	return 0;
-
- fail:
-	t_gh.gh_flags |= GL_NOCACHE;
-	gfs_glock_dq_uninit(&t_gh);
-
-	return error;
-}
-
-/**
- * gfs_make_fs_ro - Turn a Read-Write FS into a Read-Only one
- * @sdp: the filesystem
- *
- * Returns: errno
- */
-
-int
-gfs_make_fs_ro(struct gfs_sbd *sdp)
-{
-	struct gfs_holder t_gh;
-	int error;
-
-	error = gfs_glock_nq_init(sdp->sd_trans_gl,
-				  LM_ST_SHARED,
-				  GL_LOCAL_EXCL | GL_EXACT | GL_NOCACHE,
-				  &t_gh);
-	if (error &&
-	    !test_bit(SDF_SHUTDOWN, &sdp->sd_flags))
-		return error;
-
-	gfs_statfs_sync(sdp);
-
-	gfs_log_flush(sdp);
-	gfs_quota_sync(sdp);
-	gfs_quota_scan(sdp);
-
-	gfs_sync_meta(sdp);
-	gfs_log_dump(sdp, TRUE);
-	gfs_log_shutdown(sdp);
-
-	set_bit(SDF_ROFS, &sdp->sd_flags);
-	clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
-
-	if (t_gh.gh_gl)
-		gfs_glock_dq_uninit(&t_gh);
-
-	gfs_unlinked_cleanup(sdp);
-	gfs_quota_cleanup(sdp);
-
-	return error;
-}
-
-/**
- * stat_gfs_fill - fill in the sg for a given RG
- * @rgd: the RG
- * @sg: the sg structure
- *
- * Returns: 0 on success, -ESTALE if the LVB is invalid
- */
-
-static int
-stat_gfs_fill(struct gfs_rgrpd *rgd, struct gfs_stat_gfs *sg)
-{
-	struct gfs_rgrp_lvb *rb = (struct gfs_rgrp_lvb *)rgd->rd_gl->gl_lvb;
-
-	if (gfs32_to_cpu(rb->rb_magic) != GFS_MAGIC)
-		return -ESTALE;
-
-	sg->sg_total_blocks += rgd->rd_ri.ri_data;
-	sg->sg_free += gfs32_to_cpu(rb->rb_free);
-	sg->sg_used_dinode += gfs32_to_cpu(rb->rb_useddi);
-	sg->sg_free_dinode += gfs32_to_cpu(rb->rb_freedi);
-	sg->sg_used_meta += gfs32_to_cpu(rb->rb_usedmeta);
-	sg->sg_free_meta += gfs32_to_cpu(rb->rb_freemeta);
-
-	return 0;
-}
-
-/**
- * stat_gfs_async - Stat a filesystem using asynchronous locking
- * @sdp: the filesystem
- * @sg: the sg info that will be returned
- * @interruptible: TRUE if we should look for signals.
- *
- * Any error (other than a signal) will cause this routine to fall back
- * to the synchronous version.
- *
- * FIXME: This really shouldn't busy wait like this.
- *
- * Returns: errno
- */
-
-static int
-stat_gfs_async(struct gfs_sbd *sdp, struct gfs_stat_gfs *sg, int interruptible)
-{
-	struct gfs_rgrpd *rgd_next = gfs_rgrpd_get_first(sdp);
-	struct gfs_holder *gha, *gh;
-	unsigned int slots = gfs_tune_get(sdp, gt_statfs_slots);
-	unsigned int x;
-	int done;
-	int error = 0, err;
-
-	memset(sg, 0, sizeof(struct gfs_stat_gfs));
-
-	gha = vmalloc(slots * sizeof(struct gfs_holder));
-	if (!gha)
-		return -ENOMEM;
-	memset(gha, 0, slots * sizeof(struct gfs_holder));
-
-	for (;;) {
-		done = TRUE;
-
-		for (x = 0; x < slots; x++) {
-			gh = gha + x;
-
-			if (gh->gh_gl && gfs_glock_poll(gh)) {
-				err = gfs_glock_wait(gh);
-				if (err) {
-					gfs_holder_uninit(gh);
-					error = err;
-				} else {
-					if (!error)
-						error = stat_gfs_fill(get_gl2rgd(gh->gh_gl), sg);
-					gfs_glock_dq_uninit(gh);
-				}
-			}
-
-			if (gh->gh_gl)
-				done = FALSE;
-			else if (rgd_next && !error) {
-				error = gfs_glock_nq_init(rgd_next->rd_gl,
-							  LM_ST_SHARED,
-							  GL_LOCAL_EXCL | GL_SKIP | GL_ASYNC,
-							  gh);
-				rgd_next = gfs_rgrpd_get_next(rgd_next);
-				done = FALSE;
-			}
-
-			if (interruptible && signal_pending(current))
-				error = -ERESTARTSYS;
-		}
-
-		if (done)
-			break;
-
-		yield();
-	}
-
-	vfree(gha);
-
-	return error;
-}
-
-/**
- * stat_gfs_sync - Stat a filesystem using synchronous locking
- * @sdp: the filesystem
- * @sg: the sg info that will be returned
- * @interruptible: TRUE if we should look for signals.
- *
- * Returns: errno
- */
-
-static int
-stat_gfs_sync(struct gfs_sbd *sdp, struct gfs_stat_gfs *sg, int interruptible)
-{
-	struct gfs_holder rgd_gh;
-	struct gfs_rgrpd *rgd;
-	int error;
-
-	memset(sg, 0, sizeof(struct gfs_stat_gfs));
-
-	for (rgd = gfs_rgrpd_get_first(sdp);
-	     rgd;
-	     rgd = gfs_rgrpd_get_next(rgd)) {
-		for (;;) {
-			error = gfs_glock_nq_init(rgd->rd_gl,
-						  LM_ST_SHARED,
-						  GL_LOCAL_EXCL | GL_SKIP,
-						  &rgd_gh);
-			if (error)
-				return error;
-
-			error = stat_gfs_fill(rgd, sg);
-			
-			gfs_glock_dq_uninit(&rgd_gh);
-
-			if (!error)
-				break;
-
-			error = gfs_rgrp_lvb_init(rgd);
-			if (error)
-				return error;
-		}
-
-		if (interruptible && signal_pending(current))
-			return -ERESTARTSYS;
-	}
-
-	return 0;
-}
-
-/**
- * gfs_stat_gfs - Do a statfs
- * @sdp: the filesystem
- * @sg: the sg structure
- * @interruptible:  Stop if there is a signal pending
- *
- * Returns: errno
- */
-
-int
-gfs_stat_gfs(struct gfs_sbd *sdp, struct gfs_stat_gfs *sg, int interruptible)
-{
-	struct gfs_holder ri_gh;
-	int error;
-
-	error = gfs_rindex_hold(sdp, &ri_gh);
-	if (error)
-		return error;
-
-	error = stat_gfs_async(sdp, sg, interruptible);
-	if (error == -ESTALE)
-		error = stat_gfs_sync(sdp, sg, interruptible);
-
-	gfs_glock_dq_uninit(&ri_gh);
-
-	return error;
-}
-
-/**
- * gfs_lock_fs_check_clean - Stop all writes to the FS and check that all journals are clean
- * @sdp: the file system
- * @state: the state to put the transaction lock into
- * @t_gh: the hold on the transaction lock
- *
- * Returns: errno
- */
-
-int
-gfs_lock_fs_check_clean(struct gfs_sbd *sdp, unsigned int state,
-			struct gfs_holder *t_gh)
-{
-	struct gfs_holder ji_gh, cl_gh;
-	struct gfs_log_header lh;
-	unsigned int x;
-	int error;
-
-	error = gfs_jindex_hold(sdp, &ji_gh);
-	if (error)
-		return error;
-
-	error = gfs_glock_nq_num(sdp,
-				 GFS_CRAP_LOCK, &gfs_meta_glops,
-				 LM_ST_SHARED, GL_NOCACHE,
-				 &cl_gh);
-	if (error)
-		goto fail;
-
-	error = gfs_glock_nq_init(sdp->sd_trans_gl, state,
-				  LM_FLAG_PRIORITY | GL_EXACT | GL_NOCACHE,
-				  t_gh);
-	if (error)
-		goto fail_gunlock_craplock;
-
-	for (x = 0; x < sdp->sd_journals; x++) {
-		error = gfs_find_jhead(sdp, &sdp->sd_jindex[x],
-				       cl_gh.gh_gl, &lh);
-		if (error)
-			goto fail_gunlock_trans;
-
-		if (!(lh.lh_flags & GFS_LOG_HEAD_UNMOUNT)) {
-			error = -EBUSY;
-			goto fail_gunlock_trans;
-		}
-	}
-
-	gfs_glock_dq_uninit(&cl_gh);
-	gfs_glock_dq_uninit(&ji_gh);
-
-	return 0;
-
- fail_gunlock_trans:
-	gfs_glock_dq_uninit(t_gh);
-
- fail_gunlock_craplock:
-	gfs_glock_dq_uninit(&cl_gh);
-
- fail:
-	gfs_glock_dq_uninit(&ji_gh);
-
-	return error;
-}
-
-/**
- * gfs_freeze_fs - freezes the file system
- * @sdp: the file system
- *
- * This function flushes data and meta data for all machines by
- * aquiring the transaction log exclusively.  All journals are
- * ensured to be in a clean state as well.
- *
- * Returns: errno
- */
-
-int
-gfs_freeze_fs(struct gfs_sbd *sdp)
-{
-	int error = 0;
-
-	down(&sdp->sd_freeze_lock);
-
-	if (!sdp->sd_freeze_count++) {
-		error = gfs_lock_fs_check_clean(sdp, LM_ST_DEFERRED,
-						&sdp->sd_freeze_gh);
-		if (error)
-			sdp->sd_freeze_count--;
-		else
-			sdp->sd_freeze_gh.gh_owner = NULL;
-	}
-
-	up(&sdp->sd_freeze_lock);
-
-	return error;
-}
-
-/**
- * gfs_unfreeze_fs - unfreezes the file system
- * @sdp: the file system
- *
- * This function allows the file system to proceed by unlocking
- * the exclusively held transaction lock.  Other GFS nodes are
- * now free to acquire the lock shared and go on with their lives.
- *
- */
-
-void
-gfs_unfreeze_fs(struct gfs_sbd *sdp)
-{
-	down(&sdp->sd_freeze_lock);
-
-	if (sdp->sd_freeze_count && !--sdp->sd_freeze_count)
-		gfs_glock_dq_uninit(&sdp->sd_freeze_gh);
-
-	up(&sdp->sd_freeze_lock);
-}
-
-/*
- * Fast statfs implementation - mostly based on GFS2 implementation.
- */
-
-void gfs_statfs_change_in(struct gfs_statfs_change_host *sc, const void *buf)
-{
-	const struct gfs_statfs_change *str = buf;
-
-	sc->sc_total = be64_to_cpu(str->sc_total);
-	sc->sc_free = be64_to_cpu(str->sc_free);
-	sc->sc_dinodes = be64_to_cpu(str->sc_dinodes);
-}
-
-void gfs_statfs_change_out(const struct gfs_statfs_change_host *sc, void *buf)
-{
-	struct gfs_statfs_change *str = buf;
-
-	str->sc_total = cpu_to_be64(sc->sc_total);
-	str->sc_free = cpu_to_be64(sc->sc_free);
-	str->sc_dinodes = cpu_to_be64(sc->sc_dinodes);
-}
-
-int gfs_statfs_start(struct gfs_sbd *sdp)
-{
-	struct gfs_stat_gfs sg;
-	struct gfs_inode *m_ip;
-	struct gfs_statfs_change_host *m_sc = &sdp->sd_statfs_master;
-	struct gfs_statfs_change_host *l_sc = &sdp->sd_statfs_local;
-	struct buffer_head *m_bh;
-	struct gfs_holder gh;
-	int error;
-
-	printk("GFS: fsid=%s: fast statfs start time = %lu\n",
-                       sdp->sd_fsname, get_seconds());
-
-	/* created via gfs_get_linode() in fill_super(). */
-	/* gfs_inode_glops */
-	m_ip = sdp->sd_linode;
-
-	/* get real statistics */ 
-	error = gfs_stat_gfs(sdp, &sg, TRUE);
-        if (error)
-                return error;
-
-	/* make sure the page is refreshed via glock flushing */
-	error = gfs_glock_nq_init(m_ip->i_gl, LM_ST_EXCLUSIVE, GL_NOCACHE, 
-					&gh);
-	if (error)
-		goto gfs_statfs_start_out;
-
-	error = gfs_get_inode_buffer(m_ip, &m_bh);
-	if (error)
-		goto gfs_statfs_start_unlock;
-
-	error = gfs_trans_begin(sdp, 1, 0);
-	if (error)
-		goto gfs_statfs_start_bh;
-
-	spin_lock(&sdp->sd_statfs_spin);
-	m_sc->sc_total = sg.sg_total_blocks;
-	m_sc->sc_free = sg.sg_free + sg.sg_free_dinode + sg.sg_free_meta;
-	m_sc->sc_dinodes = sg.sg_used_dinode;
-	memset(l_sc, 0, sizeof(struct gfs_statfs_change_host));
-	spin_unlock(&sdp->sd_statfs_spin);
-
-	gfs_trans_add_bh(m_ip->i_gl, m_bh);
-	gfs_statfs_change_out(m_sc, m_bh->b_data + sizeof(struct gfs_dinode));
-
-	gfs_trans_end(sdp);
-
-gfs_statfs_start_bh:
-	brelse(m_bh);
-
-gfs_statfs_start_unlock:
-	gfs_glock_dq_uninit(&gh);
-
-gfs_statfs_start_out:
-	return 0;
-}
-
-int gfs_statfs_init(struct gfs_sbd *sdp, int flag)
-{
-	int error;
-
-	/* if flag == 0, do we want to turn this off ?  */
-	if (!flag)
-		return 0;
-
-	error = gfs_statfs_start(sdp);
-	if (error) 
-		printk("GFS: fsid=%s: can't initialize statfs subsystem: %d\n",
-			sdp->sd_fsname, error);
-
-	return error;
-}
-
-void gfs_statfs_modify(struct gfs_sbd *sdp, 
-			int64_t total, 
-			int64_t free,
-			int64_t dinodes)
-{
-	struct gfs_statfs_change_host *l_sc = &sdp->sd_statfs_local;
-
-	spin_lock(&sdp->sd_statfs_spin);
-	l_sc->sc_total += total;
-	l_sc->sc_free += free;
-	l_sc->sc_dinodes += dinodes;
-	spin_unlock(&sdp->sd_statfs_spin);
-}
-
-int gfs_statfs_sync(struct gfs_sbd *sdp)
-{
-	struct gfs_inode *m_ip = sdp->sd_linode;
-	struct gfs_statfs_change_host *m_sc = &sdp->sd_statfs_master;
-	struct gfs_statfs_change_host *l_sc = &sdp->sd_statfs_local;
-	struct gfs_holder gh;
-	struct buffer_head *m_bh;
-	int error;
-
-	error = gfs_glock_nq_init(m_ip->i_gl, LM_ST_EXCLUSIVE, GL_NOCACHE,
-				&gh);
-	if (error)
-		return error;
-
-	error = gfs_get_inode_buffer(m_ip, &m_bh);
-	if (error)
-		goto gfs_statfs_sync_out;
-
-	/* if no change, simply return */
-	spin_lock(&sdp->sd_statfs_spin);
-        gfs_statfs_change_in(m_sc, m_bh->b_data +
-                              sizeof(struct gfs_dinode));
-	if (!l_sc->sc_total && !l_sc->sc_free && !l_sc->sc_dinodes) {
-		spin_unlock(&sdp->sd_statfs_spin);
-		goto out_bh;
-	}
-	spin_unlock(&sdp->sd_statfs_spin);
-
-	error = gfs_trans_begin(sdp, 1, 0);
-	if (error)
-		goto out_bh;
-
-	spin_lock(&sdp->sd_statfs_spin);
-	m_sc->sc_total += l_sc->sc_total;
-	m_sc->sc_free += l_sc->sc_free;
-	m_sc->sc_dinodes += l_sc->sc_dinodes;
-	memset(l_sc, 0, sizeof(struct gfs_statfs_change_host));
-	spin_unlock(&sdp->sd_statfs_spin);
-
-	gfs_trans_add_bh(m_ip->i_gl, m_bh);
-	gfs_statfs_change_out(m_sc, m_bh->b_data + sizeof(struct gfs_dinode));
-
-	gfs_trans_end(sdp);
-
-out_bh:
-	brelse(m_bh);
-
-gfs_statfs_sync_out:
-	gfs_glock_dq_uninit(&gh);
-	return error;
-}
-
-int gfs_statfs_fast(struct gfs_sbd *sdp, void *b)
-{
-	struct kstatfs *buf = (struct kstatfs *)b;
-	struct gfs_statfs_change_host sc, *m_sc = &sdp->sd_statfs_master;
-	struct gfs_statfs_change_host *l_sc = &sdp->sd_statfs_local;
-
-	spin_lock(&sdp->sd_statfs_spin);
-
-	sc.sc_total   = m_sc->sc_total + l_sc->sc_total;
-	sc.sc_free    = m_sc->sc_free + l_sc->sc_free;
-	sc.sc_dinodes = m_sc->sc_dinodes + l_sc->sc_dinodes;
-	spin_unlock(&sdp->sd_statfs_spin);
-
-	if (sc.sc_free < 0)
-		sc.sc_free = 0;
-	if (sc.sc_free > sc.sc_total)
-		sc.sc_free = sc.sc_total;
-	if (sc.sc_dinodes < 0)
-		sc.sc_dinodes = 0;
-
-	/* fill in the statistics */
-	memset(buf, 0, sizeof(struct kstatfs));
-
-	buf->f_type = GFS_MAGIC; buf->f_bsize = sdp->sd_sb.sb_bsize;
-	buf->f_blocks = sc.sc_total;
-	buf->f_bfree = sc.sc_free;
-	buf->f_bavail = sc.sc_free;
-	buf->f_files = sc.sc_dinodes + sc.sc_free;
-	buf->f_ffree = sc.sc_free;
-	buf->f_namelen = GFS_FNAMESIZE;
-
-	return 0;
-}
diff --git a/gfs-kernel/src/gfs/super.h b/gfs-kernel/src/gfs/super.h
deleted file mode 100644
index 4156f33..0000000
--- a/gfs-kernel/src/gfs/super.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef __SUPER_DOT_H__
-#define __SUPER_DOT_H__
-
-void gfs_tune_init(struct gfs_tune *gt);
-
-int gfs_check_sb(struct gfs_sbd *sdp, struct gfs_sb *sb, int silent);
-int gfs_read_sb(struct gfs_sbd *sdp, struct gfs_glock *gl, int silent);
-int gfs_do_upgrade(struct gfs_sbd *sdp, struct gfs_glock *gl_sb);
-
-static __inline__ unsigned int
-gfs_num_journals(struct gfs_sbd *sdp)
-{
-	unsigned int num;
-	down(&sdp->sd_jindex_lock);
-	num = sdp->sd_journals;
-	up(&sdp->sd_jindex_lock);
-	return num;
-}
-
-int gfs_jindex_hold(struct gfs_sbd *sdp, struct gfs_holder *ji_gh);
-void gfs_clear_journals(struct gfs_sbd *sdp);
-
-int gfs_get_jiinode(struct gfs_sbd *sdp);
-int gfs_get_riinode(struct gfs_sbd *sdp);
-int gfs_get_rootinode(struct gfs_sbd *sdp);
-int gfs_get_qinode(struct gfs_sbd *sdp);
-int gfs_get_linode(struct gfs_sbd *sdp);
-
-int gfs_make_fs_rw(struct gfs_sbd *sdp);
-int gfs_make_fs_ro(struct gfs_sbd *sdp);
-
-int gfs_statfs_init(struct gfs_sbd *sdp, int flag);
-int gfs_statfs_sync(struct gfs_sbd *sdp);
-int gfs_statfs_fast(struct gfs_sbd *sdp, void *buf);
-
-struct gfs_stat_gfs {
-	uint64_t sg_total_blocks;
-	uint64_t sg_free;
-	uint64_t sg_used_dinode;
-	uint64_t sg_free_dinode;
-	uint64_t sg_used_meta;
-	uint64_t sg_free_meta;
-};
-
-int gfs_stat_gfs(struct gfs_sbd *sdp, struct gfs_stat_gfs *sg,
-		 int interruptible);
-
-int gfs_lock_fs_check_clean(struct gfs_sbd *sdp, unsigned int state,
-			    struct gfs_holder *t_gh);
-int gfs_freeze_fs(struct gfs_sbd *sdp);
-void gfs_unfreeze_fs(struct gfs_sbd *sdp);
-
-#endif /* __SUPER_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/sys.c b/gfs-kernel/src/gfs/sys.c
deleted file mode 100644
index d0d4b07..0000000
--- a/gfs-kernel/src/gfs/sys.c
+++ /dev/null
@@ -1,128 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <linux/proc_fs.h>
-#include <linux/module.h>
-#include <asm/uaccess.h>
-
-#include "gfs.h"
-#include "glock.h"
-#include "lm.h"
-#include "sys.h"
-#include "super.h"
-
-char *gfs_sys_margs;
-spinlock_t gfs_sys_margs_lock;
-
-static ssize_t id_show(struct gfs_sbd *sdp, char *buf)
-{
-	return sprintf(buf, "%s\n", sdp->sd_vfs->s_id);
-}
-
-static ssize_t fsname_show(struct gfs_sbd *sdp, char *buf)
-{
-	return sprintf(buf, "%s\n", sdp->sd_fsname);
-}
-
-struct gfs_attr {
-	struct attribute attr;
-	ssize_t (*show)(struct gfs_sbd *, char *);
-	ssize_t (*store)(struct gfs_sbd *, const char *, size_t);
-};
-
-#define GFS_ATTR(name, mode, show, store) \
-static struct gfs_attr gfs_attr_##name = __ATTR(name, mode, show, store)
-
-GFS_ATTR(id,                  0444, id_show,       NULL);
-GFS_ATTR(fsname,              0444, fsname_show,   NULL);
-
-static struct attribute *gfs_attrs[] = {
-	&gfs_attr_id.attr,
-	&gfs_attr_fsname.attr,
-	NULL,
-};
-
-static ssize_t gfs_attr_show(struct kobject *kobj, struct attribute *attr,
-			      char *buf)
-{
-	struct gfs_sbd *sdp = container_of(kobj, struct gfs_sbd, sd_kobj);
-	struct gfs_attr *a = container_of(attr, struct gfs_attr, attr);
-	return a->show ? a->show(sdp, buf) : 0;
-}
-
-static ssize_t gfs_attr_store(struct kobject *kobj, struct attribute *attr,
-			       const char *buf, size_t len)
-{
-	struct gfs_sbd *sdp = container_of(kobj, struct gfs_sbd, sd_kobj);
-	struct gfs_attr *a = container_of(attr, struct gfs_attr, attr);
-	return a->store ? a->store(sdp, buf, len) : len;
-}
-
-static struct sysfs_ops gfs_attr_ops = {
-	.show  = gfs_attr_show,
-	.store = gfs_attr_store,
-};
-
-static struct kobj_type gfs_ktype = {
-	.default_attrs = gfs_attrs,
-	.sysfs_ops     = &gfs_attr_ops,
-};
-
-static struct kset *gfs_kset;
-
-int gfs_sys_fs_add(struct gfs_sbd *sdp)
-{
-	int error;
-
-	sdp->sd_kobj.kset = gfs_kset;
-
-	error = kobject_init_and_add(&sdp->sd_kobj, &gfs_ktype, NULL,
-				     "%s", sdp->sd_table_name);
-	if (error)
-		goto fail;
-
-	kobject_uevent(&sdp->sd_kobj, KOBJ_ADD);
-
-	return 0;
-
- fail:
-	return error;
-}
-
-void gfs_sys_fs_del(struct gfs_sbd *sdp)
-{
-	kobject_put(&sdp->sd_kobj);
-}
-
-static int gfs_uevent(struct kset *kset, struct kobject *kobj,
-		       struct kobj_uevent_env *env)
-{
-	struct gfs_sbd *sdp = container_of(kobj, struct gfs_sbd, sd_kobj);
-	add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name);
-	add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
-	return 0;
-}
-
-static struct kset_uevent_ops gfs_uevent_ops = {
-	.uevent = gfs_uevent,
-};
-
-int gfs_sys_init(void)
-{
-	gfs_sys_margs = NULL;
-	spin_lock_init(&gfs_sys_margs_lock);
-	gfs_kset = kset_create_and_add("gfs", &gfs_uevent_ops, fs_kobj);
-	if (!gfs_kset)
-		return -ENOMEM;
-	return 0;
-}
-
-void gfs_sys_uninit(void)
-{
-	kfree(gfs_sys_margs);
-	kset_unregister(gfs_kset);
-}
diff --git a/gfs-kernel/src/gfs/sys.h b/gfs-kernel/src/gfs/sys.h
deleted file mode 100644
index 0afa549..0000000
--- a/gfs-kernel/src/gfs/sys.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __SYS_DOT_H__
-#define __SYS_DOT_H__
-
-/* Allow args to be passed to GFS when using an initial ram disk */
-extern char *gfs_sys_margs;
-extern spinlock_t gfs_sys_margs_lock;
-
-int gfs_sys_fs_add(struct gfs_sbd *sdp);
-void gfs_sys_fs_del(struct gfs_sbd *sdp);
-
-int gfs_sys_init(void);
-void gfs_sys_uninit(void);
-
-#endif /* __SYS_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/trans.c b/gfs-kernel/src/gfs/trans.c
deleted file mode 100644
index 985533e..0000000
--- a/gfs-kernel/src/gfs/trans.c
+++ /dev/null
@@ -1,453 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-
-#include "gfs.h"
-#include "dio.h"
-#include "glock.h"
-#include "log.h"
-#include "lops.h"
-#include "quota.h"
-#include "trans.h"
-#include "unlinked.h"
-
-/**
- * gfs_trans_print - Print a transaction to the console
- * @sdp: the filesystem
- * @tr: The GFS transaction
- * @where: Situation of transaction
- *
- */
-
-void
-gfs_trans_print(struct gfs_sbd *sdp, struct gfs_trans *tr, unsigned int where)
-{
-	struct gfs_log_element *le;
-	struct list_head *tmp, *head;
-	unsigned int mblks = 0, eblks = 0;
-
-	LO_TRANS_SIZE(sdp, tr, &mblks, &eblks, NULL, NULL);
-
-	printk("Transaction:  (%s, %u)\n", tr->tr_file, tr->tr_line);
-	printk("  tr_mblks_asked = %u, tr_eblks_asked = %u, tr_seg_reserved = %u\n",
-	       tr->tr_mblks_asked, tr->tr_eblks_asked, tr->tr_seg_reserved);
-	printk("  mblks = %u, eblks = %u\n", mblks, eblks);
-	printk("  tr_flags = 0x%.8X\n", tr->tr_flags);
-
-	for (head = &tr->tr_elements, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		le = list_entry(tmp, struct gfs_log_element, le_list);
-		LO_PRINT(sdp, le, where);
-	}
-
-	printk("End Trans\n");
-}
-
-/**
- * gfs_trans_begin_i - Prepare to start a transaction
- * @sdp: The GFS superblock
- * @meta_blocks: Reserve this many metadata blocks in the log
- * @extra_blocks: Number of non-metadata blocks to reserve
- *
- * Allocate the struct gfs_trans struct.
- * Grab a shared TRANSaction lock (protects this transaction from
- *   overlapping with unusual fs writes, e.g. journal replay, fs upgrade,
- *   while allowing simultaneous transaction writes throughout cluster).
- * Reserve space in the log.  @meta_blocks and @extra_blocks must indicate
- *   the worst case (maximum) size of the transaction.
- * Record this transaction as the *one* transaction being built by this
- *   Linux process, in current->journal_info.
- *
- * Returns: errno
- */
-
-int
-gfs_trans_begin_i(struct gfs_sbd *sdp,
-		  unsigned int meta_blocks, unsigned int extra_blocks,
-		  char *file, unsigned int line)
-{
-	struct gfs_trans *tr;
-	unsigned int blocks;
-	int error;
-
-	tr = kmalloc(sizeof(struct gfs_trans), GFP_KERNEL);
-	if (!tr)
-		return -ENOMEM;
-	memset(tr, 0, sizeof(struct gfs_trans));
-
-	INIT_LIST_HEAD(&tr->tr_elements);
-	INIT_LIST_HEAD(&tr->tr_free_bufs);
-	INIT_LIST_HEAD(&tr->tr_free_bmem);
-	INIT_LIST_HEAD(&tr->tr_bufs);
-	INIT_LIST_HEAD(&tr->tr_ail_bufs);
-	tr->tr_file = file;
-	tr->tr_line = line;
-
-	error = -ENOMEM;
-	tr->tr_t_gh = gfs_holder_get(sdp->sd_trans_gl, LM_ST_SHARED, 0);
-	if (!tr->tr_t_gh)
-		goto fail;
-
-	error = gfs_glock_nq(tr->tr_t_gh);
-	if (error)
-		goto fail_holder_put;
-
-	if (test_bit(SDF_ROFS, &sdp->sd_flags)) {
-		tr->tr_t_gh->gh_flags |= GL_NOCACHE;
-		error = -EROFS;
-		goto fail_gunlock;
-	}
-
-	/*  Do log reservation  */
-
-	tr->tr_mblks_asked = meta_blocks;
-	tr->tr_eblks_asked = extra_blocks;
-
-	blocks = 1;
-	if (meta_blocks)
-		blocks += gfs_struct2blk(sdp, meta_blocks,
-					 sizeof(struct gfs_block_tag)) +
-			meta_blocks;
-	blocks += extra_blocks;
-	tr->tr_seg_reserved = gfs_blk2seg(sdp, blocks);
-
-	error = gfs_log_reserve(sdp, tr->tr_seg_reserved, FALSE);
-	if (error)
-		goto fail_gunlock;
-
-	gfs_assert(sdp, !get_transaction,);
-	set_transaction(tr);
-
-	return 0;
-
- fail_gunlock:
-	gfs_glock_dq(tr->tr_t_gh);
-
- fail_holder_put:
-	gfs_holder_put(tr->tr_t_gh);
-
- fail:
-	kfree(tr);
-
-	return error;
-}
-
-/**
- * gfs_trans_end - End a transaction
- * @sdp: The GFS superblock
- *
- * If buffers were actually added to the transaction,
- * commit it.
- *
- */
-
-void
-gfs_trans_end(struct gfs_sbd *sdp)
-{
-	struct gfs_trans *tr;
-	struct gfs_holder *t_gh;
-	struct list_head *tmp, *head;
-	struct gfs_log_element *le;
-
-	/* Linux task struct indicates current new trans for this process.
-	 * We're done building it, so set it to NULL */
-	tr = get_transaction;
-	gfs_assert(sdp, tr,);
-	set_transaction(NULL);
-
-	t_gh = tr->tr_t_gh;
-	tr->tr_t_gh = NULL;
-
-	/* If no buffers were ever added to trans, forget it */
-	if (list_empty(&tr->tr_elements)) {
-		gfs_log_release(sdp, tr->tr_seg_reserved);
-		kfree(tr);
-
-		gfs_glock_dq(t_gh);
-		gfs_holder_put(t_gh);
-
-		return;
-	}
-
-	/* Do trans_end log-operation for each log element */
-	for (head = &tr->tr_elements, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		le = list_entry(tmp, struct gfs_log_element, le_list);
-		LO_TRANS_END(sdp, le);
-	}
-
-	gfs_log_commit(sdp, tr);
-
-	gfs_glock_dq(t_gh);
-	gfs_holder_put(t_gh);
-
-	if (sdp->sd_vfs->s_flags & MS_SYNCHRONOUS)
-		gfs_log_flush(sdp);
-}
-
-/**
- * gfs_trans_add_gl - Add a glock to a transaction
- * @gl: the glock
- *
- * If not already attached, add the given glock to this process's transaction.
- *
- * Even though no glock info will be written to the on-disk log, the glocks
- *   associated with a transaction provide bridges by which to combine
- *   a just-built transaction with an earlier incore committed transaction
- *   that was protected by the same glock.  See incore_commit().
- *   Combining transactions makes for more efficient logging.
- *
- * Note that more than one glock may be associated with a single transaction.
- *   However, a given glock protects no more than *one* transaction at a
- *   given stage in the transaction pipeline (i.e. new or incore-committed).
- *   After all, the process holds the glock EX (so no other process can be
- *   building a separate trans protected by this glock), and the process can
- *   build only one transaction at a time.
- *
- * Rules:
- *   This process must hold the glock in EXclusive mode, since we're going
- *   to be writing to something protected by this glock.
- */
-
-void
-gfs_trans_add_gl(struct gfs_glock *gl)
-{
-	if (!gl->gl_new_le.le_trans) {
-		gfs_assert_withdraw(gl->gl_sbd,
-				    gfs_glock_is_locked_by_me(gl) &&
-				    gfs_glock_is_held_excl(gl));
-		gfs_glock_hold(gl); /* Released in glock_trans_end() */
-
-		/* Ask for eventual flush of (meta)data protected by this glock,
-		   once trans is complete and logged.  */
-		set_bit(GLF_DIRTY, &gl->gl_flags);
-
-		/* Invoke generic_le_add() */
-		LO_ADD(gl->gl_sbd, &gl->gl_new_le);
-		gl->gl_new_le.le_trans->tr_num_gl++;
-	}
-}
-
-/**
- * gfs_trans_add_bh - Add a to-be-modified buffer to the current transaction
- * @gl: the glock the buffer belongs to
- * @bh: The buffer to add
- *
- * Add a to-be-modified buffer to the current being-built (i.e. new) trans,
- *   and pin the buffer in memory.
- *
- * Caller must hold the glock protecting this buffer.
- *
- * Call this as many times as you want during transaction formation.  It does
- * its attachment work only once.  After buffer is attached to trans, the
- * process building the trans can modify the buffer again and again (calling
- * this function before each change).  Only the final result (within this trans)
- * will be written to log.  A good example is when allocating blocks in an RG,
- * a given bitmap buffer may be updated many times within a transaction.
- *
- * Note:  This final result will also be written to its in-place location,
- *  unless this transaction gets combined with a later transaction,
- *  in which case only the later result will go to in-place.
- *
- */
-
-void
-gfs_trans_add_bh(struct gfs_glock *gl, struct buffer_head *bh)
-{
-	struct gfs_sbd *sdp = gl->gl_sbd;
-	struct gfs_bufdata *bd;
-
-	/* Make sure GFS private info struct is attached to buffer head */
-	bd = get_v2bd(bh);
-	if (!bd) {
-		gfs_attach_bufdata(bh, gl);
-		bd = get_v2bd(bh);
-	}
-
-	/* If buffer has already been attached to trans, we're done */
-	if (bd->bd_new_le.le_trans)
-		return;
-
-	gfs_meta_check(sdp, bh);
-
-	gfs_assert(sdp, bd->bd_gl == gl,);
-
-	/* Make sure glock is attached to trans */
-	if (!gl->gl_new_le.le_trans)
-		gfs_trans_add_gl(gl);
-
-	gfs_dpin(sdp, bh);
-
-	/* Attach buffer to trans */
-	LO_ADD(sdp, &bd->bd_new_le);
-	bd->bd_new_le.le_trans->tr_num_buf++;
-}
-
-/**
- * gfs_trans_add_unlinked - Add an unlinked or dealloced tag to
- *      the current transaction
- * @sdp: the filesystem
- * @type: the type of entry
- * @inum: the inode number
- *
- * Returns: the unlinked structure
- */
-
-struct gfs_unlinked *
-gfs_trans_add_unlinked(struct gfs_sbd *sdp, unsigned int type,
-		       struct gfs_inum *inum)
-{
-	struct gfs_unlinked *ul;
-
-	/* Find in fileystem's unlinked list, or create */
-	ul = gfs_unlinked_get(sdp, inum, CREATE);
-
-	LO_ADD(sdp, &ul->ul_new_le);
-
-	switch (type) {
-	case GFS_LOG_DESC_IUL:
-		set_bit(ULF_NEW_UL, &ul->ul_flags);
-		ul->ul_new_le.le_trans->tr_num_iul++;
-		break;
-	case GFS_LOG_DESC_IDA:
-		clear_bit(ULF_NEW_UL, &ul->ul_flags);
-		ul->ul_new_le.le_trans->tr_num_ida++;
-		break;
-	default:
-		gfs_assert(sdp, FALSE,);
-		break;
-	}
-
-	return ul;
-}
-
-/**
- * gfs_trans_add_quota - Add quota changes to a transaction
- * @sdp: the filesystem
- * @change: The number of blocks allocated (positive) or freed (negative)
- * @uid: the user ID doing the change
- * @gid: the group ID doing the change
- *
- */
-
-void
-gfs_trans_add_quota(struct gfs_sbd *sdp, int64_t change,
-		    uint32_t uid, uint32_t gid)
-{
-	struct gfs_trans *tr;
-	struct list_head *tmp, *head, *next;
-	struct gfs_log_element *le;
-	struct gfs_quota_le *ql;
-	int found_uid, found_gid;
-	int error;
-
-	if (!gfs_tune_get(sdp, gt_quota_account))
-		return;
-	if (gfs_assert_warn(sdp, change))
-		return;
-
-	found_uid = (uid == NO_QUOTA_CHANGE);
-	found_gid = (gid == NO_QUOTA_CHANGE);
-
-	if (gfs_assert_warn(sdp, !found_uid || !found_gid))
-		return;
-
-	tr = get_transaction;
-	gfs_assert(sdp, tr,);
-
-	for (head = &tr->tr_elements, tmp = head->next, next = tmp->next;
-	     tmp != head;
-	     tmp = next, next = next->next) {
-		le = list_entry(tmp, struct gfs_log_element, le_list);
-		if (le->le_ops != &gfs_quota_lops)
-			continue;
-
-		ql = container_of(le, struct gfs_quota_le, ql_le);
-
-		if (test_bit(QDF_USER, &ql->ql_data->qd_flags)) {
-			if (ql->ql_data->qd_id == uid) {
-				ql->ql_change += change;
-
-				spin_lock(&sdp->sd_quota_lock);
-				ql->ql_data->qd_change_new += change;
-				spin_unlock(&sdp->sd_quota_lock);
-
-				list_del(&le->le_list);
-
-				if (ql->ql_change)
-					list_add(&le->le_list,
-						 &tr->tr_elements);
-				else {
-					gfs_quota_put(sdp, ql->ql_data);
-					kfree(ql);
-					tr->tr_num_q--;
-				}
-
-				gfs_assert(sdp, !found_uid,);
-				found_uid = TRUE;
-				if (found_gid)
-					break;
-			}
-		} else {
-			if (ql->ql_data->qd_id == gid) {
-				ql->ql_change += change;
-
-				spin_lock(&sdp->sd_quota_lock);
-				ql->ql_data->qd_change_new += change;
-				spin_unlock(&sdp->sd_quota_lock);
-
-				list_del(&le->le_list);
-
-				if (ql->ql_change)
-					list_add(&le->le_list,
-						 &tr->tr_elements);
-				else {
-					gfs_quota_put(sdp, ql->ql_data);
-					kfree(ql);
-					tr->tr_num_q--;
-				}
-
-				gfs_assert(sdp, !found_gid,);
-				found_gid = TRUE;
-				if (found_uid)
-					break;
-			}
-		}
-	}
-
-	while (!found_uid || !found_gid) {
-		ql = gmalloc(sizeof(struct gfs_quota_le));
-		memset(ql, 0, sizeof(struct gfs_quota_le));
-
-		INIT_LE(&ql->ql_le, &gfs_quota_lops);
-
-		if (found_uid) {
-			error = gfs_quota_get(sdp, FALSE, gid,
-					      NO_CREATE,
-					      &ql->ql_data);
-			found_gid = TRUE;
-		} else {
-			error = gfs_quota_get(sdp, TRUE, uid,
-					      NO_CREATE,
-					      &ql->ql_data);
-			found_uid = TRUE;
-		}
-
-		gfs_assert(sdp, !error && ql->ql_data,);
-
-		ql->ql_change = change;
-
-		spin_lock(&sdp->sd_quota_lock);
-		ql->ql_data->qd_change_new += change;
-		spin_unlock(&sdp->sd_quota_lock);
-
-		LO_ADD(sdp, &ql->ql_le);
-		tr->tr_num_q++;
-	}
-}
diff --git a/gfs-kernel/src/gfs/trans.h b/gfs-kernel/src/gfs/trans.h
deleted file mode 100644
index 5d62b39..0000000
--- a/gfs-kernel/src/gfs/trans.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef __TRANS_DOT_H__
-#define __TRANS_DOT_H__
-
-#define TRANS_IS_NEW            (53)
-#define TRANS_IS_INCORE         (54)
-void gfs_trans_print(struct gfs_sbd *sdp, struct gfs_trans *tr,
-		     unsigned int where);
-
-int gfs_trans_begin_i(struct gfs_sbd *sdp,
-		      unsigned int meta_blocks, unsigned int extra_blocks,
-		      char *file, unsigned int line);
-#define gfs_trans_begin(sdp, mb, eb) \
-gfs_trans_begin_i((sdp), (mb), (eb), __FILE__, __LINE__)
-
-void gfs_trans_end(struct gfs_sbd *sdp);
-
-void gfs_trans_add_gl(struct gfs_glock *gl);
-void gfs_trans_add_bh(struct gfs_glock *gl, struct buffer_head *bh);
-struct gfs_unlinked *gfs_trans_add_unlinked(struct gfs_sbd *sdp, unsigned int type,
-					    struct gfs_inum *inum);
-void gfs_trans_add_quota(struct gfs_sbd *sdp, int64_t change, uint32_t uid,
-			 uint32_t gid);
-
-#endif /* __TRANS_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/unlinked.c b/gfs-kernel/src/gfs/unlinked.c
deleted file mode 100644
index d41c48a..0000000
--- a/gfs-kernel/src/gfs/unlinked.c
+++ /dev/null
@@ -1,432 +0,0 @@
-#include <linux/kthread.h>
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-
-#include "gfs.h"
-#include "inode.h"
-#include "log.h"
-#include "lops.h"
-#include "unlinked.h"
-
-/**
- * gfs_unlinked_get - Get a structure to represent an unlinked inode
- * @sdp: the filesystem
- * @inum: identifies the inode that's unlinked
- * @create: if TRUE, we're allowed to create the structure if we can't find it,
- *      otherwise return NULL
- *
- * Returns: the structure, or NULL
- *
- * Search the filesystem's list of gfs_unlinked to find a match.
- * If none found, create a new one and place on list.
- */
-
-struct gfs_unlinked *
-gfs_unlinked_get(struct gfs_sbd *sdp, struct gfs_inum *inum, int create)
-{
-	struct gfs_unlinked *ul = NULL, *new_ul = NULL;
-	struct list_head *tmp, *head;
-
-	for (;;) {
-		spin_lock(&sdp->sd_unlinked_lock);
-
-		for (head = &sdp->sd_unlinked_list, tmp = head->next;
-		     tmp != head;
-		     tmp = tmp->next) {
-			ul = list_entry(tmp, struct gfs_unlinked, ul_list);
-			if (gfs_inum_equal(&ul->ul_inum, inum)) {
-				ul->ul_count++;
-				break;
-			}
-		}
-
-		if (tmp == head)
-			ul = NULL;
-
-		/* 2nd pass, still not there; add the new_ul we prepared */
-		if (!ul && new_ul) {
-			ul = new_ul;
-			list_add(&ul->ul_list, &sdp->sd_unlinked_list);
-			new_ul = NULL;
-		}
-
-		spin_unlock(&sdp->sd_unlinked_lock);
-
-		/* 1st pass; we found pre-existing, OR not allowed to create.
-		   2nd pass; another process added it, or we did */
-		if (ul || !create) {
-			if (new_ul)
-				/* someone beat us to it; forget our new_ul */
-				kfree(new_ul);
-			return ul;
-		}
-
-		/* No match on list, 1st time through loop.
-		   Prepare new_ul, then repeat loop to find out if another
-		   process has created or unlinked an inode and put its
-		   gfs_unlinked on list while we've been preparing this one. */
-		new_ul = gmalloc(sizeof(struct gfs_unlinked));
-		memset(new_ul, 0, sizeof(struct gfs_unlinked));
-
-		new_ul->ul_count = 1;
-		new_ul->ul_inum = *inum;
-
-		INIT_LE(&new_ul->ul_new_le, &gfs_unlinked_lops);
-		INIT_LE(&new_ul->ul_incore_le, &gfs_unlinked_lops);
-		INIT_LE(&new_ul->ul_ondisk_le, &gfs_unlinked_lops);
-	}
-}
-
-/**
- * gfs_unlinked_hold - increment the usage count on a struct gfs_unlinked
- * @sdp: the filesystem
- * @ul: the structure
- *
- */
-
-void
-gfs_unlinked_hold(struct gfs_sbd *sdp, struct gfs_unlinked *ul)
-{
-	spin_lock(&sdp->sd_unlinked_lock);
-	gfs_assert(sdp, ul->ul_count,);
-	ul->ul_count++;
-	spin_unlock(&sdp->sd_unlinked_lock);
-}
-
-/**
- * gfs_unlinked_put - decrement the usage count on a struct gfs_unlinked
- * @sdp: the filesystem
- * @ul: the structure
- *
- * Free the structure if its reference count hits zero.
- *
- */
-
-void
-gfs_unlinked_put(struct gfs_sbd *sdp, struct gfs_unlinked *ul)
-{
-	spin_lock(&sdp->sd_unlinked_lock);
-
-	gfs_assert(sdp, ul->ul_count,);
-	ul->ul_count--;
-
-	if (!ul->ul_count) {
-		gfs_assert_warn(sdp,
-				!test_bit(ULF_IC_LIST, &ul->ul_flags) &&
-				!test_bit(ULF_OD_LIST, &ul->ul_flags) &&
-				!test_bit(ULF_LOCK, &ul->ul_flags));
-		list_del(&ul->ul_list);
-		spin_unlock(&sdp->sd_unlinked_lock);
-		kfree(ul);
-	} else
-		spin_unlock(&sdp->sd_unlinked_lock);
-}
-
-/**
- * unlinked_find - Find a inode to try to deallocate
- * @sdp: the filesystem
- *
- * The returned structure is locked and needs to be unlocked
- * with gfs_unlinked_unlock().
- *
- * Returns: A unlinked structure, or NULL
- */
-
-struct gfs_unlinked *
-unlinked_find(struct gfs_sbd *sdp)
-{
-	struct list_head *tmp, *head;
-	struct gfs_unlinked *ul = NULL;
-
-	if (test_bit(SDF_ROFS, &sdp->sd_flags))
-		return NULL;
-
-	gfs_log_lock(sdp);
-	spin_lock(&sdp->sd_unlinked_lock);
-
-	if (!atomic_read(&sdp->sd_unlinked_ic_count))
-		goto out;
-
-	for (head = &sdp->sd_unlinked_list, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		ul = list_entry(tmp, struct gfs_unlinked, ul_list);
-
-		if (test_bit(ULF_LOCK, &ul->ul_flags))
-			continue;
-		if (!test_bit(ULF_IC_LIST, &ul->ul_flags))
-			continue;
-
-		list_move_tail(&ul->ul_list, &sdp->sd_unlinked_list);
-
-		set_bit(ULF_LOCK, &ul->ul_flags);
-		ul->ul_count++;
-
-		goto out;
-	}
-
-	ul = NULL;
-
- out:
-	spin_unlock(&sdp->sd_unlinked_lock);
-	gfs_log_unlock(sdp);
-
-	return ul;
-}
-
-/**
- * gfs_unlinked_lock - lock a unlinked structure
- * @sdp: the filesystem
- * @ul: the unlinked inode structure
- *
- */
-
-void
-gfs_unlinked_lock(struct gfs_sbd *sdp, struct gfs_unlinked *ul)
-{
-	spin_lock(&sdp->sd_unlinked_lock);
-
-	gfs_assert_warn(sdp, !test_bit(ULF_LOCK, &ul->ul_flags));
-	set_bit(ULF_LOCK, &ul->ul_flags);
-
-	ul->ul_count++;
-
-	spin_unlock(&sdp->sd_unlinked_lock);	
-}
-
-/**
- * gfs_unlinked_unlock - drop a reference on a unlinked structure
- * @sdp: the filesystem
- * @ul: the unlinked inode structure
- *
- */
-
-void
-gfs_unlinked_unlock(struct gfs_sbd *sdp, struct gfs_unlinked *ul)
-{
-	spin_lock(&sdp->sd_unlinked_lock);
-
-	gfs_assert_warn(sdp, test_bit(ULF_LOCK, &ul->ul_flags));
-	clear_bit(ULF_LOCK, &ul->ul_flags);
-
-	gfs_assert(sdp, ul->ul_count,);
-	ul->ul_count--;
-
-	if (!ul->ul_count) {
-		gfs_assert_warn(sdp, !test_bit(ULF_IC_LIST, &ul->ul_flags) &&
-				!test_bit(ULF_OD_LIST, &ul->ul_flags));
-		list_del(&ul->ul_list);
-		spin_unlock(&sdp->sd_unlinked_lock);
-		kfree(ul);
-	} else
-		spin_unlock(&sdp->sd_unlinked_lock);
-}
-
-/**
- * gfs_unlinked_merge - add/remove a unlinked inode from the in-memory list
- * @sdp: the filesystem
- * @type: is this a unlink tag or a dealloc tag
- * @inum: the inode number
- *
- * Called during journal recovery.
- */
-
-void
-gfs_unlinked_merge(struct gfs_sbd *sdp, unsigned int type,
-		   struct gfs_inum *inum)
-{
-	struct gfs_unlinked *ul;
-
-	gfs_assert(sdp, atomic_read(&sdp->sd_unlinked_ic_count) ==
-		   atomic_read(&sdp->sd_unlinked_od_count),);
-
-	ul = gfs_unlinked_get(sdp, inum, CREATE);
-
-	gfs_log_lock(sdp);
-
-	switch (type) {
-	case GFS_LOG_DESC_IUL:
-		gfs_unlinked_hold(sdp, ul);
-		gfs_unlinked_hold(sdp, ul);
-		gfs_assert(sdp, !test_bit(ULF_IC_LIST, &ul->ul_flags) &&
-			   !test_bit(ULF_OD_LIST, &ul->ul_flags),);
-		set_bit(ULF_IC_LIST, &ul->ul_flags);
-		set_bit(ULF_OD_LIST, &ul->ul_flags);
-		atomic_inc(&sdp->sd_unlinked_ic_count);
-		atomic_inc(&sdp->sd_unlinked_od_count);
-
-		break;
-
-	case GFS_LOG_DESC_IDA:
-		gfs_assert(sdp, test_bit(ULF_IC_LIST, &ul->ul_flags) &&
-			   test_bit(ULF_OD_LIST, &ul->ul_flags),);
-		clear_bit(ULF_IC_LIST, &ul->ul_flags);
-		clear_bit(ULF_OD_LIST, &ul->ul_flags);
-		gfs_unlinked_put(sdp, ul);
-		gfs_unlinked_put(sdp, ul);
-		gfs_assert(sdp, atomic_read(&sdp->sd_unlinked_ic_count) > 0,);
-		atomic_dec(&sdp->sd_unlinked_ic_count);
-		gfs_assert(sdp, atomic_read(&sdp->sd_unlinked_od_count) > 0,);
-		atomic_dec(&sdp->sd_unlinked_od_count);
-
-		break;
-	}
-
-	gfs_log_unlock(sdp);
-
-	gfs_unlinked_put(sdp, ul);
-}
-
-/**
- * gfs_unlinked_cleanup - get rid of any extra struct gfs_unlinked structures
- * @sdp: the filesystem
- *
- */
-
-void
-gfs_unlinked_cleanup(struct gfs_sbd *sdp)
-{
-	struct gfs_unlinked *ul;
-
- restart:
-	gfs_log_lock(sdp);
-
-	gfs_assert(sdp, atomic_read(&sdp->sd_unlinked_ic_count) ==
-		   atomic_read(&sdp->sd_unlinked_od_count),);
-
-	spin_lock(&sdp->sd_unlinked_lock);
-
-	while (!list_empty(&sdp->sd_unlinked_list)) {
-		ul = list_entry(sdp->sd_unlinked_list.next,
-				struct gfs_unlinked, ul_list);
-
-		if (ul->ul_count > 2) {
-			spin_unlock(&sdp->sd_unlinked_lock);
-			gfs_log_unlock(sdp);
-			set_current_state(TASK_UNINTERRUPTIBLE);
-			schedule_timeout(HZ);
-			goto restart;
-		}
-		gfs_assert(sdp, ul->ul_count == 2,);
-
-		gfs_assert_warn(sdp,
-				test_bit(ULF_IC_LIST, &ul->ul_flags) &&
-				test_bit(ULF_OD_LIST, &ul->ul_flags) &&
-				!test_bit(ULF_LOCK, &ul->ul_flags));
-
-		list_del(&ul->ul_list);
-
-		atomic_dec(&sdp->sd_unlinked_ic_count);
-		atomic_dec(&sdp->sd_unlinked_od_count);
-
-		spin_unlock(&sdp->sd_unlinked_lock);
-		kfree(ul);
-		spin_lock(&sdp->sd_unlinked_lock);
-	}
-
-	spin_unlock(&sdp->sd_unlinked_lock);
-
-	gfs_assert(sdp, !atomic_read(&sdp->sd_unlinked_ic_count) &&
-		   !atomic_read(&sdp->sd_unlinked_od_count),);
-
-	gfs_log_unlock(sdp);
-}
-
-/**
- * gfs_unlinked_limit - limit the number of inodes waiting to be deallocated
- * @sdp: the filesystem
- *
- * Returns: errno
- */
-
-void
-gfs_unlinked_limit(struct gfs_sbd *sdp)
-{
-	unsigned int tries = 0, min = 0;
-	int error;
-
-	if (atomic_read(&sdp->sd_unlinked_ic_count) >=
-	    gfs_tune_get(sdp, gt_ilimit2)) {
-		tries = gfs_tune_get(sdp, gt_ilimit2_tries);
-		min = gfs_tune_get(sdp, gt_ilimit2_min);
-	} else if (atomic_read(&sdp->sd_unlinked_ic_count) >=
-		   gfs_tune_get(sdp, gt_ilimit1)) {
-		tries = gfs_tune_get(sdp, gt_ilimit1_tries);
-		min = gfs_tune_get(sdp, gt_ilimit1_min);
-	}
-
-	while (tries--) {
-		struct gfs_unlinked *ul = unlinked_find(sdp);
-		if (!ul)
-			break;
-
-		error = gfs_inode_dealloc(sdp, &ul->ul_inum);
-
-		gfs_unlinked_unlock(sdp, ul);
-
-		if (!error) {
-			if (!--min)
-				break;
-		} else if (error != 1)
-			break;
-	}
-}
-
-/**
- * gfs_unlinked_dealloc - Go through the list of inodes to be deallocated
- * @sdp: the filesystem
- *
- * Returns: errno
- */
-
-void
-gfs_unlinked_dealloc(struct gfs_sbd *sdp)
-{
-	unsigned int hits, strikes;
-	int error;
-
-	for (;;) {
-		hits = 0;
-		strikes = 0;
-
-		for (;;) {
-			struct gfs_unlinked *ul = unlinked_find(sdp);
-			if (!ul)
-				return;
-
-			error = gfs_inode_dealloc(sdp, &ul->ul_inum);
-
-			gfs_unlinked_unlock(sdp, ul);
-
-			if (!error) {
-				hits++;
-				if (strikes)
-					strikes--;
-			} else if (error == 1) {
-				strikes++;
-				if (strikes >= atomic_read(&sdp->sd_unlinked_ic_count)) {
-					error = 0;
-					break;
-				}
-			} else
-				goto out;
-		}
-
-		if (!hits || kthread_should_stop())
-			break;
-
-		cond_resched();
-	}
-
- out:
-	if (error &&
-	    error != -EROFS &&
-	    !test_bit(SDF_SHUTDOWN, &sdp->sd_flags))
-		printk("GFS: fsid=%s: error deallocating inodes: %d\n",
-		       sdp->sd_fsname, error);
-}
diff --git a/gfs-kernel/src/gfs/unlinked.h b/gfs-kernel/src/gfs/unlinked.h
deleted file mode 100644
index 1881bad..0000000
--- a/gfs-kernel/src/gfs/unlinked.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef __UNLINKED_DOT_H__
-#define __UNLINKED_DOT_H__
-
-struct gfs_unlinked *gfs_unlinked_get(struct gfs_sbd *sdp,
-				      struct gfs_inum *inum, int create);
-void gfs_unlinked_hold(struct gfs_sbd *sdp, struct gfs_unlinked *ul);
-void gfs_unlinked_put(struct gfs_sbd *sdp, struct gfs_unlinked *ul);
-
-void gfs_unlinked_lock(struct gfs_sbd *sdp, struct gfs_unlinked *ul);
-void gfs_unlinked_unlock(struct gfs_sbd *sdp, struct gfs_unlinked *ul);
-
-void gfs_unlinked_merge(struct gfs_sbd *sdp, unsigned int type,
-			struct gfs_inum *inum);
-void gfs_unlinked_cleanup(struct gfs_sbd *sdp);
-
-void gfs_unlinked_limit(struct gfs_sbd *sdp);
-void gfs_unlinked_dealloc(struct gfs_sbd *sdp);
-
-#endif /* __UNLINKED_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/util.c b/gfs-kernel/src/gfs/util.c
deleted file mode 100644
index 7d1c0e4..0000000
--- a/gfs-kernel/src/gfs/util.c
+++ /dev/null
@@ -1,571 +0,0 @@
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/buffer_head.h>
-#include <asm/uaccess.h>
-
-#include "gfs.h"
-#include "glock.h"
-#include "lm.h"
-
-uint32_t gfs_random_number;
-
-struct kmem_cache *gfs_glock_cachep = NULL;
-struct kmem_cache *gfs_inode_cachep = NULL;
-struct kmem_cache *gfs_bufdata_cachep = NULL;
-struct kmem_cache *gfs_mhc_cachep = NULL;
-
-/**
- * gfs_random - Generate a random 32-bit number
- *
- * Generate a semi-crappy 32-bit pseudo-random number without using
- * floating point.
- *
- * The PRNG is from "Numerical Recipes in C" (second edition), page 284.
- *
- * Returns: a 32-bit random number
- */
-
-uint32_t
-gfs_random(void)
-{
-	gfs_random_number = 0x0019660D * gfs_random_number + 0x3C6EF35F;
-	return gfs_random_number;
-}
-
-/**
- * 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;
-}
-
-/**
- * gfs_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
-gfs_hash(const void *data, unsigned int len)
-{
-	uint32_t h = 0x811C9DC5;
-	h = hash_more_internal(data, len, h);
-	return h;
-}
-
-/**
- * gfs_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 = gfs_hash(data1, len1);
- *   h = gfs_hash_more(data2, len2, h);
- *   h = gfs_hash_more(data3, len3, h);
- *
- * Returns: the hash
- */
-
-uint32_t
-gfs_hash_more(const void *data, unsigned int len, uint32_t hash)
-{
-	uint32_t h;
-	h = hash_more_internal(data, len, hash);
-	return h;
-}
-
-/* Byte-wise swap two items of size SIZE. */
-
-#define SWAP(a, b, size) \
-do { \
-	register size_t __size = (size); \
-        register char *__a = (a), *__b = (b); \
-        do { \
-		char __tmp = *__a; \
-		*__a++ = *__b; \
-		*__b++ = __tmp; \
-	} while (__size-- > 1); \
-} while (0)
-
-/**
- * gfs_sort - Sort base array using shell sort algorithm
- * @base: the input array
- * @num_elem: number of elements in array
- * @size: size of each element in array
- * @compar: fxn to compare array elements (returns negative
- *          for lt, 0 for eq, and positive for gt
- *
- * Sorts the array passed in using the compar fxn to compare elements using
- * the shell sort algorithm
- */
-
-void
-gfs_sort(void *base, unsigned int num_elem, unsigned int size,
-	 int (*compar) (const void *, const void *))
-{
-	register char *pbase = (char *)base;
-	int i, j, k, h;
-	static int cols[16] = {1391376, 463792, 198768, 86961,
-			       33936, 13776, 4592, 1968,
-			       861, 336, 112, 48,
-			       21, 7, 3, 1};
-	
-	for (k = 0; k < 16; k++) {
-		h = cols[k];
-		for (i = h; i < num_elem; i++) {
-			j = i;
-			while (j >= h &&
-			       (*compar)((void *)(pbase + size * (j - h)),
-					 (void *)(pbase + size * j)) > 0) {
-				SWAP(pbase + size * j,
-				     pbase + size * (j - h),
-				     size);
-				j = j - h;
-			}
-		}
-	}
-}
-
-/**
- * gfs_assert_i - Cause the machine to panic if @assertion is false
- * @sdp:
- * @assertion:
- * @function:
- * @file:
- * @line:
- *
- */
-
-void
-gfs_assert_i(struct gfs_sbd *sdp,
-	     char *assertion,
-	     const char *function,
-	     char *file, unsigned int line)
-{
-	if (sdp->sd_args.ar_oopses_ok) {
-		printk("GFS: fsid=%s: assertion \"%s\" failed\n"
-		       "GFS: fsid=%s:   function = %s\n"
-		       "GFS: fsid=%s:   file = %s, line = %u\n"
-		       "GFS: fsid=%s:   time = %lu\n",
-		       sdp->sd_fsname, assertion,
-		       sdp->sd_fsname, function,
-		       sdp->sd_fsname, file, line,
-		       sdp->sd_fsname, get_seconds());
-		BUG();
-	}
-	dump_stack();
-	panic("GFS: fsid=%s: assertion \"%s\" failed\n"
-	      "GFS: fsid=%s:   function = %s\n"
-	      "GFS: fsid=%s:   file = %s, line = %u\n"
-	      "GFS: fsid=%s:   time = %lu\n",
-	      sdp->sd_fsname, assertion,
-	      sdp->sd_fsname, function,
-	      sdp->sd_fsname, file, line,
-	      sdp->sd_fsname, get_seconds());
-}
-
-/**
- * gfs_assert_withdraw_i - Cause the machine to withdraw if @assertion is false
- * @sdp:
- * @assertion:
- * @function:
- * @file:
- * @line:
- *
- * Returns: -1 if this call withdrew the machine,
- *          -2 if it was already withdrawn
- */
-
-int
-gfs_assert_withdraw_i(struct gfs_sbd *sdp,
-		      char *assertion,
-		      const char *function,
-		      char *file, unsigned int line)
-{
-	int me;
-	me = gfs_lm_withdraw(sdp,
-			     "GFS: fsid=%s: fatal: assertion \"%s\" failed\n"
-			     "GFS: fsid=%s:   function = %s\n"
-			     "GFS: fsid=%s:   file = %s, line = %u\n"
-			     "GFS: fsid=%s:   time = %lu\n",
-			     sdp->sd_fsname, assertion,
-			     sdp->sd_fsname, function,
-			     sdp->sd_fsname, file, line,
-			     sdp->sd_fsname, get_seconds());
-	return (me) ? -1 : -2;
-}
-
-/**
- * gfs_assert_warn_i - Print a message to the console if @assertion is false
- * @sdp:
- * @assertion:
- * @function:
- * @file:
- * @line:
- *
- * Returns: -1 if we printed something
- *          -2 if we didn't
- */
-
-int
-gfs_assert_warn_i(struct gfs_sbd *sdp,
-		  char *assertion,
-		  const char *function,
-		  char *file, unsigned int line)
-{
-	if (time_before(jiffies,
-			sdp->sd_last_warning +
-			gfs_tune_get(sdp, gt_complain_secs) * HZ))
-		return -2;
-
-	printk("GFS: fsid=%s: warning: assertion \"%s\" failed\n"
-	       "GFS: fsid=%s:   function = %s\n"
-	       "GFS: fsid=%s:   file = %s, line = %u\n"
-	       "GFS: fsid=%s:   time = %lu\n",
-	       sdp->sd_fsname, assertion,
-	       sdp->sd_fsname, function,
-	       sdp->sd_fsname, file, line,
-	       sdp->sd_fsname, get_seconds());
-
-	sdp->sd_last_warning = jiffies;
-	if (sdp->sd_args.ar_debug)
-		BUG();
-
-
-	return -1;
-}
-
-/**
- * gfs_consist_i - Flag a filesystem consistency error and withdraw
- * @sdp:
- * @cluster_wide:
- * @function:
- * @file:
- * @line:
- *
- * Returns: -1 if this call withdrew the machine,
- *          0 if it was already withdrawn
- */
-
-int
-gfs_consist_i(struct gfs_sbd *sdp, int cluster_wide,
-	      const char *function,
-	      char *file, unsigned int line)
-{
-	return gfs_lm_withdraw(sdp,
-			       "GFS: fsid=%s: fatal: filesystem consistency error\n"
-			       "GFS: fsid=%s:   function = %s\n"
-			       "GFS: fsid=%s:   file = %s, line = %u\n"
-			       "GFS: fsid=%s:   time = %lu\n",
-			       sdp->sd_fsname,
-			       sdp->sd_fsname, function,
-			       sdp->sd_fsname, file, line,
-			       sdp->sd_fsname, get_seconds());
-}
-
-/**
- * gfs_consist_inode_i - Flag an inode consistency error and withdraw
- * @ip:
- * @cluster_wide:
- * @function:
- * @file:
- * @line:
- *
- * Returns: -1 if this call withdrew the machine,
- *          0 if it was already withdrawn
- */
-
-int
-gfs_consist_inode_i(struct gfs_inode *ip, int cluster_wide,
-		    const char *function,
-		    char *file, unsigned int line)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-        return gfs_lm_withdraw(sdp,
-			       "GFS: fsid=%s: fatal: filesystem consistency error\n"
-			       "GFS: fsid=%s:   inode = %"PRIu64"/%"PRIu64"\n"
-			       "GFS: fsid=%s:   function = %s\n"
-			       "GFS: fsid=%s:   file = %s, line = %u\n"
-			       "GFS: fsid=%s:   time = %lu\n",
-			       sdp->sd_fsname,
-			       sdp->sd_fsname, ip->i_num.no_formal_ino, ip->i_num.no_addr,
-			       sdp->sd_fsname, function,
-			       sdp->sd_fsname, file, line,
-			       sdp->sd_fsname, get_seconds());
-}
-
-/**
- * gfs_consist_rgrpd_i - Flag a RG consistency error and withdraw
- * @rgd:
- * @cluster_wide:
- * @function:
- * @file:
- * @line:
- *
- * Returns: -1 if this call withdrew the machine,
- *          0 if it was already withdrawn
- */
-
-int
-gfs_consist_rgrpd_i(struct gfs_rgrpd *rgd, int cluster_wide,
-		    const char *function,
-		    char *file, unsigned int line)
-{
-        struct gfs_sbd *sdp = rgd->rd_sbd;
-        return gfs_lm_withdraw(sdp,
-			       "GFS: fsid=%s: fatal: filesystem consistency error\n"
-			       "GFS: fsid=%s:   RG = %"PRIu64"\n"
-			       "GFS: fsid=%s:   function = %s\n"
-			       "GFS: fsid=%s:   file = %s, line = %u\n"
-			       "GFS: fsid=%s:   time = %lu\n",
-			       sdp->sd_fsname,
-			       sdp->sd_fsname, rgd->rd_ri.ri_addr,
-			       sdp->sd_fsname, function,
-			       sdp->sd_fsname, file, line,
-			       sdp->sd_fsname, get_seconds());
-}
-
-/**
- * gfs_meta_check_ii - Flag a magic number consistency error and withdraw
- * @sdp:
- * @bh:
- * @function:
- * @file:
- * @line:
- *
- * Returns: -1 if this call withdrew the machine,
- *          -2 if it was already withdrawn
- */
-
-int
-gfs_meta_check_ii(struct gfs_sbd *sdp, struct buffer_head *bh,
-                  const char *function,
-                  char *file, unsigned int line)
-{
-	int me;
-        me = gfs_lm_withdraw(sdp,
-			     "GFS: fsid=%s: fatal: invalid metadata block\n"
-			     "GFS: fsid=%s:   bh = %"PRIu64" (magic)\n"
-			     "GFS: fsid=%s:   function = %s\n"
-			     "GFS: fsid=%s:   file = %s, line = %u\n"
-			     "GFS: fsid=%s:   time = %lu\n",
-			     sdp->sd_fsname,
-			     sdp->sd_fsname, (uint64_t)bh->b_blocknr,
-			     sdp->sd_fsname, function,
-			     sdp->sd_fsname, file, line,
-			     sdp->sd_fsname, get_seconds());
-	return (me) ? -1 : -2;
-}
-
-/**
- * gfs_metatype_check_ii - Flag a metadata type consistency error and withdraw
- * @sdp:
- * @bh:
- * @type:
- * @t:
- * @function:
- * @file:
- * @line:
- *
- * Returns: -1 if this call withdrew the machine,
- *          -2 if it was already withdrawn
- */
-
-int
-gfs_metatype_check_ii(struct gfs_sbd *sdp, struct buffer_head *bh,
-		      uint32_t type, uint32_t t,
-		      const char *function,
-		      char *file, unsigned int line)
-{
-	int me;
-        me = gfs_lm_withdraw(sdp,
-			     "GFS: fsid=%s: fatal: invalid metadata block\n"
-			     "GFS: fsid=%s:   bh = %"PRIu64" (type: exp=%u, found=%u)\n"
-			     "GFS: fsid=%s:   function = %s\n"
-			     "GFS: fsid=%s:   file = %s, line = %u\n"
-			     "GFS: fsid=%s:   time = %lu\n",
-			     sdp->sd_fsname,
-			     sdp->sd_fsname, (uint64_t)bh->b_blocknr, type, t,
-			     sdp->sd_fsname, function,
-			     sdp->sd_fsname, file, line,
-			     sdp->sd_fsname, get_seconds());
-	return (me) ? -1 : -2;
-}
-
-/**
- * gfs_io_error_i - Flag an I/O error and withdraw
- * @sdp:
- * @function:
- * @file:
- * @line:
- *
- * Returns: -1 if this call withdrew the machine,
- *          0 if it was already withdrawn
- */
-
-int
-gfs_io_error_i(struct gfs_sbd *sdp,
-	       const char *function,
-	       char *file, unsigned int line)
-{
-        return gfs_lm_withdraw(sdp,
-			       "GFS: fsid=%s: fatal: I/O error\n"
-			       "GFS: fsid=%s:   function = %s\n"
-			       "GFS: fsid=%s:   file = %s, line = %u\n"
-			       "GFS: fsid=%s:   time = %lu\n",
-			       sdp->sd_fsname,
-			       sdp->sd_fsname, function,
-			       sdp->sd_fsname, file, line,
-			       sdp->sd_fsname, get_seconds());
-}
-
-/**
- * gfs_io_error_inode_i - Flag an inode I/O error and withdraw
- * @ip:
- * @function:
- * @file:
- * @line:
- *
- * Returns: -1 if this call withdrew the machine,
- *          0 if it was already withdrawn
- */
-
-int
-gfs_io_error_inode_i(struct gfs_inode *ip,
-		     const char *function,
-		     char *file, unsigned int line)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-        return gfs_lm_withdraw(sdp,
-			       "GFS: fsid=%s: fatal: I/O error\n"
-			       "GFS: fsid=%s:   inode = %"PRIu64"/%"PRIu64"\n"
-			       "GFS: fsid=%s:   function = %s\n"
-			       "GFS: fsid=%s:   file = %s, line = %u\n"
-			       "GFS: fsid=%s:   time = %lu\n",
-			       sdp->sd_fsname,
-			       sdp->sd_fsname, ip->i_num.no_formal_ino, ip->i_num.no_addr,
-			       sdp->sd_fsname, function,
-			       sdp->sd_fsname, file, line,
-			       sdp->sd_fsname, get_seconds());
-}
-
-/**
- * gfs_io_error_bh_i - Flag a buffer I/O error and withdraw
- * @sdp:
- * @bh:
- * @function:
- * @file:
- * @line:
- *
- * Returns: -1 if this call withdrew the machine,
- *          0 if it was already withdrawn
- */
-
-int
-gfs_io_error_bh_i(struct gfs_sbd *sdp, struct buffer_head *bh,
-		  const char *function,
-		  char *file, unsigned int line)
-{
-        return gfs_lm_withdraw(sdp,
-			       "GFS: fsid=%s: fatal: I/O error\n"
-			       "GFS: fsid=%s:   block = %"PRIu64"\n"
-			       "GFS: fsid=%s:   function = %s\n"
-			       "GFS: fsid=%s:   file = %s, line = %u\n"
-			       "GFS: fsid=%s:   time = %lu\n",
-			       sdp->sd_fsname,
-			       sdp->sd_fsname, (uint64_t)bh->b_blocknr,
-			       sdp->sd_fsname, function,
-			       sdp->sd_fsname, file, line,
-			       sdp->sd_fsname, get_seconds());
-}
-
-/**
- * gmalloc - malloc a small amount of memory
- * @size: the number of bytes to malloc
- *
- * Returns: the memory
- */
-
-void *
-gmalloc(unsigned int size)
-{
-	void *p;
-	RETRY_MALLOC(p = kmalloc(size, GFP_KERNEL), p);
-	return p;
-}
-
-/**
- * gfs_add_bh_to_ub - copy a buffer up to user space
- * @ub: the structure representing where to copy
- * @bh: the buffer
- *
- * Returns: errno
- */
-
-int
-gfs_add_bh_to_ub(struct gfs_user_buffer *ub, struct buffer_head *bh)
-{
-	uint64_t blkno = bh->b_blocknr;
-
-	if (ub->ub_count + sizeof(uint64_t) + bh->b_size > ub->ub_size)
-		return -ENOMEM;
-
-	if (copy_to_user(ub->ub_data + ub->ub_count,
-			  &blkno,
-			  sizeof(uint64_t)))
-		return -EFAULT;
-	ub->ub_count += sizeof(uint64_t);
-
-	if (copy_to_user(ub->ub_data + ub->ub_count,
-			  bh->b_data,
-			  bh->b_size))
-		return -EFAULT;
-	ub->ub_count += bh->b_size;
-
-	return 0;
-}
-
diff --git a/gfs-kernel/src/gfs/util.h b/gfs-kernel/src/gfs/util.h
deleted file mode 100644
index 4849f55..0000000
--- a/gfs-kernel/src/gfs/util.h
+++ /dev/null
@@ -1,330 +0,0 @@
-#ifndef __UTIL_DOT_H__
-#define __UTIL_DOT_H__
-
-
-/* Utility functions */
-
-extern uint32_t gfs_random_number;
-uint32_t gfs_random(void);
-
-uint32_t gfs_hash(const void *data, unsigned int len);
-uint32_t gfs_hash_more(const void *data, unsigned int len, uint32_t hash);
-
-void gfs_sort(void *base, unsigned int num_elem, unsigned int size,
-	      int (*compar) (const void *, const void *));
-
-
-/* Error handling */
-
-/**
- * gfs_assert - Cause the machine to panic if @assertion is false
- * @sdp:
- * @assertion:
- * @todo:
- *
- */
-
-void gfs_assert_i(struct gfs_sbd *sdp,
-                  char *assertion,
-                  const char *function,
-                  char *file, unsigned int line)
-__attribute__ ((noreturn));
-#define gfs_assert(sdp, assertion, todo) \
-do { \
-	if (unlikely(!(assertion))) { \
-		{todo} \
-		gfs_assert_i((sdp), #assertion, \
-			     __FUNCTION__, __FILE__, __LINE__); \
-	} \
-} while (0)
-
-/**
- * gfs_assert_withdraw - Cause the machine to withdraw if @assertion is false
- * @sdp:
- * @assertion:
- *
- * Returns: 0 if things are ok,
- *          -1 if this call withdrew the machine,
- *          -2 if it was already withdrawn
- */
-
-int gfs_assert_withdraw_i(struct gfs_sbd *sdp,
-			  char *assertion,
-			  const char *function,
-			  char *file, unsigned int line);
-#define gfs_assert_withdraw(sdp, assertion) \
-((likely(assertion)) ? 0 : \
- gfs_assert_withdraw_i((sdp), #assertion, \
-		       __FUNCTION__, __FILE__, __LINE__))
-
-/**
- * gfs_assert_warn - Print a message to the console if @assertion is false
- * @sdp:
- * @assertion:
- *
- * Returns: 0 if things are ok,
- *          -1 if we printed something
- *          -2 if we didn't
- */
-
-int gfs_assert_warn_i(struct gfs_sbd *sdp,
-		      char *assertion,
-		      const char *function,
-		      char *file, unsigned int line);
-#define gfs_assert_warn(sdp, assertion) \
-((likely(assertion)) ? 0 : \
- gfs_assert_warn_i((sdp), #assertion, \
-		   __FUNCTION__, __FILE__, __LINE__))
-
-/**
- * gfs_consist - Flag a filesystem consistency error and withdraw
- * gfs_cconsist - Flag a filesystem consistency error and withdraw cluster
- * @sdp:
- *
- * Returns: -1 if this call withdrew the machine,
- *          0 if it was already withdrawn
- */
-
-int gfs_consist_i(struct gfs_sbd *sdp, int cluster_wide,
-		  const char *function,
-		  char *file, unsigned int line);
-#define gfs_consist(sdp)\
-gfs_consist_i((sdp), FALSE, __FUNCTION__, __FILE__, __LINE__)
-#define gfs_cconsist(sdp)\
-gfs_consist_i((sdp), TRUE, __FUNCTION__, __FILE__, __LINE__)
-
-/**
- * gfs_consist_inode - Flag an inode consistency error and withdraw
- * gfs_cconsist_inode - Flag an inode consistency error and withdraw cluster
- * @ip:
- *
- * Returns: -1 if this call withdrew the machine,
- *          0 if it was already withdrawn
- */
-
-int gfs_consist_inode_i(struct gfs_inode *ip, int cluster_wide,
-			const char *function,
-			char *file, unsigned int line);
-#define gfs_consist_inode(ip) \
-gfs_consist_inode_i((ip), FALSE, __FUNCTION__, __FILE__, __LINE__)
-#define gfs_cconsist_inode(ip) \
-gfs_consist_inode_i((ip), TRUE, __FUNCTION__, __FILE__, __LINE__)
-
-/**
- * gfs_consist_rgrpd - Flag a RG consistency error and withdraw
- * gfs_cconsist_rgrpd - Flag a RG consistency error and withdraw cluster
- * @rgd:
- *
- * Returns: -1 if this call withdrew the machine,
- *          0 if it was already withdrawn
- */
-
-int gfs_consist_rgrpd_i(struct gfs_rgrpd *rgd, int cluster_wide,
-			const char *function,
-			char *file, unsigned int line);
-#define gfs_consist_rgrpd(rgd) \
-gfs_consist_rgrpd_i((rgd), FALSE, __FUNCTION__, __FILE__, __LINE__)
-#define gfs_cconsist_rgrpd(rgd) \
-gfs_consist_rgrpd_i((rgd), TRUE, __FUNCTION__, __FILE__, __LINE__)
-
-/**
- * gfs_meta_check - Flag a magic number consistency error and withdraw
- * @sdp:
- * @bh:
- *
- * Returns: 0 if things are ok,
- *          -1 if this call withdrew the machine,
- *          -2 if it was already withdrawn
- */
-
-int gfs_meta_check_ii(struct gfs_sbd *sdp, struct buffer_head *bh,
-		      const char *function,
-		      char *file, unsigned int line);
-static __inline__ int
-gfs_meta_check_i(struct gfs_sbd *sdp, struct buffer_head *bh,
-		 const char *function,
-		 char *file, unsigned int line)
-{
-	uint32_t magic;
-	magic = ((struct gfs_meta_header *)(bh)->b_data)->mh_magic;
-	magic = gfs32_to_cpu(magic);
-	if (likely(magic == GFS_MAGIC))
-		return 0;
-	return gfs_meta_check_ii(sdp, bh, function, file, line);
-}
-#define gfs_meta_check(sdp, bh) \
-gfs_meta_check_i((sdp), (bh), \
-		 __FUNCTION__, __FILE__, __LINE__)
-
-/**
- * gfs_metatype_check - Flag a metadata type consistency error and withdraw
- * @sdp:
- * @bh:
- * @type:
- *
- * Returns: 0 if things are ok,
- *          -1 if this call withdrew the machine,
- *          -2 if it was already withdrawn
- */
-
-int gfs_metatype_check_ii(struct gfs_sbd *sdp, struct buffer_head *bh,
-			  uint32_t type, uint32_t t,
-			  const char *function,
-			  char *file, unsigned int line);
-static __inline__ int
-gfs_metatype_check_i(struct gfs_sbd *sdp, struct buffer_head *bh,
-		     uint32_t type,
-		     const char *function,
-		     char *file, unsigned int line)
-{
-        uint32_t magic, t;
-        magic = ((struct gfs_meta_header *)(bh)->b_data)->mh_magic;
-        magic = gfs32_to_cpu(magic);
-	if (unlikely(magic != GFS_MAGIC))
-		return gfs_meta_check_ii(sdp, bh, function, file, line);
-	t = ((struct gfs_meta_header *)(bh)->b_data)->mh_type;
-	t = gfs32_to_cpu(t);
-        if (unlikely(t != type))
-		return gfs_metatype_check_ii(sdp, bh, type, t, function, file, line);
-	return 0;
-}
-#define gfs_metatype_check(sdp, bh, type) \
-gfs_metatype_check_i((sdp), (bh), (type), \
-		     __FUNCTION__, __FILE__, __LINE__)
-
-/**
- * gfs_metatype_check2 - Flag a metadata type consistency error and withdraw
- * @sdp:
- * @bh:
- * @type1:
- * @type2:
- *
- * Returns: 0 if things are ok,
- *          -1 if this call withdrew the machine,
- *          -2 if it was already withdrawn
- */
-
-static __inline__ int
-gfs_metatype_check2_i(struct gfs_sbd *sdp, struct buffer_head *bh,
-		      uint32_t type1, uint32_t type2,
-		      const char *function,
-		      char *file, unsigned int line)
-{
-        uint32_t magic, t;
-        magic = ((struct gfs_meta_header *)(bh)->b_data)->mh_magic;
-        magic = gfs32_to_cpu(magic);
-        if (unlikely(magic != GFS_MAGIC))
-                return gfs_meta_check_ii(sdp, bh, function, file, line);
-        t = ((struct gfs_meta_header *)(bh)->b_data)->mh_type;
-        t = gfs32_to_cpu(t);
-        if (unlikely(t != type1 && t != type2))
-                return gfs_metatype_check_ii(sdp, bh, type1, t, function, file, line);
-        return 0;
-}
-#define gfs_metatype_check2(sdp, bh, type1, type2) \
-gfs_metatype_check2_i((sdp), (bh), (type1), (type2), \
-                     __FUNCTION__, __FILE__, __LINE__)
-
-/**
- * gfs_metatype_set - set the metadata type on a buffer
- * @bh:
- * @type:
- * @format:
- *
- */
-
-static __inline__ void
-gfs_metatype_set(struct buffer_head *bh, uint32_t type, uint32_t format)
-{
-	struct gfs_meta_header *mh;
-	mh = (struct gfs_meta_header *)bh->b_data;
-	mh->mh_type = cpu_to_gfs32(type);
-	mh->mh_format = cpu_to_gfs32(format);
-}
-
-/**
- * gfs_io_error - Flag an I/O error and withdraw
- * @sdp:
- *
- * Returns: -1 if this call withdrew the machine,
- *          0 if it was already withdrawn
- */
-
-int gfs_io_error_i(struct gfs_sbd *sdp,
-		   const char *function,
-		   char *file, unsigned int line);
-#define gfs_io_error(sdp) \
-gfs_io_error_i((sdp), __FUNCTION__, __FILE__, __LINE__);
-
-/**
- * gfs_io_error_inode - Flag an inode I/O error and withdraw
- * @ip:
- *
- * Returns: -1 if this call withdrew the machine,
- *          0 if it was already withdrawn
- */
-
-int gfs_io_error_inode_i(struct gfs_inode *ip,
-			 const char *function,
-			 char *file, unsigned int line);
-#define gfs_io_error_inode(ip) \
-gfs_io_error_inode_i((ip), __FUNCTION__, __FILE__, __LINE__);
-
-/**
- * gfs_io_error_bh - Flag a buffer I/O error and withdraw
- * @sdp:
- * @bh:
- *
- * Returns: -1 if this call withdrew the machine,
- *          0 if it was already withdrawn
- */
-
-int gfs_io_error_bh_i(struct gfs_sbd *sdp, struct buffer_head *bh,
-		      const char *function,
-		      char *file, unsigned int line);
-#define gfs_io_error_bh(sdp, bh) \
-gfs_io_error_bh_i((sdp), (bh), __FUNCTION__, __FILE__, __LINE__);
-
-
-/* Memory stuff */
-
-#define RETRY_MALLOC(do_this, until_this) \
-for (;;) { \
-	{ do_this; } \
-	if (until_this) \
-		break; \
-	printk("GFS: out of memory: %s, %u\n", __FILE__, __LINE__); \
-	dump_stack(); \
-	yield(); \
-}
-
-extern struct kmem_cache *gfs_glock_cachep;
-extern struct kmem_cache *gfs_inode_cachep;
-extern struct kmem_cache *gfs_bufdata_cachep;
-extern struct kmem_cache *gfs_mhc_cachep;
-
-void *gmalloc(unsigned int size);
-
-
-struct gfs_user_buffer {
-	char *ub_data;
-	unsigned int ub_size;
-	unsigned int ub_count;
-};
-int gfs_add_bh_to_ub(struct gfs_user_buffer *ub, struct buffer_head *bh);
-
-
-static __inline__ unsigned int
-gfs_tune_get_i(struct gfs_tune *gt, unsigned int *p)
-{
-	unsigned int x;
-	spin_lock(&gt->gt_spin);
-	x = *p;
-	spin_unlock(&gt->gt_spin);
-	return x;
-}
-#define gfs_tune_get(sdp, field) \
-gfs_tune_get_i(&(sdp)->sd_tune, &(sdp)->sd_tune.field)
-
-
-#endif /* __UTIL_DOT_H__ */
diff --git a/gfs/Makefile b/gfs/Makefile
deleted file mode 100644
index 510e181..0000000
--- a/gfs/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-include ../make/defines.mk
-
-SUBDIRS=libgfs gfs_debug gfs_fsck gfs_grow gfs_jadd gfs_mkfs gfs_quota gfs_tool man init.d
-
-all: ${SUBDIRS}
-
-%:
-	set -e && \
-	for i in ${SUBDIRS}; do \
-		${MAKE} -C $$i $@; \
-	done; \
-	if [ "$@" = "install" ]; then \
-		mkdir -p ${DESTDIR}/sbin; \
-		cd ${DESTDIR}/sbin; \
-			ln -sf mount.gfs2 mount.gfs; \
-		mkdir -p ${sbindir}; \
-		cd ${sbindir}; \
-			ln -sf gfs2_edit gfs_edit; \
-	fi; \
-	if [ "$@" = "uninstall" ]; then \
-		cd ${DESTDIR}/sbin; rm -f mount.gfs; \
-		cd ${sbindir}; rm -f gfs_edit; \
-	fi
diff --git a/gfs/gfs_debug/Makefile b/gfs/gfs_debug/Makefile
deleted file mode 100644
index 29ce963..0000000
--- a/gfs/gfs_debug/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-TARGET= gfs_debug
-
-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=	block_device.o \
-	basic.o \
-	main.o \
-	ondisk.o \
-	readfile.o \
-	util.o
-
-CFLAGS += -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64
-CFLAGS += -I${gfskincdir}
-CFLAGS += -I$(S)/../include
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${libdir}
-
-${TARGET}: ${OBJS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/gfs/gfs_debug/basic.c b/gfs/gfs_debug/basic.c
deleted file mode 100644
index 0b5a517..0000000
--- a/gfs/gfs_debug/basic.c
+++ /dev/null
@@ -1,436 +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 <stdint.h>
-#include <inttypes.h>
-
-#include "gfs_ondisk.h"
-#include "linux_endian.h"
-
-#include "gfs_debug.h"
-#include "basic.h"
-#include "block_device.h"
-
-/**
- * verify_block_size -
- * @bsize:
- *
- */
-
-static int
-verify_block_size(unsigned int bsize)
-{
-	unsigned int x = 512;
-
-	for (;;) {
-		if (!x)
-			return -1;
-		if (x == bsize)
-			return 0;
-		x <<= 1;
-	}
-}
-
-/**
- * verify_gfs -
- *
- */
-
-void
-verify_gfs(void)
-{
-	char buf[GFS_BASIC_BLOCK];
-	struct gfs_sb sb;
-
-	if (device_size < (GFS_SB_ADDR + 1) * GFS_BASIC_BLOCK)
-		return;
-
-	do_lseek(device_fd, GFS_SB_ADDR * GFS_BASIC_BLOCK);
-	do_read(device_fd, buf, GFS_BASIC_BLOCK);
-
-	gfs_sb_in(&sb, buf);
-
-	if (sb.sb_header.mh_magic != GFS_MAGIC ||
-	    sb.sb_header.mh_type != GFS_METATYPE_SB ||
-	    sb.sb_bsize != 1 << sb.sb_bsize_shift ||
-	    verify_block_size(sb.sb_bsize))
-		return;
-
-	if (!block_size || block_size == sb.sb_bsize) {
-		unsigned int x;
-
-		is_gfs = TRUE;
-		block_size = sb.sb_bsize;
-		block_size_shift = sb.sb_bsize_shift;
-
-		sd_diptrs = (block_size - sizeof(struct gfs_dinode)) / sizeof(uint64_t);
-		sd_inptrs = (block_size - sizeof(struct gfs_indirect)) / sizeof(uint64_t);
-		sd_jbsize = block_size - sizeof(struct gfs_meta_header);
-		sd_hash_bsize = block_size / 2;
-		sd_hash_ptrs = sd_hash_bsize / sizeof(uint64_t);
-
-		sd_heightsize[0] = block_size - sizeof(struct gfs_dinode);
-		sd_heightsize[1] = block_size * sd_diptrs;
-		for (x = 2;; x++) {
-			uint64_t space = sd_heightsize[x - 1] * sd_inptrs;
-			uint64_t d = space / sd_inptrs;
-			uint32_t m = space % sd_inptrs;
-
-			if (d != sd_heightsize[x - 1] || m)
-				break;
-			sd_heightsize[x] = space;
-		}
-		sd_max_height = x;
-
-		sd_jheightsize[0] = block_size - sizeof(struct gfs_dinode);
-		sd_jheightsize[1] = sd_jbsize * sd_diptrs;
-		for (x = 2;; x++) {
-			uint64_t space = sd_jheightsize[x - 1] * sd_inptrs;
-			uint64_t d = space / sd_inptrs;
-			uint32_t m = space % sd_inptrs;
-
-			if (d != sd_jheightsize[x - 1] || m)
-				break;
-			sd_jheightsize[x] = space;
-		}
-		sd_max_jheight = x;
-	}
-}
-
-/**
- * must_be_gfs -
- *
- */
-
-void
-must_be_gfs(void)
-{
-	if (!is_gfs)
-		die("not a gfs filesystem\n");
-}
-
-/**
- * scan_device -
- *
- */
-
-void
-scan_device(void)
-{
-	char data[GFS_BASIC_BLOCK];
-	uint64_t bb;
-	struct gfs_meta_header mh;
-
-	for (bb = 0; (bb + 1) * GFS_BASIC_BLOCK <= device_size; bb++) {
-		do_lseek(device_fd, bb * GFS_BASIC_BLOCK);
-		do_read(device_fd, data, GFS_BASIC_BLOCK);
-		gfs_meta_header_in(&mh, data);
-
-		if (mh.mh_magic == GFS_MAGIC &&
-		    mh.mh_type && mh.mh_type <= GFS_METATYPE_EA)
-			printf("sector %"PRIu64": type %u\n",
-			       bb, mh.mh_type);
-	}
-}
-
-/**
- * print_superblock -
- *
- */
-
-void
-print_superblock(void)
-{
-	char *data;
-	struct gfs_sb sb;
-
-	must_be_gfs();
-
-	data = get_block(GFS_SB_ADDR * GFS_BASIC_BLOCK / block_size, TRUE);
-	gfs_sb_in(&sb, data);
-	free(data);
-
-	gfs_sb_print(&sb);
-}
-
-/**
- * print_bitmaps -
- * @data:
- * @offset:
- *
- */
-
-static void
-print_bitmaps(char *data, unsigned int offset)
-{
-	unsigned int bn = 0;
-	unsigned int bit;
-	unsigned char value;
-	char *type;
-
-	printf("\n");
-
-	for (; offset < block_size; offset++) {
-		for (bit = 0; bit < GFS_NBBY; bit++) {
-			value = data[offset];
-			value = (value >> (bit * GFS_BIT_SIZE)) & GFS_BIT_MASK;
-			switch (value) {
-			case GFS_BLKST_FREE:
-				type = "free";
-				break;
-			case GFS_BLKST_USED:
-				type = "used data";
-				break;
-			case GFS_BLKST_FREEMETA:
-				type = "free meta";
-				break;
-			case GFS_BLKST_USEDMETA:
-				type = "used meta";
-				break;
-			default:
-				ASSERT(FALSE,);
-			}
-			printf("  block %u: %s\n", bn, type);
-			bn++;
-		}
-	}
-}
-
-/**
- * print_stuffed_hash -
- * @data:
- *
- */
-
-static void
-print_stuffed_hash(char *data)
-{
-	uint64_t *p = (uint64_t *)(data + sizeof(struct gfs_dinode));
-	uint64_t *end = (uint64_t *)(((char *)p) + block_size / 2);
-	uint64_t this, last = 0;
-	unsigned int run = 0;
-	int first = TRUE;
-
-	printf("\n");
-
-	for (; p < end; p++) {
-		this = gfs64_to_cpu(*p);
-
-		if (first) {
-			first = FALSE;
-			run = 1;
-		} else {
-			if (this == last)
-				run++;
-			else {
-				printf("  pointer: %"PRIu64" (%u)\n",
-				       last, run);
-				run = 1;
-			}
-		}
-			
-		last = this;
-	}
-
-	printf("  pointer: %"PRIu64" (%u)\n",
-	       last, run);
-}
-
-/**
- * print_dirents -
- * @data:
- * @offset:
- *
- * Make this more robust
- *
- */
-
-void
-print_dirents(char *data, unsigned int offset)
-{
-	struct gfs_dirent de;
-
-	for (; offset < block_size; offset += de.de_rec_len) {
-		printf("\n");
-		gfs_dirent_in(&de, data + offset);
-
-		if (sizeof(struct gfs_dirent) + de.de_name_len > de.de_rec_len)
-			continue;
-		if (offset + sizeof(struct gfs_dirent) + de.de_name_len > block_size)
-			break;
-		if (de.de_inum.no_formal_ino)
-			gfs_dirent_print(&de, data + offset + sizeof(struct gfs_dirent));
-	}
-}
-
-/**
- * print_pointers -
- * @data:
- * @offset:
- *
- */
-
-static void
-print_pointers(char *data, unsigned int offset)
-{
-	uint64_t *p = (uint64_t *)(data + offset);
-	uint64_t *end = (uint64_t *)(data + block_size);
-	unsigned int x = 0;
-
-	printf("\n");
-
-	for (; p < end; p++, x++)
-		if (*p)
-			printf("  pointer #%u: %"PRIu64"\n",
-			       x, gfs64_to_cpu(*p));
-}
-
-/**
- * identify_block -
- *
- */
-
-void
-identify_block(void)
-{
-	char *data;
-	struct gfs_meta_header mh;
-
-	must_be_gfs();
-
-	data = get_block(block_number, TRUE);
-	gfs_meta_header_in(&mh, data);
-
-	if (mh.mh_magic != GFS_MAGIC) {
-		printf("Not GFS metadata\n");
-		free(data);
-		return;
-	}
-
-	switch (mh.mh_type) {
-	case GFS_METATYPE_NONE:
-		printf("GFS_METATYPE_NONE\n");
-		break;
-
-	case GFS_METATYPE_SB:
-		printf("Super\n");
-		if (verbose) {
-			struct gfs_sb sb;
-			gfs_sb_in(&sb, data);
-			gfs_sb_print(&sb);
-		}
-		break;
-
-	case GFS_METATYPE_RG:
-		printf("Resource Group Header\n");
-		if (verbose) {
-			struct gfs_rgrp rg;
-			gfs_rgrp_in(&rg, data);
-			gfs_rgrp_print(&rg);
-			if (verbose > 1)
-				print_bitmaps(data, sizeof(struct gfs_rgrp));
-		}
-		break;
-
-	case GFS_METATYPE_RB:
-		printf("Resource Group Bitmap\n");
-		if (verbose) {
-			gfs_meta_header_print(&mh);
-			if (verbose > 1)
-				print_bitmaps(data, sizeof(struct gfs_meta_header));
-		}
-		break;
-
-	case GFS_METATYPE_DI:
-		printf("Dinode\n");
-		if (verbose) {
-			struct gfs_dinode di;
-			gfs_dinode_in(&di, data);
-			gfs_dinode_print(&di);
-			if (verbose > 1) {
-				if (di.di_height)
-					print_pointers(data, sizeof(struct gfs_dinode));
-				else {
-					if (di.di_type == GFS_FILE_REG)
-						printf("\n  stuffed data\n");
-					else if (di.di_type == GFS_FILE_DIR &&
-						(di.di_flags & GFS_DIF_EXHASH))
-						print_stuffed_hash(data);
-					else if (di.di_type == GFS_FILE_DIR)
-						print_dirents(data, sizeof(struct gfs_dinode));
-					else if (di.di_type == GFS_FILE_LNK)
-						printf("\nsymlink to %s\n",
-						       data + sizeof(struct gfs_dinode));
-				}
-			}
-		}
-		break;
-
-	case GFS_METATYPE_IN:
-		printf("Indirect\n");
-		if (verbose) {
-			struct gfs_indirect in;
-			gfs_indirect_in(&in, data);
-			gfs_indirect_print(&in);
-			if (verbose > 1) {
-				print_pointers(data, sizeof(struct gfs_indirect));
-			}
-		}
-		break;
-
-	case GFS_METATYPE_LF:
-		printf("Directory Leaf\n");
-		if (verbose) {
-			struct gfs_leaf lf;
-			gfs_leaf_in(&lf, data);
-			gfs_leaf_print(&lf);
-			if (verbose > 1)
-				print_dirents(data, sizeof(struct gfs_leaf));
-		}
-		break;
-
-	case GFS_METATYPE_JD:
-		printf("Journaled Data\n");
-		if (verbose)
-			gfs_meta_header_print(&mh);
-		break;
-
-	case GFS_METATYPE_LH:
-		printf("Log Header\n");
-		if (verbose) {
-			struct gfs_log_header lh;
-			gfs_log_header_in(&lh, data);
-			gfs_log_header_print(&lh);
-		}
-		break;
-
-	case GFS_METATYPE_LD:
-		printf("Lock Descriptor\n");
-		if (verbose) {
-			struct gfs_log_descriptor ld;
-			gfs_desc_in(&ld, data);
-			gfs_desc_print(&ld);
-		}
-		break;
-
-	case GFS_METATYPE_EA:
-		printf("Extended Attribute\n");
-		if (verbose)
-			gfs_meta_header_print(&mh);
-		break;
-
-	default:
-		printf("Unknown metadata type\n");
-		if (verbose)
-			gfs_meta_header_print(&mh);
-		break;
-	}
-
-	free(data);
-}
-
diff --git a/gfs/gfs_debug/basic.h b/gfs/gfs_debug/basic.h
deleted file mode 100644
index 56d4a77..0000000
--- a/gfs/gfs_debug/basic.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef __BASIC_DOT_H__
-#define __BASIC_DOT_H__
-
-
-EXTERN unsigned int sd_diptrs INIT(0);
-EXTERN unsigned int sd_inptrs INIT(0);
-EXTERN unsigned int sd_jbsize INIT(0);
-EXTERN unsigned int sd_hash_bsize INIT(0);
-EXTERN unsigned int sd_hash_ptrs INIT(0);
-EXTERN uint32_t sd_max_height INIT(0);
-EXTERN uint64_t sd_heightsize[GFS_MAX_META_HEIGHT];
-EXTERN uint32_t sd_max_jheight INIT(0);
-EXTERN uint64_t sd_jheightsize[GFS_MAX_META_HEIGHT];
-
-
-void verify_gfs(void);
-void must_be_gfs(void);
-void scan_device(void);
-void print_superblock(void);
-void identify_block(void);
-
-void print_dirents(char *data, unsigned int offset);
-
-
-#endif /* __BASIC_DOT_H__ */
-
diff --git a/gfs/gfs_debug/block_device.c b/gfs/gfs_debug/block_device.c
deleted file mode 100644
index 8640f6f..0000000
--- a/gfs/gfs_debug/block_device.c
+++ /dev/null
@@ -1,117 +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 <stdint.h>
-#include <inttypes.h>
-
-#include "gfs_debug.h"
-#include "block_device.h"
-
-/**
- * find_device_size -
- *
- */
-
-void
-find_device_size(void)
-{
-	device_size = lseek(device_fd, 0, SEEK_END);
-	if (device_size < 0)
-		die("can't determine device size: %s\n",
-		    strerror(errno));
-}
-
-/**
- * get_block -
- * @bn:
- * @fatal:
- *
- * Returns: the data in the block (needs to be freed)
- */
-
-char *
-get_block(uint64_t bn, int fatal)
-{
-	char *data;
-
-	if (device_size < (bn + 1) * block_size) {
-		fprintf(stderr, "%s: block %"PRIu64" is off the end of the device\n",
-			prog_name, bn);
-		if (fatal)
-			exit(EXIT_FAILURE);
-	}
-
-	data = malloc(block_size);
-	if (!data)
-		die("out of memory (%s, %u)\n",
-		    __FILE__, __LINE__);
-
-	do_lseek(device_fd, bn * block_size);
-	do_read(device_fd, data, block_size);
-
-	return data;
-}
-
-/**
- * print_size -
- *
- */
-
-void
-print_size(void)
-{
-	printf("%"PRIu64"\n", device_size);
-}
-
-/**
- * print_hexblock -
- *
- */
-
-void
-print_hexblock(void)
-{
-	char *data;
-	unsigned int x;
-
-	if (!block_size)
-		die("no block size set\n");
-
-	data = get_block(block_number, TRUE);
-
-	for (x = 0; x < block_size; x++) {
-		printf("%.2X", ((unsigned char *)data)[x]);
-		if (x % 16 == 15)
-			printf("\n");
-		else
-			printf(" ");
-	}
-
-	if (x % 16)
-		printf("\n");
-
-	free(data);
-}
-
-/**
- * print_rawblock -
- *
- */
-
-void
-print_rawblock(void)
-{
-	char *data;
-
-	if (!block_size)
-		die("no block size set\n");
-
-	data = get_block(block_number, TRUE);
-	do_write(STDOUT_FILENO, data, block_size);
-	free(data);
-}
diff --git a/gfs/gfs_debug/block_device.h b/gfs/gfs_debug/block_device.h
deleted file mode 100644
index 6af5437..0000000
--- a/gfs/gfs_debug/block_device.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __BLOCK_DEVICE_DOT_H__
-#define __BLOCK_DEVICE_DOT_H__
-
-
-void find_device_size(void);
-char *get_block(uint64_t bn, int fatal);
-
-void print_size(void);
-void print_hexblock(void);
-void print_rawblock(void);
-
-
-#endif /* __BLOCK_DEVICE_DOT_H__ */
-
diff --git a/gfs/gfs_debug/gfs_debug.h b/gfs/gfs_debug/gfs_debug.h
deleted file mode 100644
index 2f675b2..0000000
--- a/gfs/gfs_debug/gfs_debug.h
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef __GFS_DEBUG_DOT_H__
-#define __GFS_DEBUG_DOT_H__
-
-
-#ifndef TRUE
-#define TRUE (1)
-#endif
-
-#ifndef FALSE
-#define FALSE (0)
-#endif
-
-#ifndef EXTERN
-#define EXTERN extern
-#define INIT(X)
-#else
-#undef EXTERN
-#define EXTERN
-#define INIT(X) =X 
-#endif
-
-
-#define die(fmt, args...) \
-do { \
-	fprintf(stderr, "%s: ", prog_name); \
-	fprintf(stderr, fmt, ##args); \
-	exit(EXIT_FAILURE); \
-} while (0)
-
-#define ASSERT(x, todo) \
-do { \
-	if (!(x)) { \
-		{todo} \
-		die("assertion failed on line %d of file %s\n", \
-		    __LINE__, __FILE__); \
-	} \
-} while (0)
-
-EXTERN char *prog_name;
-
-#define do_lseek(fd, off) \
-do { \
-	if (lseek((fd), (off), SEEK_SET) != (off)) \
-		die("bad seek on line %d of file %s: %s\n", \
-		    __LINE__, __FILE__, strerror(errno)); \
-} while (0)
-
-#define do_read(fd, buff, len) \
-do { \
-	if (read((fd), (buff), (len)) != (len)) \
-		die("bad read on line %d of file %s: %s\n", \
-		    __LINE__, __FILE__, strerror(errno)); \
-} while (0)
-
-#define do_write(fd, buff, len) \
-do { \
-	if (write((fd), (buff), (len)) != (len)) \
-		die("bad write on line %d of file %s: %s\n", \
-		    __LINE__, __FILE__, strerror(errno)); \
-} while (0)
-
-#define DIV_RU(x, y) (((x) + (y) - 1) / (y))
-
-
-/* Command line arguments */
-
-EXTERN unsigned int verbose INIT(0);
-
-EXTERN char *action INIT(NULL);
-
-EXTERN char *device INIT(NULL);
-EXTERN int device_fd INIT(-1);
-EXTERN off_t device_size INIT(-1);
-
-EXTERN int is_gfs INIT(FALSE);
-EXTERN unsigned int block_size INIT(0);
-EXTERN unsigned int block_size_shift INIT(0);
-
-EXTERN uint64_t block_number INIT(0);
-
-
-#endif /* __GFS_DEBUG_DOT_H__ */
-
diff --git a/gfs/gfs_debug/main.c b/gfs/gfs_debug/main.c
deleted file mode 100644
index b42d34a..0000000
--- a/gfs/gfs_debug/main.c
+++ /dev/null
@@ -1,179 +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 <stdint.h>
-#include <inttypes.h>
-
-#include "gfs_ondisk.h"
-#include "copyright.cf"
-
-#define EXTERN
-#include "gfs_debug.h"
-#include "basic.h"
-#include "block_device.h"
-#include "readfile.h"
-
-/**
- * print_usage - print out usage information
- *
- */
-
-static void
-print_usage(void)
-{
-	printf("Usage:\n");
-	printf("\n");
-	printf("%s [options] <action>\n", prog_name);
-	printf("\n");
-	printf("Actions:\n");
-	printf("  size             print the device size\n");
-	printf("  hexread          print a block in hex\n");
-	printf("  rawread          print a block raw\n");
-	printf("\n");
-	printf("GFS-specific Actions:\n");
-	printf("  scan             scan the device looking for GFS blocks\n");
-	printf("  identify         identify the contents of a block\n");
-	printf("  sb               print superblock\n");
-	printf("  jindex           print journal index\n");
-	printf("  rindex           print resource index\n");
-	printf("  quota            print quota file\n");
-	printf("  root             print root directory\n");
-	printf("  readfile         print the contents of a file\n");
-	printf("  readdir          print the contents of a directory\n");
-	printf("\n");
-	printf("Options:\n");
-	printf("\n");
-	printf("  -B <bytes>       Set the block size\n");
-	printf("  -b <number>      Block number\n");
-	printf("  -d <device>      Device to look at\n");
-	printf("  -h               Print this help, then exit\n");
-	printf("  -v               Verbose\n");
-	printf("  -V               Print program version information, then exit\n");
-}
-
-/**
- * decode_arguments -
- * @argc:
- * @argv:
- *
- */
-
-static void
-decode_arguments(int argc, char *argv[])
-{
-	int cont = TRUE;
-	int optchar;
-
-	while (cont) {
-		optchar = getopt(argc, argv, "B:b:d:hVv");
-
-		switch (optchar) {
-		case 'B':
-			sscanf(optarg, "%u", &block_size);
-			if (!block_size)
-				die("can't have a zero block size\n");
-			break;
-
-		case 'b':
-			sscanf(optarg, "%"SCNu64, &block_number);
-			break;
-
-		case 'd':
-			device = optarg;
-			break;
-
-		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
-
-		case 'V':
-			printf("gfs_mkfs %s (built %s %s)\n", RELEASE_VERSION, __DATE__, __TIME__);
-			printf("%s\n", REDHAT_COPYRIGHT);
-			exit(EXIT_SUCCESS);
-
-		case 'v':
-			verbose++;
-			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");
-
-	if (optind < argc) 
-		die("Unrecognized option: %s\n", argv[optind]);
-
-	if (!device)
-		die("no device specified\n");
-}
-
-/**
- * main - 
- * @argc:
- * @argv:
- *
- * Returns: exit status
- */
-
-int
-main(int argc, char *argv[])
-{
-	prog_name = argv[0];
-
-	decode_arguments(argc, argv);
-
-	device_fd = open(device, O_RDWR);
-	if (device_fd < 0)
-		die("can't open device %s: %s\n",
-		    device, strerror(errno));
-
-	find_device_size();
-	verify_gfs();
-
-	if (!strcmp(action, "size"))
-		print_size();
-	else if (!strcmp(action, "hexread"))
-		print_hexblock();
-	else if (!strcmp(action, "rawread"))
-		print_rawblock();
-	else if (!strcmp(action, "scan"))
-		scan_device();
-	else if (!strcmp(action, "identify"))
-		identify_block();
-	else if (!strcmp(action, "sb"))
-		print_superblock();
-	else if (!strcmp(action, "jindex"))
-		print_jindex();
-	else if (!strcmp(action, "rindex"))
-		print_rindex();
-	else if (!strcmp(action, "quota"))
-		print_quota();
-	else if (!strcmp(action, "root"))
-		print_root();
-	else if (!strcmp(action, "readfile"))
-		readfile();
-	else if (!strcmp(action, "readdir"))
-		readdir();
-	else
-		die("unknown action %s\n", action);
-		
-	close(device_fd);
-
-	exit(EXIT_SUCCESS);
-}
-
diff --git a/gfs/gfs_debug/ondisk.c b/gfs/gfs_debug/ondisk.c
deleted file mode 100644
index 248cb77..0000000
--- a/gfs/gfs_debug/ondisk.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdio.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/gfs/gfs_debug/readfile.c b/gfs/gfs_debug/readfile.c
deleted file mode 100644
index d1de13e..0000000
--- a/gfs/gfs_debug/readfile.c
+++ /dev/null
@@ -1,236 +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 <stdint.h>
-#include <inttypes.h>
-
-#include "gfs_ondisk.h"
-#include "linux_endian.h"
-
-#include "gfs_debug.h"
-#include "basic.h"
-#include "block_device.h"
-#include "readfile.h"
-#include "util.h"
-
-void
-print_jindex(void)
-{
-	struct gfs_sb sb;
-	struct gfs_dinode di;
-	struct gfs_jindex ji;
-	char *data;
-	char buf[sizeof(struct gfs_jindex)];
-	uint64_t o;
-	unsigned int x;
-	int error;
-
-	must_be_gfs();
-
-	data = get_block(GFS_SB_ADDR * GFS_BASIC_BLOCK / block_size, TRUE);
-	gfs_sb_in(&sb, data);
-	free(data);
-
-	data = get_block(sb.sb_jindex_di.no_addr, TRUE);
-	gfs_dinode_in(&di, data);
-	free(data);
-
-	if (di.di_size % sizeof(struct gfs_jindex))
-		fprintf(stderr, "%s: strange size for journal index %"PRIu64"\n",
-			prog_name, di.di_size);
-
-	for (o = 0, x = 0;; o += sizeof(struct gfs_jindex), x++) {
-		error = gfs_readi(&di, buf, o, sizeof(struct gfs_jindex));
-		if (!error)
-			break;
-		if (error < sizeof(struct gfs_jindex))
-			continue;
-		gfs_jindex_in(&ji, buf);
-		printf("Journal %u:\n", x);
-		gfs_jindex_print(&ji);
-		printf("\n");
-	}
-}
-
-void
-print_rindex(void)
-{
-	struct gfs_sb sb;
-	struct gfs_dinode di;
-	struct gfs_rindex ri;
-	char *data;
-	char buf[sizeof(struct gfs_rindex)];
-	uint64_t o;
-	unsigned int x;
-	int error;
-
-	must_be_gfs();
-
-	data = get_block(GFS_SB_ADDR * GFS_BASIC_BLOCK / block_size, TRUE);
-	gfs_sb_in(&sb, data);
-	free(data);
-
-	data = get_block(sb.sb_rindex_di.no_addr, TRUE);
-	gfs_dinode_in(&di, data);
-	free(data);
-
-	if (di.di_size % sizeof(struct gfs_rindex))
-		fprintf(stderr, "%s: strange size for resource index %"PRIu64"\n",
-			prog_name, di.di_size);
-
-	for (o = 0, x = 0;; o += sizeof(struct gfs_rindex), x++) {
-		error = gfs_readi(&di, buf, o, sizeof(struct gfs_rindex));
-		if (!error)
-			break;
-		if (error < sizeof(struct gfs_rindex))
-			continue;
-		gfs_rindex_in(&ri, buf);
-		printf("Resource Group %u:\n", x);
-		gfs_rindex_print(&ri);
-		printf("\n");
-	}
-}
-
-void
-print_quota(void)
-{
-	struct gfs_sb sb;
-	struct gfs_dinode di;
-	struct gfs_quota qu;
-	char *data;
-	char buf[sizeof(struct gfs_quota)];
-	uint64_t o;
-	unsigned int x;
-	int error;
-
-	must_be_gfs();
-
-	data = get_block(GFS_SB_ADDR * GFS_BASIC_BLOCK / block_size, TRUE);
-	gfs_sb_in(&sb, data);
-	free(data);
-
-	data = get_block(sb.sb_quota_di.no_addr, TRUE);
-	gfs_dinode_in(&di, data);
-	free(data);
-
-	for (o = 0, x = 0;; o += sizeof(struct gfs_quota), x++) {
-		error = gfs_readi(&di, buf, o, sizeof(struct gfs_quota));
-		if (!error)
-			break;
-		if (error < 0)
-			continue;
-		gfs_quota_in(&qu, buf);
-
-		if (!qu.qu_limit && !qu.qu_warn && !qu.qu_value)
-			continue;
-
-		printf("Quota (%s, %u):\n", (x % 2) ? "group" : "user", x / 2);
-		gfs_quota_print(&qu);
-		printf("\n");
-	}
-}
-
-void
-print_root(void)
-{
-	struct gfs_sb sb;
-	char *data;
-
-	must_be_gfs();
-
-	data = get_block(GFS_SB_ADDR * GFS_BASIC_BLOCK / block_size, TRUE);
-	gfs_sb_in(&sb, data);
-	free(data);
-
-	block_number = sb.sb_root_di.no_addr;
-
-	readdir();
-}
-
-#define CHUNKSIZE (65536)
-
-void
-readfile(void)
-{
-	struct gfs_dinode di;
-	char *data;
-	char buf[CHUNKSIZE];
-	uint64_t o = 0;
-	int error, rc;
-
-	must_be_gfs();
-
-	data = get_block(block_number, TRUE);
-	gfs_dinode_in(&di, data);
-	free(data);
-
-	if (di.di_header.mh_magic != GFS_MAGIC ||
-	    di.di_header.mh_type != GFS_METATYPE_DI)
-		die("block %"PRIu64" isn't an inode\n",
-		    block_number);
-
-	if (di.di_type != GFS_FILE_REG)
-		die("block %"PRIu64" isn't a regular file\n",
-		    block_number);
-
-	for (;;) {
-		error = gfs_readi(&di, buf, o, CHUNKSIZE);
-		if (error <= 0)
-			break;
-		rc = write(STDOUT_FILENO, buf, error);
-		o += error;
-	}
-}
-
-static void
-do_readdir(struct gfs_dinode *di, char *data,
-	   uint32_t index, uint32_t len, uint64_t leaf_no,
-	   void *opaque)
-{
-	struct gfs_leaf leaf;
-
-	print_dirents(data, sizeof(struct gfs_leaf));
-	gfs_leaf_in(&leaf, data);
-
-	while (leaf.lf_next) {
-		data = get_block(leaf.lf_next, FALSE);
-		if (!data)
-			return;
-		print_dirents(data, sizeof(struct gfs_leaf));
-		gfs_leaf_in(&leaf, data);
-		free(data);
-	}
-}
-
-void
-readdir(void)
-{
-	struct gfs_dinode di;
-	char *data;
-
-	must_be_gfs();
-
-	data = get_block(block_number, TRUE);
-	gfs_dinode_in(&di, data);
-
-	if (di.di_header.mh_magic != GFS_MAGIC ||
-	    di.di_header.mh_type != GFS_METATYPE_DI)
-		die("block %"PRIu64" isn't an inode\n",
-		    block_number);
-
-	if (di.di_type != GFS_FILE_DIR)
-		die("block %"PRIu64" isn't a directory\n",
-		    block_number);
-
-	if (di.di_flags & GFS_DIF_EXHASH)
-		foreach_leaf(&di, do_readdir, NULL);
-	else
-		print_dirents(data, sizeof(struct gfs_dinode));
-
-	free(data);
-}
diff --git a/gfs/gfs_debug/readfile.h b/gfs/gfs_debug/readfile.h
deleted file mode 100644
index e4e84e9..0000000
--- a/gfs/gfs_debug/readfile.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __READFILE_DOT_H__
-#define __READFILE_DOT_H__
-
-
-void print_jindex(void);
-void print_rindex(void);
-void print_quota(void);
-void print_root(void);
-void readfile(void);
-void readdir(void);
-
-
-#endif /* __READFILE_DOT_H__ */
-
diff --git a/gfs/gfs_debug/util.c b/gfs/gfs_debug/util.c
deleted file mode 100644
index 4dcc387..0000000
--- a/gfs/gfs_debug/util.c
+++ /dev/null
@@ -1,334 +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 <stdint.h>
-#include <inttypes.h>
-
-#include "gfs_ondisk.h"
-#include "linux_endian.h"
-
-#include "gfs_debug.h"
-#include "basic.h"
-#include "block_device.h"
-#include "util.h"
-
-int
-check_type(char *data, unsigned int type)
-{
-	struct gfs_meta_header mh;
-
-	gfs_meta_header_in(&mh, data);
-	if (mh.mh_magic != GFS_MAGIC ||
-	    mh.mh_type != type) {
-		fprintf(stderr, "%s: expected metadata type %u\n",
-			prog_name, type);
-		return -1;
-	}
-	return 0;
-}
-
-/**
- * recursive_scan - call a function for each block pointer in a file
- * @di:
- * @height:
- * @bn:
- * @pc:
- * @opaque:
- *
- */
-
-void
-recursive_scan(struct gfs_dinode *di,
-	       unsigned int height, uint64_t bn,
-	       pointer_call_t pc, void *opaque)
-{
-	char *data = NULL;
-	uint64_t *top, *bottom;
-	uint64_t x;
-	
-	if (!height) {
-		data = get_block(di->di_num.no_addr, TRUE);
-
-		top = (uint64_t *)(data + sizeof(struct gfs_dinode));
-		bottom = (uint64_t *)(data + sizeof(struct gfs_dinode)) + sd_diptrs;
-	} else {
-		data = get_block(bn, FALSE);
-		if (!data)
-			return;
-		if (check_type(data, GFS_METATYPE_IN))
-			return;
-
-		top = (uint64_t *)(data + sizeof(struct gfs_indirect));
-		bottom = (uint64_t *)(data + sizeof(struct gfs_indirect)) + sd_inptrs;
-	}
-
-	for ( ; top < bottom; top++) {
-		x = gfs64_to_cpu(*top);
-
-		pc(di, height, x, opaque);
-
-		if (x && height < di->di_height - 1)
-			recursive_scan(di,
-				       height + 1, x,
-				       pc, opaque);
-	}
-
-	free(data);
-}
-
-void
-foreach_leaf(struct gfs_dinode *di,
-	     leaf_call_t lc, void *opaque)
-{
-	char *data;
-	struct gfs_leaf leaf;
-	uint32_t hsize, len;
-	uint32_t ht_offset, lp_offset, ht_offset_cur = -1;
-	uint32_t index = 0;
-	uint64_t lp[sd_hash_ptrs];
-	uint64_t leaf_no;
-	int error;
-
-	hsize = 1 << di->di_depth;
-	if (hsize * sizeof(uint64_t) != di->di_size)
-		die("bad hash table size\n");
-
-	while (index < hsize) {
-		lp_offset = index % sd_hash_ptrs;
-		ht_offset = index - lp_offset;
-
-		if (ht_offset_cur != ht_offset) {
-			error = gfs_readi(di, (char *)lp, ht_offset * sizeof(uint64_t), sd_hash_bsize);
-			if (error != sd_hash_bsize)
-				die("FixMe!!!\n");
-			ht_offset_cur = ht_offset;
-		}
-
-		leaf_no = gfs64_to_cpu(lp[lp_offset]);
-		if (!leaf_no)
-			die("NULL leaf pointer\n");
-
-		data = get_block(leaf_no, TRUE);
-		gfs_leaf_in(&leaf, data);
-		len = 1 << (di->di_depth - leaf.lf_depth);
-
-		lc(di, data, index, len, leaf_no, opaque);
-
-		free(data);
-		index += len;
-	}
-
-	if (index != hsize)
-		die("screwed up directory\n");
-}
-
-static unsigned int
-calc_tree_height(struct gfs_dinode *di, uint64_t size)
-{
-	uint64_t *arr;
-	unsigned int max, height;
-
-	if (di->di_size > size)
-		size = di->di_size;
-
-	if (di->di_flags & GFS_DIF_JDATA) {
-		arr = sd_jheightsize;
-		max = sd_max_jheight;
-	} else {
-		arr = sd_heightsize;
-		max = sd_max_height;
-	}
-
-	for (height = 0; height < max; height++)
-		if (arr[height] >= size)
-			break;
-
-	return height;
-}
-
-struct metapath {
-	unsigned int mp_list[GFS_MAX_META_HEIGHT];
-};
-
-static struct metapath *
-find_metapath(struct gfs_dinode *di, uint64_t block)
-{
-	struct metapath *mp;
-	uint64_t b = block;
-	unsigned int i;
-
-	mp = malloc(sizeof(struct metapath));
-	if (!mp)
-		die("out of memory (%s, %u)\n",
-		    __FILE__, __LINE__);
-	memset(mp, 0, sizeof(struct metapath));
-
-	for (i = di->di_height; i--;) {
-		mp->mp_list[i] = b % sd_inptrs;
-		b /= sd_inptrs;
-	}
-
-	return mp;
-}
-
-static uint64_t
-lookup_block(char *data, unsigned int height,
-	     struct metapath *mp)
-{
-	unsigned int head_size;
-	uint64_t block;
-
-	head_size = (height > 0) ?
-		sizeof(struct gfs_indirect) : sizeof(struct gfs_dinode);
-	block = *(((uint64_t *)(data + head_size)) + mp->mp_list[height]);
-
-	if (block)
-		return gfs64_to_cpu(block);
-	else
-		return 0;
-}
-
-int
-gfs_block_map(struct gfs_dinode *di,
-	      uint64_t lblock, uint64_t *dblock)
-{
-	unsigned int bsize;
-	unsigned int height;
-	struct metapath *mp;
-	unsigned int end_of_metadata;
-	char *data;
-	unsigned int x;
-	int error = 0;
-
-	*dblock = 0;
-
-	if (!di->di_height) {
-		if (!lblock)
-			*dblock = di->di_num.no_addr;
-		return 0;
-	}
-
-	bsize = (di->di_flags & GFS_DIF_JDATA) ? sd_jbsize : block_size;
-
-	height = calc_tree_height(di, (lblock + 1) * bsize);
-	if (di->di_height < height)
-		return 0;
-
-	mp = find_metapath(di, lblock);
-	end_of_metadata = di->di_height - 1;
-
-	data = get_block(di->di_num.no_addr, TRUE);
-
-	for (x = 0; x < end_of_metadata; x++) {
-		*dblock = lookup_block(data, x, mp);
-		free(data);
-		if (!*dblock)
-			goto out;
-
-		data = get_block(*dblock, FALSE);
-		if (!data) {
-			error = -1;
-			goto out;
-		}
-	}
-
-	*dblock = lookup_block(data, x, mp);
-
-	free(data);
-
- out:
-	free(mp);
-
-	return error;
-}
-
-static int
-copy2mem(char *data, void **buf,
-	     unsigned int offset, unsigned int size)
-{
-	char **p = (char **)buf;
-
-	if (data)
-		memcpy(*p, data + offset, size);
-	else
-		memset(*p, 0, size);
-
-	*p += size;
-
-	return 0;
-}
-
-int
-gfs_readi(struct gfs_dinode *di, void *buf,
-	  uint64_t offset, unsigned int size)
-{
-	int journaled = (di->di_flags & GFS_DIF_JDATA);
-	uint64_t lblock, dblock;
-	unsigned int o;
-	unsigned int amount;
-	char *data;
-	int copied = 0;
-	int error = 0;
-
-	if (offset >= di->di_size)
-		return 0;
-
-	if ((offset + size) > di->di_size)
-		size = di->di_size - offset;
-
-	if (!size)
-		return 0;
-
-	if (journaled) {
-		lblock = offset / sd_jbsize;
-		o = offset % sd_jbsize;
-	} else {
-		lblock = offset >> block_size_shift;
-		o = offset & (block_size - 1);
-	}
-
-	if (!di->di_height)
-		o += sizeof(struct gfs_dinode);
-	else if (journaled)
-		o += sizeof(struct gfs_meta_header);
-
-	while (copied < size) {
-		amount = size - copied;
-		if (amount > block_size - o)
-			amount = block_size - o;
-
-		error = gfs_block_map(di, lblock, &dblock);
-		if (error)
-			goto fail;
-
-		if (dblock) {
-			data = get_block(dblock, FALSE);
-			if (!data) {
-				error = -1;
-				goto fail;
-			}
-		} else
-			data = NULL;
-
-		copy2mem(data, &buf, o, amount);
-
-		if (data)
-			free(data);
-
-		copied += amount;
-		lblock++;
-
-		o = (journaled) ? sizeof(struct gfs_meta_header) : 0;
-	}
-
-	return copied;
-
- fail:
-	return (copied) ? copied : error;
-}
-
diff --git a/gfs/gfs_debug/util.h b/gfs/gfs_debug/util.h
deleted file mode 100644
index 6f0489a..0000000
--- a/gfs/gfs_debug/util.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef __UTIL_DOT_H__
-#define __UTIL_DOT_H__
-
-
-int check_type(char *data, unsigned int type);
-
-
-typedef void (*pointer_call_t)(struct gfs_dinode *di,
-			       unsigned int height, uint64_t bn,
-			       void *opaque);
-void recursive_scan(struct gfs_dinode *di,
-		    unsigned int height, uint64_t bn,
-		    pointer_call_t pc, void *opaque);
-
-typedef void (*leaf_call_t)(struct gfs_dinode *di, char *data,
-			    uint32_t index, uint32_t len, uint64_t leaf_no,
-			    void *opaque);
-void foreach_leaf(struct gfs_dinode *di,
-		  leaf_call_t lc, void *opaque);
-
-
-int gfs_block_map(struct gfs_dinode *di,
-		  uint64_t lblock, uint64_t *dblock);
-int gfs_readi(struct gfs_dinode *di, void *buf,
-	      uint64_t offset, unsigned int size);
-
-
-#endif /* __UTIL_DOT_H__ */
-
diff --git a/gfs/gfs_fsck/FEATURES b/gfs/gfs_fsck/FEATURES
deleted file mode 100644
index 8a63591..0000000
--- a/gfs/gfs_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/gfs/gfs_fsck/Makefile b/gfs/gfs_fsck/Makefile
deleted file mode 100644
index 766ad35..0000000
--- a/gfs/gfs_fsck/Makefile
+++ /dev/null
@@ -1,72 +0,0 @@
-TARGET1= gfs_fsck
-TARGET2= fsck.gfs
-
-SBINDIRT=$(TARGET1)
-SBINSYMT=$(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
-
-OBJS=	bio.o \
-	bitmap.o \
-	block_list.o \
-	eattr.o \
-	file.o \
-	fs_bits.o \
-	fs_bmap.o \
-	fs_dir.o \
-	fs_inode.o \
-	fs_recovery.o \
-	hash.o \
-	initialize.o \
-	inode.o \
-	inode_hash.o \
-	link.o \
-	log.o \
-	lost_n_found.o \
-	main.o \
-	metawalk.o \
-	ondisk.o \
-	pass1.o \
-	pass1b.o \
-	pass1c.o \
-	pass2.o \
-	pass3.o \
-	pass4.o \
-	pass5.o \
-	rgrp.o \
-	super.o \
-	util.o
-
-CFLAGS += -D_FILE_OFFSET_BITS=64 -DHELPER_PROGRAM
-CFLAGS += -I$(S)/../include
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${libdir}
-
-${TARGET1}: $(OBJS)
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-${TARGET2}: ${TARGET1}
-	ln -s ${TARGET1} ${TARGET2}
-
-test_block_list: block_list.o bitmap.o log.o test_block_list.o
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-test_bitmap: bitmap.o 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/gfs/gfs_fsck/TODO b/gfs/gfs_fsck/TODO
deleted file mode 100644
index 2b2e762..0000000
--- a/gfs/gfs_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/gfs/gfs_fsck/bio.c b/gfs/gfs_fsck/bio.c
deleted file mode 100644
index 2331325..0000000
--- a/gfs/gfs_fsck/bio.c
+++ /dev/null
@@ -1,168 +0,0 @@
-#include "util.h"
-#include "fsck.h"
-#include "bio.h"
-
-/*
- * get_buf - get a buffer
- * @sdp: the super block
- * @blkno: blk # that this buffer will be associated with
- * @bhp: the location where the buffer is returned
- *
- * This function allocates space for a buffer head structure
- * and the corresponding data.  It does not fill in the
- * actual data - that is done by read_buf.
- *
- * Returns: 0 on success, -1 on error
- */
-int get_buf(struct fsck_sb *sdp, uint64 blkno, osi_buf_t **bhp){
-	osi_buf_t *bh = NULL;
-
-	*bhp = NULL;
-	bh = (osi_buf_t *)malloc(sizeof(osi_buf_t));
-	if(!bh){
-		log_err("Unable to allocate memory for new buffer head.\n");
-		return -1;
-	}
-	if(!memset(bh, 0, sizeof(osi_buf_t))) {
-		log_err("Unable to zero buffer head\n");
-		return -1;
-	}
-
-	/* FIXME: Not sure how this will work on all
-	 * architectures without the casts */
-	bh->b_blocknr = blkno;
-	bh->b_size = sdp->sb.sb_bsize;
-	bh->b_state = 0;
-	if(!(bh->b_data = malloc(BH_SIZE(bh)))) {
-		free(bh);
-		log_err("Unable to allocate memory for new buffer "
-			"blkno = %"PRIu64", size = %u\n", blkno, BH_SIZE(bh));
-		return -1;
-	}
-	if(!memset(BH_DATA(bh), 0, BH_SIZE(bh))) {
-		free(bh);
-		log_err("Unable to zero memory for new buffer "
-			"blkno = %"PRIu64", size = %u\n", blkno, BH_SIZE(bh));
-	}
-
-	*bhp = bh;
-
-	return 0;
-}
-
-
-/*
- * relse_buf - release a buffer
- * @sdp: the super block
- * @bh: the buffer to release
- *
- * This function will release the memory of the buffer
- * and associated buffer head.
- *
- * Returns: nothing
- */
-void relse_buf(struct fsck_sb *sdp, osi_buf_t *bh){
-	if(bh){
-		if(BH_DATA(bh)) {
-			free(BH_DATA(bh));
-			bh->b_data = NULL;
-		}
-		free(bh);
-		bh = NULL;
-	}
-}
-
-
-/*
- * read_buf - read a buffer
- * @sdp: the super block
- * @blkno: block number
- * @bhp: place where buffer is returned
- * @flags:
- *
- * Returns 0 on success, -1 on error
- */
-int read_buf(struct fsck_sb *sdp, osi_buf_t *bh, int flags){
-	int disk_fd = sdp->diskfd;
-
-	if(do_lseek(disk_fd, (uint64)(BH_BLKNO(bh)*BH_SIZE(bh)))){
-		log_err("Unable to seek to position %"PRIu64" "
-			"(%"PRIu64" * %u) on storage device.\n",
-			(uint64)(BH_BLKNO(bh) * BH_SIZE(bh)),
-			BH_BLKNO(bh), BH_SIZE(bh));
-		return -1;
-	}
-
-	if(do_read(disk_fd, BH_DATA(bh), BH_SIZE(bh))){
-		log_err("Unable to read %u bytes from position %"PRIu64"\n",
-			BH_SIZE(bh), (uint64)(BH_BLKNO(bh) * BH_SIZE(bh)));
-		return -1;
-	}
-
-	return 0;
-}
-
-
-/*
- * write_buf - write a buffer
- * @sdp: the super block
- * @bh: buffer head that describes buffer to write
- * @flags: flags that determine usage
- *
- * Returns: 0 on success, -1 on failure
- */
-int write_buf(struct fsck_sb *sdp, osi_buf_t *bh, int flags){
-	int disk_fd = sdp->diskfd;
-
-	if(do_lseek(disk_fd, (uint64)(BH_BLKNO(bh) * BH_SIZE(bh)))) {
-		log_err("Unable to seek to position %"PRIu64
-			"(%"PRIu64" * %u) on storage device.\n",
-			(uint64)(BH_BLKNO(bh) * BH_SIZE(bh)),
-			BH_BLKNO(bh), BH_SIZE(bh));
-		return -1;
-	}
-
-	log_debug("Writing to %"PRIu64" - %"PRIu64" %u\n",
-		  (uint64)(BH_BLKNO(bh) * BH_SIZE(bh)),
-		  BH_BLKNO(bh), BH_SIZE(bh));
-	if(do_write(disk_fd, BH_DATA(bh), BH_SIZE(bh))) {
-		log_err("Unable to write %u bytes to position %"PRIu64"\n",
-			BH_SIZE(bh), (uint64)(BH_BLKNO(bh) * BH_SIZE(bh)));
-		return -1;
-	}
-
-	if(flags & BW_WAIT){
-		fsync(disk_fd);
-	}
-
-	return 0;
-}
-
-
-/*
- * get_and_read_buf - combines get_buf and read_buf functions
- * @sdp
- * @blkno
- * @bhp
- * @flags
- *
- * Returns: 0 on success, -1 on error
- */
-int get_and_read_buf(struct fsck_sb *sdp, uint64 blkno, osi_buf_t **bhp,
-		     int flags)
-{
-	if(get_buf(sdp, blkno, bhp)) {
-		stack;
-		return -1;
-	}
-
-	if(read_buf(sdp, *bhp, flags)){
-		stack;
-		relse_buf(sdp, *bhp);
-		*bhp = NULL;  /* guarantee that ptr is NULL in failure cases */
-		return -1;
-	}
-
-	return 0;
-}
-
diff --git a/gfs/gfs_fsck/bio.h b/gfs/gfs_fsck/bio.h
deleted file mode 100644
index 08ceefa..0000000
--- a/gfs/gfs_fsck/bio.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __BIO_H
-#define __BIO_H
-
-#include "osi_user.h"
-#include "fsck_incore.h"
-/* buf_write flags */
-#define BW_WAIT 1
-
-
-#define BH_DATA(bh) ((char *)(bh)->b_data)
-#define BH_BLKNO(bh) ((uint64)(bh)->b_blocknr)
-#define BH_SIZE(bh) ((uint32)(bh)->b_size)
-#define BH_STATE(bh) ((uint32)(bh)->b_state)
-
-int get_buf(struct fsck_sb *sdp, uint64 blkno, osi_buf_t **bhp);
-void relse_buf(struct fsck_sb *sdp, osi_buf_t *bh);
-int read_buf(struct fsck_sb *sdp, osi_buf_t *bh, int flags);
-int write_buf(struct fsck_sb *sdp, osi_buf_t *bh, int flags);
-int get_and_read_buf(struct fsck_sb *sdp, uint64 blkno, osi_buf_t **bhp, int flags);
-
-#endif  /*  __BIO_H  */
-
-
diff --git a/gfs/gfs_fsck/bitmap.c b/gfs/gfs_fsck/bitmap.c
deleted file mode 100644
index 12da279..0000000
--- a/gfs/gfs_fsck/bitmap.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Basic bitmap manipulation */
-#include <stdint.h>
-#include <stdio.h>
-#include <errno.h>
-#include "osi_user.h"
-#include "bitmap.h"
-#include "block_list.h"
-#include "fsck_incore.h"
-#include "log.h"
-
-
-#define BITMAP_SIZE(size, cpb) (size / cpb)
-
-#define BITMAP_BYTE_OFFSET(x, map) ((x % map->chunks_per_byte) \
-                                    * map->chunksize )
-
-#define BITMAP_MASK(chunksize) ((2 << (chunksize - 1)) - 1)
-
-uint64_t bitmap_size(struct bmap *bmap) {
-	return bmap->size;
-}
-
-int bitmap_create(struct bmap *bmap, uint64_t size, uint8_t chunksize)
-{
-	if((((chunksize >> 1) << 1) != chunksize) && chunksize != 1) {
-		log_err("chunksize must be a power of 2\n");
-		return -1;
-	}
-	if(chunksize > 8) {
-		log_err("chunksize must be <= 8\n");
-		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))) {
-		log_err("Unable to allocate bitmap of size %"PRIu64"\n",
-			bmap->mapsize);
-		return -ENOMEM;
-	}
-	if(!memset(bmap->map, 0, sizeof(char) * bmap->mapsize)) {
-		log_err("Unable to zero bitmap of size %"PRIu64"\n",
-			bmap->mapsize);
-		free(bmap->map);
-		bmap->map = NULL;
-		return -ENOMEM;
-	}
-	log_debug("Allocated bitmap of size %"PRIu64
-		  " with %d chunks per byte\n",
-		  bmap->mapsize, bmap->chunks_per_byte);
-	return 0;
-}
-
-int bitmap_set(struct bmap *bmap, uint64_t offset, uint8_t val)
-{
-	char *byte = NULL;
-	uint64_t b = offset;
-
-	if(offset < bmap->size) {
-		byte = bmap->map + BITMAP_SIZE(offset, bmap->chunks_per_byte);
-		b = BITMAP_BYTE_OFFSET(offset, bmap);
-
-		*byte |= (val & BITMAP_MASK(bmap->chunksize)) << b;
-		return 0;
-	}
-	log_debug("offset %d out of bounds\n", offset);
-	return -1;
-}
-
-int bitmap_get(struct bmap *bmap, uint64_t bit, uint8_t *val)
-{
-	char *byte = NULL;
-	uint64_t b = bit;
-
-	if(bit < bmap->size) {
-		byte = bmap->map + BITMAP_SIZE(bit, bmap->chunks_per_byte);
-		b = BITMAP_BYTE_OFFSET(bit, bmap);
-
-		*val = (*byte & (BITMAP_MASK(bmap->chunksize) << b )) >> b;
-		return 0;
-	}
-	log_debug("offset %d out of bounds\n", bit);
-	return -1;
-}
-
-
-int bitmap_clear(struct bmap *bmap, uint64_t offset)
-{
-	char *byte = NULL;
-	uint64_t b = offset;
-
-	if(offset < bmap->size) {
-		byte = bmap->map + BITMAP_SIZE(offset, bmap->chunks_per_byte);
-		b = BITMAP_BYTE_OFFSET(offset, bmap);
-
-		*byte &= ~(BITMAP_MASK(bmap->chunksize) << b);
-		return 0;
-	}
-	log_debug("offset %d out of bounds\n", offset);
-	return -1;
-
-}
-
-void bitmap_destroy(struct 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/gfs/gfs_fsck/bitmap.h b/gfs/gfs_fsck/bitmap.h
deleted file mode 100644
index c634a06..0000000
--- a/gfs/gfs_fsck/bitmap.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _BITMAP_H
-#define _BITMAP_H
-
-struct bmap {
-	uint64_t size;
-	uint64_t mapsize;
-	int chunksize;
-	int chunks_per_byte;
-	char *map;
-};
-
-int bitmap_create(struct bmap *bmap, uint64_t size, uint8_t bitsize);
-int bitmap_set(struct bmap *bmap, uint64_t offset, uint8_t val);
-int bitmap_get(struct bmap *bmap, uint64_t bit, uint8_t *val);
-int bitmap_clear(struct bmap *bmap, uint64_t offset);
-void bitmap_destroy(struct bmap *bmap);
-uint64_t bitmap_size(struct bmap *bmap);
-
-
-#endif /* _BITMAP_H */
diff --git a/gfs/gfs_fsck/block_list.c b/gfs/gfs_fsck/block_list.c
deleted file mode 100644
index f377fd0..0000000
--- a/gfs/gfs_fsck/block_list.c
+++ /dev/null
@@ -1,263 +0,0 @@
-#include <unistd.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include "bitmap.h"
-#include "block_list.h"
-#include "fsck.h"
-
-/* Must be kept in sync with mark_block enum in block_list.h */
-static int mark_to_gbmap[16] = {
-	block_free, block_used, indir_blk, inode_dir, inode_file,
-	inode_lnk, inode_blk, inode_chr, inode_fifo, inode_sock,
-	leaf_blk, journal_blk, meta_other, meta_free,
-	meta_eattr, meta_inval
-};
-
-struct block_list *block_list_create(uint64_t size, enum block_list_type type)
-{
-	struct block_list *il;
-	uint64_t addl_mem_needed = 0L;
-	log_info("Creating a block list of size %"PRIu64"...\n", size);
-
-	if ((il = malloc(sizeof(*il)))) {
-		memset(il, 0, sizeof(*il));
-		il->type = type;
-
-		switch(type) {
-		case gbmap:
-			if(bitmap_create(&il->list.gbmap.group_map, size, 4)) {
-				/* Note on addl_mem_needed: We've tried to allocate ram   */
-				/* for our bitmaps, but we failed.  The fs is too big.    */
-				/* We should tell them how much to allocate.  This first  */
-				/* bitmap is the biggest, but we need three more smaller  */
-				/* for the code that immediately follows.  I'm rounding   */
-				/* up to twice the memory for this bitmap, even though    */
-				/* it's actually 1 + 3/4.  That will allow for future     */
-				/* mallocs that happen after this point in the code.      */
-				/* For the bad_map, we have two more to go (total of 3)   */
-				/* but again I'm rounding it up to 4 smaller ones.        */
-				/* For the dup_map, I'm rounding from 2 to 3, and for     */
-				/* eattr_map, I'm rounding up from 1 to 2.                */
-				addl_mem_needed = il->list.gbmap.group_map.mapsize * 2;
-				stack;
-				free(il);
-				il = NULL;
-			}
-			else if(bitmap_create(&il->list.gbmap.bad_map, size, 1)) {
-				addl_mem_needed = il->list.gbmap.group_map.mapsize * 4;
-				stack;
-				free(il);
-				il = NULL;
-			}
-			else if(bitmap_create(&il->list.gbmap.dup_map, size, 1)) {
-				addl_mem_needed = il->list.gbmap.group_map.mapsize * 3;
-				stack;
-				free(il);
-				il = NULL;
-			}
-			else if(bitmap_create(&il->list.gbmap.eattr_map, size, 1)) {
-				addl_mem_needed = il->list.gbmap.group_map.mapsize * 2;
-				stack;
-				free(il);
-				il = NULL;
-			}
-			if (addl_mem_needed) {
-				log_err("This system doesn't have enough memory + swap space to fsck this file system.\n");
-				log_err("Additional memory needed is approximately: %ldMB\n", addl_mem_needed / 1048576);
-				log_err("Please increase your swap space by that amount and run gfs_fsck again.\n");
-			}
-			break;
-		default:
-			log_crit("Block list type %d not implemented\n",
-				type);
-			break;
-		}
-	}
-
-	return il;
-}
-
-int block_mark(struct block_list *il, uint64_t block, enum mark_block mark)
-{
-	int err = 0;
-
-	switch(il->type) {
-	case gbmap:
-		if(mark == bad_block) {
-			err = bitmap_set(&il->list.gbmap.bad_map, block, 1);
-		}
-		else if(mark == dup_block) {
-			err = bitmap_set(&il->list.gbmap.dup_map, block, 1);
-		}
-		else if(mark == eattr_block) {
-			err = bitmap_set(&il->list.gbmap.eattr_map, block, 1);
-		}
-		else {
-			err = bitmap_set(&il->list.gbmap.group_map, block,
-					 mark_to_gbmap[mark]);
-		}
-
-		break;
-	default:
-		log_err("block list type %d not implemented\n",
-			il->type);
-		err = -1;
-		break;
-	}
-	return err;
-}
-
-int block_set(struct block_list *il, uint64_t block, enum mark_block mark)
-{
-	int err = 0;
-	err = block_clear(il, block, mark);
-	if(!err)
-		err = block_mark(il, block, mark);
-	return err;
-}
-
-int block_clear(struct block_list *il, uint64_t block, enum mark_block m)
-{
-	int err = 0;
-
-	switch(il->type) {
-	case gbmap:
-		switch (m) {
-		case dup_block:
-			err = bitmap_clear(&il->list.gbmap.dup_map, block);
-			break;
-		case bad_block:
-			err = bitmap_clear(&il->list.gbmap.bad_map, block);
-			break;
-		case eattr_block:
-			err = bitmap_clear(&il->list.gbmap.eattr_map, block);
-			break;
-		default:
-			/* FIXME: check types */
-			err = bitmap_clear(&il->list.gbmap.group_map, block);
-			break;
-		}
-
-		break;
-	default:
-		log_err("block list type %d not implemented\n",
-			il->type);
-		err = -1;
-		break;
-	}
-	return err;
-}
-
-int block_check(struct block_list *il, uint64_t block, struct block_query *val)
-{
-	int err = 0;
-	val->block_type = 0;
-	val->bad_block = 0;
-	val->dup_block = 0;
-	switch(il->type) {
-	case gbmap:
-		if((err = bitmap_get(&il->list.gbmap.group_map, block,
-				     &val->block_type))) {
-			log_err("Unable to get block type for block %"
-				PRIu64"\n", block);
-			break;
-		}
-		if((err = bitmap_get(&il->list.gbmap.bad_map, block,
-				     &val->bad_block))) {
-			log_err("Unable to get bad block status for block %"
-				PRIu64"\n", block);
-			break;
-		}
-		if((err = bitmap_get(&il->list.gbmap.dup_map, block,
-				     &val->dup_block))) {
-			log_err("Unable to get duplicate status for block %"
-				PRIu64"\n", block);
-			break;
-		}
-		if((err = bitmap_get(&il->list.gbmap.eattr_map, block,
-				     &val->eattr_block))) {
-			log_err("Unable to get eattr status for block %"
-				PRIu64"\n", block);
-			break;
-		}
-		break;
-	default:
-		log_err("block list type %d not implemented\n",
-			il->type);
-		err = -1;
-		break;
-	}
-
-	return err;
-}
-
-void *block_list_destroy(struct block_list *il)
-{
-	if(il) {
-		switch(il->type) {
-		case gbmap:
-			bitmap_destroy(&il->list.gbmap.group_map);
-			bitmap_destroy(&il->list.gbmap.bad_map);
-			bitmap_destroy(&il->list.gbmap.dup_map);
-			bitmap_destroy(&il->list.gbmap.eattr_map);
-			break;
-		default:
-			break;
-		}
-		free(il);
-		il = NULL;
-	}
-	return il;
-}
-
-
-int find_next_block_type(struct block_list *il, enum mark_block m, uint64_t *b)
-{
-	uint64_t i;
-	uint8_t val;
-	int found = 0;
-	for(i = *b; ; i++) {
-		switch(il->type) {
-		case gbmap:
-			if(i >= bitmap_size(&il->list.gbmap.dup_map))
-				return -1;
-
-			switch(m) {
-			case dup_block:
-				if(bitmap_get(&il->list.gbmap.dup_map, i, &val)) {
-					stack;
-					return -1;
-				}
-
-				if(val)
-					found = 1;
-				break;
-			case eattr_block:
-				if(bitmap_get(&il->list.gbmap.eattr_map, i, &val)) {
-					stack;
-					return -1;
-				}
-
-				if(val)
-					found = 1;
-				break;
-			default:
-				/* FIXME: add support for getting
-				 * other types */
-				log_err("Unhandled block type\n");
-			}
-			break;
-		default:
-			log_err("Unhandled block list type\n");
-			break;
-		}
-		if(found) {
-			*b = i;
-			return 0;
-		}
-	}
-	return -1;
-}
diff --git a/gfs/gfs_fsck/block_list.h b/gfs/gfs_fsck/block_list.h
deleted file mode 100644
index ca1524b..0000000
--- a/gfs/gfs_fsck/block_list.h
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef _BLOCK_LIST_H
-#define _BLOCK_LIST_H
-
-#include "bitmap.h"
-
-#define BMAP_COUNT 13
-
-enum block_list_type {
-	gbmap = 0,  /* Grouped bitmap */
-	dbmap,	    /* Ondisk bitmap - like grouped bitmap, but mmaps
-		     * the bitmaps onto file(s) ondisk - not implemented */
-};
-
-/* Must be kept in sync with mark_to_bitmap array in block_list.c */
-enum mark_block {
-	block_free = 0,
-	block_used = 1,
-	indir_blk = 2,
-	inode_dir = 3,
-	inode_file = 4,
-	inode_lnk = 5,
-	inode_blk = 6,
-	inode_chr = 7,
-	inode_fifo = 8,
-	inode_sock = 9,
-	leaf_blk = 10,
-	journal_blk = 11,
-	meta_other = 12,
-	meta_free = 13,
-	meta_eattr = 14,
-	meta_inval = 15,
-	/* above this are nibble-values 0x0-0xf */
-	bad_block = 16,	/* Contains at least one bad block */
-	dup_block = 17,	/* Contains at least one duplicate block */
-	eattr_block = 18,	/* Contains an eattr */
-};
-
-struct block_query {
-	uint8_t block_type;
-	uint8_t bad_block;
-	uint8_t dup_block;
-	uint8_t eattr_block;
-};
-
-struct gbmap {
-	struct bmap group_map;
-	struct bmap bad_map;
-	struct bmap dup_map;
-	struct bmap eattr_map;
-};
-
-struct dbmap {
-	struct bmap group_map;
-	char *group_file;
-	struct bmap bad_map;
-	char *bad_file;
-	struct bmap dup_map;
-	char *dup_file;
-	struct bmap eattr_map;
-	char *eattr_file;
-};
-
-union block_lists {
-	struct gbmap gbmap;
-	struct dbmap dbmap;
-};
-
-
-/* bitmap implementation */
-struct block_list {
-	enum block_list_type type;
-	/* Union of bitmap, rle */
-	union block_lists list;
-};
-
-
-struct block_list *block_list_create(uint64_t size, enum block_list_type type);
-int block_mark(struct block_list *il, uint64_t block, enum mark_block mark);
-int block_set(struct block_list *il, uint64_t block, enum mark_block mark);
-int block_clear(struct block_list *il, uint64_t block, enum mark_block m);
-int block_check(struct block_list *il, uint64_t block,
-		struct block_query *val);
-int block_check_for_mark(struct block_list *il, uint64_t block,
-			 enum mark_block mark);
-void *block_list_destroy(struct block_list *il);
-int find_next_block_type(struct block_list *il, enum mark_block m, uint64_t *b);
-
-#endif /* _BLOCK_LIST_H */
diff --git a/gfs/gfs_fsck/eattr.c b/gfs/gfs_fsck/eattr.c
deleted file mode 100644
index b88caf9..0000000
--- a/gfs/gfs_fsck/eattr.c
+++ /dev/null
@@ -1,100 +0,0 @@
-#include <stdint.h>
-
-#include "fsck_incore.h"
-
-
-static int clear_blk_nodup(struct fsck_sb *sbp, uint64_t block)
-{
-	struct block_query q;
-
-	if(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;
-	}
-
-	block_set(sbp->bl, block, block_free);
-
-	return 0;
-
-}
-
-int clear_eattr_indir(struct fsck_inode *ip, uint64_t block,
-		      uint64_t parent, osi_buf_t **bh,
-		      void *private)
-{
-	return clear_blk_nodup(ip->i_sbd, block);
-}
-
-
-int clear_eattr_leaf(struct fsck_inode *ip, uint64_t block,
-		     uint64_t parent, osi_buf_t **bh,
-		     void *private)
-{
-
-	return clear_blk_nodup(ip->i_sbd, block);
-
-}
-
-
-int clear_eattr_entry (struct fsck_inode *ip,
-		       osi_buf_t *leaf_bh,
-		       struct gfs_ea_header *ea_hdr,
-		       struct gfs_ea_header *ea_hdr_prev,
-		       void *private)
-{
-	struct fsck_sb *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 gfs_ea_header),
-		ea_hdr->ea_name_len);
-
-	if(!GFS_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 avail_size;
-		int max_ptrs;
-
-		avail_size = sdp->sb.sb_bsize - sizeof(struct gfs_meta_header);
-		max_ptrs = (gfs32_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 fsck_inode *ip, uint64_t *ea_data_ptr,
-			 osi_buf_t *leaf_bh, struct gfs_ea_header *ea_hdr,
-			 struct gfs_ea_header *ea_hdr_prev, void *private)
-{
-	uint64_t block = gfs64_to_cpu(*ea_data_ptr);
-
-	return clear_blk_nodup(ip->i_sbd, block);
-
-}
-
-
-
diff --git a/gfs/gfs_fsck/eattr.h b/gfs/gfs_fsck/eattr.h
deleted file mode 100644
index c1cbfea..0000000
--- a/gfs/gfs_fsck/eattr.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef _EATTR_H
-#define _EATTR_H
-
-int clear_eattr_indir(struct fsck_inode *ip, uint64_t block,
-		      uint64_t parent, osi_buf_t **bh,
-		      void *private);
-int clear_eattr_leaf(struct fsck_inode *ip, uint64_t block,
-		     uint64_t parent, osi_buf_t **bh,
-		     void *private);
-int clear_eattr_entry (struct fsck_inode *ip,
-		       osi_buf_t *leaf_bh,
-		       struct gfs_ea_header *ea_hdr,
-		       struct gfs_ea_header *ea_hdr_prev,
-		       void *private);
-int clear_eattr_extentry(struct fsck_inode *ip, uint64_t *ea_data_ptr,
-			 osi_buf_t *leaf_bh, struct gfs_ea_header *ea_hdr,
-			 struct gfs_ea_header *ea_hdr_prev, void *private);
-
-
-
-#endif /* _EATTR_H */
diff --git a/gfs/gfs_fsck/file.c b/gfs/gfs_fsck/file.c
deleted file mode 100644
index 366409c..0000000
--- a/gfs/gfs_fsck/file.c
+++ /dev/null
@@ -1,229 +0,0 @@
-#include "util.h"
-#include "bio.h"
-#include "fs_bmap.h"
-#include "fs_inode.h"
-#include "fsck.h"
-#include "file.h"
-
-/**
- * readi - Read a file
- * @ip: The GFS Inode
- * @buf: The buffer to place result into
- * @offset: File offset to begin reading from
- * @size: Amount of data to transfer
- *
- * Returns: The amount of data actually copied or the error
- */
-int readi(struct fsck_inode *ip, void *buf, uint64 offset, unsigned int size)
-{
-	struct fsck_sb *sdp = ip->i_sbd;
-	osi_buf_t *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;
-	int error = 0;
-
-	if (offset >= ip->i_di.di_size){
-		log_debug("readi:  Offset (%"PRIu64") is >= "
-			"the file size (%"PRIu64").\n",
-			offset, ip->i_di.di_size);
-		goto out;
-	}
-
-	if ((offset + size) > ip->i_di.di_size)
-		size = ip->i_di.di_size - offset;
-
-	if (!size){
-		log_err("readi:  Nothing to be read.\n");
-		goto out;
-	}
-
-	if (journaled){
-		lblock = offset / sdp->jbsize;
-		offset %= sdp->jbsize;
-	}
-	else{
-		lblock = offset >> sdp->sb.sb_bsize_shift;
-		offset &= sdp->sb.sb_bsize - 1;
-	}
-
-	if (fs_is_stuffed(ip))
-		offset += sizeof(struct gfs_dinode);
-	else if (journaled)
-		offset += sizeof(struct gfs_meta_header);
-
-
-	while (copied < size){
-		amount = size - copied;
-		if (amount > sdp->sb.sb_bsize - offset)
-			amount = sdp->sb.sb_bsize - offset;
-
-		if (!extlen){
-			error = fs_block_map(ip, lblock, &not_new, &dblock, &extlen);
-			if (error){
-				log_err("readi:  The call to fs_block_map() failed.\n");
-				goto out;
-			}
-		}
-
-		if (dblock){
-			error = get_and_read_buf(ip->i_sbd, dblock, &bh, 0);
-			if (error){
-				log_err("readi:  Unable to perform get_and_read_buf()\n");
-				goto out;
-			}
-
-			dblock++;
-			extlen--;
-		}
-		else
-			bh = NULL;
-
-		if (bh){
-			memcpy(buf+copied, BH_DATA(bh)+offset, amount);
-			relse_buf(ip->i_sbd, bh);
-		} else {
-			memset(buf+copied, 0, amount);
-		}
-		copied += amount;
-		lblock++;
-
-		offset = (journaled) ? sizeof(struct gfs_meta_header) : 0;
-	}
-
- out:
-
-	return (error < 0) ? error : copied;
-}
-
-
-
-/**
- * writei - Write bytes to a file
- * @ip: The GFS inode
- * @buf: The buffer containing information to be written
- * @offset: The file offset to start writing at
- * @size: The amount of data to write
- *
- * Returns: The number of bytes correctly written or error code
- */
-int writei(struct fsck_inode *ip, void *buf, uint64_t offset, unsigned int size)
-{
-	struct fsck_sb *sdp = ip->i_sbd;
-	osi_buf_t *dibh, *bh;
-	uint64_t lblock, dblock;
-	uint32_t extlen = 0;
-	unsigned int amount;
-	int new;
-	int journaled = fs_is_jdata(ip);
-	const uint64_t start = offset;
-	int copied = 0;
-	int error = 0;
-
-	/*  Bomb out on writing nothing.
-	    Posix says we can't change the time here.  */
-
-	if (!size)
-		goto fail;  /*  Not really an error  */
-
-
-	if (fs_is_stuffed(ip) &&
-	    ((start + size) > (sdp->sb.sb_bsize - sizeof(struct gfs_dinode)))){
-		error = fs_unstuff_dinode(ip);
-		if (error)
-			goto fail;
-	}
-
-
-	if (journaled){
-		lblock = offset / sdp->jbsize;
-		offset %= sdp->jbsize;
-	}
-	else{
-		lblock = offset >> sdp->sb.sb_bsize_shift;
-		offset &= sdp->sb.sb_bsize - 1;
-	}
-
-	if (fs_is_stuffed(ip))
-		offset += sizeof(struct gfs_dinode);
-	else if (journaled)
-		offset += sizeof(struct gfs_meta_header);
-
-
-	while (copied < size){
-		amount = size - copied;
-		if (amount > sdp->sb.sb_bsize - offset)
-			amount = sdp->sb.sb_bsize - offset;
-
-		if (!extlen){
-			new = TRUE;
-			error = fs_block_map(ip, lblock, &new, &dblock, &extlen);
-			if (error)
-				goto fail;
-			if(!dblock){
-				log_crit("fs_writei:  "
-					"Unable to map logical block to real block.\n");
-				log_crit("Uncircumventable error.\n");
-				exit(EXIT_FAILURE);
-			}
-		}
-
-		error = get_and_read_buf(ip->i_sbd, dblock, &bh, 0);
-		if (error)
-			goto fail;
-
-		if(journaled && dblock != ip->i_di.di_num.no_addr ) {
-			set_meta(bh, GFS_METATYPE_JD, GFS_FORMAT_JD);
-		}
-
-		memcpy(BH_DATA(bh)+offset, buf+copied, amount);
-		write_buf(ip->i_sbd, bh, 0);
-		relse_buf(ip->i_sbd, bh);
-
-		copied += amount;
-		lblock++;
-		dblock++;
-		extlen--;
-
-		offset = (journaled) ? sizeof(struct gfs_meta_header) : 0;
-	}
-
-
- out:
-	error = get_and_read_buf(ip->i_sbd, ip->i_num.no_addr, &dibh, 0);
-	if (error){
-		log_err("fs_writei:  "
-			"Unable to get inode buffer.\n");
-		return -1;
-	}
-
-	error = check_meta(dibh, GFS_METATYPE_DI);
-	if(error){
-		log_err("fs_writei:  "
-			"Buffer is not a valid inode.\n");
-		relse_buf(ip->i_sbd, dibh);
-		return -1;
-	}
-
-	if (ip->i_di.di_size < start + copied)
-		ip->i_di.di_size = start + copied;
-	ip->i_di.di_mtime = ip->i_di.di_ctime = osi_current_time();
-
-	gfs_dinode_out(&ip->i_di, BH_DATA(dibh));
-	write_buf(ip->i_sbd, dibh, 0);
-	relse_buf(ip->i_sbd, dibh);
-
-	return copied;
-
-
-
- fail:
-	if (copied)
-		goto out;
-
-	return error;
-}
-
diff --git a/gfs/gfs_fsck/file.h b/gfs/gfs_fsck/file.h
deleted file mode 100644
index dfccb00..0000000
--- a/gfs/gfs_fsck/file.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _FILE_H
-#define _FILE_H
-
-#include <stdint.h>
-#include "fsck_incore.h"
-
-int readi(struct fsck_inode *ip, void *buf, uint64_t offset, unsigned int size);
-int writei(struct fsck_inode *ip, void *buf, uint64_t offset, unsigned int size);
-
-#endif /* _FILE_H */
diff --git a/gfs/gfs_fsck/fs_bits.c b/gfs/gfs_fsck/fs_bits.c
deleted file mode 100644
index 848931f..0000000
--- a/gfs/gfs_fsck/fs_bits.c
+++ /dev/null
@@ -1,350 +0,0 @@
-#include "util.h"
-#include "bio.h"
-#include "rgrp.h"
-
-#include "fsck_incore.h"
-#include "fs_bits.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 fs_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 / GFS_NBBY);
-	bit = (block % GFS_NBBY) * GFS_BIT_SIZE;
-	end = buffer + buflen;
-
-	if(byte >= end){
-		log_err("fs_setbit:  byte >= end\n");
-		exit(1);
-	}
-	cur_state = (*byte >> bit) & GFS_BIT_MASK;
-
-	*byte ^= cur_state << bit;
-	*byte |= new_state << bit;
-}
-
-uint32_t fs_bitfit_core(struct fsck_sb *sbp, uint64_t goal, uint64_t start, uint64_t len,
-		   unsigned char old_state)
-{
-	uint64_t block;
-	struct block_query q;
-
-	log_debug("Goal: %"PRIu64", Start: %"PRIu64" len: %"PRIu64"\n",
-		  goal, start, len);
-	for(block = start+goal; block < start+len; block++) {
-		block_check(sbp->bl, block, &q);
-		switch(old_state) {
-		case GFS_BLKST_FREE:
-			switch(q.block_type) {
-			case block_free:
-				return block - start;
-			}
-			break;
-		case GFS_BLKST_FREEMETA:
-			switch(q.block_type) {
-			case meta_free:
-				return block - start;
-			}
-			break;
-		case GFS_BLKST_USEDMETA:
-			switch(q.block_type) {
-			case inode_dir:
-			case inode_file:
-			case inode_lnk:
-			case inode_blk:
-			case inode_chr:
-			case inode_fifo:
-			case inode_sock:
-			case indir_blk:
-			case leaf_blk:
-			case journal_blk:
-			case meta_other:
-			case meta_eattr:
-				return block - start;
-			}
-			break;
-		case GFS_BLKST_USED:
-			switch(q.block_type) {
-			case block_used:
-				return block - start;
-			}
-			break;
-		default:
-			log_err("Invalid type");
-			break;
-		}
-	}
-	return BFITNOENT;
-}
-/**
- * fs_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 fs_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 / GFS_NBBY);
-	bit = (goal % GFS_NBBY) * GFS_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) & GFS_BIT_MASK) == old_state){
-			return blk;
-		}
-
-		bit += GFS_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 fs_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) & GFS_BIT_MASK) == state)
-			count++;
-
-		bit += GFS_BIT_SIZE;
-		if (bit >= 8){
-			bit = 0;
-			byte++;
-		}
-	}
-	return count;
-}
-
-
-/**
- * fs_blkalloc_internal - allocate a single block
- * @rgd: the resource group descriptor
- * @goal: the goal block in the RG
- * @old_state: the type of block to find
- * @new_state: the resulting block type
- * @do_it: if FALSE, we just find the block we would allocate
- *
- *
- * Returns:  returns the block allocated, or BFITNOENT on failure
- */
-uint32_t fs_blkalloc_internal(struct fsck_rgrp *rgd, uint32_t goal,
-			      unsigned char old_state,
-			      unsigned char new_state, int do_it)
-{
-	struct fsck_sb *sdp = rgd->rd_sbd;
-	uint32_t block = 0;
-	log_debug("fs_blkalloc_internal got %u as goal\n", goal);
-	goal = ((int)(goal - rgd->rd_ri.ri_data1) < 0)
-		? 0
-		: goal - rgd->rd_ri.ri_data1;
-
-
-	block = fs_bitfit_core(sdp, goal, rgd->rd_ri.ri_data1,
-			       rgd->rd_ri.ri_data, old_state);
-
-
-	if(block == BFITNOENT) {
-		log_debug("No bits left in old_state?\n"
-			  "\told_state   = %u\n"
-			  "\tnew_state   = %u\n"
-			  "\trg_free     = %u\n"
-			  "\trg_freemeta = %u\n",
-			old_state, new_state,
-			rgd->rd_rg.rg_free,
-			rgd->rd_rg.rg_freemeta);
-		return BFITNOENT;
-	}
-
-	log_debug("fs_blkalloc_internal found block %u\n", block);
-	switch(new_state) {
-	case GFS_BLKST_FREE:
-		block_set(sdp->bl, block + rgd->rd_ri.ri_data1, block_free);
-		break;
-	case GFS_BLKST_USED:
-		block_set(sdp->bl, block + rgd->rd_ri.ri_data1, block_used);
-		break;
-	case GFS_BLKST_USEDMETA:
-		block_set(sdp->bl, block + rgd->rd_ri.ri_data1, meta_other);
-		break;
-	case GFS_BLKST_FREEMETA:
-		block_set(sdp->bl, block + rgd->rd_ri.ri_data1, meta_free);
-		break;
-	}
-	return  block;
-}
-
-
-/*
- * 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_FREEMETA (2)
- *  GFS_BLKST_USEDMETA (3)
- *
- * Returns: state on success, -1 on error
- */
-int fs_get_bitmap(struct fsck_sb *sdp, uint64 blkno, struct fsck_rgrp *rgd){
-	int           buf, val;
-	uint32_t        rgrp_block;
-/*  struct fsck_rgrp	*rgd;*/
-	fs_bitmap_t	*bits = NULL;
-	unsigned int  bit;
-	unsigned char *byte;
-	int local_rgd = 0;
-
-	if(check_range(sdp, blkno)){
-		log_warn("Block #%"PRIu64" is out of range.\n", blkno);
-		return -1;
-	}
-	if(rgd == NULL) {
-		local_rgd = 1;
-		rgd = fs_blk2rgrpd(sdp, blkno);
-	}
-	if(rgd == NULL){
-		log_err( "Unable to get rgrp for block #%"PRIu64"\n", blkno);
-		return -1;
-	}
-	if(fs_rgrp_read(rgd, FALSE)){ /* FALSE:don't try to fix (done elsewhere) */
-		log_err( "Unable to read rgrp.\n");
-		return -1;
-	}
-
-	rgrp_block = (uint32_t)(blkno - rgd->rd_ri.ri_data1);
-
-	for(buf= 0; buf < rgd->rd_ri.ri_length; buf++){
-		bits = &(rgd->rd_bits[buf]);
-		if(rgrp_block < ((bits->bi_start + bits->bi_len)*GFS_NBBY)){
-			break;
-		}
-	}
-
-	if(buf >= rgd->rd_ri.ri_length){
-		log_err( "Unable to locate bitmap entry for block #%"PRIu64"\n",
-			blkno);
-		fs_rgrp_relse(rgd);
-		return -1;
-	}
-
-	byte = (unsigned char *)((BH_DATA(rgd->rd_bh[buf]) + bits->bi_offset) +
-				 (rgrp_block/GFS_NBBY - bits->bi_start));
-	bit = (rgrp_block % GFS_NBBY) * GFS_BIT_SIZE;
-
-	val = ((*byte >> bit) & GFS_BIT_MASK);
-	if(local_rgd) {
-		fs_rgrp_relse(rgd);
-	}
-
-	return val;
-}
-
-
-/*
- * fs_set_bitmap
- * @sdp: super block
- * @blkno: block number relative to file system
- * @state: one of 4 possible states
- *
- * This function sets the value of a bit of the
- * file system bitmap.
- *
- * Returns: 0 on success, -1 on error
- */
-int fs_set_bitmap(struct fsck_sb *sdp, uint64 blkno, int state){
-	int           buf;
-	uint32_t        rgrp_block;
-	fs_bitmap_t	*bits = NULL;
-	struct fsck_rgrp	*rgd;
-
-	if((state != GFS_BLKST_FREE) && (state != GFS_BLKST_USED) &&
-	   (state != GFS_BLKST_FREEMETA) && (state != GFS_BLKST_USEDMETA)){
-		return -1;
-	}
-
-	rgd = fs_blk2rgrpd(sdp, blkno);
-
-	if(!rgd) {
-		log_err("Unable to get resource group for blkno %"PRIu64"\n",
-			blkno);
-		return -1;
-	}
-
-	if(fs_rgrp_read(rgd, FALSE)) {
-		stack;
-		return -1;
-	}
-	rgrp_block = (uint32_t)(blkno - rgd->rd_ri.ri_data1);
-	for(buf= 0; buf < rgd->rd_ri.ri_length; buf++){
-		bits = &(rgd->rd_bits[buf]);
-		if(rgrp_block < ((bits->bi_start + bits->bi_len)*GFS_NBBY)){
-			break;
-		}
-	}
-	if (buf < rgd->rd_ri.ri_length) {
-		fs_setbit((unsigned char *)BH_DATA(rgd->rd_bh[buf]) +
-			  bits->bi_offset,
-			  bits->bi_len,
-			  (rgrp_block - (bits->bi_start*GFS_NBBY)),
-			  state);
-		if(write_buf(sdp, rgd->rd_bh[buf], 0)){
-			fs_rgrp_relse(rgd);
-			return -1;
-		}
-	}
-	fs_rgrp_relse(rgd);
-	return 0;
-}
diff --git a/gfs/gfs_fsck/fs_bits.h b/gfs/gfs_fsck/fs_bits.h
deleted file mode 100644
index 7d889bc..0000000
--- a/gfs/gfs_fsck/fs_bits.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef __FS_BITS_H__
-#define __FS_BITS_H__
-
-#include "global.h"
-#include "rgrp.h"
-#include "fsck_incore.h"
-#include "fsck.h"
-
-#define BFITNOENT (0xFFFFFFFF)
-
-struct fs_bitmap
-{
-	uint32   bi_offset;	/* The offset in the buffer of the first byte */
-	uint32   bi_start;      /* The position of the first byte in this block */
-	uint32   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 fs_bitcount(unsigned char *buffer, unsigned int buflen,
-		     unsigned char state);
-uint32_t fs_bitfit(unsigned char *buffer, unsigned int buflen,
-		   uint32_t goal, unsigned char old_state);
-
-/* functions with blk #'s that are rgrp relative */
-uint32_t fs_blkalloc_internal(struct fsck_rgrp *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 fs_get_bitmap(struct fsck_sb *sdp, uint64_t blkno, struct fsck_rgrp *rgd);
-int fs_set_bitmap(struct fsck_sb *sdp, uint64_t blkno, int state);
-
-#endif /* __FS_BITS_H__ */
diff --git a/gfs/gfs_fsck/fs_bmap.c b/gfs/gfs_fsck/fs_bmap.c
deleted file mode 100644
index 97b2292..0000000
--- a/gfs/gfs_fsck/fs_bmap.c
+++ /dev/null
@@ -1,529 +0,0 @@
-#include "util.h"
-#include "rgrp.h"
-#include "fs_inode.h"
-#include "bio.h"
-
-#include "fs_bmap.h"
-
-typedef struct metapath
-{
-	uint64              mp_list[GFS_MAX_META_HEIGHT];
-}metapath_t;
-
-
-/**
- * fs_unstuff_dinode - Unstuff a dinode when the data has grown too big
- * @ip: The GFS inode to unstuff
- * * This routine unstuffs a dinode and returns it to a "normal" state such
- * that the height can be grown in the traditional way.
- *
- * Returns: 0 on success, -EXXXX on failure
- */
-int fs_unstuff_dinode(struct fsck_inode *ip)
-{
-	struct fsck_sb *sdp = ip->i_sbd;
-	osi_buf_t *bh = NULL;
-	osi_buf_t *dibh = NULL;
-	int journaled = fs_is_jdata(ip);
-	uint64 block = 0;
-	int error;
-
-	log_debug("Unstuffing inode %"PRIu64" - %u\n", ip->i_di.di_num.no_addr,
-		  journaled);
-
-	if(!fs_is_stuffed(ip)){
-		log_err("Trying to unstuff a dinode that is already unstuffed.\n");
-		return -1;
-	}
-
-
-	error = get_and_read_buf(sdp, ip->i_num.no_addr, &dibh, 0);
-	if (error) {
-		stack;
-		goto fail;
-	}
-
-	error = check_meta(dibh, GFS_METATYPE_DI);
-	if(error) {
-		stack;
-		goto fail;
-	}
-
-	if (ip->i_di.di_size){
-		log_err("Allocating new block for unstuffed dinode\n");
-		if(journaled){
-			error = fs_metaalloc(ip, &block);
-			if (error) {
-				stack;
-				goto fail;
-			}
-			log_err("Got block %"PRIu64"\n", block);
-			error = get_buf(sdp, block, &bh);
-			if (error) {
-				stack;
-				goto fail;
-			}
-
-			set_meta(bh, GFS_METATYPE_JD, GFS_FORMAT_JD);
-
-			memcpy(BH_DATA(bh)+sizeof(struct gfs_meta_header),
-			       BH_DATA(dibh)+sizeof(struct gfs_dinode),
-			       BH_SIZE(dibh)-sizeof(struct gfs_dinode));
-
-			error = write_buf(sdp, bh, 0);
-			if(error) {
-				stack;
-				goto fail;
-			}
-			relse_buf(sdp, bh);
-			block_set(sdp->bl, block, journal_blk);
-		}
-		else{
-			error = fs_blkalloc(ip, &block);
-
-			if(error) {
-				stack;
-				goto fail;
-			}
-
-			error = get_buf(sdp, block, &bh);
-			if (error) {
-				stack;
-				goto fail;
-			}
-
-			memcpy(BH_DATA(bh)+sizeof(struct gfs_meta_header),
-			       BH_DATA(dibh)+sizeof(struct gfs_dinode),
-			       BH_SIZE(dibh)-sizeof(struct gfs_dinode));
-
-			error = write_buf(sdp, bh, 0);
-			if(error) {
-				stack;
-				goto fail;
-			}
-			relse_buf(sdp, bh);
-			block_set(sdp->bl, block, block_used);
-		}
-	}
-
-	bh = NULL;
-	/*  Set up the pointer to the new block  */
-
-	memset(BH_DATA(dibh)+sizeof(struct gfs_dinode), 0,
-	       BH_SIZE(dibh)-sizeof(struct gfs_dinode));
-
-	if (ip->i_di.di_size){
-		((uint64 *)(BH_DATA(dibh) + sizeof(struct gfs_dinode)))[0] = cpu_to_gfs64(block);
-		ip->i_di.di_blocks++;
-	}
-
-	ip->i_di.di_height = 1;
-
-	gfs_dinode_out(&ip->i_di, BH_DATA(dibh));
-	if(write_buf(sdp, dibh, 0)){
-		log_err("Dinode unstuffed, but unable to write back dinode.\n");
-		goto fail;
-	}
-	relse_buf(sdp, dibh);
-
-	return 0;
-
-
-
- fail:
-	if(bh) relse_buf(sdp, bh);
-	if(dibh) relse_buf(sdp, dibh);
-
-	return error;
-}
-
-
-/**
- * calc_tree_height - Calculate the height of a metadata tree
- * @ip: The GFS inode
- * @size: The proposed size of the file
- *
- * Work out how tall a metadata tree needs to be in order to accommodate a
- * file of a particular size. If size is less than the current size of
- * the inode, then the current size of the inode is used instead of the
- * supplied one.
- *
- * Returns: the height the tree should be
- */
-
-static unsigned int calc_tree_height(struct fsck_inode *ip, uint64 size)
-{
-	struct fsck_sb *sdp = ip->i_sbd;
-	uint64 *arr;
-	unsigned int max, height;
-
-	if (ip->i_di.di_size > size)
-		size = ip->i_di.di_size;
-
-	if (fs_is_jdata(ip)){
-		arr = sdp->jheightsize;
-		max = sdp->max_jheight;
-	}
-	else{
-		arr = sdp->heightsize;
-		max = sdp->max_height;
-	}
-	for (height = 0; height < max; height++)
-		if (arr[height] >= size)
-			break;
-
-	return height;
-}
-
-
-/**
- * build_height - Build a metadata tree of the requested height
- * @ip: The GFS inode
- * @height: The height to build to
- *
- *
- * Returns: 0 on success, -EXXXX on failure
- */
-static int build_height(struct fsck_inode *ip, int height)
-{
-	struct fsck_sb *sdp = ip->i_sbd;
-	osi_buf_t *bh, *dibh;
-	uint64 block, *bp;
-	unsigned int x;
-	int new_block;
-	int error;
-
-	while (ip->i_di.di_height < height){
-		error = get_and_read_buf(ip->i_sbd, ip->i_num.no_addr, &dibh, 0);
-		if (error)
-			goto fail;
-
-		new_block = FALSE;
-		bp = (uint64 *)(BH_DATA(dibh) + sizeof(struct gfs_dinode));
-		for (x = 0; x < sdp->diptrs; x++, bp++)
-			if (*bp){
-				new_block = TRUE;
-				break;
-			}
-
-
-		if (new_block){
-			/*  Get a new block, fill it with the old direct pointers and write it out  */
-			error = fs_metaalloc(ip, &block);
-			if (error)
-				goto fail_drelse;
-
-			error = get_and_read_buf(sdp, block, &bh, 0);
-			if (error)
-				goto fail_drelse;
-
-			set_meta(bh, GFS_METATYPE_IN, GFS_FORMAT_IN);
-			/*
-			  gfs_buffer_copy_tail(bh, sizeof(struct gfs_indirect),
-			  dibh, sizeof(struct gfs_dinode));
-			*/
-			log_err("ATTENTION -- Not doing copy_tail...\n");
-			exit(1);
-			error = -1;
-			goto fail_drelse;
-			if((error = write_buf(sdp, bh, 0))){
-				log_err( "Unable to write new buffer #%"PRIu64".\n",
-					BH_BLKNO(bh));
-				goto fail_drelse;
-			}
-			relse_buf(sdp, bh);
-		}
-
-
-		/*  Set up the new direct pointer and write it out to disk  */
-
-		memset(BH_DATA(dibh)+sizeof(struct gfs_dinode), 0,
-		       BH_SIZE(dibh)-sizeof(struct gfs_dinode));
-
-		if (new_block){
-			((uint64 *)(BH_DATA(dibh) + sizeof(struct gfs_dinode)))[0] = cpu_to_gfs64(block);
-			ip->i_di.di_blocks++;
-		}
-
-		ip->i_di.di_height++;
-
-		gfs_dinode_out(&ip->i_di, BH_DATA(dibh));
-		write_buf(sdp, dibh, 0);
-		relse_buf(sdp, dibh);
-	}
-
-	return 0;
-
-
-
- fail_drelse:
-	relse_buf(sdp, dibh);
-
- fail:
-	return error;
-}
-
-
-static void find_metapath(struct fsck_inode *ip, metapath_t *mp, uint64 block)
-{
-	struct fsck_sb *sdp = ip->i_sbd;
-	unsigned int i;
-
-	for (i = ip->i_di.di_height; i--; ){
-		mp->mp_list[i] = block % sdp->inptrs;
-		block /= sdp->inptrs;
-	}
-}
-
-
-/**
- * metapointer - Return pointer to start of metadata in a buffer
- * @bh: The buffer
- * @level: The metadata level (0 = dinode)
- * @mp: The metapath
- *
- * Return a pointer to the block number of the next level of the metadata
- * tree given a buffer containing the pointer to the current level of the
- * metadata tree.
- */
-
-static uint64 *metapointer(osi_buf_t *bh, unsigned int level, metapath_t *mp)
-{
-	int head_size = (level > 0) ? sizeof(struct gfs_indirect) : sizeof(struct gfs_dinode);
-	return ((uint64 *)(BH_DATA(bh) + head_size)) + mp->mp_list[level];
-}
-
-
-/**
- * get_metablock - Get the next metadata block in metadata tree
- * @ip: The GFS inode
- * @bh: Buffer containing the pointers to metadata blocks
- * @level: The level of the tree (0 = dinode)
- * @mp: The metapath
- * @create: Non-zero if we may create a new meatdata block
- * @new: Used to indicate if we did create a new metadata block
- * @block: the returned disk block number
- *
- * Given a metatree, complete to a particular level, checks to see if the next
- * level of the tree exists. If not the next level of the tree is created.
- * The block number of the next level of the metadata tree is returned.
- *
- * Returns: 0 on success, -EXXX on failure
- */
-
-static int get_metablock(struct fsck_inode *ip,
-			 osi_buf_t *bh, unsigned int level, metapath_t *mp,
-			 int create, int *new, uint64 *block)
-{
-	uint64 *ptr = metapointer(bh, level, mp);
-	int error = 0;
-
-	*new = 0;
-	*block = 0;
-
-	if (*ptr){
-		*block = gfs64_to_cpu(*ptr);
-		goto out;
-	}
-
-	if (!create)
-		goto out;
-
-	error = fs_metaalloc(ip, block);
-	if (error)
-		goto out;
-
-	*ptr = cpu_to_gfs64(*block);
-	ip->i_di.di_blocks++;
-	write_buf(ip->i_sbd, bh, 0);
-
-	*new = 1;
-
- out:
-	return error;
-}
-
-
-/**
- * get_datablock - Get datablock number from metadata block
- * @rgd: rgrp to allocate from if necessary
- * @ip: The GFS inode
- * @bh: The buffer containing pointers to datablocks
- * @mp: The metapath
- * @create: Non-zero if we may create a new data block
- * @new: Used to indicate if we created a new data block
- * @block: the returned disk block number
- *
- * Given a fully built metadata tree, checks to see if a particular data
- * block exists. It is created if it does not exist and the block number
- * on disk is returned.
- *
- * Returns: 0 on success, -EXXX on failure
- */
-
-static int get_datablock(struct fsck_inode *ip,
-			 osi_buf_t *bh, metapath_t *mp,
-			 int create, int *new, uint64 *block)
-{
-	uint64 *ptr = metapointer(bh, ip->i_di.di_height - 1, mp);
-	int error = 0;
-
-	*new = 0;
-	*block = 0;
-
-
-	if (*ptr){
-		*block = gfs64_to_cpu(*ptr);
-		goto out;
-	}
-
-	if (!create)
-		goto out;
-
-	if (fs_is_jdata(ip)){
-		error = fs_metaalloc(ip, block);
-		if (error)
-			goto out;
-	}
-	else {
-		error = fs_blkalloc(ip, block);
-		if (error)
-			goto out;
-	}
-
-	*ptr = cpu_to_gfs64(*block);
-	ip->i_di.di_blocks++;
-	write_buf(ip->i_sbd, bh, 0);
-
-	*new = 1;
-
- out:
-	return error;
-}
-
-
-/**
- * fs_block_map - Map a block from an inode to a disk block
- * @ip: The GFS inode
- * @lblock: The logical block number
- * @new: Value/Result argument (1 = may create/did create new blocks)
- * @dblock: the disk block number of the start of an extent
- * @extlen: the size of the extent
- *
- * Find the block number on the current device which corresponds to an
- * inode's block. If the block had to be created, "new" will be set.
- *
- * Returns: 0 on success, -EXXX on failure
- */
-int fs_block_map(struct fsck_inode *ip, uint64 lblock, int *new,
-		 uint64 *dblock, uint32 *extlen)
-{
-	struct fsck_sb *sdp = ip->i_sbd;
-	osi_buf_t *bh = NULL;
-	metapath_t mp;
-	int create = *new;
-	unsigned int bsize;
-	unsigned int height;
-	unsigned int x, end_of_metadata;
-	unsigned int nptrs;
-	uint64 tmp_dblock;
-	int tmp_new;
-	int error = 0;
-
-	*new = 0;
-	*dblock = 0;
-	if (extlen)
-		*extlen = 0;
-
-	if (fs_is_stuffed(ip)){
-		*dblock = ip->i_num.no_addr;
-		if (extlen)
-			*extlen = 1;
-		goto out;
-	}
-	bsize = (fs_is_jdata(ip)) ? sdp->jbsize : sdp->sb.sb_bsize;
-
-	height = calc_tree_height(ip, (lblock + 1) * bsize);
-	if (ip->i_di.di_height < height){
-		if (!create){
-			error = 0;
-			goto fail;
-		}
-
-		error = build_height(ip, height);
-		if (error)
-			goto fail;
-	}
-
-
-	error = get_and_read_buf(ip->i_sbd, ip->i_num.no_addr, &bh, 0);
-	if (error)
-		goto fail;
-
-
-	find_metapath(ip, &mp, lblock);
-	end_of_metadata = ip->i_di.di_height - 1;
-
-	for (x = 0; x < end_of_metadata; x++){
-		error = get_metablock(ip, bh, x, &mp, create, new, dblock);
-		relse_buf(ip->i_sbd, bh); bh = NULL;
-		if (error)
-			goto fail;
-		if (!*dblock)
-			goto out;
-
-		error = get_and_read_buf(ip->i_sbd, *dblock, &bh, 0);
-		if (error)
-			goto fail;
-	}
-
-
-	error = get_datablock(ip, bh, &mp, create, new, dblock);
-	if (error)
-		goto fail_drelse;
-
-	if (extlen && *dblock){
-		*extlen = 1;
-
-		if (!*new){
-			nptrs = (end_of_metadata) ? sdp->inptrs : sdp->diptrs;
-			while (++mp.mp_list[end_of_metadata] < nptrs){
-				error = get_datablock(ip, bh, &mp, 0, &tmp_new,
-						      &tmp_dblock);
-				if(error){
-					log_err( "Unable to perform get_datablock.\n");
-					goto fail;
-				}
-
-				if (*dblock + *extlen != tmp_dblock)
-					break;
-
-				(*extlen)++;
-			}
-		}
-	}
-
-
-	relse_buf(sdp, bh);
-
-
- out:
-	if (*new){
-		error = get_and_read_buf(sdp, ip->i_num.no_addr, &bh, 0);
-		if (error)
-			goto fail;
-		gfs_dinode_out(&ip->i_di, BH_DATA(bh));
-		write_buf(sdp, bh, 0);
-		relse_buf(sdp, bh);
-	}
-	return 0;
-
-
-
- fail_drelse:
-	if(bh)
-		relse_buf(sdp, bh);
-
- fail:
-	return error;
-}
diff --git a/gfs/gfs_fsck/fs_bmap.h b/gfs/gfs_fsck/fs_bmap.h
deleted file mode 100644
index 658a62e..0000000
--- a/gfs/gfs_fsck/fs_bmap.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __FS_BMAP_H__
-#define __FS_BMAP_H__
-
-#include "fsck_incore.h"
-
-int fs_unstuff_dinode(struct fsck_inode *ip);
-int fs_block_map(struct fsck_inode *ip, uint64 lblock, int *new,
-		 uint64 *dblock, uint32 *extlen);
-
-#endif /* __FS_BMAP_H__ */
diff --git a/gfs/gfs_fsck/fs_dir.c b/gfs/gfs_fsck/fs_dir.c
deleted file mode 100644
index 27f559a..0000000
--- a/gfs/gfs_fsck/fs_dir.c
+++ /dev/null
@@ -1,1756 +0,0 @@
-#include "util.h"
-#include "file.h"
-#include "rgrp.h"
-#include "fsck_incore.h"
-#include "fs_inode.h"
-#include "bio.h"
-#include "link.h"
-#include "limits.h"
-#include "metawalk.h"
-#include "fs_dir.h"
-
-#define IS_LEAF     (1)
-#define IS_DINODE   (2)
-
-#define dir_hash(qstr) (gfs_dir_hash((char *)(qstr)->name, (qstr)->len))
-
-/* Detect directory is a stuffed inode */
-int fsck_inode_is_stuffed(struct fsck_inode *ip)
-{
-	return !ip->i_di.di_height;
-}
-
-/**
- * dirent_first - Return the first dirent
- * @bh: The buffer
- * @dent: Pointer to list of dirents
- *
- * return first dirent whether bh points to leaf or stuffed dinode
- *
- * Returns: IS_LEAF or IS_DINODE
- */
-int dirent_first(osi_buf_t *bh, struct gfs_dirent **dent)
-{
-	struct gfs_leaf *leaf;
-	struct gfs_dinode *dinode;
-
-	leaf = (struct gfs_leaf *)BH_DATA(bh);
-
-	if (gfs32_to_cpu(leaf->lf_header.mh_type) == GFS_METATYPE_LF)
-	{
-		*dent = (struct gfs_dirent *)(BH_DATA(bh) + sizeof(struct gfs_leaf));
-
-		return IS_LEAF;
-	}
-	else
-	{
-		dinode = (struct gfs_dinode *)BH_DATA(bh);
-		if(gfs32_to_cpu(dinode->di_header.mh_type) != GFS_METATYPE_DI){
-			log_err("buffer is not GFS_METATYPE_[DI | LF]\n");
-			return -1;
-		}
-
-		*dent = (struct gfs_dirent *)(BH_DATA(bh) + sizeof(struct gfs_dinode));
-
-		return IS_DINODE;
-	}
-}
-
-
-/**
- * dirent_next - Next dirent
- * @bh: The buffer
- * @dent: Pointer to list of dirents
- *
- * Returns: 0 on success, error code otherwise
- */
-int dirent_next(osi_buf_t *bh, struct gfs_dirent **dent)
-{
-	struct gfs_dirent *tmp, *cur;
-	char *bh_end;
-	uint32 cur_rec_len;
-
-	cur = *dent;
-	bh_end = BH_DATA(bh) + BH_SIZE(bh);
-
-	cur_rec_len = gfs16_to_cpu(cur->de_rec_len);
-
-	if ((char *)cur + cur_rec_len >= bh_end){
-		if((char *)cur + cur_rec_len != bh_end){
-			log_err("Bad record length causing failure in dirent_next()\n");
-			return -1;
-		}
-		return -ENOENT;
-	}
-
-	tmp = (struct gfs_dirent *)((char *)cur + cur_rec_len);
-
-	if((char *)tmp + gfs16_to_cpu(tmp->de_rec_len) > bh_end){
-		log_err("Bad record length causing failure in dirent_next\n");
-		return -1;
-	}
-
-	/*  only the first dent could ever have de_ino == 0  */
-	if(!tmp->de_inum.no_formal_ino){
-		char tmp_name[256];
-
-		memcpy(tmp_name, cur+sizeof(struct gfs_dirent), gfs16_to_cpu(cur->de_name_len));
-		tmp_name[gfs16_to_cpu(cur->de_name_len)] = '\0';
-		log_err("dirent_next:  "
-			"A non-first dir entry has zero formal inode.\n");
-		log_err("\tFaulty dirent after (%s) in block #%"PRIu64".\n",
-			tmp_name, BH_BLKNO(bh));
-
-		return -1;
-	}
-
-	*dent = tmp;
-
-	return 0;
-}
-
-
-/**
- * dirent_del - Delete a dirent
- * @dip: The GFS inode
- * @bh: The buffer
- * @prev: The previous dirent
- * @cur: The current dirent
- *
- * Returns: 0 on success, error code otherwise
- */
-
-int dirent_del(struct fsck_inode *dip, osi_buf_t *bh,
-	       struct gfs_dirent *prev, struct gfs_dirent *cur){
-	uint32 cur_rec_len, prev_rec_len;
-
-	dip->i_di.di_entries--;
-	if(!cur->de_inum.no_formal_ino){
-		log_err("dirent_del:  "
-			"Can not delete dirent with !no_formal_ino.\n");
-		return -1;
-	}
-
-	/*  If there is no prev entry, this is the first entry in the block.
-	    The de_rec_len is already as big as it needs to be.  Just zero
-	    out the inode number and return.  */
-
-	if (!prev){
-		cur->de_inum.no_formal_ino = 0;  /*  No endianess worries  */
-		if(write_buf(dip->i_sbd, bh, 0)){
-			log_err("dirent_del: Bad write_buf.\n");
-			return -EIO;
-		}
-		return 0;
-	}
-
-	/*  Combine this dentry with the previous one.  */
-
-	prev_rec_len = gfs16_to_cpu(prev->de_rec_len);
-	cur_rec_len = gfs16_to_cpu(cur->de_rec_len);
-
-	if((char *)prev + prev_rec_len != (char *)cur){
-		log_err("dirent_del: Bad bounds for directory entries.\n");
-		return -1;
-	}
-
-	if((char *)cur + cur_rec_len > BH_DATA(bh) + BH_SIZE(bh)){
-		log_err("dirent_del: Directory entry has record length"
-			" longer than buffer.\n");
-		return -1;
-	}
-
-	log_debug("Updating previous record from %u to %u\n",
-		  prev_rec_len, prev_rec_len+cur_rec_len);
-	prev_rec_len += cur_rec_len;
-	prev->de_rec_len = cpu_to_gfs16(prev_rec_len);
-
-	if(write_buf(dip->i_sbd, bh, 0)){
-		log_err("dirent_del: Bad write_buf.\n");
-		return -EIO;
-	}
-
-	return 0;
-}
-
-
-/**
- * get_leaf - Get leaf
- * @dip:
- * @leaf_no:
- * @bh_out:
- *
- * Returns: 0 on success, error code otherwise
- */
-
-static int get_leaf(struct fsck_inode *dip, uint64 leaf_no, osi_buf_t **bhp)
-{
-	int error;
-
-	error = get_and_read_buf(dip->i_sbd, leaf_no, bhp, 0);
-
-	if (error) {
-		log_err("Unable to read leaf buffer #%"PRIu64"\n", leaf_no);
-		return error;
-	}
-
-	error = check_meta(*bhp, GFS_METATYPE_LF);
-
-	if(error) {
-		log_err("Metatype for block #%"PRIu64" is not type 'leaf'\n",
-			leaf_no);
-		relse_buf(dip->i_sbd, *bhp);
-	}
-	return error;
-}
-
-
-/**
- * get_first_leaf - Get first leaf
- * @dip: The GFS inode
- * @index:
- * @bh_out:
- *
- * Returns: 0 on success, error code otherwise
- */
-
-static int get_first_leaf(struct fsck_inode *dip, uint32 index, osi_buf_t **bh_out)
-{
-	uint64 leaf_no;
-	int error;
-
-	error = get_leaf_nr(dip, index, &leaf_no);
-	if (!error)
-		error = get_leaf(dip, leaf_no, bh_out);
-
-	return error;
-}
-
-
-/**
- * get_next_leaf - Get next leaf
- * @dip: The GFS inode
- * @bh_in: The buffer
- * @bh_out:
- *
- * Returns: 0 on success, error code otherwise
- */
-
-static int get_next_leaf(struct fsck_inode *dip,osi_buf_t *bh_in,osi_buf_t **bh_out)
-{
-	struct gfs_leaf *leaf;
-	int error;
-
-	leaf = (struct gfs_leaf *)BH_DATA(bh_in);
-
-	if (!leaf->lf_next)
-		error = -ENOENT;
-	else
-		error = get_leaf(dip, gfs64_to_cpu(leaf->lf_next), bh_out);
-	return error;
-}
-
-/**
- * leaf_search
- * @bh:
- * @id:
- * @dent_out:
- * @dent_prev:
- *
- * Returns:
- */
-static int leaf_search(osi_buf_t *bh, identifier_t *id,
-                       struct gfs_dirent **dent_out,
-		       struct gfs_dirent **dent_prev)
-{
-	uint32 hash;
-	struct gfs_dirent *dent, *prev = NULL;
-	unsigned int entries = 0, x = 0;
-	int type;
-
-	type = dirent_first(bh, &dent);
-
-	if (type == IS_LEAF){
-		struct gfs_leaf *leaf = (struct gfs_leaf *)BH_DATA(bh);
-		entries = gfs16_to_cpu(leaf->lf_entries);
-	} else if (type == IS_DINODE) {
-		struct gfs_dinode *dinode = (struct gfs_dinode *)(BH_DATA(bh));
-		entries = gfs32_to_cpu(dinode->di_entries);
-	} else {
-		log_err("type != IS_LEAF && type != IS_DINODE\n");
-		return -1;
-	}
-
-	if(id->type == ID_FILENAME){
-		hash = dir_hash(id->filename);
-
-		do{
-			if (!dent->de_inum.no_formal_ino){
-				prev = dent;
-				continue;
-			}
-
-			if (gfs32_to_cpu(dent->de_hash) == hash &&
-			    fs_filecmp(id->filename, (char *)(dent + 1),
-				       gfs16_to_cpu(dent->de_name_len))){
-				*dent_out = dent;
-				if (dent_prev)
-					*dent_prev = prev;
-				return 0;
-			}
-
-			if(x >= entries){
-				log_err("x >= entries (%u >= %u)\n", x, entries);
-				return -1;
-			}
-			x++;
-			prev = dent;
-		} while (dirent_next(bh, &dent) == 0);
-	} else if(id->type == ID_INUM){
-		struct gfs_inum inum;
-
-		do{
-			if (!dent->de_inum.no_formal_ino){
-				prev = dent;
-				continue;
-			}
-
-			gfs_inum_in(&inum, (char *)&dent->de_inum);
-
-			if(inum.no_addr == id->inum->no_addr){
-				*dent_out = dent;
-				if(dent_prev)
-					*dent_prev = prev;
-				return 0;
-			}
-
-			if(x >= entries){
-				log_err("x >= entries (%u >= %u)\n", x, entries);
-				return -1;
-			}
-			x++;
-			prev = dent;
-		} while (dirent_next(bh, &dent) == 0);
-	} else {
-		log_err("leaf_search:  Invalid type for identifier.\n");
-		exit(1);
-	}
-
-	return -ENOENT;
-}
-
-
-/**
- * linked_leaf_search - Linked leaf search
- * @dip: The GFS inode
- * @id:
- * @dent_out:
- * @dent_prev:
- * @bh_out:
- *
- * Returns: 0 on sucess, error code otherwise
- */
-
-static int linked_leaf_search(struct fsck_inode *dip, identifier_t *id,
-                              struct gfs_dirent **dent_out,
-			      struct gfs_dirent **dent_prev, osi_buf_t **bh_out)
-{
-	osi_buf_t *bh = NULL, *bh_next;
-	uint32 hsize, index;
-	uint32 hash;
-	int error = 0;
-
-	hsize = 1 << dip->i_di.di_depth;
-	if(hsize * sizeof(uint64) != dip->i_di.di_size){
-		log_err("hsize * sizeof(uint64) != dip->i_di.di_size\n");
-		return -1;
-	}
-
-	/*  Figure out the address of the leaf node.  */
-
-	if(id->type == ID_FILENAME){
-		hash = dir_hash(id->filename);
-		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)
-				relse_buf(dip->i_sbd, bh);
-
-			bh = bh_next;
-
-			error = leaf_search(bh, id, dent_out, dent_prev);
-			switch (error){
-			case 0:
-				*bh_out = bh;
-				return 0;
-
-			case -ENOENT:
-				break;
-
-			default:
-				relse_buf(dip->i_sbd, bh);
-				return error;
-			}
-
-			error = get_next_leaf(dip, bh, &bh_next);
-		}while (!error);
-
-		relse_buf(dip->i_sbd, bh);
-	} else if(id->type == ID_INUM){
-		for(index=0; index < (1 << dip->i_di.di_depth); index++){
-			error = get_first_leaf(dip, index, &bh_next);
-			if (error){
-				return error;
-			}
-
-			/*  Find the entry  */
-			do{
-				if (bh)
-					relse_buf(dip->i_sbd, bh);
-
-				bh = bh_next;
-
-				error = leaf_search(bh, id, dent_out, dent_prev);
-				switch (error){
-				case 0:
-					*bh_out = bh;
-					return 0;
-
-				case -ENOENT:
-					break;
-
-				default:
-					relse_buf(dip->i_sbd, bh);
-					return error;
-				}
-
-				error = get_next_leaf(dip, bh, &bh_next);
-			}while (!error);
-		}
-	} else {
-		log_err("linked_leaf_search:  Invalid type for identifier.\n");
-		exit(1);
-	}
-	return error;
-}
-
-
-/**
- * dir_e_search -
- * @dip: The GFS inode
- * @id:
- * @inode:
- *
- * Returns:
- */
-static int dir_e_search(struct fsck_inode *dip, identifier_t *id, unsigned int *type)
-{
-	osi_buf_t *bh = NULL;
-	struct gfs_dirent *dent;
-	int error;
-
-	error = linked_leaf_search(dip, id, &dent, NULL, &bh);
-	if (error){
-		return error;
-	}
-
-	if(id->type == ID_FILENAME){
-		if(id->inum){
-			log_err("dir_e_search:  Illegal parameter.  inum must be NULL.\n");
-			exit(1);
-		}
-		if(!(id->inum = (struct gfs_inum *)malloc(sizeof(struct gfs_inum)))) {
-			log_err("Unable to allocate inum structure\n");
-			return -1;
-		}
-		if(!memset(id->inum, 0, sizeof(struct gfs_inum))) {
-			log_err("Unable to zero inum structure\n");
-			return -1;
-		}
-
-		gfs_inum_in(id->inum, (char *)&dent->de_inum);
-	} else {
-		if(id->filename){
-			log_err("dir_e_search:  Illegal parameter.  name must be NULL.\n");
-			exit(1);
-		}
-		if(!(id->filename = (osi_filename_t *)malloc(sizeof(osi_filename_t)))) {
-			log_err("Unable to allocate osi_filename structure\n");
-			return -1;
-		}
-		if(!(memset(id->filename, 0, sizeof(osi_filename_t)))) {
-			log_err("Unable to zero osi_filename structure\n");
-			return -1;
-		}
-
-		id->filename->len = gfs16_to_cpu(dent->de_name_len);
-		if(!(id->filename->name = malloc(id->filename->len))) {
-			log_err("Unable to allocate name in osi_filename structure\n");
-			free(id->filename);
-			return -1;
-		}
-		if(!(memset(id->filename->name, 0, id->filename->len))) {
-			log_err("Unable to zero name in osi_filename structure\n");
-			free(id->inum);
-			free(id->filename);
-			return -1;
-		}
-
-		memcpy(id->filename->name, (char *)dent+sizeof(struct gfs_dirent),
-		       id->filename->len);
-	}
-	if (type)
-		*type = gfs16_to_cpu(dent->de_type);
-
-	relse_buf(dip->i_sbd, bh);
-
-	return 0;
-}
-
-
-/**
- * dir_l_search -
- * @dip: The GFS inode
- * @id:
- * @inode:
- *
- * Returns:
- */
-static int dir_l_search(struct fsck_inode *dip, identifier_t *id, unsigned int *type)
-{
-	osi_buf_t *dibh;
-	struct gfs_dirent *dent;
-	int error;
-
-	if(!fs_is_stuffed(dip)){
-		log_err("A linear search was attempted on a directory "
-			"that is not stuffed.\n");
-		return -1;
-	}
-
-	error = get_and_read_buf(dip->i_sbd, dip->i_num.no_addr, &dibh, 0);
-	if (error)
-		goto out;
-
-
-	error = leaf_search(dibh, id, &dent, NULL);
-	if (error)
-		goto out_drelse;
-
-	if(id->type == ID_FILENAME){
-		if(id->inum){
-			log_err("dir_l_search:  Illegal parameter.  inum must be NULL.\n");
-			exit(1);
-		}
-		id->inum = (struct gfs_inum *)malloc(sizeof(struct gfs_inum));
-		// FIXME: don't dereference NULL on failed malloc
-		memset(id->inum, 0, sizeof(struct gfs_inum));
-
-		gfs_inum_in(id->inum, (char *)&dent->de_inum);
-	} else {
-		if(id->filename){
-			log_err("dir_l_search:  Illegal parameter.  name must be NULL.\n");
-			exit(1);
-		}
-		id->filename = (osi_filename_t *)malloc(sizeof(osi_filename_t));
-		// FIXME: don't dereference NULL on failed malloc
-		memset(id->filename, 0, sizeof(osi_filename_t));
-
-		id->filename->len = gfs16_to_cpu(dent->de_name_len);
-		id->filename->name = malloc(id->filename->len);
-		// FIXME: don't dereference NULL on failed malloc
-		memset(id->filename->name, 0, id->filename->len);
-
-		memcpy(id->filename->name, (char *)dent+sizeof(struct gfs_dirent),
-		       id->filename->len);
-	}
-	if(type)
-		*type = gfs16_to_cpu(dent->de_type);
-
-
- out_drelse:
-	relse_buf(dip->i_sbd, dibh);
-
- out:
-	return error;
-}
-
-
-/**
- * dir_make_exhash - Convet a stuffed directory into an ExHash directory
- * @dip: The GFS inode
- *
- * Returns: 0 on success, error code otherwise
- */
-
-static int dir_make_exhash(struct fsck_inode *dip)
-{
-	struct fsck_sb *sdp = dip->i_sbd;
-	struct gfs_dirent *dent;
-	osi_buf_t *bh = NULL, *dibh = NULL;
-	struct gfs_leaf *leaf;
-	int y;
-	uint32 x;
-	uint64 *lp, bn;
-	int error;
-
-	/*  Sanity checks  */
-
-	if(sizeof(struct gfs_leaf) > sizeof(struct gfs_dinode)){
-		log_err(
-			"dir_make_exhash:  on-disk leaf is larger than on-disk dinode.\n"
-			"                  Unable to expand directory.\n");
-		return -1;
-	}
-
-	error = get_and_read_buf(dip->i_sbd, dip->i_num.no_addr, &dibh, 0);
-	if (error)
-		goto fail;
-
-
-	error = fs_metaalloc(dip, &bn);
-
-	if (error)
-		goto fail_drelse;
-
-
-	/*  Turn over a new leaf  */
-
-	error = get_and_read_buf(sdp, bn, &bh, 0);
-	if (error)
-		goto fail_drelse;
-
-	if(check_meta(bh, 0)){
-		log_err("dir_make_exhash:  Buffer has bad meta header.\n");
-		goto fail_drelse;
-	}
-
-	set_meta(bh, GFS_METATYPE_LF, GFS_FORMAT_LF);
-	memset(BH_DATA(bh) + sizeof(struct gfs_meta_header), 0,
-	       BH_SIZE(bh) - sizeof(struct gfs_meta_header));
-
-	/*  Fill in the leaf structure  */
-
-	leaf = (struct gfs_leaf *)BH_DATA(bh);
-
-	if(dip->i_di.di_entries >= (1 << 16)){
-		log_err(
-			"dir_make_exhash:  Too many directory entries.\n"
-			"                  Unable to expand directory.\n");
-		goto fail_drelse;
-	}
-	leaf->lf_dirent_format = cpu_to_gfs32(GFS_FORMAT_DE);
-	leaf->lf_entries = cpu_to_gfs16(dip->i_di.di_entries);
-
-
-	/*  Copy dirents  */
-	memset(BH_DATA(bh)+sizeof(struct gfs_leaf), 0, BH_SIZE(bh)-sizeof(struct gfs_leaf));
-	memcpy(BH_DATA(bh)+sizeof(struct gfs_leaf),
-	       BH_DATA(dibh)+sizeof(struct gfs_dinode),
-	       BH_SIZE(dibh)-sizeof(struct gfs_dinode));
-
-	/*  Find last entry  */
-
-	x = 0;
-	dirent_first(bh, &dent);
-
-	do
-	{
-		if (!dent->de_inum.no_formal_ino)
-			continue;
-
-		if (++x == dip->i_di.di_entries)
-			break;
-	}
-	while (dirent_next(bh, &dent) == 0);
-
-
-	/*  Adjust the last dirent's record length
-	    (Remember that dent still points to the last entry.)  */
-
-	dent->de_rec_len = gfs16_to_cpu(dent->de_rec_len) +
-		sizeof(struct gfs_dinode) - sizeof(struct gfs_leaf);
-	dent->de_rec_len = cpu_to_gfs16(dent->de_rec_len);
-
-	if(write_buf(dip->i_sbd, bh, 0)){
-		log_err("dir_make_exhash:  bad write_buf()\n");
-		goto fail_drelse;
-	}
-	relse_buf(dip->i_sbd, bh); bh=NULL;
-
-	log_debug("Created a new leaf block at %"PRIu64"\n", bn);
-
-	block_set(dip->i_sbd->bl, bn, leaf_blk);
-	/*  We're done with the new leaf block, now setup the new
-	    hash table.  */
-
-	memset(BH_DATA(dibh) + sizeof(struct gfs_dinode), 0,
-	       BH_SIZE(dibh) - sizeof(struct gfs_dinode));
-
-	lp = (uint64 *)(BH_DATA(dibh) + sizeof(struct gfs_dinode));
-
-	for (x = sdp->hash_ptrs; x--; lp++)
-		*lp = cpu_to_gfs64(bn);
-
-	dip->i_di.di_size = sdp->sb.sb_bsize / 2;
-	dip->i_di.di_blocks++;
-	dip->i_di.di_flags |= GFS_DIF_EXHASH;
-	dip->i_di.di_payload_format = 0;
-
-	for (x = sdp->hash_ptrs, y = -1; x; x >>= 1, y++) ;
-	dip->i_di.di_depth = y;
-
-	gfs_dinode_out(&dip->i_di, BH_DATA(dibh));
-
-	if(write_buf(dip->i_sbd, dibh, 0)){
-		log_err("dir_make_exhash: bad write_buf()\n");
-		goto fail_drelse;
-	}
-	relse_buf(dip->i_sbd, dibh); dibh = NULL;
-
-	return 0;
-
-
-
- fail_drelse:
-	if(bh)
-		relse_buf(dip->i_sbd, bh);
-	if(dibh)
-		relse_buf(dip->i_sbd, dibh);
-
- fail:
-	return error;
-}
-
-
-/**
- * dir_split_leaf - Split a leaf block into two
- * @dip: The GFS inode
- * @index:
- * @leaf_no:
- *
- * Returns: 0 on success, error code on failure
- */
-static int dir_split_leaf(struct fsck_inode *dip, uint32 index, uint64 leaf_no)
-{
-	struct fsck_sb *sdp = dip->i_sbd;
-	osi_buf_t *nbh, *obh, *dibh;
-	struct gfs_leaf *nleaf, *oleaf;
-	struct gfs_dirent *dent, *prev = NULL, *next = NULL, *new;
-	uint32 start, len, half_len, divider;
-	uint64 bn, *lp;
-	uint32 name_len;
-	int x, moved = FALSE;
-	int error;
-
-	/*  Allocate the new leaf block  */
-
-	error = fs_metaalloc(dip, &bn);
-	if (error)
-		goto fail;
-
-
-	/*  Get the new leaf block  */
-	error = get_and_read_buf(sdp, bn, &nbh, 0);
-	if (error)
-		goto fail;
-
-	if(check_meta(nbh, 0)){
-		log_err("dir_split_leaf:  Buffer is not a meta buffer.\n");
-		relse_buf(sdp, nbh);
-		return -1;
-	}
-
-	set_meta(nbh, GFS_METATYPE_LF, GFS_FORMAT_LF);
-
-	memset(BH_DATA(nbh)+sizeof(struct gfs_meta_header), 0,
-	       BH_SIZE(nbh)-sizeof(struct gfs_meta_header));
-
-	nleaf = (struct gfs_leaf *)BH_DATA(nbh);
-
-	nleaf->lf_dirent_format = cpu_to_gfs32(GFS_FORMAT_DE);
-
-
-	/*  Get the old leaf block  */
-
-	error = get_leaf(dip, leaf_no, &obh);
-	if (error)
-		goto fail_nrelse;
-
-	oleaf = (struct gfs_leaf *)BH_DATA(obh);
-
-
-	/*  Compute the start and len of leaf pointers in the hash table.  */
-
-	len = 1 << (dip->i_di.di_depth - gfs16_to_cpu(oleaf->lf_depth));
-	if(len == 1){
-		log_err("dir_split_leaf:  Corrupted leaf block encountered.\n");
-		goto fail_orelse;
-	}
-	half_len = len >> 1;
-
-	start = (index & ~(len - 1));
-
-	log_debug("Splitting leaf: len = %u, half_len = %u\n", len, half_len);
-
-	/*  Change the pointers.
-	    Don't bother distinguishing stuffed from non-stuffed.
-	    This code is complicated enough already.  */
-
-	lp = (uint64 *)malloc(half_len * sizeof(uint64));
-	// FIXME: don't dereference NULL on failed malloc
-	memset(lp, 0, half_len * sizeof(uint64));
-
-	error = readi(dip, (char *)lp, start * sizeof(uint64),
-		      half_len * sizeof(uint64));
-	if (error != half_len * sizeof(uint64)){
-		if (error >= 0)
-			error = -EIO;
-		goto fail_lpfree;
-	}
-
-	/*  Change the pointers  */
-
-	for (x = 0; x < half_len; x++)
-		lp[x] = cpu_to_gfs64(bn);
-
-	error = writei(dip, (char *)lp, start * sizeof(uint64),
-		       half_len * sizeof(uint64));
-
-	if (error != half_len * sizeof(uint64)){
-		if (error >= 0)
-			error = -EIO;
-		goto fail_lpfree;
-	}
-
-	free(lp); lp = NULL;  /* need to set lp for failure cases */
-
-
-	/*  Compute the divider  */
-
-	divider = (start + half_len) << (32 - dip->i_di.di_depth);
-
-	/*  Copy the entries  */
-
-	dirent_first(obh, &dent);
-
-	do{
-		next = dent;
-		if (dirent_next(obh, &next))
-			next = NULL;
-
-		if (dent->de_inum.no_formal_ino &&
-		    (gfs32_to_cpu(dent->de_hash) < divider)){
-			name_len = gfs16_to_cpu(dent->de_name_len);
-
-			error = fs_dirent_alloc(dip, nbh, name_len, &new);
-			if(error){
-				log_err("dir_split_leaf:  fs_dirent_alloc failed.\n");
-				goto fail_orelse;
-			}
-
-			new->de_inum = dent->de_inum;  /*  No endianness worries  */
-			new->de_hash = dent->de_hash;  /*  No endianness worries  */
-			new->de_type = dent->de_type;  /*  No endianness worries  */
-			memcpy((char *)(new + 1), (char *)(dent + 1), name_len);
-
-			nleaf->lf_entries = gfs16_to_cpu(nleaf->lf_entries) + 1;
-			nleaf->lf_entries = cpu_to_gfs16(nleaf->lf_entries);
-
-			dirent_del(dip, obh, prev, dent);
-			/* Dirent del decrements entries, but we're
-			 * just shifting entries around, so increment
-			 * it again */
-			dip->i_di.di_entries++;
-
-			if(!gfs16_to_cpu(oleaf->lf_entries)){
-				log_err("dir_split_leaf:  old leaf contains no entries.\n");
-				goto fail_orelse;
-			}
-			oleaf->lf_entries = gfs16_to_cpu(oleaf->lf_entries) - 1;
-			oleaf->lf_entries = cpu_to_gfs16(oleaf->lf_entries);
-
-			if (!prev)
-				prev = dent;
-
-			moved = TRUE;
-		}
-		else
-			prev = dent;
-
-		dent = next;
-	}
-	while (dent);
-
-
-	/*  If none of the entries got moved into the new leaf,
-	    artificially fill in the first entry.  */
-
-	if (!moved){
-		error = fs_dirent_alloc(dip, nbh, 0, &new);
-		if(error){
-			log_err("dir_split_leaf:  fs_dirent_alloc failed..\n");
-			goto fail_orelse;
-		}
-		new->de_inum.no_formal_ino = 0;
-	}
-
-
-	oleaf->lf_depth = gfs16_to_cpu(oleaf->lf_depth) + 1;
-	oleaf->lf_depth = cpu_to_gfs16(oleaf->lf_depth);
-	nleaf->lf_depth = oleaf->lf_depth;
-
-
-	error = get_and_read_buf(dip->i_sbd, dip->i_num.no_addr, &dibh, 0);
-	if(error){
-		log_err("dir_split_leaf:  Unable to get inode buffer.\n");
-		goto fail_orelse;
-	}
-
-	error = check_meta(dibh, GFS_METATYPE_DI);
-	if(error){
-		log_err("dir_split_leaf:  Buffer #%"PRIu64" is not a directory "
-			"inode.\n", BH_BLKNO(dibh));
-		goto fail_drelse;
-	}
-
-	dip->i_di.di_blocks++;
-
-	gfs_dinode_out(&dip->i_di, BH_DATA(dibh));
-	if(write_buf(sdp, dibh, 0)){
-		log_err("dir_split_leaf:  Failed to write new directory inode.\n");
-		goto fail_drelse;
-	}
-	relse_buf(sdp, dibh);
-
-
-	if(write_buf(sdp, obh, 0)){
-		log_err("dir_split_leaf:  Failed to write back old leaf block.\n");
-		goto fail_orelse;
-	}
-	relse_buf(sdp, obh);
-	if(write_buf(sdp, nbh, 0)){
-		log_err("dir_split_leaf:  Failed to write new leaf block.\n");
-		goto fail_nrelse;
-	}
-
-	log_debug("Created a new leaf block at %"PRIu64"\n", BH_BLKNO(nbh));
-
-	block_set(dip->i_sbd->bl, BH_BLKNO(nbh), leaf_blk);
-
-	relse_buf(sdp, nbh);
-
-	return 0;
-
-
-
- fail_drelse:
-	relse_buf(sdp, dibh);
-
- fail_lpfree:
-	if(lp) free(lp);
-
- fail_orelse:
-	relse_buf(sdp, obh);
-
- fail_nrelse:
-	relse_buf(sdp, nbh);
-
- fail:
-	return -1;
-}
-
-
-/**
- * dir_double_exhash - Double size of ExHash table
- * @dip: The GFS dinode
- *
- * Returns: 0 on success, -1 on failure
- */
-static int dir_double_exhash(struct fsck_inode *dip)
-{
-	struct fsck_sb *sdp = dip->i_sbd;
-	osi_buf_t *dibh;
-	uint32 hsize;
-	uint64 *buf;
-	uint64 *from, *to;
-	uint64 block;
-	int x;
-	int error = 0;
-
-	/*  Sanity Checks  */
-
-	hsize = 1 << dip->i_di.di_depth;
-	if(hsize * sizeof(uint64) != dip->i_di.di_size){
-		log_err("dir_double_exhash:  "
-			"hash size does not correspond to di_size.\n");
-		return -1;
-	}
-
-
-	/*  Allocate both the "from" and "to" buffers in one big chunk  */
-
-	buf = (uint64 *)malloc(3 * sdp->hash_bsize);
-	if(!buf){
-		log_err("dir_double_exhash:  "
-			"Unable to allocate memory for blk ptr list.\n");
-		return -1;
-	}
-	memset(buf, 0, 3 * sdp->hash_bsize);
-
-	for (block = dip->i_di.di_size / sdp->hash_bsize; block--;){
-		error = readi(dip, (char *)buf, block * sdp->hash_bsize,
-			      sdp->hash_bsize);
-		if (error != sdp->hash_bsize){
-			if (error >= 0)
-				error = -EIO;
-			goto out;
-		}
-
-		from = buf;
-		to = (uint64 *)((char *)buf + sdp->hash_bsize);
-
-		for (x = sdp->hash_ptrs; x--; from++){
-			*to++ = *from;  /*  No endianess worries  */
-			*to++ = *from;
-		}
-
-		error = writei(dip, (char *)buf + sdp->hash_bsize,
-			       block * sdp->sb.sb_bsize, sdp->sb.sb_bsize);
-		if (error != sdp->sb.sb_bsize){
-			if (error >= 0)
-				error = -EIO;
-			goto out;
-		}
-	}
-
-	free(buf); buf=NULL;
-
-
-	error = get_and_read_buf(sdp, dip->i_num.no_addr, &dibh, 0);
-	if(error){
-		log_err("dir_double_exhash:  "
-			"Unable to get inode buffer.\n");
-		return -1;
-	}
-
-	error = check_meta(dibh, GFS_METATYPE_DI);
-	if(error){
-		log_err("dir_double_exhash:  "
-			"Buffer does not contain directory inode.\n");
-		relse_buf(sdp, dibh);
-		return -1;
-	}
-
-	dip->i_di.di_depth++;
-
-	gfs_dinode_out(&dip->i_di, BH_DATA(dibh));
-	if(write_buf(sdp, dibh, 0)){
-		log_err("dir_double_exhash:  "
-			"Unable to write out directory inode.\n");
-		relse_buf(sdp, dibh);
-		return -1;
-	}
-
-	relse_buf(sdp, dibh);
-
-	return 0;
-
-
- out:
-	if(buf) free(buf);
-
-	return error;
-}
-
-
-static int dir_e_del(struct fsck_inode *dip, osi_filename_t *filename){
-	int index;
-	int error;
-	int found = 0;
-	uint64 leaf_no;
-	osi_buf_t *bh;
-	identifier_t id;
-	struct gfs_dirent *cur, *prev;
-
-	id.type = ID_FILENAME;
-	id.filename = filename;
-	id.inum = NULL;
-
-	index = (1 << (dip->i_di.di_depth))-1;
-
-	for(; (index >= 0) && !found; index--){
-		error = get_leaf_nr(dip, index, &leaf_no);
-		if (error){
-			log_err("dir_e_del:  Unable to get leaf number.\n");
-			return error;
-		}
-
-		while(leaf_no && !found){
-			if(get_leaf(dip, leaf_no, &bh)){
-				stack;
-				return -1;
-			}
-
-			error = leaf_search(bh, &id, &cur, &prev);
-			if(id.inum) free(id.inum);
-
-			if(error){
-				if(error != -ENOENT){
-					log_err("dir_e_del:  leaf_search failed.\n");
-					relse_buf(dip->i_sbd, bh);
-					return -1;
-				}
-				leaf_no = gfs64_to_cpu(((struct gfs_leaf *)BH_DATA(bh))->lf_next);
-				relse_buf(dip->i_sbd, bh);
-			} else {
-				found = 1;
-			}
-		}
-	}
-
-	if(!found)
-		return 1;
-
-	if(dirent_del(dip, bh, prev, cur)){
-		log_err("dir_e_del:  dirent_del failed.\n");
-		relse_buf(dip->i_sbd, bh);
-		return -1;
-	}
-
-	relse_buf(dip->i_sbd, bh);
-	return 0;
-}
-
-
-static int dir_l_del(struct fsck_inode *dip, osi_buf_t *dibh,
-		     osi_filename_t *filename){
-	int error=0;
-	int got_buf = 0;
-	struct gfs_dirent *cur, *prev;
-	identifier_t id;
-
-	id.type = ID_FILENAME;
-	id.filename = filename;
-	id.inum = NULL;
-
-	if(!fs_is_stuffed(dip)){
-		log_crit("dir_l_del: Attempting linear delete on unstuffed"
-			 " dinode.\n");
-		return -1;
-	}
-
-	if(!dibh) {
-		error = get_and_read_buf(dip->i_sbd, dip->i_num.no_addr,
-					 &dibh, 0);
-		if (error){
-			log_err("dir_l_del:  Failed to read in dinode buffer.\n");
-			return -1;
-		}
-		got_buf = 1;
-	}
-
-	error = leaf_search(dibh, &id, &cur, &prev);
-	if(id.inum) free(id.inum);
-
-	if(error){
-		if(error == -ENOENT){
-			log_debug("dir_l_del found no entry\n");
-			if(got_buf)
-				relse_buf(dip->i_sbd, dibh);
-			return 1;
-		} else {
-			log_err("dir_l_del:  leaf_search failed.\n");
-			if(got_buf)
-				relse_buf(dip->i_sbd, dibh);
-			return -1;
-		}
-	}
-
-	if(dirent_del(dip, dibh, prev, cur)){
-		stack;
-		if(got_buf)
-			relse_buf(dip->i_sbd, dibh);
-		return -1;
-	}
-
-	if(got_buf)
-		relse_buf(dip->i_sbd, dibh);
-	return 0;
-}
-
-
-/*
- * fs_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 fs_dirent_del(struct fsck_inode *dip, osi_buf_t *bh, osi_filename_t *filename){
-	int error;
-
-	if(dip->i_di.di_type != GFS_FILE_DIR){
-		log_err("fs_dirent_del:  parent inode is not a directory.\n");
-		return -1;
-	}
-
-	if (dip->i_di.di_flags & GFS_DIF_EXHASH)
-		error = dir_e_del(dip, filename);
-	else
-		error = dir_l_del(dip, bh, filename);
-
-	return error;
-
-}
-
-
-/**
- * dir_e_add -
- * @dip: The GFS inode
- * @filename:
- * @inode:
- * @type:
- *
- */
-static int dir_e_add(struct fsck_inode *dip, osi_filename_t *filename,
-                     struct gfs_inum *inum, unsigned int type)
-{
-	struct fsck_sb *sdp = dip->i_sbd;
-	osi_buf_t *bh, *nbh, *dibh;
-	struct gfs_leaf *leaf, *nleaf;
-	struct gfs_dirent *dent;
-	uint32 hsize, index;
-	uint32 hash;
-	uint64 leaf_no, bn;
-	int error;
-
- restart:
-
-	/*  Sanity Checks  */
-
-	hsize = 1 << dip->i_di.di_depth;
-	if(hsize * sizeof(uint64) != dip->i_di.di_size){
-		log_err("dir_e_add:  hash size and di_size do not correspond.\n");
-		return -1;
-	}
-
-	/*  Figure out the address of the leaf node.  */
-
-	hash = dir_hash(filename);
-	index = hash >> (32 - dip->i_di.di_depth);
-
-
-	error = get_leaf_nr(dip, index, &leaf_no);
-	if (error){
-		log_err("dir_e_add:  Unable to get leaf number.\n");
-		return error;
-	}
-
-
-	/*  Add entry to the leaf  */
-
-	while (TRUE){
-		error = get_leaf(dip, leaf_no, &bh);
-		if (error){
-			log_err("dir_e_add:  Unable to get leaf #%"PRIu64"\n", leaf_no);
-			return error;
-		}
-
-		leaf = (struct gfs_leaf *)BH_DATA(bh);
-
-
-		if (fs_dirent_alloc(dip, bh, filename->len, &dent)){
-			if (gfs16_to_cpu(leaf->lf_depth) < dip->i_di.di_depth){
-				/*  Can we split the leaf?  */
-				relse_buf(sdp, bh);
-
-				error = dir_split_leaf(dip, index, leaf_no);
-				if (error){
-					log_err("dir_e_add:  Unable to split leaf.\n");
-					return error;
-				}
-
-				goto restart;
-			}
-			else if (dip->i_di.di_depth < GFS_DIR_MAX_DEPTH){
-				/*  Can we double the hash table?  */
-				relse_buf(sdp, bh);
-
-				error = dir_double_exhash(dip);
-				if (error){
-					log_err("dir_e_add:  Unable to double exhash.\n");
-					return error;
-				}
-
-				goto restart;
-			}
-			else if (leaf->lf_next){
-				/*  Can we try the next leaf in the list?  */
-				leaf_no = gfs64_to_cpu(leaf->lf_next);
-				relse_buf(sdp, bh);
-				continue;
-			}
-			else {
-				/*  Create a new leaf and add it to the list.  */
-				error = fs_metaalloc(dip, &bn);
-				if (error){
-					relse_buf(sdp, bh);
-					log_err("dir_e_add:  "
-						"Unable to allocate space for meta block.\n");
-					return error;
-				}
-
-				error = get_and_read_buf(sdp, bn, &nbh, 0);
-				if (error){
-					relse_buf(sdp, bh);
-					return error;
-				}
-
-				/*gfs_trans_add_bh(sdp, dip->i_gl, nbh);*/
-				if(check_meta(nbh, 0)){
-					log_err("dir_e_add:  Buffer is not a meta buffer.\n");
-					relse_buf(sdp, bh);
-					relse_buf(sdp, nbh);
-					return -1;
-				}
-				set_meta(nbh, GFS_METATYPE_LF, GFS_FORMAT_LF);
-				/* Make sure the bitmap is updated */
-				log_debug("Setting leaf block at %"PRIu64"\n",
-					  bn);
-				block_set(dip->i_sbd->bl, bn, leaf_blk);
-				memset(BH_DATA(nbh)+sizeof(struct gfs_meta_header), 0,
-				       BH_SIZE(nbh)-sizeof(struct gfs_meta_header));
-
-				/*gfs_trans_add_bh(sdp, dip->i_gl, bh);*/
-				leaf->lf_next = cpu_to_gfs64(bn);
-
-				nleaf = (struct gfs_leaf *)BH_DATA(nbh);
-				nleaf->lf_depth = leaf->lf_depth;
-				nleaf->lf_dirent_format = cpu_to_gfs32(GFS_FORMAT_DE);
-
-				if (fs_dirent_alloc(dip, nbh, filename->len, &dent)){
-					log_err("dir_e_add:  Uncircumventible error!\n");
-					exit(EXIT_FAILURE);
-				}
-
-				dip->i_di.di_blocks++;
-
-				/* ATTENTION -- check for errors */
-				write_buf(sdp, nbh, BW_WAIT);
-				write_buf(sdp, bh, 0);
-				relse_buf(sdp, bh);
-
-				bh = nbh;
-				leaf = nleaf;
-			}
-		}
-
-
-		gfs_inum_out(inum, (char *)&dent->de_inum);
-		dent->de_hash = cpu_to_gfs32(hash);
-		dent->de_type = cpu_to_gfs16(type);
-		memcpy((char *)(dent + 1), filename->name, filename->len);
-
-		leaf->lf_entries = gfs16_to_cpu(leaf->lf_entries) + 1;
-		leaf->lf_entries = cpu_to_gfs16(leaf->lf_entries);
-
-		write_buf(sdp, bh, 0);
-		relse_buf(sdp, bh);
-
-		error = get_and_read_buf(dip->i_sbd, dip->i_num.no_addr, &dibh, 0);
-		if(error){
-			log_err("dir_e_add:  Unable to get inode buffer.\n");
-			return error;
-		}
-
-		error = check_meta(dibh, GFS_METATYPE_DI);
-		if(error){
-			log_err("dir_e_add:  Buffer #%"PRIu64" is not a directory "
-				"inode.\n", BH_BLKNO(dibh));
-			relse_buf(sdp, dibh);
-			return error;
-		}
-
-		dip->i_di.di_entries++;
-		dip->i_di.di_mtime = dip->i_di.di_ctime = osi_current_time();
-		log_debug("Entries for %"PRIu64" is %u\n", dip->i_di.di_num.no_addr,
-			dip->i_di.di_entries);
-
-		gfs_dinode_out(&dip->i_di, BH_DATA(dibh));
-		write_buf(sdp, dibh, 0);
-		relse_buf(sdp, dibh);
-
-		return 0;
-	}
-
-	return -ENOENT;
-}
-
-
-/**
- * dir_l_add -
- * @dip: The GFS inode
- * @filename:
- * @inode:
- * @type:
- *
- * Returns:
- */
-
-static int dir_l_add(struct fsck_inode *dip, osi_filename_t *filename,
-                     struct gfs_inum *inum, unsigned int type)
-{
-	osi_buf_t *dibh;
-	struct gfs_dirent *dent;
-	int error;
-
-	/*  Sanity checks  */
-
-	if(!fs_is_stuffed(dip)){
-		log_err("dir_l_add:  Attempting linear add on unstuffed dinode.\n");
-		return -1;
-	}
-
-	error = get_and_read_buf(dip->i_sbd, dip->i_num.no_addr, &dibh, 0);
-	if (error)
-		goto out;
-
-
-	if (fs_dirent_alloc(dip, dibh, filename->len, &dent))
-	{
-		/* no need to write buffer, it hasn't changed. */
-		relse_buf(dip->i_sbd, dibh);
-
-		error = dir_make_exhash(dip);
-		/* DEBUG */
-		log_debug("Changing Linear dir to Exhash dir - %s\n",
-			  (error)? "UNSUCCESSFUL": "SUCCESSFUL");
-		if (!error)
-			error = dir_e_add(dip, filename, inum, type);
-
-		goto out;
-	}
-
-
-	gfs_inum_out(inum, (char *)&dent->de_inum);
-	dent->de_hash = dir_hash(filename);
-	dent->de_hash = cpu_to_gfs32(dent->de_hash);
-	dent->de_type = cpu_to_gfs16(type);
-	memcpy((char *)(dent + 1), filename->name, filename->len);
-
-
-	dip->i_di.di_entries++;
-	dip->i_di.di_mtime = dip->i_di.di_ctime = osi_current_time();
-	log_debug("Entries for %"PRIu64" is %u\n", dip->i_di.di_num.no_addr,
-		dip->i_di.di_entries);
-	gfs_dinode_out(&dip->i_di, BH_DATA(dibh));
-	if(write_buf(dip->i_sbd, dibh, 0)){
-		log_err("dir_l_add:  bad write_buf()\n");
-		error = -EIO;
-	}
-
-	relse_buf(dip->i_sbd, dibh);
-
- out:
-	if(error){
-		char tmp_name[256];
-		memset(tmp_name, 0, sizeof(tmp_name));
-		memcpy(tmp_name, filename->name, filename->len);
-		log_err("Unable to add \"%s\" to directory #%"PRIu64"\n",
-			tmp_name, dip->i_num.no_addr);
-	}
-	return error;
-}
-
-
-
-/**
- * fs_dir_add - Add new filename into directory
- * @dip: The GFS inode
- * @filename: The new name
- * @inode: The inode number of the entry
- * @type: The type of the entry
- *
- * Returns: 0 on success, error code on failure
- */
-int fs_dir_add(struct fsck_inode *dip, osi_filename_t *filename,
-	       struct gfs_inum *inum, unsigned int type)
-{
-	int error;
-
-	if(dip->i_di.di_type != GFS_FILE_DIR){
-		log_err("fs_dir_add:  parent inode is not a directory.\n");
-		return -1;
-	}
-
-	if (dip->i_di.di_flags & GFS_DIF_EXHASH)
-		error = dir_e_add(dip, filename, inum, type);
-	else
-		error = dir_l_add(dip, filename, inum, type);
-
-	return error;
-}
-
-
-/**
- * fs_dirent_alloc - Allocate a directory entry
- * @dip: The GFS inode
- * @bh: The buffer
- * @name_len: The length of the name
- * @dent_out: Pointer to list of dirents
- *
- * Returns: 0 on success, error code otherwise
- */
-int fs_dirent_alloc(struct fsck_inode *dip, osi_buf_t *bh,
-		    int name_len, struct gfs_dirent **dent_out)
-{
-	struct fsck_sb *sdp = dip->i_sbd;
-	struct gfs_dirent *dent, *new;
-	struct gfs_leaf *leaf;
-	struct gfs_dinode *dinode;
-	unsigned int rec_len = GFS_DIRENT_SIZE(name_len);
-	unsigned int entries = 0, offset = 0, x = 0;
-	int type;
-
-	type = dirent_first(bh, &dent);
-
-	if (type == IS_LEAF){
-		leaf = (struct gfs_leaf *)BH_DATA(bh);
-		entries = gfs16_to_cpu(leaf->lf_entries);
-		offset = sizeof(struct gfs_leaf);
-	}
-	else if (type == IS_DINODE) {
-		dinode = (struct gfs_dinode *)BH_DATA(bh);
-		entries = gfs32_to_cpu(dinode->di_entries);
-		offset = sizeof(struct gfs_dinode);
-	} else {
-		log_err("fs_dirent_alloc:  Buffer has bad metatype.\n");
-		return -1;
-	}
-
-	if (!entries){
-		dent->de_rec_len = BH_SIZE(bh) - offset;
-		dent->de_rec_len = cpu_to_gfs16(dent->de_rec_len);
-		dent->de_name_len = cpu_to_gfs16(name_len);
-
-		*dent_out = dent;
-		write_buf(sdp, bh, 0);
-		goto success;
-	}
-
-
-	do{
-		uint32 cur_rec_len, cur_name_len;
-
-		cur_rec_len = gfs16_to_cpu(dent->de_rec_len);
-		cur_name_len = gfs16_to_cpu(dent->de_name_len);
-
-		if ((!dent->de_inum.no_formal_ino && cur_rec_len >= rec_len) ||
-		    (cur_rec_len >= GFS_DIRENT_SIZE(cur_name_len) + rec_len)){
-			if (dent->de_inum.no_formal_ino){
-				new = (struct gfs_dirent *)((char *)dent + GFS_DIRENT_SIZE(cur_name_len));
-				memset(new, 0, sizeof(struct gfs_dirent));
-
-				new->de_rec_len = cpu_to_gfs16(cur_rec_len - GFS_DIRENT_SIZE(cur_name_len));
-				new->de_name_len = cpu_to_gfs16(name_len);
-
-				dent->de_rec_len = cur_rec_len - gfs16_to_cpu(new->de_rec_len);
-				dent->de_rec_len = cpu_to_gfs16(dent->de_rec_len);
-
-				*dent_out = new;
-				write_buf(sdp, bh, 0);
-				goto success;
-			}
-
-			dent->de_name_len = cpu_to_gfs16(name_len);
-
-			*dent_out = dent;
-			write_buf(sdp, bh, 0);
-			goto success;
-		}
-
-		if(x >= entries){
-			log_err("fs_dirent_alloc:  dirents contain bad length information.\n");
-			return -1;
-		}
-
-		if (dent->de_inum.no_formal_ino)
-			x++;
-	}
-	while(dirent_next(bh, &dent) == 0);
-
-	return -ENOSPC;
-
- success:
-	return 0;
-}
-
-
-/**
- * get_leaf_nr - Get a leaf number associated with the index
- * @dip: The GFS inode
- * @index:
- * @leaf_out:
- *
- * Returns: 0 on success, error code otherwise
- */
-
-int get_leaf_nr(struct fsck_inode *dip, uint32 index, uint64 *leaf_out)
-{
-	uint64 leaf_no;
-	int error = -1;
-	error = readi(dip, (char *)&leaf_no,
-		      index * sizeof(uint64), sizeof(uint64));
-	if (error != sizeof(uint64)){
-		log_debug("get_leaf_nr:  Bad internal read.  (rtn = %d)\n",
-			  error);
-		return (error < 0) ? error : -EIO;
-	}
-
-	*leaf_out = gfs64_to_cpu(leaf_no);
-
-	return 0;
-}
-
-
-/**
- * put_leaf_nr - Put a leaf number associated with the index
- * @dip: The GFS inode
- * @index:
- * @leaf_out:
- *
- * Returns: 0 on success, error code otherwise
- */
-
-int put_leaf_nr(struct fsck_inode *dip, uint32 index, uint64 leaf_out)
-{
-	uint64 leaf_no;
-	int error = -1;
-
-	leaf_no = cpu_to_gfs64(leaf_out);
-
-	error = writei(dip, (char *)&leaf_no,
-		       index * sizeof(uint64), sizeof(uint64));
-	if (error != sizeof(uint64)){
-		log_debug("put_leaf_nr:  Bad internal write.  (rtn = %d)\n",
-			  error);
-		return (error < 0) ? error : -EIO;
-	}
-
-	return 0;
-}
-
-
-/**
- * fs_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 TRUE if they are equal.
- *
- * Returns: TRUE (!=0) if the files are the same, otherwise FALSE (0).
- */
-int fs_filecmp(osi_filename_t *file1, char *file2, int len_of_file2)
-{
-	if (file1->len != len_of_file2){
-		return FALSE;
-	}
-
-	if (osi_memcmp(file1->name, file2, file1->len)){
-		return FALSE;
-	}
-	return TRUE;
-}
-
-
-/**
- * fs_dir_search - Search a directory
- * @dip: The GFS inode
- * @id
- * @type:
- *
- * This routine searches a directory for a file or another directory
- * given its identifier.  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 fs_dir_search(struct fsck_inode *dip, identifier_t *id,  unsigned int *type)
-{
-	int error;
-
-	if(dip->i_di.di_type != GFS_FILE_DIR){
-		log_err("An attempt was made to search an inode "
-			"that is not a directory.\n");
-		return -1;
-	}
-
-	if (dip->i_di.di_flags & GFS_DIF_EXHASH)
-		error = dir_e_search(dip, id, type);
-	else
-		error = dir_l_search(dip, id, type);
-
-	return error;
-}
-
-/**
- * dirent_repair - attempt to repair a corrupt directory entry.
- * @bh - The buffer header that contains the bad dirent
- * @de - The directory entry in native format
- * @dent - The directory entry in on-disk format
- * @type - Type of directory (DIR_LINEAR or DIR_EXHASH)
- * @first - TRUE if this is the first dirent in the buffer
- *
- * This function tries to repair a corrupt directory entry.  All we
- * know at this point is that the length field is wrong.
- */
-int dirent_repair(struct fsck_inode *ip, osi_buf_t *bh, struct gfs_dirent *de, 
-		  struct gfs_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 = BH_SIZE(bh) -
-				sizeof(struct gfs_dinode);
-		else
-			de->de_rec_len = BH_SIZE(bh) - sizeof(struct gfs_leaf);
-	}
-	else {
-		bh_end = BH_DATA(bh) + BH_SIZE(bh);
-		/* first, figure out a probable name length */
-		p = (char *)dent + sizeof(struct gfs_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 = GFS_DIRENT_SIZE(de->de_name_len);
-	}
-	gfs_dirent_out(de, (char *)dent);
-	write_buf(ip->i_sbd, bh, 0);
-	return 0;
-}
diff --git a/gfs/gfs_fsck/fs_dir.h b/gfs/gfs_fsck/fs_dir.h
deleted file mode 100644
index c0e514b..0000000
--- a/gfs/gfs_fsck/fs_dir.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef __FS_DIR_H__
-#define __FS_DIR_H__
-
-#include "osi_user.h"
-#include "fsck_incore.h"
-
-#define ID_FILENAME 0
-#define ID_INUM     1
-typedef struct identifier_s {
-	int type;
-
-	osi_filename_t *filename;
-	struct gfs_inum *inum;
-} identifier_t;
-
-int dirent_del(struct fsck_inode *dip, osi_buf_t *bh,
-	       struct gfs_dirent *prev, struct gfs_dirent *cur);
-int fsck_inode_is_stuffed(struct fsck_inode *ip);
-int dirent_first(osi_buf_t *bh, struct gfs_dirent **dent);
-int get_leaf_nr(struct fsck_inode *dip, uint32 index, uint64 *leaf_out);
-int put_leaf_nr(struct fsck_inode *dip, uint32 index, uint64 leaf_out);
-int fs_filecmp(osi_filename_t *file1, char *file2, int len_of_file2);
-int fs_dirent_del(struct fsck_inode *dip, osi_buf_t *bh, osi_filename_t *filename);
-int fs_dir_add(struct fsck_inode *dip, osi_filename_t *filename,
-	       struct gfs_inum *inum, unsigned int type);
-int fs_dirent_alloc(struct fsck_inode *dip, osi_buf_t *bh,
-		    int name_len, struct gfs_dirent **dent_out);
-
-int fs_dir_search(struct fsck_inode *dip, identifier_t *id, unsigned int *type);
-int dirent_repair(struct fsck_inode *ip, osi_buf_t *bh, struct gfs_dirent *de, 
-		  struct gfs_dirent *dent, int type, int first);
-
-#endif /* __FS_DIR_H__ */
diff --git a/gfs/gfs_fsck/fs_inode.c b/gfs/gfs_fsck/fs_inode.c
deleted file mode 100644
index 828f092..0000000
--- a/gfs/gfs_fsck/fs_inode.c
+++ /dev/null
@@ -1,600 +0,0 @@
-#include "util.h"
-#include "bio.h"
-#include "fs_bits.h"
-#include "fs_dir.h"
-#include "rgrp.h"
-#include "log.h"
-
-#include "fs_inode.h"
-
-#define ST_CREATE 1
-
-/**
- * fs_get_istruct - Get an inode given its number
- * @sdp: The GFS superblock
- * @inum: The inode number
- * @create: Flag to say if we are allowed to create a new struct fsck_inode
- * @ipp: pointer to put the returned inode in
- *
- * Returns: 0 on success, -1 on error
- */
-static int fs_get_istruct(struct fsck_sb *sdp, struct gfs_inum *inum,
-			  int create, struct fsck_inode **ipp)
-{
-	struct fsck_inode *ip = NULL;
-	int error = 0;
-
-	if (!create){
-		/* we are not currently tracking which inodes we already have */
-		error = -1;
-		goto out;
-	}
-
-	if(!(ip = (struct fsck_inode *)malloc(sizeof(struct fsck_inode)))) {
-		log_err("Unable to allocate fsck_inode structure\n");
-		error = -1;
-		goto out;
-	}
-	if(!memset(ip, 0, sizeof(struct fsck_inode))) {
-		log_err("Unable to zero fsck_inode structure\n");
-		error = -1;
-		goto out;
-	}
-
-	ip->i_num = *inum;
-
-	ip->i_sbd = sdp;
-
-	error = fs_copyin_dinode(ip, NULL);
-	if (error){
-		free(ip);
-		ip = NULL;
-		goto out;
-	}
-
- out:
-	*ipp = ip;
-
-	return error;
-}
-
-
-/*
- * fs_copyin_dinode - read dinode from disk and store in inode
- * @ip: inode, sdp and inum must be set
- *
- * Returns: 0 on success, -1 on error
- */
-int fs_copyin_dinode(struct fsck_inode *ip, osi_buf_t *dibh)
-{
-/*	osi_buf_t *dibh;*/
-	int do_relse = 0;
-	int error = 0;
-
-	if(!dibh) {
-		error = get_and_read_buf(ip->i_sbd,
-					 ip->i_num.no_addr, &dibh, 0);
-		if (error) {
-			stack;
-			goto out;
-		}
-
-		if(check_meta(dibh, GFS_METATYPE_DI)){
-			log_err("Block #%"PRIu64" is not a dinode.\n",
-				ip->i_num.no_addr);
-			relse_buf(ip->i_sbd, dibh);
-			return -1;
-		}
-		do_relse = 1;
-	}
-	gfs_dinode_in(&ip->i_di, BH_DATA(dibh));
-
-	if(do_relse)
-		relse_buf(ip->i_sbd, dibh);
-
-	
-
- out:
-	return error;
-}
-
-
-/*
- * fs_copyout_dinode - given an inode, copy its dinode data to disk
- * @ip: the inode
- *
- * Returns: 0 on success, -1 on error
- */
-int fs_copyout_dinode(struct fsck_inode *ip){
-	osi_buf_t *dibh;
-	int error;
-
-	error = get_and_read_buf(ip->i_sbd, ip->i_num.no_addr, &dibh, 0);
-	if(error){
-		log_err( "Unable to get a buffer to write dinode to disk.\n");
-		return -1;
-	}
-
-	gfs_dinode_out(&ip->i_di, BH_DATA(dibh));
-
-	if(write_buf(ip->i_sbd, dibh, 0)){
-		log_err( "Unable to commit dinode buffer to disk.\n");
-		relse_buf(ip->i_sbd, dibh);
-		return -1;
-	}
-
-	relse_buf(ip->i_sbd, dibh);
-	return 0;
-}
-
-/**
- * make_dinode - Fill in a new dinode structure
- * @dip: the directory this inode is being created in
- * @inum: the inode number
- * @type: the file type
- * @mode: the file permissions
- * @cred: a credentials structure
- *
- */
-
-static int make_dinode(struct fsck_inode *dip, struct gfs_inum *inum,
-                       unsigned int type, unsigned int mode, osi_cred_t *cred)
-{
-	struct fsck_sb *sdp = dip->i_sbd;
-	struct gfs_dinode di;
-	osi_buf_t *dibh;
-	struct fsck_rgrp *rgd;
-	int error;
-
-	error = get_and_read_buf(sdp, inum->no_addr, &dibh, 0);
-	if (error)
-		goto out;
-
-	if(check_meta(dibh, 0)){
-		log_err("make_dinode:  Buffer #%"PRIu64" has no meta header.\n",
-			BH_BLKNO(dibh));
-		if(query(dip->i_sbd, "Add header? (y/n) ")){
-			struct gfs_meta_header mh;
-			memset(&mh, 0, sizeof(struct gfs_meta_header));
-			mh.mh_magic = GFS_MAGIC;
-			mh.mh_type = GFS_METATYPE_NONE;
-			gfs_meta_header_out(&mh, BH_DATA(dibh));
-			log_warn("meta header added.\n");
-		} else {
-			log_err("meta header not added.  Failing make_dinode.\n");
-			relse_buf(sdp, dibh);
-			return -1;
-		}
-	}
-
-	((struct gfs_meta_header *)BH_DATA(dibh))->mh_type =
-		cpu_to_gfs32(GFS_METATYPE_DI);
-	((struct gfs_meta_header *)BH_DATA(dibh))->mh_format =
-		cpu_to_gfs32(GFS_FORMAT_DI);
-
-	memset(BH_DATA(dibh) + sizeof(struct gfs_dinode), 0,
-	       BH_SIZE(dibh) - sizeof(struct gfs_dinode));
-
-	memset(&di, 0, sizeof(struct gfs_dinode));
-
-	gfs_meta_header_in(&di.di_header, BH_DATA(dibh));
-
-	di.di_num = *inum;
-
-	if (dip->i_di.di_mode & 02000)
-	{
-		di.di_mode = mode | ((type == GFS_FILE_DIR) ? 02000 : 0);
-		di.di_gid = dip->i_di.di_gid;
-	}
-	else
-	{
-		di.di_mode = mode;
-		di.di_gid = osi_cred_to_gid(cred);
-	}
-
-	di.di_uid = osi_cred_to_uid(cred);
-	di.di_nlink = 1;
-	di.di_blocks = 1;
-	di.di_atime = di.di_mtime = di.di_ctime = osi_current_time();
-
-	rgd = fs_blk2rgrpd(sdp, inum->no_addr);
-	if(!rgd){
-		log_err( "Unable to map block #%"PRIu64" to rgrp\n", inum->no_addr);
-		exit(1);
-	}
-
-	di.di_rgrp = rgd->rd_ri.ri_addr;
-	di.di_goal_rgrp = di.di_rgrp;
-	di.di_goal_dblk = di.di_goal_mblk = inum->no_addr - rgd->rd_ri.ri_data1;
-
-	di.di_type = type;
-
-	gfs_dinode_out(&di, BH_DATA(dibh));
-	if(write_buf(dip->i_sbd, dibh, 0)){
-		log_err( "make_dinode:  bad write_buf()\n");
-		error = -EIO;
-	}
-
-	relse_buf(dip->i_sbd, dibh);
-
-
- out:
-
-	return error;
-}
-
-#if 0
-/**
- * fs_change_nlink - Change nlink count on inode
- * @ip: The GFS inode
- * @diff: The change in the nlink count required
- *
- * Returns: 0 on success, -EXXXX on failure.
- */
-static int fs_change_nlink(struct fsck_inode *ip, int diff)
-{
-	osi_buf_t *dibh;
-	uint32 nlink;
-	int error=0;
-
-	nlink = ip->i_di.di_nlink + diff;
-
-	if (diff < 0)
-		if(nlink >= ip->i_di.di_nlink)
-			log_err( "fs_change_nlink:  Bad link count detected in dinode.\n");
-
-	error = get_and_read_buf(ip->i_sbd, ip->i_num.no_addr, &dibh, 0);
-	if (error)
-		goto out;
-
-	ip->i_di.di_nlink = nlink;
-	ip->i_di.di_ctime = osi_current_time();
-
-	gfs_dinode_out(&ip->i_di, BH_DATA(dibh));
-	write_buf(ip->i_sbd, dibh, 0);
-	relse_buf(ip->i_sbd,dibh);
-
- out:
-	return error;
-}
-#endif
-/**
- * fs_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
- * @cred: The caller's credentials
- * @ipp: Used to return the found inode if any
- *
- * Returns: 0 on success, -EXXXX on failure
- */
-static int fs_lookupi(struct fsck_inode *dip, osi_filename_t *name,
-		      osi_cred_t *cred, struct fsck_inode **ipp)
-{
-	struct fsck_sb *sdp = dip->i_sbd;
-	int error = 0;
-	identifier_t id;
-
-	memset(&id, 0, sizeof(identifier_t));
-	id.filename = name;
-	id.type = ID_FILENAME;
-
-	*ipp = NULL;
-
-	if (!name->len || name->len > GFS_FNAMESIZE)
-	{
-		error = -ENAMETOOLONG;
-		goto out;
-	}
-
-	if (fs_filecmp(name, (char *)".", 1))
-	{
-		*ipp = dip;
-		goto out;
-	}
-
-	error = fs_dir_search(dip, &id, NULL);
-	if (error){
-		if (error == -ENOENT)
-			error = 0;
-		goto out;
-	}
-
-	error = fs_get_istruct(sdp, id.inum, ST_CREATE, ipp);
-
- out:
-
-	if(id.inum) free(id.inum);
-	return error;
-}
-
-int fs_createi(struct fsck_inode *dip, osi_filename_t *name,
-	       unsigned int type, unsigned int mode, osi_cred_t *cred,
-	       int *new, struct fsck_inode **ipp)
-{
-	osi_list_t *tmp=NULL;
-	struct fsck_sb *sdp = dip->i_sbd;
-	struct gfs_inum inum;
-	int error;
-	int allocate=0;
-	identifier_t id;
-
-	memset(&id, 0, sizeof(identifier_t));
-
-	if (!name->len || name->len > GFS_FNAMESIZE){
-		error = -ENAMETOOLONG;
-		goto fail;
-	}
-
- restart:
-
-	/*  Don't create entries in an unlinked directory  */
-	if (!dip->i_di.di_nlink){
-		error = -EPERM;
-		goto fail;
-	}
-
-	id.filename = name;
-	id.type = ID_FILENAME;
-
-	error = fs_dir_search(dip, &id, NULL);
-	if(id.inum) free(id.inum);
-	switch (error)
-	{
-	case -ENOENT:
-		break;
-
-	case 0:
-		if (!new){
-			error = -EEXIST;
-			goto fail;
-		} else {
-			error = fs_lookupi(dip, name, cred, ipp);
-			if (error)
-				goto fail;
-
-			if (*ipp){
-				*new = FALSE;
-				return 0;
-			} else
-				goto restart;
-		}
-		break;
-
-	default:
-		goto fail;
-	}
-
-	if (dip->i_di.di_entries == (uint32)-1){
-		error = -EFBIG;
-		goto fail;
-	}
-	if (type == GFS_FILE_DIR && dip->i_di.di_nlink == (uint32)-1){
-		error = -EMLINK;
-		goto fail;
-	}
-
- retry:
-	inum.no_addr = inum.no_formal_ino = 0;
-	for (tmp = sdp->rglist.next; tmp != &sdp->rglist; tmp = tmp->next){
-		uint64 block;
-		struct fsck_rgrp *rgd;
-
-		rgd = osi_list_entry(tmp, struct fsck_rgrp, rd_list);
-		if(fs_rgrp_read(rgd, FALSE))
-			return -1;
-		if(rgd->rd_rg.rg_freemeta){
-			block = fs_blkalloc_internal(rgd, dip->i_num.no_addr,
-						     GFS_BLKST_FREEMETA,
-						     GFS_BLKST_USEDMETA, 1);
-			log_debug("Got block %"PRIu64"\n", block);
-			if(block == BFITNOENT) {
-				fs_rgrp_relse(rgd);
-				continue;
-			}
-			block += rgd->rd_ri.ri_data1;
-			log_debug("Got block #%"PRIu64"\n", block);
-			inum.no_addr = inum.no_formal_ino = block;
-			rgd->rd_rg.rg_freemeta--;
-			rgd->rd_rg.rg_useddi++;
-
-			if(fs_rgrp_recount(rgd)){
-				log_err(  "fs_createi:  Unable to recount rgrp blocks.\n");
-				fs_rgrp_relse(rgd);
-				error = -EIO;
-				goto fail;
-			}
-
-			/* write out the rgrp */
-			gfs_rgrp_out(&rgd->rd_rg, BH_DATA(rgd->rd_bh[0]));
-			write_buf(sdp, rgd->rd_bh[0], 0);
-			fs_rgrp_relse(rgd);
-			break;
-		} else {
-			if(allocate){
-				if(!clump_alloc(rgd, 0)){
-					block = fs_blkalloc_internal(rgd, dip->i_num.no_addr,
-								     GFS_BLKST_FREEMETA,
-								     GFS_BLKST_USEDMETA, 1);
-					log_debug("Got block %"PRIu64"\n",
-						  block);
-					if(block == BFITNOENT) {
-						fs_rgrp_relse(rgd);
-						continue;
-					}
-					block += rgd->rd_ri.ri_data1;
-
-					inum.no_addr = inum.no_formal_ino = block;
-					rgd->rd_rg.rg_freemeta--;
-					rgd->rd_rg.rg_useddi++;
-
-					if(fs_rgrp_recount(rgd)){
-						log_err( "fs_createi:  Unable to recount rgrp blocks.\n");
-						fs_rgrp_relse(rgd);
-						error = -EIO;
-						goto fail;
-					}
-
-					/* write out the rgrp */
-					gfs_rgrp_out(&rgd->rd_rg, BH_DATA(rgd->rd_bh[0]));
-					write_buf(sdp, rgd->rd_bh[0], 0);
-					fs_rgrp_relse(rgd);
-					break;
-				}
-			}
-			fs_rgrp_relse(rgd);
-		}
-	}
-
-	if(!inum.no_addr){
-		if(allocate){
-			log_err( "No space available for new file or directory.\n");
-			return -1;
-		} else {
-			allocate = 1;
-			goto retry;
-		}
-	}
-
-	error = fs_dir_add(dip, name, &inum, type);
-	if (error)
-		goto fail;
-
-	error = make_dinode(dip, &inum, type, mode, cred);
-	if (error)
-		goto fail;
-
-
-	error = fs_get_istruct(sdp, &inum, ST_CREATE, ipp);
-	if (error)
-		goto fail;
-
-	if (new)
-		*new = TRUE;
-
-	return 0;
-
- fail:
-	return error;
-}
-
-
-/*
- * fs_mkdir - make a directory
- * @dip - dir inode that is the parent of the new dir
- * @new_dir - name of the new dir
- * @mode - mode of new dir
- * @nip - returned inode ptr to the new directory
- *
- * This function has one main difference from the way a normal mkdir
- * works.  It will not return an error if the directory already
- * exists.  Instead it will return success and nip will point to the
- * inode that exists with the same name as new_dir.
- *
- * Returns: 0 on success, -1 on failure.
- */
-int fs_mkdir(struct fsck_inode *dip, char *new_dir, int mode, struct fsck_inode **nip){
-	int error;
-	osi_cred_t creds;
-	osi_buf_t *dibh;
-	struct gfs_dinode *di;
-	struct gfs_dirent *dent;
-	struct fsck_inode *ip= NULL;
-	struct fsck_sb *sdp = dip->i_sbd;
-	osi_filename_t name;
-	int new;
-
-	name.name = (unsigned char *)new_dir;
-	name.len = strlen(new_dir);
-	creds.cr_uid = getuid();
-	creds.cr_gid = getgid();
-
-	error = fs_createi(dip, &name, GFS_FILE_DIR, mode, &creds, &new, &ip);
-
-	if (error)
-		goto fail;
-
-	if(!new){
-		goto out;
-	}
-
-	if(!ip){
-		log_err(  "fs_mkdir:  fs_createi() failed.\n");
-		error = -1;
-		goto fail;
-	}
-
-	ip->i_di.di_nlink = 2;
-	ip->i_di.di_size = sdp->sb.sb_bsize - sizeof(struct gfs_dinode);
-	ip->i_di.di_flags |= GFS_DIF_JDATA;
-	ip->i_di.di_payload_format = GFS_FORMAT_DE;
-	ip->i_di.di_entries = 2;
-
-	error = get_and_read_buf(ip->i_sbd, ip->i_num.no_addr, &dibh, 0);
-	if(error){
-		log_err( "fs_mkdir:  Unable to aquire directory buffer.\n");
-		goto fail;
-	}
-
-	di = (struct gfs_dinode *)BH_DATA(dibh);
-
-	error = fs_dirent_alloc(ip, dibh, 1, &dent);
-	if(error){  /*  This should never fail  */
-		log_err( "fs_mkdir:  fs_dirent_alloc() failed for \".\" entry.\n");
-		goto fail;
-	}
-
-	dent->de_inum = di->di_num;  /*  already GFS endian  */
-	dent->de_hash = gfs_dir_hash(".", 1);
-	dent->de_hash = cpu_to_gfs32(dent->de_hash);
-	dent->de_type = cpu_to_gfs16(GFS_FILE_DIR);
-	memcpy((char *)(dent + 1), ".", 1);
-	di->di_entries = cpu_to_gfs32(1);
-
-	error = fs_dirent_alloc(ip, dibh, 2, &dent);
-	if(error){  /*  This should never fail  */
-		log_err( "fs_mkdir:  fs_dirent_alloc() failed for \"..\" entry.\n");
-		goto fail;
-	}
-	gfs_inum_out(&dip->i_num, (char *)&dent->de_inum);
-	dent->de_hash = gfs_dir_hash("..", 2);
-	dent->de_hash = cpu_to_gfs32(dent->de_hash);
-	dent->de_type = cpu_to_gfs16(GFS_FILE_DIR);
-	memcpy((char *)(dent + 1), "..", 2);
-
-	gfs_dinode_out(&ip->i_di, (char *)di);
-	if(write_buf(ip->i_sbd, dibh, 0)){
-		log_err( "fs_mkdir:  Bad write_buf()\n");
-		error = -EIO;
-		goto fail;
-	}
-
-	relse_buf(ip->i_sbd, dibh);
-
-
-	/* FIXME: this may break stuff elsewhere, but since I'm
-	 * keeping track of the linkcount in-core, we shouldn't need
-	 * to do this...
-
-	error = fs_change_nlink(dip, +1);
-	if(error){
-		log_err( "fs_mkdir:  fs_change_nlink() failed.\n");
-		goto fail;
-		} */
-
- out:
-	error=0;
-	if(nip) {
-		*nip = ip;
-	}
-	else if(ip) {
-		free(ip);
-		ip = NULL;
-	}
-	return 0;
- fail:
-	if(ip)
-		free(ip);
-	return error;
-}
-
-
diff --git a/gfs/gfs_fsck/fs_inode.h b/gfs/gfs_fsck/fs_inode.h
deleted file mode 100644
index d7aa904..0000000
--- a/gfs/gfs_fsck/fs_inode.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef __FS_INODE_H__
-#define __FS_INODE_H__
-
-#include "fsck_incore.h"
-
-int fs_copyin_dinode(struct fsck_inode *ip, osi_buf_t *bh);
-int fs_copyout_dinode(struct fsck_inode *ip);
-int fs_mkdir(struct fsck_inode *dip, char *new_dir, int mode, struct fsck_inode **nip);
-int fs_remove(struct fsck_inode *ip);
-
-static __inline__ int fs_is_stuffed(struct fsck_inode *ip)
-{
-	return !ip->i_di.di_height;
-}
-
-static __inline__ int fs_is_jdata(struct fsck_inode *ip)
-{
-	return ip->i_di.di_flags & GFS_DIF_JDATA;
-}
-
-
-#endif /*  __FS_INODE_H__ */
diff --git a/gfs/gfs_fsck/fs_recovery.c b/gfs/gfs_fsck/fs_recovery.c
deleted file mode 100644
index 76980a2..0000000
--- a/gfs/gfs_fsck/fs_recovery.c
+++ /dev/null
@@ -1,75 +0,0 @@
-#include "util.h"
-#include "bio.h"
-
-#include "fs_recovery.h"
-
-/*
- * reconstruct_single_journal - write a fresh journal
- * @sdp: superblock
- * @jnum: journal number
- *
- * This function will write a fresh journal over the top of
- * the previous journal.  All journal information is lost.  This
- * process is basically stolen from write_journals() in the mkfs code.
- *
- * Returns: -1 on error, 0 otherwise
- */
-static int reconstruct_single_journal(struct fsck_sb *sdp, int jnum){
-  struct gfs_log_header	lh;
-  struct gfs_jindex    	*jdesc = &(sdp->jindex[jnum]);
-  uint32		seg, sequence;
-  char			buf[sdp->sb.sb_bsize];
-
-  srandom(time(NULL));
-  sequence = jdesc->ji_nsegment / (RAND_MAX + 1.0) * random();
-
-  log_info("Clearing journal %d\n", jnum);
-
-  for (seg = 0; seg < jdesc->ji_nsegment; seg++){
-    memset(buf, 0, sdp->sb.sb_bsize);
-    memset(&lh, 0, sizeof(struct gfs_log_header));
-
-    lh.lh_header.mh_magic = GFS_MAGIC;
-    lh.lh_header.mh_type = GFS_METATYPE_LH;
-    lh.lh_header.mh_format = GFS_FORMAT_LH;
-    lh.lh_header.mh_generation = 0x101674;
-    lh.lh_flags = GFS_LOG_HEAD_UNMOUNT;
-    lh.lh_first = jdesc->ji_addr + seg * sdp->sb.sb_seg_size;
-    lh.lh_sequence = sequence;
-
-    gfs_log_header_out(&lh, buf);
-    gfs_log_header_out(&lh,
-		       buf + GFS_BASIC_BLOCK - sizeof(struct gfs_log_header));
-
-    if(do_lseek(sdp->diskfd, lh.lh_first * sdp->sb.sb_bsize) ||
-       do_write(sdp->diskfd, buf, sdp->sb.sb_bsize)){
-      log_err("Unable to reconstruct journal %d.\n", jnum);
-      return -1;
-    }
-
-    if (++sequence == jdesc->ji_nsegment)
-      sequence = 0;
-  }
-  return 0;
-}
-
-
-/*
- * reconstruct_journals - write fresh journals
- * sdp: the super block
- *
- * Returns: 0 on success, -1 on failure
- */
-int reconstruct_journals(struct fsck_sb *sdp){
-	int i;
-
-	log_notice("Clearing journals (this may take a while)");
-	for(i=0; i < sdp->journals; i++) {
-		if((i % 2) == 0)
-			log_at_notice(".");
-		if(reconstruct_single_journal(sdp, i))
-			return -1;
-	}
-	log_notice("\nJournals cleared.\n");
-	return 0;
-}
diff --git a/gfs/gfs_fsck/fs_recovery.h b/gfs/gfs_fsck/fs_recovery.h
deleted file mode 100644
index 7460310..0000000
--- a/gfs/gfs_fsck/fs_recovery.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __FS_RECOVERY_H__
-#define __FS_RECOVERY_H__
-
-#include "fsck_incore.h"
-
-int reconstruct_journals(struct fsck_sb *sdp);
-
-#endif /* __FS_RECOVERY_H__ */
-
diff --git a/gfs/gfs_fsck/fsck.h b/gfs/gfs_fsck/fsck.h
deleted file mode 100644
index 1cb4291..0000000
--- a/gfs/gfs_fsck/fsck.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef _FSCK_H
-#define _FSCK_H
-
-
-#include "fsck_incore.h"
-#include "log.h"
-
-struct gfs_sb;
-struct fsck_sb;
-
-struct options {
-	char *device;
-	int yes:1;
-	int no:1;
-};
-
-extern uint64_t last_fs_block, last_reported_block;
-extern int skip_this_pass, fsck_abort, fsck_query;
-
-int initialize(struct fsck_sb *sbp);
-void destroy(struct fsck_sb *sbp);
-int block_mounters(struct fsck_sb *sbp, int block_em);
-int pass1(struct fsck_sb *sbp);
-int pass1b(struct fsck_sb *sbp);
-int pass1c(struct fsck_sb *sbp);
-int pass2(struct fsck_sb *sbp, struct options *opts);
-int pass3(struct fsck_sb *sbp, struct options *opts);
-int pass4(struct fsck_sb *sbp, struct options *opts);
-int pass5(struct fsck_sb *sbp, struct options *opts);
-
-/* 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 fsck_sb *sbp, uint64_t block);
-
-#endif /* _FSCK_H */
diff --git a/gfs/gfs_fsck/fsck_incore.h b/gfs/gfs_fsck/fsck_incore.h
deleted file mode 100644
index cac7632..0000000
--- a/gfs/gfs_fsck/fsck_incore.h
+++ /dev/null
@@ -1,136 +0,0 @@
-#ifndef _FSCK_INCORE_H
-#define _FSCK_INCORE_H
-
-#include <stdint.h>
-#include "ondisk.h"
-#include "osi_list.h"
-#include "osi_user.h"
-#include "fs_bits.h"
-#include "block_list.h"
-
-#define SBF_RECONSTRUCT_JOURNALS (1)
-
-#define FSCK_HASH_SHIFT         (13)
-#define FSCK_HASH_SIZE          (1 << FSCK_HASH_SHIFT)
-#define FSCK_HASH_MASK          (FSCK_HASH_SIZE - 1)
-
-struct fsck_sb;
-
-struct inode_info
-{
-	osi_list_t list;
-	uint64_t   inode;
-	uint32_t   link_count;   /* the number of links the inode
-				  * thinks it has */
-	uint32_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;
-
-};
-
-/*  Use to manage in core bitmaps  */
-
-struct bitmap_list
-{
-  osi_list_t list;
-  char *bm;
-  struct fsck_rgrp *rgd;
-};
-
-/*
- *  Incore inode structure
- */
-
-struct fsck_inode
-{
-	struct fsck_sb           *i_sbd;           /* GFS superblock pointer */
-	struct gfs_inum          i_num;
-	struct gfs_dinode         i_di;             /* Dinode Structure */
-};
-
-struct fsck_rgrp
-{
-	struct fsck_sb            *rd_sbd;        /* ptr to in-core super block */
-	osi_list_t          rd_list;        /* Link with superblock */
-
-	struct gfs_rindex        rd_ri;          /* Resource Index structure */
-	struct gfs_rgrp          rd_rg;          /* Resource Group structure */
-
-	int32_t               rd_open_count;  /* # of open references on this rgrpd */
-
-	fs_bitmap_t         *rd_bits;
-	osi_buf_t           **rd_bh;
-};
-
-
-
-struct fsck_sb {
-	struct gfs_sb	sb;            /* Super Block */
-	int		diskfd;
-	uint32_t	flags;
-	char		fsname[256];
-
-	/* Special inodes */
-	struct fsck_inode	*lf_dip;       /* lost-n-found dir inode */
-	struct fsck_inode       *jiinode;
-        struct fsck_inode       *riinode;
-	struct fsck_inode       *rooti;
-
-	/* rgrp stuff */
-	osi_list_t	rglist;        /* List of resource groups */
-	unsigned int	rgcount;       /* Count of resource groups */
-
-	/* journal stuff */
-	unsigned int  journals;  /* Number of journals in the FS */
-	struct gfs_jindex  *jindex;   /* Array of Jindex structs for
-				       * this FS's journals */
-	struct gfs_jindex  jdesc;     /* Jindex struct for this
-				       * machine's journal */
-
-	/*  Constants computed on mount  */
-	uint32_t fsb2bb_shift;  /* Shift FS Block numbers to the left by
-				   this to get buffer cache blocks  */
-	uint32_t diptrs;        /* Number of pointers in a dinode */
-	uint32_t inptrs;        /* Number of pointers in a indirect block */
-	uint32_t jbsize;        /* Size of a journaled data block */
-	uint32_t hash_bsize;    /* sizeof(exhash block) */
-	uint32_t hash_ptrs;     /* Number of points in a hash block */
-	uint32_t max_height;    /* Maximum height of a file's metadata tree */
-	uint64_t heightsize[GFS_MAX_META_HEIGHT];
-	uint32_t max_jheight;   /* Max height of a journaled file's metadata tree */
-	uint64_t jheightsize[GFS_MAX_META_HEIGHT];
-
-	uint64_t last_fs_block;
-	uint64_t last_data_block;
-	uint64_t first_data_block;
-
-	/* dir_list is used to keep track of directory inodes and
-	 * their parents */
-	osi_list_t dir_hash[FSCK_HASH_SIZE];
-
-	/* inode_list is used to keep track of the link count of
-	 * inodes */
-	osi_list_t inode_hash[FSCK_HASH_SIZE];
-
-	/* contains list of data and metadata blocks and various info
-	 * about each */
-	struct block_list *bl;
-
-	osi_list_t dup_list;
-
-	/* fsck_opts is used to pass command line params around */
-	struct options *opts;
-
-};
-
-
-
-
-#endif /* _FSCK_INCORE_H */
diff --git a/gfs/gfs_fsck/hash.c b/gfs/gfs_fsck/hash.c
deleted file mode 100644
index b151021..0000000
--- a/gfs/gfs_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 "fsck_incore.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/gfs/gfs_fsck/hash.h b/gfs/gfs_fsck/hash.h
deleted file mode 100644
index d5fe8e9..0000000
--- a/gfs/gfs_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/gfs/gfs_fsck/initialize.c b/gfs/gfs_fsck/initialize.c
deleted file mode 100644
index 5136b42..0000000
--- a/gfs/gfs_fsck/initialize.c
+++ /dev/null
@@ -1,428 +0,0 @@
-#include <stdio.h>
-#include <stdint.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include "fsck_incore.h"
-#include "fsck.h"
-#include "util.h"
-#include "super.h"
-#include "fs_inode.h"
-#include "fs_recovery.h"
-#include "inode.h"
-#include "bio.h"
-
-/**
- * init_journals
- *
- * Go through journals and replay them - then clear them
- */
-int init_journals(struct fsck_sb *sbp)
-{
-
-	if(!sbp->opts->no) {
-		/* Next, Replay the journals */
-		if(sbp->flags & SBF_RECONSTRUCT_JOURNALS){
-			if(reconstruct_journals(sbp)){
-				stack;
-				return 1;
-			}
-		} else {
-			/* ATTENTION -- Journal replay is not supported */
-			if(reconstruct_journals(sbp)){
-				stack;
-				return 1;
-			}
-		}
-	}
-	return 0;
-}
-
-/**
- * block_mounters
- *
- * Change the lock protocol so nobody can mount the fs
- *
- */
-int block_mounters(struct fsck_sb *sbp, int block_em)
-{
-	if(block_em) {
-		/* verify it starts with lock_ */
-		if(!strncmp(sbp->sb.sb_lockproto, "lock_", 5)) {
-			/* Change lock_ to fsck_ */
-			memcpy(sbp->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->sb.sb_lockproto, "fsck_", 5)) {
-			/* Change fsck_ to lock_ */
-			memcpy(sbp->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 fsck_sb *sdp)
-{
-	uint32_t i;
-
-	log_info("Freeing buffers.\n");
-	if(sdp->riinode){
-		free(sdp->riinode);
-		sdp->riinode = NULL;
-	}
-	if(sdp->jiinode){
-		free(sdp->jiinode);
-		sdp->jiinode = NULL;
-	}
-	if(sdp->rooti){
-		free(sdp->rooti);
-		sdp->rooti = NULL;
-	}
-
-	if(sdp->jindex){
-		free(sdp->jindex);
-		sdp->jindex = NULL;
-	}
-	if(sdp->lf_dip) {
-		free(sdp->lf_dip);
-		sdp->lf_dip = NULL;
-	}
-	while(!osi_list_empty(&sdp->rglist)){
-		struct fsck_rgrp *rgd;
-		unsigned int x;
-		rgd = osi_list_entry(sdp->rglist.next,
-				     struct fsck_rgrp, rd_list);
-		osi_list_del(&rgd->rd_list);
-		if(rgd->rd_bits)
-			free(rgd->rd_bits);
-		if(rgd->rd_bh) {
-			for(x = 0; x < rgd->rd_ri.ri_length; x++) {
-				if(rgd->rd_bh[x]) {
-					if(BH_DATA(rgd->rd_bh[x])) {
-						free(BH_DATA(rgd->rd_bh[x]));
-					}
-					free(rgd->rd_bh[x]);
-				}
-			}
-			free(rgd->rd_bh);
-		}
-		free(rgd);
-	}
-
-	for(i = 0; i < FSCK_HASH_SIZE; i++) {
-		while(!osi_list_empty(&sdp->inode_hash[i])) {
-			struct inode_info *ii;
-			ii = osi_list_entry(sdp->inode_hash[i].next,
-					    struct inode_info, list);
-			osi_list_del(&ii->list);
-			free(ii);
-		}
-		while(!osi_list_empty(&sdp->dir_hash[i])) {
-			struct dir_info *di;
-			di = osi_list_entry(sdp->dir_hash[i].next,
-					    struct dir_info, list);
-			osi_list_del(&di->list);
-			free(di);
-		}
-	}
-
-	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 fsck_sb *sdp)
-{
-	struct gfs_jindex *jdesc;
-	struct fsck_rgrp *rgd;
-	struct gfs_rindex *ri;
-	osi_list_t *tmp;
-	char buf[sdp->sb.sb_bsize];
-	uint64 rmax = 0;
-	uint64 jmax = 0;
-	uint64 rmin = 0;
-	uint64 i;
-	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 fsck_rgrp, rd_list);
-		ri = &rgd->rd_ri;
-		if (ri->ri_data1 + ri->ri_data - 1 > rmax)
-			rmax = ri->ri_data1 + ri->ri_data - 1;
-		if (!rmin || ri->ri_data1 < rmin)
-			rmin = ri->ri_data1;
-	}
-
-	last_fs_block = rmax;
-
-	for (i = 0; i < sdp->journals; i++)
-	{
-		jdesc = &sdp->jindex[i];
-
-		if ((jdesc->ji_addr+jdesc->ji_nsegment*sdp->sb.sb_seg_size-1)
-		    > jmax)
-			jmax = jdesc->ji_addr + jdesc->ji_nsegment
-				* sdp->sb.sb_seg_size - 1;
-	}
-
-	sdp->last_fs_block = (jmax > rmax) ? jmax : rmax;
-	if (sdp->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",
-				 sdp->last_fs_block, sizeof(unsigned long));
-		goto fail;
-	}
-
-	sdp->last_data_block = rmax;
-	sdp->first_data_block = rmin;
-
-	if(do_lseek(sdp->diskfd, (sdp->last_fs_block * sdp->sb.sb_bsize))){
-		log_crit("Can't seek to last block in file system: %"
-			 PRIu64"\n", sdp->last_fs_block);
-		goto fail;
-	}
-
-	memset(buf, 0, sdp->sb.sb_bsize);
-	error = read(sdp->diskfd, buf, sdp->sb.sb_bsize);
-	if (error != sdp->sb.sb_bsize){
-		log_crit("Can't read last block in file system (%u), "
-			 "last_fs_block: %"PRIu64"\n",
-			 error, sdp->last_fs_block);
-		goto fail;
-	}
-
-	return 0;
-
- fail:
-	return -1;
-}
-
-
-/**
- * read_super_block
- * @sdp:
- *
- * Returns: 0 on success, -1 on failure
- */
-static int read_super_block(struct fsck_sb *sdp)
-{
-	uint32_t i;
-
-	sync();
-
-	/********************************************************************
-	 ***************** First, initialize all lists **********************
-	 ********************************************************************/
-	log_info("Initializing lists...\n");
-	osi_list_init(&sdp->rglist);
-	for(i = 0; i < FSCK_HASH_SIZE; i++) {
-		osi_list_init(&sdp->dir_hash[i]);
-		osi_list_init(&sdp->inode_hash[i]);
-	}
-
-	/********************************************************************
-	 ************  next, read in on-disk SB and set constants  **********
-	 ********************************************************************/
-	sdp->sb.sb_bsize = 512;
-	if (sdp->sb.sb_bsize < GFS_BASIC_BLOCK)
-		sdp->sb.sb_bsize = GFS_BASIC_BLOCK;
-
-	if(sizeof(struct gfs_sb) > sdp->sb.sb_bsize){
-		log_crit("GFS superblock is larger than the blocksize!\n");
-		log_debug("sizeof(struct gfs_sb) > sdp->sb.sb_bsize\n");
-		return -1;
-	}
-
-	if(read_sb(sdp) < 0){
-		return -1;
-	}
-
-	return 0;
-}
-
-/**
- * fill_super_block
- * @sdp:
- *
- * Returns: 0 on success, -1 on failure
- */
-static int fill_super_block(struct fsck_sb *sdp)
-{
-        struct fsck_inode *ip = NULL;
-	/*******************************************************************
-	 ******************  Initialize important inodes  ******************
-	 *******************************************************************/
-
-	log_info("Initializing special inodes...\n");
-	/* get ri inode */
-	if(load_inode(sdp, sdp->sb.sb_rindex_di.no_addr, &ip)) {
-		stack;
-		return -1;
-	}
-	sdp->riinode = ip;
-
-	/* get ji inode */
-	if(load_inode(sdp, sdp->sb.sb_jindex_di.no_addr, &ip)) {
-		stack;
-		return -1;
-	}
-	sdp->jiinode = ip;
-
-	/* get root dinode */
-	if(!load_inode(sdp, sdp->sb.sb_root_di.no_addr, &ip)) {
-		if(!check_inode(ip)) {
-			sdp->rooti = ip;
-		}
-		else {
-			free(ip);
-		}
-	} else {
-		log_warn("Unable to load root inode\n");
-	}
-
-	/*******************************************************************
-	 *******  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;
-	}
-
-	if(ri_update(sdp)){
-		log_err("Unable to fill in resource group information.\n");
-		goto fail;
-	}
-
-	/*******************************************************************
-	 *******  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;
-	}
-
-	sdp->bl = block_list_create(sdp->last_fs_block+1, gbmap);
-	if (!sdp->bl)
-		goto fail;
-
-	return 0;
-
- fail:
-	empty_super_block(sdp);
-
-	return -1;
-}
-
-/**
- * init_sbp - initialize superblock pointer
- *
- */
-static int init_sbp(struct fsck_sb *sbp)
-{
-	if(sbp->opts->no) {
-		if ((sbp->diskfd = open(sbp->opts->device, O_RDONLY)) < 0) {
-			log_crit("Unable to open device: %s\n", sbp->opts->device);
-			return -1;
-		}
-	} else {
-		/* read in sb from disk */
-		if ((sbp->diskfd = open(sbp->opts->device, O_RDWR)) < 0){
-			log_crit("Unable to open device: %s\n", sbp->opts->device);
-			return -1;
-		}
-	}
-
-	/* initialize lists and read in the sb */
-	if(read_super_block(sbp)) {
-		stack;
-		return -1;
-	}
-
-	/* Change lock protocol to be fsck_* instead of lock_* */
-	if(!sbp->opts->no) {
-		if(block_mounters(sbp, 1)) {
-			log_err("Unable to block other mounters\n");
-			return -1;
-		}
-	}
-
-	/* initialize important inodes, fill the rgrp and journal indexes, etc */
-	if(fill_super_block(sbp)) {
-		if(!sbp->opts->no)
-			block_mounters(sbp, 0);
-		stack;
-		return -1;
-	}
-
-	/* verify various things */
-
-	if(init_journals(sbp)) {
-		if(!sbp->opts->no)
-			block_mounters(sbp, 0);
-		stack;
-		return -1;
-	}
-
-	return 0;
-}
-
-static void destroy_sbp(struct fsck_sb *sbp)
-{
-	if(!sbp->opts->no) {
-		if(block_mounters(sbp, 0)) {
-			log_warn("Unable to unblock other mounters - manual intevention required\n");
-			log_warn("Use 'gfs_tool sb <device> proto' to fix\n");
-		}
-		log_info("Syncing the device.\n");
-		fsync(sbp->diskfd);
-	}
-	empty_super_block(sbp);
-	close(sbp->diskfd);
-}
-
-int initialize(struct fsck_sb *sbp)
-{
-
-	return init_sbp(sbp);
-
-}
-
-void destroy(struct fsck_sb *sbp)
-{
-	destroy_sbp(sbp);
-
-}
diff --git a/gfs/gfs_fsck/inode.c b/gfs/gfs_fsck/inode.c
deleted file mode 100644
index 7a88589..0000000
--- a/gfs/gfs_fsck/inode.c
+++ /dev/null
@@ -1,335 +0,0 @@
-#include "fsck_incore.h"
-#include "fsck.h"
-#include "osi_user.h"
-#include "bio.h"
-#include "fs_inode.h"
-#include "inode.h"
-#include "rgrp.h"
-#include "util.h"
-#include "fs_dir.h"
-
-/* FIXME: Not crazy about this name vs. load_inode, but I'm not very
- * creative ATM */
-/* replaces fs_copyin_dinode */
-int copyin_inode(struct fsck_sb *sbp, osi_buf_t *bh, struct fsck_inode **inode)
-{
-	struct fsck_inode *ip;
-
-	if(!(ip = (struct fsck_inode *)malloc(sizeof(struct fsck_inode)))) {
-		log_err("Unable to allocate memory for inode\n");
-		return -1;
-	}
-	if(!memset(ip, 0, sizeof(struct fsck_inode))) {
-		log_err("Unable to zero inode memory\n");
-		return -1;
-	}
-	ip->i_sbd = sbp;
-
-	ip->i_num.no_addr = ip->i_num.no_formal_ino = BH_BLKNO(bh);
-	memset(&ip->i_di, 0, sizeof(struct gfs_dinode));
-
-	gfs_dinode_in(&ip->i_di, BH_DATA(bh));
-
-	*inode = ip;
-
-	return 0;
-}
-
-int load_inode(struct fsck_sb *sbp, uint64_t block, struct fsck_inode **inode)
-{
-	osi_buf_t *bh;
-
-	if(get_and_read_buf(sbp, block, &bh, 0)){
-		stack;
-		log_err("Unable to retrieve block %"PRIu64"\n",
-			block);
-		return -1;
-	}
-
-	if(copyin_inode(sbp, bh, inode)) {
-		stack;
-		relse_buf(sbp, bh);
-		return -1;
-	}
-
-	relse_buf(sbp, bh);
-	return 0;
-}
-
-
-void free_inode(struct fsck_inode **inode)
-{
-	free(*inode);
-	inode = NULL;
-}
-
-
-int check_inode(struct fsck_inode *ip)
-{
-	int error = 0;
-	if(ip->i_di.di_header.mh_type != GFS_METATYPE_DI) {
-		return -1;
-	}
-
-	if(ip->i_num.no_formal_ino != ip->i_di.di_num.no_formal_ino){
-		log_err(
-			"In-core and on-disk formal inode"
-			"numbers do not match. %"PRIu64" %"PRIu64"\n",
-			ip->i_num.no_formal_ino,
-			ip->i_di.di_num.no_formal_ino);
-		error = -1;
-	}
-
-	/*  Handle a moved inode  */
-
-	if (ip->i_num.no_addr != ip->i_di.di_num.no_addr){
-		log_err("\tBlock # used to read disk inode: %"PRIu64"\n"
-			"\tBlock # recorded in disk inode : %"PRIu64"\n",
-			ip->i_num.no_addr, ip->i_di.di_num.no_addr);
-		error = -1;
-	}
-
-	return error;
-
-}
-
-
-
-/*int remove_inode(struct fsck_sb *sbp, uint64_t block)
-{
-	struct fsck_inode *ip;
-	load_inode(sbp, block, &ip);
-	check_metatree(ip, &fxns);
-	free_inode(&ip);
-	return 0;
-}*/
-
-/**
- * fs_get_istruct - Get an inode given its number
- * @sdp: The GFS superblock
- * @inum: The inode number
- * @create: Flag to say if we are allowed to create a new struct fsck_inode
- * @ipp: pointer to put the returned inode in
- *
- * Returns: 0 on success, -1 on error
- */
-static int fs_get_istruct(struct fsck_sb *sdp, struct gfs_inum *inum,
-			  int create, struct fsck_inode **ipp)
-{
-	struct fsck_inode *ip = NULL;
-	int error = 0;
-
-	if (!create){
-		/* we are not currently tracking which inodes we already have */
-		error = -1;
-		goto out;
-	}
-
-	if(!(ip = (struct fsck_inode *)malloc(sizeof(struct fsck_inode)))) {
-		log_err("Unable to allocate memory for inode\n");
-		error = -1;
-		goto out;
-	}
-	ip->i_num = *inum;
-
-	ip->i_sbd = sdp;
-
-	error = fs_copyin_dinode(ip, NULL);
-	if (error){
-		free(ip);
-		ip = NULL;
-		goto out;
-	}
-
- out:
-	*ipp = ip;
-
-	return error;
-}
-
-
-
-/**
- * make_dinode - Fill in a new dinode structure
- * @dip: the directory this inode is being created in
- * @inum: the inode number
- * @type: the file type
- * @mode: the file permissions
- * @cred: a credentials structure
- *
- */
-
-static int make_dinode(struct fsck_inode *dip, struct fsck_sb *sdp,
-		       struct gfs_inum *inum,
-                       unsigned int type, unsigned int mode, osi_cred_t *cred)
-{
-	struct gfs_dinode di;
-	osi_buf_t *dibh;
-	struct fsck_rgrp *rgd;
-	int error;
-
-	error = get_and_read_buf(sdp, inum->no_addr, &dibh, 0);
-	if (error)
-		goto out;
-
-	if(check_meta(dibh, 0)){
-		struct gfs_meta_header mh;
-	        log_debug("Buffer #%"PRIu64" has no meta header.\n",
-			  BH_BLKNO(dibh));
-		memset(&mh, 0, sizeof(struct gfs_meta_header));
-		mh.mh_magic = GFS_MAGIC;
-		mh.mh_type = GFS_METATYPE_NONE;
-		gfs_meta_header_out(&mh, BH_DATA(dibh));
-		log_debug("meta header added.\n");
-	}
-
-	((struct gfs_meta_header *)BH_DATA(dibh))->mh_type =
-		cpu_to_gfs32(GFS_METATYPE_DI);
-	((struct gfs_meta_header *)BH_DATA(dibh))->mh_format =
-		cpu_to_gfs32(GFS_FORMAT_DI);
-
-	memset(BH_DATA(dibh) + sizeof(struct gfs_dinode), 0,
-	       BH_SIZE(dibh) - sizeof(struct gfs_dinode));
-
-	memset(&di, 0, sizeof(struct gfs_dinode));
-
-	gfs_meta_header_in(&di.di_header, BH_DATA(dibh));
-
-	di.di_num = *inum;
-
-	if (dip && (dip->i_di.di_mode & 02000))
-	{
-		di.di_mode = mode | ((type == GFS_FILE_DIR) ? 02000 : 0);
-		di.di_gid = dip->i_di.di_gid;
-	}
-	else
-	{
-		di.di_mode = mode;
-		di.di_gid = osi_cred_to_gid(cred);
-	}
-
-	di.di_uid = osi_cred_to_uid(cred);
-	di.di_nlink = 1;
-	di.di_blocks = 1;
-	di.di_atime = di.di_mtime = di.di_ctime = osi_current_time();
-
-	rgd = fs_blk2rgrpd(sdp, inum->no_addr);
-	if(!rgd){
-		log_crit("Unable to map block #%"PRIu64" to rgrp\n", inum->no_addr);
-		exit(1);
-	}
-
-	di.di_rgrp = rgd->rd_ri.ri_addr;
-	di.di_goal_rgrp = di.di_rgrp;
-	di.di_goal_dblk = di.di_goal_mblk = inum->no_addr - rgd->rd_ri.ri_data1;
-
-	di.di_type = type;
-
-	gfs_dinode_out(&di, BH_DATA(dibh));
-	if(write_buf(sdp, dibh, 0)){
-		log_err("make_dinode:  bad write_buf()\n");
-		error = -EIO;
-	}
-
-	relse_buf(sdp, dibh);
-
-
- out:
-
-	return error;
-}
-
-
-int create_inode(struct fsck_sb *sbp, unsigned int type, struct fsck_inode **ip)
-{
-	uint64_t block;
-	struct fsck_rgrp *rgd;
-	osi_list_t *tmp;
-	struct gfs_inum inum;
-	int allocate=0;
-	unsigned int mode = 0755;
-	osi_cred_t cred;
-	cred.cr_uid = getuid();
-	cred.cr_gid = getgid();
- retry:
-	inum.no_addr = inum.no_formal_ino = 0;
-	/* Search for a resource group that has free space */
-	osi_list_foreach(tmp, &sbp->rglist) {
-		/* Create a new inode in that rgd */
-		rgd = osi_list_entry(tmp, struct fsck_rgrp, rd_list);
-		if(fs_rgrp_read(rgd, FALSE)) {
-			stack;
-			return -1;
-		}
-		if(rgd->rd_rg.rg_freemeta){
-			block = fs_blkalloc_internal(rgd, 0,
-						     GFS_BLKST_FREEMETA, GFS_BLKST_USEDMETA, 1);
-			log_debug("Got block %"PRIu64"\n", block);
-			if(block == BFITNOENT) {
-				fs_rgrp_relse(rgd);
-				continue;
-			}
-			block += rgd->rd_ri.ri_data1;
-
-			inum.no_addr = inum.no_formal_ino = block;
-			/* FIXME: type isn't right */
-			block_set(sbp->bl, block, type);
-			/* write out the rgrp */
-			gfs_rgrp_out(&rgd->rd_rg, BH_DATA(rgd->rd_bh[0]));
-			write_buf(sbp, rgd->rd_bh[0], 0);
-			fs_rgrp_relse(rgd);
-			break;
-		}
-		else {
-			if(allocate && !clump_alloc(rgd, 0)){
-				block = fs_blkalloc_internal(rgd, 0,
-							     GFS_BLKST_FREEMETA,
-							     GFS_BLKST_USEDMETA, 1);
-				log_debug("Got block %"PRIu64"\n", block);
-
-				if(block == BFITNOENT) {
-					fs_rgrp_relse(rgd);
-					continue;
-				}
-				block += rgd->rd_ri.ri_data1;
-
-				inum.no_addr = inum.no_formal_ino = block;
-
-				/* FIXME: type isn't right */
-				block_set(sbp->bl, block, type);
-
-				/* write out the rgrp */
-				gfs_rgrp_out(&rgd->rd_rg, BH_DATA(rgd->rd_bh[0]));
-				write_buf(sbp, rgd->rd_bh[0], 0);
-				fs_rgrp_relse(rgd);
-				break;
-			}
-			fs_rgrp_relse(rgd);
-		}
-	}
-
-	if(!inum.no_addr){
-		if(allocate){
-			log_err("No space available for new file or directory.\n");
-			return -1;
-		} else {
-			allocate = 1;
-			goto retry;
-		}
-	}
-
-        /* We need to setup the inode without attaching it to a directory */
-	if(make_dinode(NULL, sbp, &inum, type, mode, &cred)) {
-		stack;
-		return -1;
-	}
-	if(fs_get_istruct(sbp, &inum, 1, ip)) {
-		stack;
-		return -1;
-	}
-
-	return 0;
-
-
-}
-
diff --git a/gfs/gfs_fsck/inode.h b/gfs/gfs_fsck/inode.h
deleted file mode 100644
index 3670c05..0000000
--- a/gfs/gfs_fsck/inode.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef _INODE_H
-#define _INODE_H
-
-
-int copyin_inode(struct fsck_sb *sbp, osi_buf_t *bh, struct fsck_inode **ip);
-int load_inode(struct fsck_sb *sbp, uint64_t block, struct fsck_inode **ip);
-void free_inode(struct fsck_inode **inode);
-int check_inode(struct fsck_inode *ip);
-int create_inode(struct fsck_sb *sbp, unsigned int type,
-		 struct fsck_inode **ip);
-
-
-#endif /* _INODE_H */
diff --git a/gfs/gfs_fsck/inode_hash.c b/gfs/gfs_fsck/inode_hash.c
deleted file mode 100644
index 8173dcc..0000000
--- a/gfs/gfs_fsck/inode_hash.c
+++ /dev/null
@@ -1,74 +0,0 @@
-#include <stdint.h>
-#include "osi_list.h"
-#include "fsck_incore.h"
-#include "hash.h"
-#include "inode_hash.h"
-
-static uint32_t 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[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[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[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/gfs/gfs_fsck/inode_hash.h b/gfs/gfs_fsck/inode_hash.h
deleted file mode 100644
index bd463c7..0000000
--- a/gfs/gfs_fsck/inode_hash.h
+++ /dev/null
@@ -1,7 +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/gfs/gfs_fsck/link.c b/gfs/gfs_fsck/link.c
deleted file mode 100644
index d303937..0000000
--- a/gfs/gfs_fsck/link.c
+++ /dev/null
@@ -1,94 +0,0 @@
-#include <stdint.h>
-#include "fsck_incore.h"
-#include "inode_hash.h"
-#include "link.h"
-
-int set_link_count(struct fsck_sb *sbp, uint64_t inode_no, uint32_t count)
-{
-	struct inode_info *ii = NULL;
-	log_debug("Setting link count to %u for %"PRIu64"\n", count, inode_no);
-	/* If the list has entries, look for one that matches
-	 * inode_no */
-	ii = inode_hash_search(sbp->inode_hash, inode_no);
-	if(ii) {
-		if(ii->link_count) {
-			log_err("Link count already set for inode #%"
-				PRIu64"!\n");
-			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(sbp->inode_hash, inode_no, ii);
-	}
-	return 0;
-
-
-}
-
-int increment_link(struct fsck_sb *sbp, uint64_t inode_no)
-{
-	struct inode_info *ii = NULL;
-
-	ii = inode_hash_search(sbp->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"\n",
-			  ii->counted_links, inode_no);
-		return 0;
-	}
-	log_debug("No match found when incrementing link for %"PRIu64"!\n",
-		  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(sbp->inode_hash, inode_no, ii);
-
-	return 0;
-}
-
-int decrement_link(struct fsck_sb *sbp, uint64_t inode_no)
-{
-	struct inode_info *ii = NULL;
-
-	ii = inode_hash_search(sbp->inode_hash, inode_no);
-	/* If the list has entries, look for one that matches
-	 * inode_no */
-	log_err("Decrementing %"PRIu64"\n", inode_no);
-	if(ii) {
-		ii->counted_links--;
-		return 0;
-	}
-	log_debug("No match found when decrementing link for %"PRIu64"!\n",
-		  inode_no);
-	return -1;
-
-}
-
-
diff --git a/gfs/gfs_fsck/link.h b/gfs/gfs_fsck/link.h
deleted file mode 100644
index 460bc26..0000000
--- a/gfs/gfs_fsck/link.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _LINK_H
-#define _LINK_H
-
-int set_link_count(struct fsck_sb *sbp, uint64_t inode_no, uint32_t count);
-int increment_link(struct fsck_sb *sbp, uint64_t inode_no);
-int decrement_link(struct fsck_sb *sbp, uint64_t inode_no);
-
-#endif /* _LINK_H */
diff --git a/gfs/gfs_fsck/log.c b/gfs/gfs_fsck/log.c
deleted file mode 100644
index 3730d41..0000000
--- a/gfs/gfs_fsck/log.c
+++ /dev/null
@@ -1,145 +0,0 @@
-#include <stdio.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <libintl.h>
-
-#include <sys/select.h>
-#include <unistd.h>
-
-#include "fsck_incore.h"
-#include "log.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(stdout);
-		break;
-	case MSG_INFO:
-	case MSG_NOTICE:
-	case MSG_WARN:
-		vprintf(format, args);
-		fflush(stdout);
-		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);
-}
-
-
-
-int query(struct fsck_sb *sbp, const char *format, ...)
-{
-
-	va_list args;
-	const char *transform;
-	char response;
-	fd_set rfds;
-	struct timeval tv;
-	int err = 0;
-	int ret = 0;
-
-	if(sbp->opts->yes)
-		return 1;
-	if(sbp->opts->no)
-		return 0;
-
-	fsck_query = TRUE;
-    /* Watch stdin (fd 0) to see when it has input. */
-	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;
-		}
-		err = read(STDIN_FILENO, &response, sizeof(char));
-
-	}
- query:
-	va_start(args, format);
-
-	transform = _(format);
-
-	vprintf(transform, args);
-
-	/* Make sure query is printed out */
-	fflush(NULL);
-
- rescan:
-	err = read(STDIN_FILENO, &response, sizeof(char));
-
-	if(tolower(response) == 'y') {
-		ret = 1;
-	} else if (tolower(response) == 'n') {
-		ret = 0;
-	} else if ((response == ' ') || (response == '\t')) {
-		goto rescan;
-	} else {
-		while(response != '\n')
-			err = read(STDIN_FILENO, &response, sizeof(char));
-		printf("Bad response, please type 'y' or 'n'.\n");
-		va_end(args);
-		goto query;
-	}
-
-	/* Clip the input */
-	while((err = select(STDIN_FILENO + 1, &rfds, NULL, NULL, &tv))) {
-		if(err < 0) {
-			log_debug("Error in select() on stdin\n");
-			break;
-		}
-		err = read(STDIN_FILENO, &response, sizeof(char));
-	}
-
-	va_end(args);
-	fsck_query = FALSE;
-	return ret;
-}
diff --git a/gfs/gfs_fsck/log.h b/gfs/gfs_fsck/log.h
deleted file mode 100644
index 358fc14..0000000
--- a/gfs/gfs_fsck/log.h
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifndef __LOG_H
-#define __LOG_H
-
-#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, ...);
-int query(struct fsck_sb *sbp, const char *format, ...);
-
-
-#endif /* __LOG_H */
diff --git a/gfs/gfs_fsck/lost_n_found.c b/gfs/gfs_fsck/lost_n_found.c
deleted file mode 100644
index 648e567..0000000
--- a/gfs/gfs_fsck/lost_n_found.c
+++ /dev/null
@@ -1,133 +0,0 @@
-#include "fs_dir.h"
-
-#include "lost_n_found.h"
-#include "link.h"
-#include "fs_inode.h"
-#include "bio.h"
-#include "inode.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 fsck_inode *ip){
-	char tmp_name[256];
-	struct fsck_inode *lf_ip, *ri;
-	osi_filename_t filename;
-	struct block_query q;
-
-	if(!ip->i_sbd->lf_dip) {
-		log_info("Locating/Creating lost and found directory\n");
-
-		load_inode(ip->i_sbd, ip->i_sbd->sb.sb_root_di.no_addr, &ri);
-
-		if(fs_mkdir(ri, "l+f", 00700, &lf_ip)){
-			log_err("Unable to create/locate l+f directory.\n");
-		}
-		free_inode(&ri);
-		if(!lf_ip){
-			log_warn("No l+f directory, can not add inode.\n");
-			return -1;
-		}
-		log_notice("l+f directory at %"PRIu64"\n", lf_ip->i_num.no_addr);
-
-		ip->i_sbd->lf_dip = lf_ip;
-		if(block_check(ip->i_sbd->bl, lf_ip->i_num.no_addr, &q)) {
-			stack;
-			return -1;
-		}
-		if(q.block_type != inode_dir) {
-			/* This is a new l+f 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 */
-			block_set(ip->i_sbd->bl, lf_ip->i_num.no_addr, inode_dir);
-			increment_link(ip->i_sbd, ip->i_sbd->sb.sb_root_di.no_addr);
-			increment_link(ip->i_sbd, lf_ip->i_num.no_addr);
-			increment_link(ip->i_sbd, lf_ip->i_num.no_addr);
-		}
-	} else {
-		lf_ip = ip->i_sbd->lf_dip;
-	}
-
-	if(ip->i_num.no_addr == lf_ip->i_num.no_addr) {
-		log_err("Trying to add l+f to itself...skipping");
-		return 0;
-	}
-	switch(ip->i_di.di_type){
-	case GFS_FILE_DIR:
-		log_info("Adding .. entry pointing to l+f for %"PRIu64"\n",
-			 ip->i_num.no_addr);
-		sprintf(tmp_name, "..");
-		filename.len = strlen(tmp_name);  /* no trailing NULL */
-		if(!(filename.name = malloc(sizeof(char) * filename.len))) {
-			log_err("Unable to allocate name\n");
-			stack;
-			return -1;
-		}
-		if(!memset(filename.name, 0, sizeof(char) * filename.len)) {
-			log_err("Unable to zero name\n");
-			stack;
-			return -1;
-		}
-		memcpy(filename.name, tmp_name, filename.len);
-
-		if(fs_dirent_del(ip, NULL, &filename)){
-			log_warn("add_inode_to_lf:  "
-				"Unable to remove \"..\" directory entry.\n");
-		}
-
-		if(fs_dir_add(ip, &filename, &(lf_ip->i_num),
-			      lf_ip->i_di.di_type)){
-			log_err("Failed to link \"..\" entry to l+f directory.\n");
-			block_set(ip->i_sbd->bl, ip->i_num.no_addr, meta_inval);
-			return 0;
-		}
-
-		free(filename.name);
-		sprintf(tmp_name, "lost_dir_%"PRIu64, ip->i_num.no_addr);
-		break;
-	case GFS_FILE_REG:
-		sprintf(tmp_name, "lost_file_%"PRIu64, ip->i_num.no_addr);
-		break;
-	default:
-		sprintf(tmp_name, "lost_%"PRIu64, ip->i_num.no_addr);
-		break;
-	}
-	filename.len = strlen(tmp_name);  /* no trailing NULL */
-	if(!(filename.name = malloc(sizeof(char) * filename.len))) {
-		log_err("Unable to allocate name\n");
-			stack;
-			return -1;
-		}
-	if(!memset(filename.name, 0, sizeof(char) * filename.len)) {
-		log_err("Unable to zero name\n");
-		stack;
-		return -1;
-	}
-	memcpy(filename.name, tmp_name, filename.len);
-
-	if(fs_dir_add(lf_ip, &filename, &(ip->i_num), ip->i_di.di_type)){
-		log_err("Failed to add inode #%"PRIu64" to l+f dir.\n",
-			ip->i_num.no_addr);
-		/* FIXME: don't return -1 here, just mark the inode bad */
-		free(filename.name);
-		block_set(ip->i_sbd->bl, ip->i_num.no_addr, meta_inval);
-		return 0;
-	}
-  	increment_link(ip->i_sbd, ip->i_num.no_addr);
-	if(ip->i_di.di_type == GFS_FILE_DIR) {
-		increment_link(ip->i_sbd, lf_ip->i_num.no_addr);
-	}
-	free(filename.name);
-	log_notice("Added inode #%"PRIu64" to l+f dir\n", ip->i_num.no_addr);
-	return 0;
-}
diff --git a/gfs/gfs_fsck/lost_n_found.h b/gfs/gfs_fsck/lost_n_found.h
deleted file mode 100644
index dde343a..0000000
--- a/gfs/gfs_fsck/lost_n_found.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef __LOST_N_FOUND_H__
-#define __LOST_N_FOUND_H__
-
-#include "fsck_incore.h"
-
-int add_inode_to_lf(struct fsck_inode *ip);
-
-#endif /* __LOST_N_FOUND_H__ */
diff --git a/gfs/gfs_fsck/main.c b/gfs/gfs_fsck/main.c
deleted file mode 100644
index 8e080ce..0000000
--- a/gfs/gfs_fsck/main.c
+++ /dev/null
@@ -1,277 +0,0 @@
-#include <unistd.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <libgen.h>
-#include <ctype.h>
-#include <signal.h>
-
-#include "copyright.cf"
-#include "fsck_incore.h"
-#include "fsck.h"
-#include "log.h"
-
-uint64_t last_fs_block, last_reported_block = -1;
-int skip_this_pass = FALSE, fsck_abort = FALSE, fsck_query = FALSE;
-const char *pass = "";
-
-void print_map(struct block_list *il, int count)
-{
-	int i, j;
-	struct block_query k;
-
-	log_info("Printing map of blocks - 80 blocks per row\n");
-	j = 0;
-	for(i = 0; i < count; i++) {
-		if(j > 79) {
-			log_info("\n");
-			j = 0;
-		}
-		else if(!(j %10) && j != 0) {
-			log_info(" ");
-		}
-		j++;
-		block_check(il, i, &k);
-		log_info("%X", k.block_type);
-
-	}
-	log_info("\n");
-}
-
-void usage(char *name)
-{
-	printf("Usage: %s [-hnqvVy] <device> \n", basename(name));
-}
-
-void version(void)
-{
-	printf("GFS fsck %s (built %s %s)\n",
-	       RELEASE_VERSION, __DATE__, __TIME__);
-	printf("%s\n", REDHAT_COPYRIGHT);
-}
-
-int read_cmdline(int argc, char **argv, struct 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)
-{
-	fd_set rfds;
-	struct timeval tv;
-	char response;
-	int err;
-	ssize_t amtread;
-
-	if (fsck_query) /* if we're asking them a question */
-		return;     /* ignore the interrupt signal */
-	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;
-		}
-		err = read(STDIN_FILENO, &response, sizeof(char));
-	}
-	while (TRUE) {
-		printf("\ngfs_fsck interrupted in %s:  ", pass);
-		if (!last_reported_block || last_reported_block == last_fs_block)
-			printf("progress unknown.\n");
-		else
-			printf("processing block %" PRIu64 " out of %" PRIu64 "\n",
-				   last_reported_block, last_fs_block);
-		printf("Do you want to abort gfs_fsck, skip the rest of %s or continue (a/s/c)?", pass);
-
-		/* Make sure query is printed out */
-		fflush(stdout);
-		amtread = read(STDIN_FILENO, &response, sizeof(char));
-
-		if(amtread && tolower(response) == 's') {
-			skip_this_pass = TRUE;
-			return;
-		}
-		else if (amtread && tolower(response) == 'a') {
-			fsck_abort = TRUE;
-			return;
-		}
-		else if (amtread && tolower(response) == 'c')
-			return;
-		else {
-			while(response != '\n')
-				amtread = read(STDIN_FILENO, &response,
-					       sizeof(char));
-			printf("Bad response, please type 'c', 'a' or 's'.\n");
-			continue;
-		}
-	}
-}
-
-int main(int argc, char **argv)
-{
-	struct fsck_sb sb;
-	struct options opts = {0};
-
-	struct fsck_sb *sbp = &sb;
-	memset(sbp, 0, sizeof(*sbp));
-
-	sbp->opts = &opts;
-
-	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");
-
-	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, &opts))
-			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, &opts))
-			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, &opts))
-			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, &opts))
-			return 1;
-		if (skip_this_pass || fsck_abort) {
-			skip_this_pass = FALSE;
-			log_notice("Pass5 interrupted   \n");
-		}
-		else
-			log_notice("Pass5 complete      \n");
-		log_notice("Writing changes to disk\n");
-	}
-	destroy(sbp);
-
-	return 0;
-}
-
-
-
diff --git a/gfs/gfs_fsck/metawalk.c b/gfs/gfs_fsck/metawalk.c
deleted file mode 100644
index 0a91b5a..0000000
--- a/gfs/gfs_fsck/metawalk.c
+++ /dev/null
@@ -1,862 +0,0 @@
-#include "fsck_incore.h"
-#include "fsck.h"
-#include "bio.h"
-#include "fs_dir.h"
-#include "inode.h"
-#include "util.h"
-#include "hash.h"
-
-#include "metawalk.h"
-
-int check_entries(struct fsck_inode *ip, osi_buf_t *bh, int index,
-		  int type, int *update, uint16_t *count,
-		  struct metawalk_fxns *pass)
-{
-	struct gfs_leaf *leaf = NULL;
-	struct gfs_dirent *dent;
-	struct gfs_dirent de, *prev;
-	int error = 0;
-	char *bh_end;
-	char *filename;
-	int first = 1;
-
-	bh_end = BH_DATA(bh) + BH_SIZE(bh);
-
-	if(type == DIR_LINEAR) {
-		dent = (struct gfs_dirent *)(BH_DATA(bh)
-					     + sizeof(struct gfs_dinode));
-	}
-	else if (type == DIR_EXHASH) {
-		dent = (struct gfs_dirent *)(BH_DATA(bh)
-					     + sizeof(struct gfs_leaf));
-		leaf = (struct gfs_leaf *)BH_DATA(bh);
-		log_debug("Checking leaf %"PRIu64"\n", BH_BLKNO(bh));
-	}
-	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 gfs_dirent));
-		gfs_dirent_in(&de, (char *)dent);
-		filename = (char *)dent + sizeof(struct gfs_dirent);
-
-		if (de.de_rec_len < sizeof(struct gfs_dirent) +
-		    de.de_name_len || !de.de_name_len) {
-			log_err("Directory block %"
-				PRIu64 ", entry %d of directory %"
-				PRIu64 " is corrupt.\n", BH_BLKNO(bh),
-				(*count) + 1, ip->i_di.di_num.no_addr);
-			if (query(ip->i_sbd, "Attempt to repair it? (y/n) ")) {
-				if (dirent_repair(ip, bh, &de, dent, type,
-						  first))
-					break;
-			}
-			else {
-				log_err("Corrupt directory entry %d 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" of directory %"PRIu64"!\n", BH_BLKNO(bh), ip->i_di.di_num.no_addr);
-				return 1;
-			}
-		} 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 gfs_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 fsck_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 " points to leaf %"
-			PRIu64 " %s.\n", ip->i_di.di_num.no_addr, *leaf_no,
-			msg);
-	}
-	if (*leaf_no == *bad_leaf ||
-	    query(ip->i_sbd, "Attempt to patch around it? (y/n) ")) {
-		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 exthash directory entries */
-int check_leaf(struct fsck_inode *ip, int *update, struct metawalk_fxns *pass)
-{
-	int error;
-	struct gfs_leaf leaf, oldleaf;
-	uint64_t leaf_no, old_leaf, bad_leaf = -1;
-	osi_buf_t *lbh;
-	int index;
-	struct fsck_sb *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++) {
-		if(get_leaf_nr(ip, index, &leaf_no)) {
-			log_err("Unable to get leaf block number in dir %"
-				PRIu64"\n"
-				"\tDepth = %u\n"
-				"\tindex = %u\n",
-				ip->i_num.no_addr,
-				ip->i_di.di_depth,
-				index);
-			return -1;
-		}
-
-		/* GFS has multiple indirect pointers to the same leaf
-		 * until those extra pointers are needed, so skip the
-		 * dups */
-		if (leaf_no == bad_leaf) {
-			put_leaf_nr(ip, index, old_leaf); /* fill w/old leaf */
-			ref_count++;
-			continue;
-		}
-		else if(old_leaf == leaf_no) {
-			ref_count++;
-			continue;
-		} else {
-			if(ref_count != exp_count){
-				log_err("Dir #%"PRIu64" has an incorrect number "
-					 "of pointers to leaf #%"PRIu64"\n"
-					 "\tFound: %u,  Expected: %u\n",
-					 ip->i_num.no_addr,
-					 old_leaf,
-					 ref_count,
-					 exp_count);
-				if (query(ip->i_sbd, "Attempt to fix it? (y/n) ")) {
-					int factor = 0, divisor = ref_count;
-
-					get_and_read_buf(sbp, old_leaf, &lbh,
-							 0);
-					while (divisor > 1) {
-						factor++;
-						divisor /= 2;
-					}
-					oldleaf.lf_depth = ip->i_di.di_depth -
-						factor;
-					gfs_leaf_out(&oldleaf, BH_DATA(lbh));
-					write_buf(sbp, lbh, 0);
-					relse_buf(sbp, lbh);
-				}
-				else
-					return 1;
-			}
-			ref_count = 1;
-		}
-
-		count = 0;
-		do {
-			/* Make sure the block number is in range. */
-			if(check_range(ip->i_sbd, leaf_no)){
-				log_err("Leaf block #%"PRIu64" is out of "
-					"range for directory #%"PRIu64".\n",
-					leaf_no, 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;
-			}
-			/* Try to read in the leaf block. */
-			if(get_and_read_buf(sbp, leaf_no, &lbh, 0)){
-				log_err("Unable to read leaf block #%"
-					PRIu64" for "
-					"directory #%"PRIu64".\n",
-					leaf_no, ip->i_di.di_num.no_addr);
-				warn_and_patch(ip, &leaf_no, &bad_leaf,
-					       old_leaf, index,
-					       "that cannot be read");
-				memcpy(&leaf, &oldleaf, sizeof(oldleaf));
-				relse_buf(sbp, lbh);
-				break;
-			}
-			/* Make sure it's really a valid leaf block. */
-			if (check_meta(lbh, GFS_METATYPE_LF)) {
-				warn_and_patch(ip, &leaf_no, &bad_leaf,
-					       old_leaf, index,
-					       "that is not really a leaf");
-				memcpy(&leaf, &oldleaf, sizeof(oldleaf));
-				relse_buf(sbp, lbh);
-				break;
-			}
-			gfs_leaf_in(&leaf, BH_DATA(lbh));
-			if(pass->check_leaf) {
-				error = pass->check_leaf(ip, leaf_no, lbh,
-							 pass->private);
-			}
-
-			exp_count = (1 << (ip->i_di.di_depth - leaf.lf_depth));
-			log_debug("expected count %u - %u %u\n", exp_count,
-				  ip->i_di.di_depth, leaf.lf_depth);
-			if(pass->check_dentry && 
-			   ip->i_di.di_type == GFS_FILE_DIR) {
-				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 */
-				relse_buf(sbp, lbh);
-				if(error < 0) {
-					stack;
-					return -1;
-				}
-
-				if(error > 0) {
-					return 1;
-				}
-
-				if(update && (count != leaf.lf_entries)) {
-
-					if(get_and_read_buf(sbp, leaf_no,
-							    &lbh, 0)){
-						log_err("Unable to read leaf block #%"
-							PRIu64" for "
-							"directory #%"PRIu64".\n",
-							leaf_no,
-							ip->i_di.di_num.no_addr);
-						return -1;
-					}
-					gfs_leaf_in(&leaf, BH_DATA(lbh));
-
-					log_err("Leaf(%"PRIu64") entry count in directory %"PRIu64" doesn't match number of entries found - is %u, found %u\n", leaf_no, ip->i_num.no_addr, leaf.lf_entries, count);
-					if(query(sbp, "Update leaf entry count? (y/n) ")) {
-						leaf.lf_entries = count;
-						gfs_leaf_out(&leaf, BH_DATA(lbh));
-						write_buf(sbp, lbh, 0);
-						log_warn("Leaf entry count updated\n");
-					} else {
-						log_err("Leaf entry count left in inconsistant state\n");
-					}
-					relse_buf(sbp, lbh);
-				}
-				/* FIXME: Need to get entry count and
-				 * compare it against
-				 * leaf->lf_entries */
-
-				break;
-			} else {
-				relse_buf(sbp, lbh);
-				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 fsck_inode *ip, osi_buf_t *bh,
-			       struct metawalk_fxns *pass)
-{
-	struct gfs_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 gfs_meta_header);
-
-	if(!pass->check_eattr_entry) {
-		return 0;
-	}
-
-	ea_hdr = (struct gfs_ea_header *)(BH_DATA(bh) +
-					  sizeof(struct gfs_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) {
-			if(pass->check_eattr_extentry && ea_hdr->ea_num_ptrs) {
-				ea_data_ptr = ((uint64_t *)((char *)ea_hdr +
-							    sizeof(struct gfs_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,
-								      pass->private)) {
-						stack;
-						return -1;
-					}
-					ea_data_ptr++;
-				}
-			}
-		}
-		offset += gfs32_to_cpu(ea_hdr->ea_rec_len);
-		if(ea_hdr->ea_flags & GFS_EAFLAG_LAST ||
-		   offset >= ip->i_sbd->sb.sb_bsize || ea_hdr->ea_rec_len == 0){
-			break;
-		}
-		ea_hdr_prev = ea_hdr;
-		ea_hdr = (struct gfs_ea_header *)
-			((char *)(ea_hdr) +
-			 gfs32_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 fsck_inode *ip, uint64_t block,
-			    uint64_t parent, struct metawalk_fxns *pass)
-{
-	osi_buf_t *bh = NULL;
-	int error = 0;
-	log_debug("Checking EA leaf block #%"PRIu64".\n", block);
-
-	if(pass->check_eattr_leaf) {
-		error = pass->check_eattr_leaf(ip, block, parent,
-					       &bh, pass->private);
-		if(error < 0) {
-			stack;
-			return -1;
-		}
-		if(error > 0) {
-			relse_buf(ip->i_sbd, bh);
-			return 1;
-		}
-	}
-
-	check_eattr_entries(ip, bh, pass);
-
-	relse_buf(ip->i_sbd, bh);
-
-	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 fsck_inode *ip, uint64_t indirect,
-				struct metawalk_fxns *pass){
-	int error = 0;
-	uint64_t *ea_leaf_ptr, *end;
-	uint64_t block;
-	osi_buf_t *indirect_buf = NULL;
-	struct fsck_sb *sdp = ip->i_sbd;
-
-	log_debug("Checking EA indirect block #%"PRIu64".\n", indirect);
-
-	if (!pass->check_eattr_indir ||
-	    !pass->check_eattr_indir(ip, indirect, ip->i_di.di_num.no_addr,
-				     &indirect_buf, pass->private)) {
-		ea_leaf_ptr = (uint64 *)(BH_DATA(indirect_buf)
-					 + sizeof(struct gfs_indirect));
-		end = ea_leaf_ptr
-			+ ((sdp->sb.sb_bsize
-			    - sizeof(struct gfs_indirect)) / 8);
-
-		while(*ea_leaf_ptr && (ea_leaf_ptr < end)){
-			block = gfs64_to_cpu(*ea_leaf_ptr);
-			/* FIXME: should I call check_leaf_eattr if we
-			 * find a dup? */
-			error = check_leaf_eattr(ip, block, indirect, pass);
-			ea_leaf_ptr++;
-		}
-	}
-
-	relse_buf(sdp, indirect_buf);
-	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 fsck_inode *ip, struct metawalk_fxns *pass)
-{
-	int error = 0;
-
-	if(!ip->i_di.di_eattr){
-		return 0;
-	}
-
-	log_debug("Extended attributes exist for inode #%"PRIu64".\n",
-		ip->i_num.no_formal_ino);
-
-	if(ip->i_di.di_flags & GFS_DIF_EA_INDIRECT){
-		if((error = check_indirect_eattr(ip, ip->i_di.di_eattr, pass)))
-			stack;
-	} else {
-		if((error = check_leaf_eattr(ip, ip->i_di.di_eattr,
-					     ip->i_di.di_num.no_addr, pass)))
-			stack;
-	}
-
-	return error;
-}
-
-/**
- * build_metalist
- * @ip:
- * @mlp:
- *
- */
-
-static int build_metalist(struct fsck_inode *ip, osi_list_t *mlp,
-			  struct metawalk_fxns *pass)
-{
-	uint32 height = ip->i_di.di_height;
-	osi_buf_t *bh, *nbh;
-	osi_list_t *prev_list, *cur_list, *tmp;
-	int i, head_size;
-	uint64 *ptr, block;
-	int err;
-
-	if(get_and_read_buf(ip->i_sbd, ip->i_di.di_num.no_addr, &bh, 0)) {
-		stack;
-		return -1;
-	}
-
-	osi_list_add(&bh->b_list, &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, osi_buf_t, b_list);
-
-			head_size = (i > 1 ?
-				     sizeof(struct gfs_indirect) :
-				     sizeof(struct gfs_dinode));
-
-			for (ptr = (uint64 *)(bh->b_data + head_size);
-			     (char *)ptr < (bh->b_data + bh->b_size);
-			     ptr++) {
-				nbh = NULL;
-
-				if (!*ptr)
-					continue;
-
-				block = gfs64_to_cpu(*ptr);
-
-				err = pass->check_metalist(ip, block, &nbh,
-							   pass->private);
-				if(err < 0) {
-					stack;
-					goto fail;
-				}
-				if(err > 0) {
-					log_debug("Skipping block %"PRIu64
-						  "\n", block);
-					continue;
-				}
-				if(!nbh) {
-					if(get_and_read_buf(ip->i_sbd, block,
-							    &nbh, 0)) {
-						stack;
-						goto fail;
-					}
-				}
-				osi_list_add(&nbh->b_list, cur_list);
-			}
-		}
-	}
-	return 0;
-
- fail:
-	for (i = 0; i < GFS_MAX_META_HEIGHT; i++)
-	{
-		osi_list_t *list;
-		list = &mlp[i];
-		while (!osi_list_empty(list))
-		{
-			bh = osi_list_entry(list->next, osi_buf_t, b_list);
-			osi_list_del(&bh->b_list);
-			relse_buf(ip->i_sbd, bh);
-		}
-	}
-	return -1;
-}
-
-/**
- * check_metatree
- * @ip:
- * @rgd:
- *
- */
-int check_metatree(struct fsck_inode *ip, struct metawalk_fxns *pass)
-{
-	osi_list_t metalist[GFS_MAX_META_HEIGHT];
-	osi_list_t *list, *tmp;
-	osi_buf_t *bh;
-	uint64_t block, *ptr;
-	uint32_t height = ip->i_di.di_height;
-	int  i, head_size;
-	int update = 0;
-	int error = 0;
-
-	if (!height)
-		goto end;
-
-
-	for (i = 0; i < GFS_MAX_META_HEIGHT; i++)
-		osi_list_init(&metalist[i]);
-
-	/* create metalist for each level */
-	if(build_metalist(ip, &metalist[0], pass)){
-		stack;
-		return -1;
-	}
-
-	/* We don't need to record directory blocks - they will be
-	 * recorded later...i think... */
-	if (ip->i_di.di_type == GFS_FILE_DIR) {
-		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, osi_buf_t, b_list);
-
-		head_size = (height != 1 ? sizeof(struct gfs_indirect) : sizeof(struct gfs_dinode));
-		ptr = (uint64 *)(bh->b_data + head_size);
-
-		for ( ; (char *)ptr < (bh->b_data + bh->b_size); ptr++)
-		{
-			if (!*ptr)
-				continue;
-
-			block =  gfs64_to_cpu(*ptr);
-
-			if(pass->check_data &&
-			   (pass->check_data(ip, block, pass->private) < 0)) {
-				stack;
-				return -1;
-			}
-		}
-	}
-
-
-	/* free metalists */
-	for (i = 0; i < GFS_MAX_META_HEIGHT; i++)
-	{
-		list = &metalist[i];
-		while (!osi_list_empty(list))
-		{
-			bh = osi_list_entry(list->next, osi_buf_t, b_list);
-			osi_list_del(&bh->b_list);
-			relse_buf(ip->i_sbd, bh);
-		}
-	}
-
-end:
-	if (ip->i_di.di_type == GFS_FILE_DIR) {
-		/* check validity of leaf blocks and leaf chains */
-		if (ip->i_di.di_flags & GFS_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 fsck_inode *ip, osi_buf_t *bh, int *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 fsck_sb *sbp, uint64_t block, struct metawalk_fxns *pass)
-{
-	osi_buf_t *bh;
-	struct fsck_inode *ip;
-	int update = 0;
-	int error = 0;
-
-	if(get_and_read_buf(sbp, block, &bh, 0)){
-		log_err("Unable to retrieve block #%"PRIu64"\n",
-			block);
-		block_set(sbp->bl, block, meta_inval);
-		return -1;
-	}
-
-	if(copyin_inode(sbp, bh, &ip)) {
-		stack;
-		relse_buf(sbp, bh);
-		return -1;
-	}
-
-	if(ip->i_di.di_flags & GFS_DIF_EXHASH) {
-
-		error = check_leaf(ip, &update, pass);
-		if(error < 0) {
-			stack;
-			free_inode(&ip);
-			relse_buf(sbp, bh);
-			return -1;
-		}
-	}
-	else {
-		error = check_linear_dir(ip, bh, &update, pass);
-		if(error < 0) {
-			stack;
-			free_inode(&ip);
-			relse_buf(sbp, bh);
-			return -1;
-		}
-	}
-
-	free_inode(&ip);
-	relse_buf(sbp, bh);
-
-	return error;
-
-}
-
-
-static int remove_dentry(struct fsck_inode *ip, struct gfs_dirent *dent,
-		  struct gfs_dirent *prev_de,
-		  osi_buf_t *bh, char *filename, int *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 gfs_dirent dentry, *de;
-
-	memset(&dentry, 0, sizeof(struct gfs_dirent));
-	gfs_dirent_in(&dentry, (char *)dent);
-	de = &dentry;
-
-	if(de->de_inum.no_addr == *dentryblock) {
-		*update = 1;
-		if(dirent_del(ip, bh, prev_de, dent)) {
-			stack;
-			return -1;
-		}
-	}
-	else {
-		(*count)++;
-		*update = 1;
-	}
-
-	return 0;
-
-}
-
-int remove_dentry_from_dir(struct fsck_sb *sbp, uint64_t dir,
-			   uint64_t dentryblock)
-{
-	struct metawalk_fxns remove_dentry_fxns = {0};
-	struct block_query q;
-	int error;
-
-	log_debug("Removing dentry %"PRIu64" from directory %"PRIu64"\n",
-		  dentryblock, dir);
-	if(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(block_check(sbp->bl, dir, &q)) {
-		stack;
-		return -1;
-	}
-	if(q.block_type != 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 fsck_sb *sbp, uint64_t childblock, struct dir_info **dip)
-{
-	osi_list_t *bucket = &sbp->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/gfs/gfs_fsck/metawalk.h b/gfs/gfs_fsck/metawalk.h
deleted file mode 100644
index 43d1544..0000000
--- a/gfs/gfs_fsck/metawalk.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef _METAWALK_H
-#define _METAWALK_H
-
-#define DIR_LINEAR 1
-#define DIR_EXHASH 2
-
-struct metawalk_fxns;
-
-int check_inode_eattr(struct fsck_inode *ip, struct metawalk_fxns *pass);
-int check_metatree(struct fsck_inode *ip, struct metawalk_fxns *pass);
-int check_dir(struct fsck_sb *sbp, uint64_t block, struct metawalk_fxns *pass);
-int remove_dentry_from_dir(struct fsck_sb *sbp, uint64_t dir,
-			   uint64_t dentryblock);
-int find_di(struct fsck_sb *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 fsck_inode *ip, uint64_t block,
-			   osi_buf_t *bh, void *private);
-	int (*check_metalist) (struct fsck_inode *ip, uint64_t block,
-			       osi_buf_t **bh, void *private);
-	int (*check_data) (struct fsck_inode *ip, uint64_t block,
-			   void *private);
-	int (*check_eattr_indir) (struct fsck_inode *ip, uint64_t block,
-				  uint64_t parent, osi_buf_t **bh,
-				  void *private);
-	int (*check_eattr_leaf) (struct fsck_inode *ip, uint64_t block,
-				 uint64_t parent, osi_buf_t **bh,
-				 void *private);
-	int (*check_dentry) (struct fsck_inode *ip, struct gfs_dirent *de,
-			     struct gfs_dirent *prev,
-			     osi_buf_t *bh, char *filename, int *update,
-			     uint16_t *count,
-			     void *private);
-	int (*check_eattr_entry) (struct fsck_inode *ip,
-				  osi_buf_t *leaf_bh,
-				  struct gfs_ea_header *ea_hdr,
-				  struct gfs_ea_header *ea_hdr_prev,
-				  void *private);
-	int (*check_eattr_extentry) (struct fsck_inode *ip,
-				     uint64_t *ea_data_ptr,
-				     osi_buf_t *leaf_bh,
-				     struct gfs_ea_header *ea_hdr,
-				     struct gfs_ea_header *ea_hdr_prev,
-				     void *private);
-};
-
-#endif /* _METAWALK_H */
diff --git a/gfs/gfs_fsck/ondisk.c b/gfs/gfs_fsck/ondisk.c
deleted file mode 100644
index 8d80173..0000000
--- a/gfs/gfs_fsck/ondisk.c
+++ /dev/null
@@ -1,1342 +0,0 @@
-#ifndef HELPER_PROGRAM
-
-#include "gfs.h"
-
-#define pv(struct, member, fmt) printk("  "#member" = "fmt"\n", struct->member);
-
-#else
-
-#include <stdio.h>
-#include <string.h>
-
-#include "global.h"
-#include "linux_endian.h"
-#include "ondisk.h"
-
-#define printk printf
-#define pv(struct, member, fmt) printf("  "#member" = "fmt"\n", struct->member);
-
-#endif				/*  !HELPER_PROGRAM  */
-
-#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) = gfs16_to_cpu((s2->member));}
-#define CPOUT_16(s1, s2, member) {(s2->member) = cpu_to_gfs16((s1->member));}
-#define CPIN_32(s1, s2, member) {(s1->member) = gfs32_to_cpu((s2->member));}
-#define CPOUT_32(s1, s2, member) {(s2->member) = cpu_to_gfs32((s1->member));}
-#define CPIN_64(s1, s2, member) {(s1->member) = gfs64_to_cpu((s2->member));}
-#define CPOUT_64(s1, s2, member) {(s2->member) = cpu_to_gfs64((s1->member));}
-
-#define pa(struct, member, count) print_array(#member, struct->member, count, console);
-
-/**
- * print_array - Print out an array of bytes
- * @title: what to print before the array
- * @buf: the array
- * @count: the number of bytes
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- *
- */
-
-static void
-print_array(char *title, char *buf, int count, int console)
-{
-	int x;
-
-	printk("  %s =\n", title);
-	for (x = 0; x < count; x++) {
-		printk("%.2X ", (unsigned char) buf[x]);
-		if (x % 16 == 15)
-			printk("\n");
-	}
-	if (x % 16)
-		printk("\n");
-
-}
-
-/**
- * gfs_inum_in - Read in an inode number
- * @no: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_inum_in(struct gfs_inum *no, char *buf)
-{
-	struct gfs_inum *str = (struct gfs_inum *) buf;
-
-	CPIN_64(no, str, no_formal_ino);
-	CPIN_64(no, str, no_addr);
-
-}
-
-/**
- * gfs_inum_out - Write out an inode number
- * @no: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_inum_out(struct gfs_inum *no, char *buf)
-{
-	struct gfs_inum *str = (struct gfs_inum *) buf;
-
-	CPOUT_64(no, str, no_formal_ino);
-	CPOUT_64(no, str, no_addr);
-
-}
-
-/**
- * gfs_inum_print - Print out a inode number
- * @no: the cpu-order buffer
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- *
- */
-
-void
-gfs_inum_print(struct gfs_inum *no, int console)
-{
-
-	pv(no, no_formal_ino, "%" PRIu64);
-	pv(no, no_addr, "%" PRIu64);
-
-}
-
-/**
- * gfs_meta_header_in - Read in a metadata header
- * @mh: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_meta_header_in(struct gfs_meta_header *mh, char *buf)
-{
-	struct gfs_meta_header *str = (struct gfs_meta_header *) buf;
-
-	CPIN_32(mh, str, mh_magic);
-	CPIN_32(mh, str, mh_type);
-	CPIN_64(mh, str, mh_generation);
-	CPIN_32(mh, str, mh_format);
-	CPIN_32(mh, str, mh_incarn);
-
-}
-
-/**
- * gfs_meta_header_in - Write out a metadata header
- * @mh: the cpu-order structure
- * @buf: the disk-order buffer
- *
- * Don't ever change the generation number in this routine.
- * It's done manually in increment_generation().
- */
-
-void
-gfs_meta_header_out(struct gfs_meta_header *mh, char *buf)
-{
-	struct gfs_meta_header *str = (struct gfs_meta_header *) buf;
-
-	CPOUT_32(mh, str, mh_magic);
-	CPOUT_32(mh, str, mh_type);
-	/*CPOUT_64(mh, str, mh_generation); */
-	CPOUT_32(mh, str, mh_format);
-	CPOUT_32(mh, str, mh_incarn);
-
-}
-
-/**
- * gfs_meta_header_print - Print out a metadata header
- * @mh: the cpu-order buffer
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- *
- */
-
-void
-gfs_meta_header_print(struct gfs_meta_header *mh, int console)
-{
-
-	pv(mh, mh_magic, "0x%.8X");
-	pv(mh, mh_type, "%u");
-	pv(mh, mh_generation, "%" PRIu64);
-	pv(mh, mh_format, "%u");
-	pv(mh, mh_incarn, "%u");
-
-}
-
-/**
- * gfs_sb_in - Read in a superblock
- * @sb: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_sb_in(struct gfs_sb *sb, char *buf)
-{
-	struct gfs_sb *str = (struct gfs_sb *) buf;
-
-	gfs_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_flags);
-
-	CPIN_32(sb, str, sb_bsize);
-	CPIN_32(sb, str, sb_bsize_shift);
-	CPIN_32(sb, str, sb_seg_size);
-
-	gfs_inum_in(&sb->sb_jindex_di, (char *) &str->sb_jindex_di);
-	gfs_inum_in(&sb->sb_rindex_di, (char *) &str->sb_rindex_di);
-	gfs_inum_in(&sb->sb_root_di, (char *) &str->sb_root_di);
-
-	CPIN_08(sb, str, sb_lockproto, GFS_LOCKNAME_LEN);
-	CPIN_08(sb, str, sb_locktable, GFS_LOCKNAME_LEN);
-
-	gfs_inum_in(&sb->sb_quota_di, (char *) &str->sb_quota_di);
-	gfs_inum_in(&sb->sb_license_di, (char *) &str->sb_license_di);
-
-	CPIN_08(sb, str, sb_reserved, 96);
-
-}
-
-/**
- * gfs_sb_out - Write out a superblock
- * @sb: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_sb_out(struct gfs_sb *sb, char *buf)
-{
-	struct gfs_sb *str = (struct gfs_sb *) buf;
-
-	gfs_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_flags);
-
-	CPOUT_32(sb, str, sb_bsize);
-	CPOUT_32(sb, str, sb_bsize_shift);
-	CPOUT_32(sb, str, sb_seg_size);
-
-	gfs_inum_out(&sb->sb_jindex_di, (char *) &str->sb_jindex_di);
-	gfs_inum_out(&sb->sb_rindex_di, (char *) &str->sb_rindex_di);
-	gfs_inum_out(&sb->sb_root_di, (char *) &str->sb_root_di);
-
-	CPOUT_08(sb, str, sb_lockproto, GFS_LOCKNAME_LEN);
-	CPOUT_08(sb, str, sb_locktable, GFS_LOCKNAME_LEN);
-
-	gfs_inum_out(&sb->sb_quota_di, (char *) &str->sb_quota_di);
-	gfs_inum_out(&sb->sb_license_di, (char *) &str->sb_license_di);
-
-	CPOUT_08(sb, str, sb_reserved, 96);
-
-}
-
-/**
- * gfs_sb_print - Print out a superblock
- * @sb: the cpu-order buffer
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- *
- */
-
-void
-gfs_sb_print(struct gfs_sb *sb, int console)
-{
-
-	gfs_meta_header_print(&sb->sb_header, console);
-
-	pv(sb, sb_fs_format, "%u");
-	pv(sb, sb_multihost_format, "%u");
-	pv(sb, sb_flags, "%u");
-
-	pv(sb, sb_bsize, "%u");
-	pv(sb, sb_bsize_shift, "%u");
-	pv(sb, sb_seg_size, "%u");
-
-	gfs_inum_print(&sb->sb_jindex_di, console);
-	gfs_inum_print(&sb->sb_rindex_di, console);
-	gfs_inum_print(&sb->sb_root_di, console);
-
-	pv(sb, sb_lockproto, "%s");
-	pv(sb, sb_locktable, "%s");
-
-	gfs_inum_print(&sb->sb_quota_di, console);
-	gfs_inum_print(&sb->sb_license_di, console);
-
-	pa(sb, sb_reserved, 96);
-
-}
-
-/**
- * gfs_jindex_in - Read in a journal index structure
- * @jindex: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_jindex_in(struct gfs_jindex *jindex, char *buf)
-{
-	struct gfs_jindex *str = (struct gfs_jindex *) buf;
-
-	CPIN_64(jindex, str, ji_addr);
-	CPIN_32(jindex, str, ji_nsegment);
-	CPIN_32(jindex, str, ji_pad);
-
-	CPIN_08(jindex, str, ji_reserved, 64);
-
-}
-
-/**
- * gfs_jindex_out - Write out a journal index structure
- * @jindex: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_jindex_out(struct gfs_jindex *jindex, char *buf)
-{
-	struct gfs_jindex *str = (struct gfs_jindex *) buf;
-
-	CPOUT_64(jindex, str, ji_addr);
-	CPOUT_32(jindex, str, ji_nsegment);
-	CPOUT_32(jindex, str, ji_pad);
-
-	CPOUT_08(jindex, str, ji_reserved, 64);
-
-}
-
-/**
- * gfs_jindex_print - Print out a journal index structure
- * @ji: the cpu-order buffer
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- *
- */
-
-void
-gfs_jindex_print(struct gfs_jindex *ji, int console)
-{
-
-	pv(ji, ji_addr, "%" PRIu64);
-	pv(ji, ji_nsegment, "%u");
-	pv(ji, ji_pad, "%u");
-
-	pa(ji, ji_reserved, 64);
-
-}
-
-/**
- * gfs_rindex_in - Read in a resource index structure
- * @rindex: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_rindex_in(struct gfs_rindex *rindex, char *buf)
-{
-	struct gfs_rindex *str = (struct gfs_rindex *) buf;
-
-	CPIN_64(rindex, str, ri_addr);
-	CPIN_32(rindex, str, ri_length);
-	CPIN_32(rindex, str, ri_pad);
-
-	CPIN_64(rindex, str, ri_data1);
-	CPIN_32(rindex, str, ri_data);
-
-	CPIN_32(rindex, str, ri_bitbytes);
-
-	CPIN_08(rindex, str, ri_reserved, 64);
-
-}
-
-/**
- * gfs_rindex_out - Write out a resource index structure
- * @rindex: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_rindex_out(struct gfs_rindex *rindex, char *buf)
-{
-	struct gfs_rindex *str = (struct gfs_rindex *) buf;
-
-	CPOUT_64(rindex, str, ri_addr);
-	CPOUT_32(rindex, str, ri_length);
-	CPOUT_32(rindex, str, ri_pad);
-
-	CPOUT_64(rindex, str, ri_data1);
-	CPOUT_32(rindex, str, ri_data);
-
-	CPOUT_32(rindex, str, ri_bitbytes);
-
-	CPOUT_08(rindex, str, ri_reserved, 64);
-
-}
-
-/**
- * gfs_rindex_print - Print out a resource index structure
- * @ri: the cpu-order buffer
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- *
- */
-
-void
-gfs_rindex_print(struct gfs_rindex *ri, int console)
-{
-
-	pv(ri, ri_addr, "%" PRIu64);
-	pv(ri, ri_length, "%u");
-	pv(ri, ri_pad, "%u");
-
-	pv(ri, ri_data1, "%" PRIu64);
-	pv(ri, ri_data, "%u");
-
-	pv(ri, ri_bitbytes, "%u");
-
-	pa(ri, ri_reserved, 64);
-
-}
-
-/**
- * gfs_rgrp_in - Read in a resource group header
- * @rgrp: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_rgrp_in(struct gfs_rgrp *rgrp, char *buf)
-{
-	struct gfs_rgrp *str = (struct gfs_rgrp *) buf;
-
-	gfs_meta_header_in(&rgrp->rg_header, buf);
-
-	CPIN_32(rgrp, str, rg_flags);
-
-	CPIN_32(rgrp, str, rg_free);
-
-	CPIN_32(rgrp, str, rg_useddi);
-	CPIN_32(rgrp, str, rg_freedi);
-	gfs_inum_in(&rgrp->rg_freedi_list, (char *) &str->rg_freedi_list);
-
-	CPIN_32(rgrp, str, rg_usedmeta);
-	CPIN_32(rgrp, str, rg_freemeta);
-
-	CPIN_08(rgrp, str, rg_reserved, 64);
-
-}
-
-/**
- * gfs_rgrp_out - Write out a resource group header
- * @rgrp: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_rgrp_out(struct gfs_rgrp *rgrp, char *buf)
-{
-	struct gfs_rgrp *str = (struct gfs_rgrp *) buf;
-
-	gfs_meta_header_out(&rgrp->rg_header, buf);
-
-	CPOUT_32(rgrp, str, rg_flags);
-
-	CPOUT_32(rgrp, str, rg_free);
-
-	CPOUT_32(rgrp, str, rg_useddi);
-	CPOUT_32(rgrp, str, rg_freedi);
-	gfs_inum_out(&rgrp->rg_freedi_list, (char *) &str->rg_freedi_list);
-
-	CPOUT_32(rgrp, str, rg_usedmeta);
-	CPOUT_32(rgrp, str, rg_freemeta);
-
-	CPOUT_08(rgrp, str, rg_reserved, 64);
-
-}
-
-/**
- * gfs_rgrp_print - Print out a resource group header
- * @rg: the cpu-order buffer
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- *
- */
-
-void
-gfs_rgrp_print(struct gfs_rgrp *rg, int console)
-{
-
-	gfs_meta_header_print(&rg->rg_header, console);
-
-	pv(rg, rg_flags, "%u");
-
-	pv(rg, rg_free, "%u");
-
-	pv(rg, rg_useddi, "%u");
-	pv(rg, rg_freedi, "%u");
-	gfs_inum_print(&rg->rg_freedi_list, console);
-
-	pv(rg, rg_usedmeta, "%u");
-	pv(rg, rg_freemeta, "%u");
-
-	pa(rg, rg_reserved, 64);
-
-}
-
-/**
- * gfs_quota_in - Read in a quota structures
- * @quota: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_quota_in(struct gfs_quota *quota, char *buf)
-{
-	struct gfs_quota *str = (struct gfs_quota *) buf;
-
-	CPIN_64(quota, str, qu_limit);
-	CPIN_64(quota, str, qu_warn);
-	CPIN_64(quota, str, qu_value);
-
-	CPIN_08(quota, str, qu_reserved, 64);
-
-}
-
-/**
- * gfs_quota_out - Write out a quota structure
- * @quota: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_quota_out(struct gfs_quota *quota, char *buf)
-{
-	struct gfs_quota *str = (struct gfs_quota *) buf;
-
-	CPOUT_64(quota, str, qu_limit);
-	CPOUT_64(quota, str, qu_warn);
-	CPOUT_64(quota, str, qu_value);
-
-	CPOUT_08(quota, str, qu_reserved, 64);
-
-}
-
-/**
- * gfs_quota_print - Print out a quota structure
- * @quota: the cpu-order buffer
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- *
- */
-
-void
-gfs_quota_print(struct gfs_quota *quota, int console)
-{
-
-	pv(quota, qu_limit, "%" PRIu64);
-	pv(quota, qu_warn, "%" PRIu64);
-	pv(quota, qu_value, "%" PRId64);
-
-	pa(quota, qu_reserved, 64);
-
-}
-
-/**
- * gfs_dinode_in - Read in a dinode
- * @dinode: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_dinode_in(struct gfs_dinode *dinode, char *buf)
-{
-	struct gfs_dinode *str = (struct gfs_dinode *) buf;
-
-	gfs_meta_header_in(&dinode->di_header, buf);
-
-	gfs_inum_in(&dinode->di_num, (char *) &str->di_num);
-
-	CPIN_32(dinode, str, di_mode);
-	CPIN_32(dinode, str, di_uid);
-	CPIN_32(dinode, str, di_gid);
-	CPIN_32(dinode, str, di_nlink);
-	CPIN_64(dinode, str, di_size);
-	CPIN_64(dinode, str, di_blocks);
-	CPIN_64(dinode, str, di_atime);
-	CPIN_64(dinode, str, di_mtime);
-	CPIN_64(dinode, str, di_ctime);
-	CPIN_32(dinode, str, di_major);
-	CPIN_32(dinode, str, di_minor);
-
-	CPIN_64(dinode, str, di_rgrp);
-	CPIN_64(dinode, str, di_goal_rgrp);
-	CPIN_32(dinode, str, di_goal_dblk);
-	CPIN_32(dinode, str, di_goal_mblk);
-	CPIN_32(dinode, str, di_flags);
-	CPIN_32(dinode, str, di_payload_format);
-	CPIN_16(dinode, str, di_type);
-	CPIN_16(dinode, str, di_height);
-	CPIN_32(dinode, str, di_incarn);
-	CPIN_16(dinode, str, di_pad);
-
-	CPIN_16(dinode, str, di_depth);
-	CPIN_32(dinode, str, di_entries);
-
-	gfs_inum_in(&dinode->di_next_unused, (char *) &str->di_next_unused);
-
-	CPIN_64(dinode, str, di_eattr);
-
-	CPIN_08(dinode, str, di_reserved, 56);
-
-}
-
-/**
- * gfs_dinode_out - Write out a dinode
- * @dinode: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_dinode_out(struct gfs_dinode *dinode, char *buf)
-{
-	struct gfs_dinode *str = (struct gfs_dinode *) buf;
-
-	gfs_meta_header_out(&dinode->di_header, buf);
-
-	gfs_inum_out(&dinode->di_num, (char *) &str->di_num);
-
-	CPOUT_32(dinode, str, di_mode);
-	CPOUT_32(dinode, str, di_uid);
-	CPOUT_32(dinode, str, di_gid);
-	CPOUT_32(dinode, str, di_nlink);
-	CPOUT_64(dinode, str, di_size);
-	CPOUT_64(dinode, str, di_blocks);
-	CPOUT_64(dinode, str, di_atime);
-	CPOUT_64(dinode, str, di_mtime);
-	CPOUT_64(dinode, str, di_ctime);
-	CPOUT_32(dinode, str, di_major);
-	CPOUT_32(dinode, str, di_minor);
-
-	CPOUT_64(dinode, str, di_rgrp);
-	CPOUT_64(dinode, str, di_goal_rgrp);
-	CPOUT_32(dinode, str, di_goal_dblk);
-	CPOUT_32(dinode, str, di_goal_mblk);
-	CPOUT_32(dinode, str, di_flags);
-	CPOUT_32(dinode, str, di_payload_format);
-	CPOUT_16(dinode, str, di_type);
-	CPOUT_16(dinode, str, di_height);
-	CPOUT_32(dinode, str, di_incarn);
-	CPOUT_16(dinode, str, di_pad);
-
-	CPOUT_16(dinode, str, di_depth);
-	CPOUT_32(dinode, str, di_entries);
-
-	gfs_inum_out(&dinode->di_next_unused, (char *) &str->di_next_unused);
-
-	CPOUT_64(dinode, str, di_eattr);
-
-	CPOUT_08(dinode, str, di_reserved, 56);
-
-}
-
-/**
- * gfs_dinode_print - Print out a dinode
- * @di: the cpu-order buffer
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- *
- */
-
-void
-gfs_dinode_print(struct gfs_dinode *di, int console)
-{
-
-	gfs_meta_header_print(&di->di_header, console);
-
-	gfs_inum_print(&di->di_num, console);
-
-	pv(di, di_mode, "0%o");
-	pv(di, di_uid, "%u");
-	pv(di, di_gid, "%u");
-	pv(di, di_nlink, "%u");
-	pv(di, di_size, "%" PRIu64);
-	pv(di, di_blocks, "%" PRIu64);
-	pv(di, di_atime, "%" PRId64);
-	pv(di, di_mtime, "%" PRId64);
-	pv(di, di_ctime, "%" PRId64);
-	pv(di, di_major, "%u");
-	pv(di, di_minor, "%u");
-
-	pv(di, di_rgrp, "%" PRIu64);
-	pv(di, di_goal_rgrp, "%" PRIu64);
-	pv(di, di_goal_dblk, "%u");
-	pv(di, di_goal_mblk, "%u");
-	pv(di, di_flags, "0x%.8X");
-	pv(di, di_payload_format, "%u");
-	pv(di, di_type, "%u");
-	pv(di, di_height, "%u");
-	pv(di, di_incarn, "%u");
-	pv(di, di_pad, "%u");
-
-	pv(di, di_depth, "%u");
-	pv(di, di_entries, "%u");
-
-	gfs_inum_print(&di->di_next_unused, console);
-
-	pv(di, di_eattr, "%" PRIu64);
-
-	pa(di, di_reserved, 56);
-
-}
-
-/**
- * gfs_indirect_in - copy in the header of an indirect block
- * @indirect: the in memory copy
- * @buf: the buffer copy
- *
- */
-
-void
-gfs_indirect_in(struct gfs_indirect *indirect, char *buf)
-{
-	struct gfs_indirect *str = (struct gfs_indirect *) buf;
-
-	gfs_meta_header_in(&indirect->in_header, buf);
-
-	CPIN_08(indirect, str, in_reserved, 64);
-
-}
-
-/**
- * gfs_indirect_out - copy out the header of an indirect block
- * @indirect: the in memory copy
- * @buf: the buffer copy
- *
- */
-
-void
-gfs_indirect_out(struct gfs_indirect *indirect, char *buf)
-{
-	struct gfs_indirect *str = (struct gfs_indirect *) buf;
-
-	gfs_meta_header_out(&indirect->in_header, buf);
-
-	CPOUT_08(indirect, str, in_reserved, 64);
-
-}
-
-/**
- * gfs_indirect_print - Print out a indirect block header
- * @indirect: the cpu-order buffer
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- *
- */
-
-void
-gfs_indirect_print(struct gfs_indirect *indirect, int console)
-{
-
-	gfs_meta_header_print(&indirect->in_header, console);
-
-	pa(indirect, in_reserved, 64);
-
-}
-
-/**
- * gfs_dirent_in - Read in a directory entry
- * @dirent: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_dirent_in(struct gfs_dirent *dirent, char *buf)
-{
-	struct gfs_dirent *str = (struct gfs_dirent *) buf;
-
-	gfs_inum_in(&dirent->de_inum, (char *) &str->de_inum);
-	CPIN_32(dirent, str, de_hash);
-	CPIN_16(dirent, str, de_rec_len);
-	CPIN_16(dirent, str, de_name_len);
-	CPIN_16(dirent, str, de_type);
-
-	CPIN_08(dirent, str, de_reserved, 14);
-
-}
-
-/**
- * gfs_dirent_out - Write out a directory entry
- * @dirent: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_dirent_out(struct gfs_dirent *dirent, char *buf)
-{
-	struct gfs_dirent *str = (struct gfs_dirent *) buf;
-
-	gfs_inum_out(&dirent->de_inum, (char *) &str->de_inum);
-	CPOUT_32(dirent, str, de_hash);
-	CPOUT_16(dirent, str, de_rec_len);
-	CPOUT_16(dirent, str, de_name_len);
-	CPOUT_16(dirent, str, de_type);
-
-	CPOUT_08(dirent, str, de_reserved, 14);
-
-}
-
-/**
- * gfs_dirent_print - Print out a directory entry
- * @de: the cpu-order buffer
- * @name: the filename
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- *
- */
-
-void
-gfs_dirent_print(struct gfs_dirent *de, char *name, int console)
-{
-	char buf[GFS_FNAMESIZE + 1];
-
-	gfs_inum_print(&de->de_inum, console);
-	pv(de, de_hash, "0x%.8X");
-	pv(de, de_rec_len, "%u");
-	pv(de, de_name_len, "%u");
-	pv(de, de_type, "%u");
-
-	pa(de, de_reserved, 14);
-
-	memset(buf, 0, GFS_FNAMESIZE + 1);
-	memcpy(buf, name, de->de_name_len);
-	printk("  name = %s\n", buf);
-
-}
-
-/**
- * gfs_leaf_in - Read in a directory leaf header
- * @leaf: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_leaf_in(struct gfs_leaf *leaf, char *buf)
-{
-	struct gfs_leaf *str = (struct gfs_leaf *) buf;
-
-	gfs_meta_header_in(&leaf->lf_header, buf);
-
-	CPIN_16(leaf, str, lf_depth);
-	CPIN_16(leaf, str, lf_entries);
-	CPIN_32(leaf, str, lf_dirent_format);
-	CPIN_64(leaf, str, lf_next);
-
-	CPIN_08(leaf, str, lf_reserved, 64);
-
-}
-
-/**
- * gfs_leaf_out - Write out a directory leaf header
- * @leaf: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_leaf_out(struct gfs_leaf *leaf, char *buf)
-{
-	struct gfs_leaf *str = (struct gfs_leaf *) buf;
-
-	gfs_meta_header_out(&leaf->lf_header, buf);
-
-	CPOUT_16(leaf, str, lf_depth);
-	CPOUT_16(leaf, str, lf_entries);
-	CPOUT_32(leaf, str, lf_dirent_format);
-	CPOUT_64(leaf, str, lf_next);
-
-	CPOUT_08(leaf, str, lf_reserved, 64);
-
-}
-
-/**
- * gfs_leaf_print - Print out a directory leaf header
- * @lf: the cpu-order buffer
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- *
- */
-
-void
-gfs_leaf_print(struct gfs_leaf *lf, int console)
-{
-
-	gfs_meta_header_print(&lf->lf_header, console);
-
-	pv(lf, lf_depth, "%u");
-	pv(lf, lf_entries, "%u");
-	pv(lf, lf_dirent_format, "%u");
-	pv(lf, lf_next, "%" PRIu64);
-
-	pa(lf, lf_reserved, 64);
-
-}
-
-/**
- * gfs_log_header_in - Read in a log header
- * @head: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_log_header_in(struct gfs_log_header *head, char *buf)
-{
-	struct gfs_log_header *str = (struct gfs_log_header *) buf;
-
-	gfs_meta_header_in(&head->lh_header, buf);
-
-	CPIN_32(head, str, lh_flags);
-	CPIN_32(head, str, lh_pad);
-
-	CPIN_64(head, str, lh_first);
-	CPIN_64(head, str, lh_sequence);
-
-	CPIN_64(head, str, lh_tail);
-	CPIN_64(head, str, lh_last_dump);
-
-	CPIN_08(head, str, lh_reserved, 64);
-
-}
-
-/**
- * gfs_log_header_out - Write out a log header
- * @head: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_log_header_out(struct gfs_log_header *head, char *buf)
-{
-	struct gfs_log_header *str = (struct gfs_log_header *) buf;
-
-	gfs_meta_header_out(&head->lh_header, buf);
-
-	CPOUT_32(head, str, lh_flags);
-	CPOUT_32(head, str, lh_pad);
-
-	CPOUT_64(head, str, lh_first);
-	CPOUT_64(head, str, lh_sequence);
-
-	CPOUT_64(head, str, lh_tail);
-	CPOUT_64(head, str, lh_last_dump);
-
-	CPOUT_08(head, str, lh_reserved, 64);
-
-}
-
-/**
- * gfs_log_header_print - Print out a log header
- * @head: the cpu-order buffer
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- *
- */
-
-void
-gfs_log_header_print(struct gfs_log_header *lh, int console)
-{
-
-	gfs_meta_header_print(&lh->lh_header, console);
-
-	pv(lh, lh_flags, "0x%.8X");
-	pv(lh, lh_pad, "%u");
-
-	pv(lh, lh_first, "%" PRIu64);
-	pv(lh, lh_sequence, "%" PRIu64);
-
-	pv(lh, lh_tail, "%" PRIu64);
-	pv(lh, lh_last_dump, "%" PRIu64);
-
-	pa(lh, lh_reserved, 64);
-
-}
-
-/**
- * gfs_desc_in - Read in a log descriptor
- * @desc: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_desc_in(struct gfs_log_descriptor *desc, char *buf)
-{
-	struct gfs_log_descriptor *str = (struct gfs_log_descriptor *) buf;
-
-	gfs_meta_header_in(&desc->ld_header, buf);
-
-	CPIN_32(desc, str, ld_type);
-	CPIN_32(desc, str, ld_length);
-	CPIN_32(desc, str, ld_data1);
-	CPIN_32(desc, str, ld_data2);
-
-	CPIN_08(desc, str, ld_reserved, 64);
-
-}
-
-/**
- * gfs_desc_out - Write out a log descriptor
- * @desc: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_desc_out(struct gfs_log_descriptor *desc, char *buf)
-{
-	struct gfs_log_descriptor *str = (struct gfs_log_descriptor *) buf;
-
-	gfs_meta_header_out(&desc->ld_header, buf);
-
-	CPOUT_32(desc, str, ld_type);
-	CPOUT_32(desc, str, ld_length);
-	CPOUT_32(desc, str, ld_data1);
-	CPOUT_32(desc, str, ld_data2);
-
-	CPOUT_08(desc, str, ld_reserved, 64);
-
-}
-
-/**
- * gfs_desc_print - Print out a log descriptor
- * @ld: the cpu-order buffer
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- *
- */
-
-void
-gfs_desc_print(struct gfs_log_descriptor *ld, int console)
-{
-
-	gfs_meta_header_print(&ld->ld_header, console);
-
-	pv(ld, ld_type, "%u");
-	pv(ld, ld_length, "%u");
-	pv(ld, ld_data1, "%u");
-	pv(ld, ld_data2, "%u");
-
-	pa(ld, ld_reserved, 64);
-
-}
-
-/**
- * gfs_block_tag_in - Read in a block tag
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_block_tag_in(struct gfs_block_tag *tag, char *buf)
-{
-	struct gfs_block_tag *str = (struct gfs_block_tag *) buf;
-
-	CPIN_64(tag, str, bt_blkno);
-	CPIN_32(tag, str, bt_flags);
-	CPIN_32(tag, str, bt_pad);
-
-}
-
-/**
- * gfs_block_tag_out - Write out a block tag
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_block_tag_out(struct gfs_block_tag *tag, char *buf)
-{
-	struct gfs_block_tag *str = (struct gfs_block_tag *) buf;
-
-	CPOUT_64(tag, str, bt_blkno);
-	CPOUT_32(tag, str, bt_flags);
-	CPOUT_32(tag, str, bt_pad);
-
-}
-
-/**
- * gfs_block_tag_print - Print out a block tag
- * @tag: the cpu-order buffer
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- *
- */
-
-void
-gfs_block_tag_print(struct gfs_block_tag *tag, int console)
-{
-
-	pv(tag, bt_blkno, "%" PRIu64);
-	pv(tag, bt_flags, "%u");
-	pv(tag, bt_pad, "%u");
-
-}
-
-/**
- * gfs_quota_tag_in - Read in a quota tag
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_quota_tag_in(struct gfs_quota_tag *tag, char *buf)
-{
-	struct gfs_quota_tag *str = (struct gfs_quota_tag *) buf;
-
-	CPIN_64(tag, str, qt_change);
-	CPIN_32(tag, str, qt_flags);
-	CPIN_32(tag, str, qt_id);
-
-}
-
-/**
- * gfs_quota_tag_out - Write out a quota tag
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_quota_tag_out(struct gfs_quota_tag *tag, char *buf)
-{
-	struct gfs_quota_tag *str = (struct gfs_quota_tag *) buf;
-
-	CPOUT_64(tag, str, qt_change);
-	CPOUT_32(tag, str, qt_flags);
-	CPOUT_32(tag, str, qt_id);
-
-}
-
-/**
- * gfs_quota_tag_print - Print out a quota tag
- * @tag: the cpu-order buffer
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- *
- */
-
-void
-gfs_quota_tag_print(struct gfs_quota_tag *tag, int console)
-{
-
-	pv(tag, qt_change, "%" PRId64);
-	pv(tag, qt_flags, "0x%.8X");
-	pv(tag, qt_id, "%u");
-
-}
-
-/**
- * gfs_ea_header_in - Read in a Extended Attribute header
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_ea_header_in(struct gfs_ea_header *ea, char *buf)
-{
-	struct gfs_ea_header *str = (struct gfs_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;
-	CPIN_32(ea, str, ea_pad);
-
-}
-
-/**
- * gfs_ea_header_out - Write out a Extended Attribute header
- * @ea: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_ea_header_out(struct gfs_ea_header *ea, char *buf)
-{
-	struct gfs_ea_header *str = (struct gfs_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;
-	CPOUT_32(ea, str, ea_pad);
-
-}
-
-/**
- * gfs_ea_header_printt - Print out a Extended Attribute header
- * @ea: the cpu-order buffer
- * @console - TRUE if this should be printed to the console,
- *            FALSE if it should be just printed to the incore debug
- *            buffer
- *
- */
-
-void
-gfs_ea_header_print(struct gfs_ea_header *ea, int console)
-{
-
-	pv(ea, ea_rec_len, "%u");
-	pv(ea, ea_data_len, "%u");
-	pv(ea, ea_name_len, "%u");
-	pv(ea, ea_type, "%u");
-	pv(ea, ea_flags, "%u");
-	pv(ea, ea_num_ptrs, "%u");
-	pv(ea, ea_pad, "%u");
-
-}
-
-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
-};
-
-/**
- * gfs_dir_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.
- *
- * 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
-gfs_dir_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;
-}
diff --git a/gfs/gfs_fsck/ondisk.h b/gfs/gfs_fsck/ondisk.h
deleted file mode 100644
index 01875c0..0000000
--- a/gfs/gfs_fsck/ondisk.h
+++ /dev/null
@@ -1,2045 +0,0 @@
-/*
- * On-disk structures.
- *
- * THE BIG PICTURE of on-disk layout:
- *
- * GFS filesystem code views the entire filesystem, including journals, as
- * one contiguous group of blocks on one (perhaps virtual) storage device.
- * The filesystem space is shared, not distributed; each node in the cluster
- * must see the entire filesystem space.
- *
- * If the filesystem is spread across multiple physical storage devices,
- * volume management (device mapping) must be used to present the fileystem
- * space to GFS as one (virtual) device, with contiguous blocks.
- *
- * The superblock contains basic information about the filesytem, and appears
- * at a location 64 KBytes into the filesystem.  The first 64 KBytes of the
- * filesystem are empty, providing a safety buffer against wayward volume
- * management software (that sometimes write data into the first few bytes of
- * a device) or administrators.
- *
- * After the superblock, the rest of the filesystem is divided into multiple
- * Resource Groups and several journals.
- *
- * The Resource Groups (RGs or rgrps) contain the allocatable blocks that are
- * used for storing files, directories, etc., and all of the associated
- * metadata.  Each RG has its own set of block allocation statistics (within
- * the RG header), a number of blocks containing the block allocation bitmap,
- * and a large number of allocatable blocks for file data and metadata.
- * Multiple RGs allow multiple nodes to simultaneously allocate blocks from the 
- * filesystem (using different RGs), enhancing parallel access.  RG size and
- * number of RGs are determined by gfs_mkfs when creating the filesystem.
- * An administrator can specify RG size (see man gfs_mkfs).
- *
- * The journals contain temporary copies of metadata blocks, along with
- * other data, that allow GFS to recover the filesystem to a consistent state
- * (at least as far as metadata is concerned) if a node fails in the midst
- * of performing a write transaction.  There must be one journal for each node
- * in the cluster.  Since access to the entire filesystem space is shared,
- * if a node crashes, another node will be able to read the crashed node's
- * journal, and perform recovery.
- *
- * Currently, gfs_mkfs places the journals right in the middle of a freshly
- * created filesystem space, between 2 large groups of RGs.  From a filesystem
- * layout perspective, this placement is not a requirement; the journals
- * could be placed anywhere within the filesystem space.
- *
- * New Resource Groups and Journals may be added to the filesystem after the
- * filesystem has been created, if the filesystem's (virtual) device is made
- * larger.  See man gfs_grow and gfs_jadd.
- *
- * A few special hidden inodes are contained in a GFS filesystem.  They do
- * not appear in any directories; instead, the superblock points to them
- * using block numbers for their location.  The special inodes are:
- *
- *   Root inode:  Root directory of the filesystem
- *   Resource Group Index:  A file containing block numbers and sizes of all RGs
- *   Journal Index:  A file containing block numbers and sizes of all journals
- *   Quota:  A file containing all quota information for the filesystem
- *   License:  A file containing license information
- *
- * Note that there is NOTHING RELATED TO INTER-NODE LOCK MANAGEMENT ON-DISK.
- * Locking is handled completely off-disk, typically via LAN.
- *
- * NOTE:
- * If you add 8 byte fields to these structures, they must be 8 byte
- * aligned.  4 byte field must be 4 byte aligned, etc...
- *
- * All structures must be a multiple of 8 bytes long.
- *
- * GRIPES:
- * We should have forgetten about supporting 512B FS block sizes 
- * and made the di_reserved field in the struct gfs_dinode structure
- * much bigger.
- *
- * de_rec_len in struct gfs_dirent should really have been a 32-bit value
- * as it now limits us to a 64k FS block size (with the current code
- * in dir.c).
- */
-
-#ifndef __GFS_ONDISK_DOT_H__
-#define __GFS_ONDISK_DOT_H__
-
-#define GFS_MAGIC               (0x01161970) /* for all on-disk headers */
-#define GFS_BASIC_BLOCK         (512)  /* "basic block" = "sector" = 512B */
-#define GFS_BASIC_BLOCK_SHIFT   (9)
-
-/*  Controls how much data can be logged in-core before dumping log to disk */
-
-#define GFS_DUMPS_PER_LOG       (4)    /* 1/4 of on-disk journal size*/
-
-/*  Lock numbers of the LM_TYPE_NONDISK type.  These protect certain
- *  cluster-wide operations (rather than on-disk entities).
- *  Currently, the LIVE lock is not used for any real purpose.  */
-
-#define GFS_MOUNT_LOCK          (0)    /* only one node can Mount at a time */
-#define GFS_LIVE_LOCK           (1)    /* shared by all mounted nodes */
-#define GFS_TRANS_LOCK          (2)    /* Transaction, protects jrnl recovery */
-#define GFS_RENAME_LOCK         (3)    /* only one node can Rename at a time */
-
-/*  On-disk format (version) numbers for various metadata types,
- *  used in gfs_meta_header  */
-
-#define GFS_FORMAT_SB           (100)  /* Super-Block */
-#define GFS_FORMAT_RG           (200)  /* Resource Group Header */
-#define GFS_FORMAT_RB           (300)  /* Resource Group Block Alloc BitBlock */
-#define GFS_FORMAT_DI           (400)  /* "Disk" inode (dinode) */
-#define GFS_FORMAT_IN           (500)  /* Indirect dinode block list */
-#define GFS_FORMAT_LF           (600)  /* Leaf dinode block list */
-#define GFS_FORMAT_JD           (700)  /* Journal Data */
-#define GFS_FORMAT_LH           (800)  /* Log Header */
-#define GFS_FORMAT_LD           (900)  /* Log Descriptor */
-/*  These don't have actual struct gfs_meta_header structures to go with them */
-#define GFS_FORMAT_JI           (1000) /* Journal Index */
-#define GFS_FORMAT_RI           (1100) /* Resource Group Index */
-#define GFS_FORMAT_DE           (1200) /* Directory Entry */
-#define GFS_FORMAT_QU           (1500) /* Quota */
-#define GFS_FORMAT_EA           (1600) /* Extended Attribute */
-#define GFS_FORMAT_ED           (1700) /* Extended Attribute data */
-/*  These version #s are embedded in the superblock  */
-#define GFS_FORMAT_FS           (1309) /* Filesystem (all-encompassing) */
-#define GFS_FORMAT_MULTI        (1401) /* Multi-Host */
-
-/*
- *  An on-disk inode number
- *  Initially, the on-disk block address of the inode block is assigned as the
- *  formal (permanent) ID as well.  Block address can change (to move inode
- *  on-disk), but formal ID must stay unchanged once assigned.
- */
-
-#define gfs_inum_equal(ino1, ino2) \
-(((ino1)->no_formal_ino == (ino2)->no_formal_ino) && \
- ((ino1)->no_addr == (ino2)->no_addr))
-
-struct gfs_inum {
-	uint64_t no_formal_ino;        /* inode identifier */
-	uint64_t no_addr;              /* block # of dinode block */
-};
-
-/*
- *  Generic metadata head structure
- *
- *  Every inplace buffer logged in the journal must start
- *  with a struct gfs_meta_header.
- *
- *  In addition to telling what kind of metadata is in the block,
- *  the metaheader contains the important generation and incarnation
- *  numbers.
- *
- *  The generation number is used during journal recovery to determine
- *  whether an in-place block on-disk is older than an on-disk journaled copy
- *  of the block.  If so, GFS overwrites the in-place block with the journaled
- *  version of the block.
- *
- *  A meta block's generation number must increment monotonically across the
- *  cluster, each time new contents are committed to the block.  This means
- *  that whenever GFS allocates a pre-existing metadata block, GFS must read
- *  that block from disk (in case another node has incremented it).  It also
- *  means that GFS must sync the block (with incremented generation number)
- *  to disk (both log and in-place blocks), not only after changing contents
- *  of the block, but also after de-allocating the block (GFS can't just throw
- *  away incore metadata for a file that it's just erased).
- *
- *  The incarnation number is used only for on-disk (d)inodes.  GFS increments
- *  it each time it de-allocates a dinode block (i.e. each time the dinode
- *  loses its identity with a particular file, directory, etc.).  When the
- *  dinode is later allocated (i.e. to be identified with a new file, etc.),
- *  GFS copies the incarnation number into the VFS inode's i_generation member.
- *  If GFS is used as the backing store for an NFS server, GFS uses this
- *  i_generation number as part of the NFS filehandle, which differentiates
- *  it from the previous identity of the dinode, and helps protect against
- *  filesystem corruption that could happen with the use of outdated,
- *  invalid, or malicious filehandles.  See ops_export.c.
- *
- *  GFS caches de-allocated meta-headers, to minimize disk reads.
- *  See struct gfs_meta_header_cache.
- */
-
-#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 */
-
-
-#define GFS_META_CLUMP          (64)   /* # blocks to convert fm data to meta */
-
-struct gfs_meta_header {
-	uint32_t mh_magic;      /* GFS_MAGIC sanity check magic number */
-	uint32_t mh_type;       /* GFS_METATYPE_XX type of metadata block */
-	uint64_t mh_generation; /* increment before writing to journal */
-	uint32_t mh_format;     /* GFS_FORMAT_XX (version # for this type) */
-	uint32_t mh_incarn;     /* increment when marking dinode "unused" */
-};
-
-/*
- *  super-block structure
- *
- *  One of these is at beginning of filesystem.
- *  It's probably good if SIZEOF_SB <= GFS_BASIC_BLOCK (512 bytes)
- */
-
-/*  Address of SuperBlock in GFS basic blocks.  1st 64K of filesystem is empty
-    for safety against getting clobbered by wayward volume managers, etc.
-    64k was chosen because it's the largest GFS-supported fs block size.  */
-#define GFS_SB_ADDR             (128)
-
-/*  The lock number for the superblock (must be zero)  */
-#define GFS_SB_LOCK             (0)
-#define GFS_CRAP_LOCK           (1)
-
-/*  Requirement:  GFS_LOCKNAME_LEN % 8 == 0
-    Includes: the fencing zero at the end  */
-#define GFS_LOCKNAME_LEN        (64)
-
-struct gfs_sb {
-	/*  Order is important; need to be able to read old superblocks
-	    in order to support on-disk version upgrades */
-	struct gfs_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 gfs_inum sb_jindex_di;  /* journal index inode */
-	struct gfs_inum sb_rindex_di;  /* resource group index inode */
-	struct gfs_inum sb_root_di;    /* root directory inode */
-
-	/* Default inter-node locking protocol (lock module) and namespace */
-	char sb_lockproto[GFS_LOCKNAME_LEN]; /* lock protocol name */
-	char sb_locktable[GFS_LOCKNAME_LEN]; /* unique name for this FS */
-
-	/* More special inodes */
-	struct gfs_inum sb_quota_di;   /* quota inode */
-	struct gfs_inum sb_license_di; /* license inode */
-
-	char sb_reserved[96];
-};
-
-/*
- *  journal index structure 
- *
- *  One for each journal used by the filesystem.
- *  These descriptors are packed contiguously within the jindex inode (file).
- */
-
-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];
-};
-
-/*
- *  resource index structure 
- *
- *  One of these for each resource group in the filesystem.
- *  These descriptors are packed contiguously within the rindex inode (file).
- *  Also see struct gfs_rgrp.
- */
-
-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];
-};
-
-/*
- *  resource group header structure
- *
- *  One of these at beginning of the first block of an rgrp,
- *     followed by block alloc bitmap data in remainder of first block.
- *  Each resource group contains:
- *    Header block, including block allocation statistics (struct gfs_rgrp)
- *       and first part of block alloc bitmap.
- *    Bitmap block(s), continuing block alloc bitmap started in header block.
- *    Data/meta blocks, allocatable blocks containing file data and metadata.
- *  
- *  In older versions, now-unused (but previously allocated) dinodes were
- *  saved for re-use in an on-disk linked list (chain).  This is no longer
- *  done, but support still exists for reclaiming dinodes from this list,
- *  to support upgrades from older on-disk formats.
- */
-
-/* Each data block within rgrp is represented by 2 bits in the alloc bitmap */
-#define GFS_NBBY                (4)  /* # blocks represented by 1 bitmap byte */
-#define GFS_BIT_SIZE            (2)
-#define GFS_BIT_MASK            (0x00000003)
-
-/*
- * 4 possible block allocation states:
- *   bit 0 = alloc(1)/free(0)
- *   bit 1 = metadata(1)/data(0)
- */
-#define GFS_BLKST_FREE          (0)
-#define GFS_BLKST_USED          (1)
-#define GFS_BLKST_FREEMETA      (2)
-#define GFS_BLKST_USEDMETA      (3)
-
-struct gfs_rgrp {
-	struct gfs_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 gfs_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];
-};
-
-/*
- *  quota structure
- */
-
-struct gfs_quota {
-	uint64_t qu_limit;
-	uint64_t qu_warn;
-	int64_t qu_value;
-
-	char qu_reserved[64];
-};
-
-/*
- *  dinode (disk inode) structure
- *  The ondisk representation of inodes
- *  One for each file, directory, etc.
- *  GFS does not put more than one inode in a single block.
- *  The inode may be "stuffed", carrying file data along with metadata,
- *    if the file data is small enough.
- *  Otherwise, the inode block contains pointers to other blocks that contain
- *    either file data or other pointers to other blocks (indirect addressing
- *    via a metadata tree).
- */
-
-#define GFS_MAX_META_HEIGHT     (10)
-#define GFS_DIR_MAX_DEPTH       (17)
-
-/*  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 */
-
-/*  Dinode flags  */
-#define GFS_DIF_JDATA             (0x00000001) /* jrnl all data for this file */
-#define GFS_DIF_EXHASH            (0x00000002) /* hashed directory (leaves) */
-#define GFS_DIF_UNUSED            (0x00000004) /* unused dinode */
-#define GFS_DIF_EA_INDIRECT       (0x00000008) /* extended attribute, indirect*/
-#define GFS_DIF_DIRECTIO          (0x00000010)
-#define GFS_DIF_IMMUTABLE         (0x00000020) /* Can't change file */
-#define GFS_DIF_APPENDONLY        (0x00000040) /* Can only add to end of file */
-#define GFS_DIF_NOATIME           (0x00000080) /* Don't update access time
-						  (currently unused/ignored) */
-#define GFS_DIF_SYNC              (0x00000100) /* Flush to disk, don't cache
-						  (currently unused/ignored) */
-#define GFS_DIF_INHERIT_DIRECTIO  (0x40000000) /* new files get DIRECTIO flag */
-#define GFS_DIF_INHERIT_JDATA     (0x80000000) /* new files get JDATA flag */
-
-struct gfs_dinode {
-	struct gfs_meta_header di_header;
-
-	struct gfs_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 gfs_inum di_next_unused;  /* used in old versions only */
-
-	uint64_t di_eattr;	/* extended attribute block number */
-
-	char di_reserved[56];
-};
-
-/*
- *  indirect block header
- *
- *  A component of a dinode's indirect addressing metadata tree.
- *  These are pointed to by pointers in dinodes or other indirect blocks.
- */
-
-struct gfs_indirect {
-	struct gfs_meta_header in_header;
-
-	char in_reserved[64];
-};
-
-/*
- *  directory structure - many of these per directory file
- *
- * See comments at beginning of dir.c
- */
-
-#define GFS_FNAMESIZE               (255)
-#define GFS_DIRENT_SIZE(name_len) ((sizeof(struct gfs_dirent) + (name_len) + 7) & ~7)
-
-struct gfs_dirent {
-	struct gfs_inum de_inum;    /* formal inode number and block address */
-	uint32_t de_hash;           /* hash of the filename */
-	uint16_t de_rec_len;        /* the length of the dirent */
-	uint16_t de_name_len;       /* the length of the name */
-	uint16_t de_type;           /* GFS_FILE_... type of dinode this points to */
-
-	char de_reserved[14];
-};
-
-/*
- *  Header of leaf directory nodes
- *
- * See comments at beginning of dir.c
- */
-
-struct gfs_leaf {
-	struct gfs_meta_header lf_header;
-
-	uint16_t lf_depth;          /* Depth of leaf */
-	uint16_t lf_entries;        /* Number of dirents in leaf */
-	uint32_t lf_dirent_format;  /* GFS_FORMAT_DE (version #) */
-	uint64_t lf_next;           /* Next leaf, if overflow */
-
-	char lf_reserved[64];
-};
-
-/*
- *  Log header structure
- *
- *  Two of these are in the first block of a transaction log:
- *    1)  at beginning of block
- *    2)  at end of first 512-byte sector within block
- */
-
-#define GFS_LOG_HEAD_UNMOUNT    (0x00000001)  /* log is clean, can unmount fs */
-
-struct gfs_log_header {
-	struct gfs_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];
-};
-
-/*
- *  Log type descriptor
- *
- *  One of these for each chunk in a transaction
- */
-
-#define GFS_LOG_DESC_METADATA   (300)    /* metadata */
-/*  ld_data1 is the number (quantity) of metadata blocks in the descriptor.
-    ld_data2 is unused.
-    */
-
-#define GFS_LOG_DESC_IUL        (400)    /* unlinked inode */
-/*  ld_data1 is TRUE if this is a dump.
-    ld_data2 is unused.
-    FixMe!!!  ld_data1 should be the number (quantity) of entries.
-              ld_data2 should be "TRUE if this is a dump".
-    */
-
-#define GFS_LOG_DESC_IDA        (401)    /* de-allocated inode */
-/*  ld_data1 is unused.
-    ld_data2 is unused.
-    FixMe!!!  ld_data1 should be the number (quantity) of entries.
-    */
-
-#define GFS_LOG_DESC_Q          (402)    /* quota */
-/*  ld_data1 is the number of quota changes in the descriptor.
-    ld_data2 is TRUE if this is a dump.
-    */
-
-#define GFS_LOG_DESC_LAST       (500)    /* final in a logged transaction */
-/*  ld_data1 is unused.
-    ld_data2 is unused.
-    */
-
-struct gfs_log_descriptor {
-	struct gfs_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];
-};
-
-/*
- *  Metadata block tags
- *
- *  One for each logged block.  Tells where block really belongs on-disk.
- *  These descriptor tags are packed contiguously after a gfs_log_descriptor.
- */
-
-struct gfs_block_tag {
-	uint64_t bt_blkno;	/* inplace block number */
-	uint32_t bt_flags;	/* ?? */
-	uint32_t bt_pad;
-};
-
-/*
- *  Quota Journal Tag
- */
-
-#define GFS_QTF_USER            (0x00000001)
-
-struct gfs_quota_tag {
-	int64_t qt_change;
-	uint32_t qt_flags;      /* GFS_QTF_... */
-	uint32_t qt_id;
-};
-
-/*
- *  Extended attribute header format
- */
-
-#define GFS_EA_MAX_NAME_LEN     (255)
-#define GFS_EA_MAX_DATA_LEN     (65536)
-
-#define GFS_EATYPE_UNUSED       (0)
-#define GFS_EATYPE_USR          (1)     /* user attribute */
-#define GFS_EATYPE_SYS          (2)     /* system attribute */
-#define GFS_EATYPE_SECURITY     (3)	/* security attribute */
-
-#define GFS_EATYPE_LAST         (3)
-#define GFS_EATYPE_VALID(x)     ((x) <= GFS_EATYPE_LAST)
-
-#define GFS_EAFLAG_LAST         (0x01)	/* last ea in block */
-
-struct gfs_ea_header {
-	uint32_t ea_rec_len;    /* total record length: hdr + name + data */
-	uint32_t ea_data_len;   /* data length, in bytes */
-	uint8_t ea_name_len;    /* no NULL pointer after the string */
-	uint8_t ea_type;        /* GFS_EATYPE_... */
-	uint8_t ea_flags;       /* GFS_EAFLAG_... */
-	uint8_t ea_num_ptrs;    /* # fs blocks needed for EA */
-	uint32_t ea_pad;
-};
-
-/*  Endian functions  */
-
-#define GFS_ENDIAN_BIG
-
-#ifdef GFS_ENDIAN_BIG
-
-#define gfs16_to_cpu be16_to_cpu
-#define gfs32_to_cpu be32_to_cpu
-#define gfs64_to_cpu be64_to_cpu
-
-#define cpu_to_gfs16 cpu_to_be16
-#define cpu_to_gfs32 cpu_to_be32
-#define cpu_to_gfs64 cpu_to_be64
-
-#else				/*  GFS_ENDIAN_BIG  */
-
-#define gfs16_to_cpu le16_to_cpu
-#define gfs32_to_cpu le32_to_cpu
-#define gfs64_to_cpu le64_to_cpu
-
-#define cpu_to_gfs16 cpu_to_le16
-#define cpu_to_gfs32 cpu_to_le32
-#define cpu_to_gfs64 cpu_to_le64
-
-#endif				/*  GFS_ENDIAN_BIG  */
-
-/*  Translation functions  */
-
-void gfs_inum_in(struct gfs_inum *no, char *buf);
-void gfs_inum_out(struct gfs_inum *no, char *buf);
-void gfs_meta_header_in(struct gfs_meta_header *mh, char *buf);
-void gfs_meta_header_out(struct gfs_meta_header *mh, char *buf);
-void gfs_sb_in(struct gfs_sb *sb, char *buf);
-void gfs_sb_out(struct gfs_sb *sb, char *buf);
-void gfs_jindex_in(struct gfs_jindex *jindex, char *buf);
-void gfs_jindex_out(struct gfs_jindex *jindex, char *buf);
-void gfs_rindex_in(struct gfs_rindex *rindex, char *buf);
-void gfs_rindex_out(struct gfs_rindex *rindex, char *buf);
-void gfs_rgrp_in(struct gfs_rgrp *rgrp, char *buf);
-void gfs_rgrp_out(struct gfs_rgrp *rgrp, char *buf);
-void gfs_quota_in(struct gfs_quota *quota, char *buf);
-void gfs_quota_out(struct gfs_quota *quota, char *buf);
-void gfs_dinode_in(struct gfs_dinode *dinode, char *buf);
-void gfs_dinode_out(struct gfs_dinode *dinode, char *buf);
-void gfs_indirect_in(struct gfs_indirect *indirect, char *buf);
-void gfs_indirect_out(struct gfs_indirect *indirect, char *buf);
-void gfs_dirent_in(struct gfs_dirent *dirent, char *buf);
-void gfs_dirent_out(struct gfs_dirent *dirent, char *buf);
-void gfs_leaf_in(struct gfs_leaf *leaf, char *buf);
-void gfs_leaf_out(struct gfs_leaf *leaf, char *buf);
-void gfs_log_header_in(struct gfs_log_header *head, char *buf);
-void gfs_log_header_out(struct gfs_log_header *head, char *buf);
-void gfs_desc_in(struct gfs_log_descriptor *desc, char *buf);
-void gfs_desc_out(struct gfs_log_descriptor *desc, char *buf);
-void gfs_block_tag_in(struct gfs_block_tag *btag, char *buf);
-void gfs_block_tag_out(struct gfs_block_tag *btag, char *buf);
-void gfs_quota_tag_in(struct gfs_quota_tag *qtag, char *buf);
-void gfs_quota_tag_out(struct gfs_quota_tag *qtag, char *buf);
-void gfs_ea_header_in(struct gfs_ea_header *qtag, char *buf);
-void gfs_ea_header_out(struct gfs_ea_header *qtag, char *buf);
-
-/*  Printing functions  */
-
-void gfs_inum_print(struct gfs_inum *no, int console);
-void gfs_meta_header_print(struct gfs_meta_header *mh, int console);
-void gfs_sb_print(struct gfs_sb *sb, int console);
-void gfs_jindex_print(struct gfs_jindex *jindex, int console);
-void gfs_rindex_print(struct gfs_rindex *rindex, int console);
-void gfs_rgrp_print(struct gfs_rgrp *rgrp, int console);
-void gfs_quota_print(struct gfs_quota *quota, int console);
-void gfs_dinode_print(struct gfs_dinode *dinode, int console);
-void gfs_indirect_print(struct gfs_indirect *indirect, int console);
-void gfs_dirent_print(struct gfs_dirent *dirent, char *name, int console);
-void gfs_leaf_print(struct gfs_leaf *leaf, int console);
-void gfs_log_header_print(struct gfs_log_header *head, int console);
-void gfs_desc_print(struct gfs_log_descriptor *desc, int console);
-void gfs_block_tag_print(struct gfs_block_tag *tag, int console);
-void gfs_quota_tag_print(struct gfs_quota_tag *tag, int console);
-void gfs_ea_header_print(struct gfs_ea_header *ea, int console);
-
-/*  The hash function for ExHash directories  */
-
-uint32_t gfs_dir_hash(const char *data, int len);
-
-#endif /* __GFS_ONDISK_DOT_H__ */
-
-
-
-#ifdef WANT_GFS_CONVERSION_FUNCTIONS
-
-#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) = gfs16_to_cpu((s2->member));}
-#define CPOUT_16(s1, s2, member) {(s2->member) = cpu_to_gfs16((s1->member));}
-#define CPIN_32(s1, s2, member) {(s1->member) = gfs32_to_cpu((s2->member));}
-#define CPOUT_32(s1, s2, member) {(s2->member) = cpu_to_gfs32((s1->member));}
-#define CPIN_64(s1, s2, member) {(s1->member) = gfs64_to_cpu((s2->member));}
-#define CPOUT_64(s1, s2, member) {(s2->member) = cpu_to_gfs64((s1->member));}
-
-#define pa(struct, member, count) print_array(#member, struct->member, count);
-
-/**
- * print_array - Print out an array of bytes
- * @title: what to print before the array
- * @buf: the array
- * @count: the number of bytes
- *
- */
-
-static void
-print_array(char *title, char *buf, int count)
-{
-	ENTER(GFN_PRINT_ARRAY)
-	int x;
-
-	printk("  %s =\n", title);
-	for (x = 0; x < count; x++) {
-		printk("%.2X ", (unsigned char)buf[x]);
-		if (x % 16 == 15)
-			printk("\n");
-	}
-	if (x % 16)
-		printk("\n");
-
-	RET(GFN_PRINT_ARRAY);
-}
-
-/**
- * gfs_inum_in - Read in an inode number
- * @no: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_inum_in(struct gfs_inum *no, char *buf)
-{
-	ENTER(GFN_INUM_IN)
-	struct gfs_inum *str = (struct gfs_inum *)buf;
-
-	CPIN_64(no, str, no_formal_ino);
-	CPIN_64(no, str, no_addr);
-
-	RET(GFN_INUM_IN);
-}
-
-/**
- * gfs_inum_out - Write out an inode number
- * @no: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_inum_out(struct gfs_inum *no, char *buf)
-{
-	ENTER(GFN_INUM_OUT)
-	struct gfs_inum *str = (struct gfs_inum *)buf;
-
-	CPOUT_64(no, str, no_formal_ino);
-	CPOUT_64(no, str, no_addr);
-
-	RET(GFN_INUM_OUT);
-}
-
-/**
- * gfs_inum_print - Print out a inode number
- * @no: the cpu-order buffer
- *
- */
-
-void
-gfs_inum_print(struct gfs_inum *no)
-{
-	ENTER(GFN_INUM_PRINT)
-	pv(no, no_formal_ino, "%"PRIu64);
-	pv(no, no_addr, "%"PRIu64);
-	RET(GFN_INUM_PRINT);
-}
-
-/**
- * gfs_meta_header_in - Read in a metadata header
- * @mh: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_meta_header_in(struct gfs_meta_header *mh, char *buf)
-{
-	ENTER(GFN_META_HEADER_IN)
-	struct gfs_meta_header *str = (struct gfs_meta_header *)buf;
-
-	CPIN_32(mh, str, mh_magic);
-	CPIN_32(mh, str, mh_type);
-	CPIN_64(mh, str, mh_generation);
-	CPIN_32(mh, str, mh_format);
-	CPIN_32(mh, str, mh_incarn);
-
-	RET(GFN_META_HEADER_IN);
-}
-
-/**
- * gfs_meta_header_in - Write out a metadata header
- * @mh: the cpu-order structure
- * @buf: the disk-order buffer
- *
- * Don't ever change the generation number in this routine.
- * It's done manually in increment_generation().
- */
-
-void
-gfs_meta_header_out(struct gfs_meta_header *mh, char *buf)
-{
-	ENTER(GFN_META_HEADER_OUT)
-	struct gfs_meta_header *str = (struct gfs_meta_header *)buf;
-
-	CPOUT_32(mh, str, mh_magic);
-	CPOUT_32(mh, str, mh_type);
-#if 0
-	/* Don't do this!
-	   Mh_generation should only be change manually. */
-	CPOUT_64(mh, str, mh_generation);
-#endif
-	CPOUT_32(mh, str, mh_format);
-	CPOUT_32(mh, str, mh_incarn);
-
-	RET(GFN_META_HEADER_OUT);
-}
-
-/**
- * gfs_meta_header_print - Print out a metadata header
- * @mh: the cpu-order buffer
- *
- */
-
-void
-gfs_meta_header_print(struct gfs_meta_header *mh)
-{
-	ENTER(GFN_META_HEADER_PRINT)
-
-	pv(mh, mh_magic, "0x%.8X");
-	pv(mh, mh_type, "%u");
-	pv(mh, mh_generation, "%"PRIu64);
-	pv(mh, mh_format, "%u");
-	pv(mh, mh_incarn, "%u");
-
-	RET(GFN_META_HEADER_PRINT);
-}
-
-/**
- * gfs_sb_in - Read in a superblock
- * @sb: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_sb_in(struct gfs_sb *sb, char *buf)
-{
-	ENTER(GFN_SB_IN)
-	struct gfs_sb *str = (struct gfs_sb *)buf;
-
-	gfs_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_flags);
-
-	CPIN_32(sb, str, sb_bsize);
-	CPIN_32(sb, str, sb_bsize_shift);
-	CPIN_32(sb, str, sb_seg_size);
-
-	gfs_inum_in(&sb->sb_jindex_di, (char *)&str->sb_jindex_di);
-	gfs_inum_in(&sb->sb_rindex_di, (char *)&str->sb_rindex_di);
-	gfs_inum_in(&sb->sb_root_di, (char *)&str->sb_root_di);
-
-	CPIN_08(sb, str, sb_lockproto, GFS_LOCKNAME_LEN);
-	CPIN_08(sb, str, sb_locktable, GFS_LOCKNAME_LEN);
-
-	gfs_inum_in(&sb->sb_quota_di, (char *)&str->sb_quota_di);
-	gfs_inum_in(&sb->sb_license_di, (char *)&str->sb_license_di);
-
-	CPIN_08(sb, str, sb_reserved, 96);
-
-	RET(GFN_SB_IN);
-}
-
-/**
- * gfs_sb_out - Write out a superblock
- * @sb: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_sb_out(struct gfs_sb *sb, char *buf)
-{
-	ENTER(GFN_SB_OUT)
-	struct gfs_sb *str = (struct gfs_sb *)buf;
-
-	gfs_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_flags);
-
-	CPOUT_32(sb, str, sb_bsize);
-	CPOUT_32(sb, str, sb_bsize_shift);
-	CPOUT_32(sb, str, sb_seg_size);
-
-	gfs_inum_out(&sb->sb_jindex_di, (char *)&str->sb_jindex_di);
-	gfs_inum_out(&sb->sb_rindex_di, (char *)&str->sb_rindex_di);
-	gfs_inum_out(&sb->sb_root_di, (char *)&str->sb_root_di);
-
-	CPOUT_08(sb, str, sb_lockproto, GFS_LOCKNAME_LEN);
-	CPOUT_08(sb, str, sb_locktable, GFS_LOCKNAME_LEN);
-
-	gfs_inum_out(&sb->sb_quota_di, (char *)&str->sb_quota_di);
-	gfs_inum_out(&sb->sb_license_di, (char *)&str->sb_license_di);
-
-	CPOUT_08(sb, str, sb_reserved, 96);
-
-	RET(GFN_SB_OUT);
-}
-
-/**
- * gfs_sb_print - Print out a superblock
- * @sb: the cpu-order buffer
- *
- */
-
-void
-gfs_sb_print(struct gfs_sb *sb)
-{
-	ENTER(GFN_SB_PRINT)
-
-	gfs_meta_header_print(&sb->sb_header);
-
-	pv(sb, sb_fs_format, "%u");
-	pv(sb, sb_multihost_format, "%u");
-	pv(sb, sb_flags, "%u");
-
-	pv(sb, sb_bsize, "%u");
-	pv(sb, sb_bsize_shift, "%u");
-	pv(sb, sb_seg_size, "%u");
-
-	gfs_inum_print(&sb->sb_jindex_di);
-	gfs_inum_print(&sb->sb_rindex_di);
-	gfs_inum_print(&sb->sb_root_di);
-
-	pv(sb, sb_lockproto, "%s");
-	pv(sb, sb_locktable, "%s");
-
-	gfs_inum_print(&sb->sb_quota_di);
-	gfs_inum_print(&sb->sb_license_di);
-
-	pa(sb, sb_reserved, 96);
-
-	RET(GFN_SB_PRINT);
-}
-
-/**
- * gfs_jindex_in - Read in a journal index structure
- * @jindex: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_jindex_in(struct gfs_jindex *jindex, char *buf)
-{
-	ENTER(GFN_JINDEX_IN)
-	struct gfs_jindex *str = (struct gfs_jindex *)buf;
-
-	CPIN_64(jindex, str, ji_addr);
-	CPIN_32(jindex, str, ji_nsegment);
-	CPIN_32(jindex, str, ji_pad);
-
-	CPIN_08(jindex, str, ji_reserved, 64);
-
-	RET(GFN_JINDEX_IN);
-}
-
-/**
- * gfs_jindex_out - Write out a journal index structure
- * @jindex: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_jindex_out(struct gfs_jindex *jindex, char *buf)
-{
-	ENTER(GFN_JINDEX_OUT)
-	struct gfs_jindex *str = (struct gfs_jindex *)buf;
-
-	CPOUT_64(jindex, str, ji_addr);
-	CPOUT_32(jindex, str, ji_nsegment);
-	CPOUT_32(jindex, str, ji_pad);
-
-	CPOUT_08(jindex, str, ji_reserved, 64);
-
-	RET(GFN_JINDEX_OUT);
-}
-
-/**
- * gfs_jindex_print - Print out a journal index structure
- * @ji: the cpu-order buffer
- *
- */
-
-void
-gfs_jindex_print(struct gfs_jindex *ji)
-{
-	ENTER(GFN_JINDEX_PRINT)
-
-	pv(ji, ji_addr, "%"PRIu64);
-	pv(ji, ji_nsegment, "%u");
-	pv(ji, ji_pad, "%u");
-
-	pa(ji, ji_reserved, 64);
-
-	RET(GFN_JINDEX_PRINT);
-}
-
-/**
- * gfs_rindex_in - Read in a resource index structure
- * @rindex: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_rindex_in(struct gfs_rindex *rindex, char *buf)
-{
-	ENTER(GFN_RINDEX_IN)
-	struct gfs_rindex *str = (struct gfs_rindex *)buf;
-
-	CPIN_64(rindex, str, ri_addr);
-	CPIN_32(rindex, str, ri_length);
-	CPIN_32(rindex, str, ri_pad);
-
-	CPIN_64(rindex, str, ri_data1);
-	CPIN_32(rindex, str, ri_data);
-
-	CPIN_32(rindex, str, ri_bitbytes);
-
-	CPIN_08(rindex, str, ri_reserved, 64);
-
-	RET(GFN_RINDEX_IN);
-}
-
-/**
- * gfs_rindex_out - Write out a resource index structure
- * @rindex: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_rindex_out(struct gfs_rindex *rindex, char *buf)
-{
-	ENTER(GFN_RINDEX_OUT)
-	struct gfs_rindex *str = (struct gfs_rindex *)buf;
-
-	CPOUT_64(rindex, str, ri_addr);
-	CPOUT_32(rindex, str, ri_length);
-	CPOUT_32(rindex, str, ri_pad);
-
-	CPOUT_64(rindex, str, ri_data1);
-	CPOUT_32(rindex, str, ri_data);
-
-	CPOUT_32(rindex, str, ri_bitbytes);
-
-	CPOUT_08(rindex, str, ri_reserved, 64);
-
-	RET(GFN_RINDEX_OUT);
-}
-
-/**
- * gfs_rindex_print - Print out a resource index structure
- * @ri: the cpu-order buffer
- *
- */
-
-void
-gfs_rindex_print(struct gfs_rindex *ri)
-{
-	ENTER(GFN_RINDEX_PRINT)
-
-	pv(ri, ri_addr, "%"PRIu64);
-	pv(ri, ri_length, "%u");
-	pv(ri, ri_pad, "%u");
-
-	pv(ri, ri_data1, "%"PRIu64);
-	pv(ri, ri_data, "%u");
-
-	pv(ri, ri_bitbytes, "%u");
-
-	pa(ri, ri_reserved, 64);
-
-	RET(GFN_RINDEX_PRINT);
-}
-
-/**
- * gfs_rgrp_in - Read in a resource group header
- * @rgrp: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_rgrp_in(struct gfs_rgrp *rgrp, char *buf)
-{
-	ENTER(GFN_RGRP_IN)
-	struct gfs_rgrp *str = (struct gfs_rgrp *)buf;
-
-	gfs_meta_header_in(&rgrp->rg_header, buf);
-
-	CPIN_32(rgrp, str, rg_flags);
-
-	CPIN_32(rgrp, str, rg_free);
-
-	CPIN_32(rgrp, str, rg_useddi);
-	CPIN_32(rgrp, str, rg_freedi);
-	gfs_inum_in(&rgrp->rg_freedi_list, (char *)&str->rg_freedi_list);
-
-	CPIN_32(rgrp, str, rg_usedmeta);
-	CPIN_32(rgrp, str, rg_freemeta);
-
-	CPIN_08(rgrp, str, rg_reserved, 64);
-
-	RET(GFN_RGRP_IN);
-}
-
-/**
- * gfs_rgrp_out - Write out a resource group header
- * @rgrp: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_rgrp_out(struct gfs_rgrp *rgrp, char *buf)
-{
-	ENTER(GFN_RGRP_OUT)
-	struct gfs_rgrp *str = (struct gfs_rgrp *)buf;
-
-	gfs_meta_header_out(&rgrp->rg_header, buf);
-
-	CPOUT_32(rgrp, str, rg_flags);
-
-	CPOUT_32(rgrp, str, rg_free);
-
-	CPOUT_32(rgrp, str, rg_useddi);
-	CPOUT_32(rgrp, str, rg_freedi);
-	gfs_inum_out(&rgrp->rg_freedi_list, (char *)&str->rg_freedi_list);
-
-	CPOUT_32(rgrp, str, rg_usedmeta);
-	CPOUT_32(rgrp, str, rg_freemeta);
-
-	CPOUT_08(rgrp, str, rg_reserved, 64);
-
-	RET(GFN_RGRP_OUT);
-}
-
-/**
- * gfs_rgrp_print - Print out a resource group header
- * @rg: the cpu-order buffer
- *
- */
-
-void
-gfs_rgrp_print(struct gfs_rgrp *rg)
-{
-	ENTER(GFN_RGRP_PRINT)
-
-	gfs_meta_header_print(&rg->rg_header);
-
-	pv(rg, rg_flags, "%u");
-
-	pv(rg, rg_free, "%u");
-
-	pv(rg, rg_useddi, "%u");
-	pv(rg, rg_freedi, "%u");
-	gfs_inum_print(&rg->rg_freedi_list);
-
-	pv(rg, rg_usedmeta, "%u");
-	pv(rg, rg_freemeta, "%u");
-
-	pa(rg, rg_reserved, 64);
-
-	RET(GFN_RGRP_PRINT);
-}
-
-/**
- * gfs_quota_in - Read in a quota structures
- * @quota: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_quota_in(struct gfs_quota *quota, char *buf)
-{
-	ENTER(GFN_QUOTA_IN)
-	struct gfs_quota *str = (struct gfs_quota *)buf;
-
-	CPIN_64(quota, str, qu_limit);
-	CPIN_64(quota, str, qu_warn);
-	CPIN_64(quota, str, qu_value);
-
-	CPIN_08(quota, str, qu_reserved, 64);
-
-	RET(GFN_QUOTA_IN);
-}
-
-/**
- * gfs_quota_out - Write out a quota structure
- * @quota: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_quota_out(struct gfs_quota *quota, char *buf)
-{
-	ENTER(GFN_QUOTA_OUT)
-	struct gfs_quota *str = (struct gfs_quota *)buf;
-
-	CPOUT_64(quota, str, qu_limit);
-	CPOUT_64(quota, str, qu_warn);
-	CPOUT_64(quota, str, qu_value);
-
-	CPOUT_08(quota, str, qu_reserved, 64);
-
-	RET(GFN_QUOTA_OUT);
-}
-
-/**
- * gfs_quota_print - Print out a quota structure
- * @quota: the cpu-order buffer
- *
- */
-
-void
-gfs_quota_print(struct gfs_quota *quota)
-{
-	ENTER(GFN_QUOTA_PRINT)
-
-	pv(quota, qu_limit, "%"PRIu64);
-	pv(quota, qu_warn, "%"PRIu64);
-	pv(quota, qu_value, "%"PRId64);
-
-	pa(quota, qu_reserved, 64);
-
-	RET(GFN_QUOTA_PRINT);
-}
-
-/**
- * gfs_dinode_in - Read in a dinode
- * @dinode: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_dinode_in(struct gfs_dinode *dinode, char *buf)
-{
-	ENTER(GFN_DINODE_IN)
-	struct gfs_dinode *str = (struct gfs_dinode *)buf;
-
-	gfs_meta_header_in(&dinode->di_header, buf);
-
-	gfs_inum_in(&dinode->di_num, (char *)&str->di_num);
-
-	CPIN_32(dinode, str, di_mode);
-	CPIN_32(dinode, str, di_uid);
-	CPIN_32(dinode, str, di_gid);
-	CPIN_32(dinode, str, di_nlink);
-	CPIN_64(dinode, str, di_size);
-	CPIN_64(dinode, str, di_blocks);
-	CPIN_64(dinode, str, di_atime);
-	CPIN_64(dinode, str, di_mtime);
-	CPIN_64(dinode, str, di_ctime);
-	CPIN_32(dinode, str, di_major);
-	CPIN_32(dinode, str, di_minor);
-
-	CPIN_64(dinode, str, di_rgrp);
-	CPIN_64(dinode, str, di_goal_rgrp);
-	CPIN_32(dinode, str, di_goal_dblk);
-	CPIN_32(dinode, str, di_goal_mblk);
-	CPIN_32(dinode, str, di_flags);
-	CPIN_32(dinode, str, di_payload_format);
-	CPIN_16(dinode, str, di_type);
-	CPIN_16(dinode, str, di_height);
-	CPIN_32(dinode, str, di_incarn);
-	CPIN_16(dinode, str, di_pad);
-
-	CPIN_16(dinode, str, di_depth);
-	CPIN_32(dinode, str, di_entries);
-
-	gfs_inum_in(&dinode->di_next_unused, (char *)&str->di_next_unused);
-
-	CPIN_64(dinode, str, di_eattr);
-
-	CPIN_08(dinode, str, di_reserved, 56);
-
-	RET(GFN_DINODE_IN);
-}
-
-/**
- * gfs_dinode_out - Write out a dinode
- * @dinode: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_dinode_out(struct gfs_dinode *dinode, char *buf)
-{
-	ENTER(GFN_DINODE_OUT)
-	struct gfs_dinode *str = (struct gfs_dinode *)buf;
-
-	gfs_meta_header_out(&dinode->di_header, buf);
-
-	gfs_inum_out(&dinode->di_num, (char *)&str->di_num);
-
-	CPOUT_32(dinode, str, di_mode);
-	CPOUT_32(dinode, str, di_uid);
-	CPOUT_32(dinode, str, di_gid);
-	CPOUT_32(dinode, str, di_nlink);
-	CPOUT_64(dinode, str, di_size);
-	CPOUT_64(dinode, str, di_blocks);
-	CPOUT_64(dinode, str, di_atime);
-	CPOUT_64(dinode, str, di_mtime);
-	CPOUT_64(dinode, str, di_ctime);
-	CPOUT_32(dinode, str, di_major);
-	CPOUT_32(dinode, str, di_minor);
-
-	CPOUT_64(dinode, str, di_rgrp);
-	CPOUT_64(dinode, str, di_goal_rgrp);
-	CPOUT_32(dinode, str, di_goal_dblk);
-	CPOUT_32(dinode, str, di_goal_mblk);
-	CPOUT_32(dinode, str, di_flags);
-	CPOUT_32(dinode, str, di_payload_format);
-	CPOUT_16(dinode, str, di_type);
-	CPOUT_16(dinode, str, di_height);
-	CPOUT_32(dinode, str, di_incarn);
-	CPOUT_16(dinode, str, di_pad);
-
-	CPOUT_16(dinode, str, di_depth);
-	CPOUT_32(dinode, str, di_entries);
-
-	gfs_inum_out(&dinode->di_next_unused, (char *)&str->di_next_unused);
-
-	CPOUT_64(dinode, str, di_eattr);
-
-	CPOUT_08(dinode, str, di_reserved, 56);
-
-	RET(GFN_DINODE_OUT);
-}
-
-/**
- * gfs_dinode_print - Print out a dinode
- * @di: the cpu-order buffer
- *
- */
-
-void
-gfs_dinode_print(struct gfs_dinode *di)
-{
-	ENTER(GFN_DINODE_PRINT)
-
-	gfs_meta_header_print(&di->di_header);
-
-	gfs_inum_print(&di->di_num);
-
-	pv(di, di_mode, "0%o");
-	pv(di, di_uid, "%u");
-	pv(di, di_gid, "%u");
-	pv(di, di_nlink, "%u");
-	pv(di, di_size, "%"PRIu64);
-	pv(di, di_blocks, "%"PRIu64);
-	pv(di, di_atime, "%"PRId64);
-	pv(di, di_mtime, "%"PRId64);
-	pv(di, di_ctime, "%"PRId64);
-	pv(di, di_major, "%u");
-	pv(di, di_minor, "%u");
-
-	pv(di, di_rgrp, "%"PRIu64);
-	pv(di, di_goal_rgrp, "%"PRIu64);
-	pv(di, di_goal_dblk, "%u");
-	pv(di, di_goal_mblk, "%u");
-	pv(di, di_flags, "0x%.8X");
-	pv(di, di_payload_format, "%u");
-	pv(di, di_type, "%u");
-	pv(di, di_height, "%u");
-	pv(di, di_incarn, "%u");
-	pv(di, di_pad, "%u");
-
-	pv(di, di_depth, "%u");
-	pv(di, di_entries, "%u");
-
-	gfs_inum_print(&di->di_next_unused);
-
-	pv(di, di_eattr, "%"PRIu64);
-
-	pa(di, di_reserved, 56);
-
-	RET(GFN_DINODE_PRINT);
-}
-
-/**
- * gfs_indirect_in - copy in the header of an indirect block
- * @indirect: the in memory copy
- * @buf: the buffer copy
- *
- */
-
-void
-gfs_indirect_in(struct gfs_indirect *indirect, char *buf)
-{
-	ENTER(GFN_INDIRECT_IN)
-	struct gfs_indirect *str = (struct gfs_indirect *)buf;
-
-	gfs_meta_header_in(&indirect->in_header, buf);
-
-	CPIN_08(indirect, str, in_reserved, 64);
-
-	RET(GFN_INDIRECT_IN);
-}
-
-/**
- * gfs_indirect_out - copy out the header of an indirect block
- * @indirect: the in memory copy
- * @buf: the buffer copy
- *
- */
-
-void
-gfs_indirect_out(struct gfs_indirect *indirect, char *buf)
-{
-	ENTER(GFN_INDIRECT_OUT)
-	struct gfs_indirect *str = (struct gfs_indirect *)buf;
-
-	gfs_meta_header_out(&indirect->in_header, buf);
-
-	CPOUT_08(indirect, str, in_reserved, 64);
-
-	RET(GFN_INDIRECT_OUT);
-}
-
-/**
- * gfs_indirect_print - Print out a indirect block header
- * @indirect: the cpu-order buffer
- *
- */
-
-void
-gfs_indirect_print(struct gfs_indirect *indirect)
-{
-	ENTER(GFN_INDIRECT_PRINT)
-
-	gfs_meta_header_print(&indirect->in_header);
-
-	pa(indirect, in_reserved, 64);
-
-	RET(GFN_INDIRECT_PRINT);
-}
-
-/**
- * gfs_dirent_in - Read in a directory entry
- * @dirent: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_dirent_in(struct gfs_dirent *dirent, char *buf)
-{
-	ENTER(GFN_DIRENT_IN)
-	struct gfs_dirent *str = (struct gfs_dirent *)buf;
-
-	gfs_inum_in(&dirent->de_inum, (char *)&str->de_inum);
-	CPIN_32(dirent, str, de_hash);
-	CPIN_16(dirent, str, de_rec_len);
-	CPIN_16(dirent, str, de_name_len);
-	CPIN_16(dirent, str, de_type);
-
-	CPIN_08(dirent, str, de_reserved, 14);
-
-	RET(GFN_DIRENT_IN);
-}
-
-/**
- * gfs_dirent_out - Write out a directory entry
- * @dirent: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_dirent_out(struct gfs_dirent *dirent, char *buf)
-{
-	ENTER(GFN_DIRENT_OUT)
-	struct gfs_dirent *str = (struct gfs_dirent *)buf;
-
-	gfs_inum_out(&dirent->de_inum, (char *)&str->de_inum);
-	CPOUT_32(dirent, str, de_hash);
-	CPOUT_16(dirent, str, de_rec_len);
-	CPOUT_16(dirent, str, de_name_len);
-	CPOUT_16(dirent, str, de_type);
-
-	CPOUT_08(dirent, str, de_reserved, 14);
-
-	RET(GFN_DIRENT_OUT);
-}
-
-/**
- * gfs_dirent_print - Print out a directory entry
- * @de: the cpu-order buffer
- * @name: the filename
- *
- */
-
-void
-gfs_dirent_print(struct gfs_dirent *de, char *name)
-{
-	ENTER(GFN_DIRENT_PRINT)
-	char buf[GFS_FNAMESIZE + 1];
-
-	gfs_inum_print(&de->de_inum);
-	pv(de, de_hash, "0x%.8X");
-	pv(de, de_rec_len, "%u");
-	pv(de, de_name_len, "%u");
-	pv(de, de_type, "%u");
-
-	pa(de, de_reserved, 14);
-
-	memset(buf, 0, GFS_FNAMESIZE + 1);
-	memcpy(buf, name, de->de_name_len);
-	printk("  name = %s\n", buf);
-
-	RET(GFN_DIRENT_PRINT);
-}
-
-/**
- * gfs_leaf_in - Read in a directory leaf header
- * @leaf: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_leaf_in(struct gfs_leaf *leaf, char *buf)
-{
-	ENTER(GFN_LEAF_IN)
-	struct gfs_leaf *str = (struct gfs_leaf *)buf;
-
-	gfs_meta_header_in(&leaf->lf_header, buf);
-
-	CPIN_16(leaf, str, lf_depth);
-	CPIN_16(leaf, str, lf_entries);
-	CPIN_32(leaf, str, lf_dirent_format);
-	CPIN_64(leaf, str, lf_next);
-
-	CPIN_08(leaf, str, lf_reserved, 64);
-
-	RET(GFN_LEAF_IN);
-}
-
-/**
- * gfs_leaf_out - Write out a directory leaf header
- * @leaf: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_leaf_out(struct gfs_leaf *leaf, char *buf)
-{
-	ENTER(GFN_LEAF_OUT)
-	struct gfs_leaf *str = (struct gfs_leaf *)buf;
-
-	gfs_meta_header_out(&leaf->lf_header, buf);
-
-	CPOUT_16(leaf, str, lf_depth);
-	CPOUT_16(leaf, str, lf_entries);
-	CPOUT_32(leaf, str, lf_dirent_format);
-	CPOUT_64(leaf, str, lf_next);
-
-	CPOUT_08(leaf, str, lf_reserved, 64);
-
-	RET(GFN_LEAF_OUT);
-}
-
-/**
- * gfs_leaf_print - Print out a directory leaf header
- * @lf: the cpu-order buffer
- *
- */
-
-void
-gfs_leaf_print(struct gfs_leaf *lf)
-{
-	ENTER(GFN_LEAF_PRINT)
-
-	gfs_meta_header_print(&lf->lf_header);
-
-	pv(lf, lf_depth, "%u");
-	pv(lf, lf_entries, "%u");
-	pv(lf, lf_dirent_format, "%u");
-	pv(lf, lf_next, "%"PRIu64);
-
-	pa(lf, lf_reserved, 64);
-
-	RET(GFN_LEAF_PRINT);
-}
-
-/**
- * gfs_log_header_in - Read in a log header
- * @head: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_log_header_in(struct gfs_log_header *head, char *buf)
-{
-	ENTER(GFN_LOG_HEADER_IN)
-	struct gfs_log_header *str = (struct gfs_log_header *)buf;
-
-	gfs_meta_header_in(&head->lh_header, buf);
-
-	CPIN_32(head, str, lh_flags);
-	CPIN_32(head, str, lh_pad);
-
-	CPIN_64(head, str, lh_first);
-	CPIN_64(head, str, lh_sequence);
-
-	CPIN_64(head, str, lh_tail);
-	CPIN_64(head, str, lh_last_dump);
-
-	CPIN_08(head, str, lh_reserved, 64);
-
-	RET(GFN_LOG_HEADER_IN);
-}
-
-/**
- * gfs_log_header_out - Write out a log header
- * @head: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_log_header_out(struct gfs_log_header *head, char *buf)
-{
-	ENTER(GFN_LOG_HEADER_OUT)
-	struct gfs_log_header *str = (struct gfs_log_header *)buf;
-
-	gfs_meta_header_out(&head->lh_header, buf);
-
-	CPOUT_32(head, str, lh_flags);
-	CPOUT_32(head, str, lh_pad);
-
-	CPOUT_64(head, str, lh_first);
-	CPOUT_64(head, str, lh_sequence);
-
-	CPOUT_64(head, str, lh_tail);
-	CPOUT_64(head, str, lh_last_dump);
-
-	CPOUT_08(head, str, lh_reserved, 64);
-
-	RET(GFN_LOG_HEADER_OUT);
-}
-
-/**
- * gfs_log_header_print - Print out a log header
- * @head: the cpu-order buffer
- *
- */
-
-void
-gfs_log_header_print(struct gfs_log_header *lh)
-{
-	ENTER(GFN_LOG_HEADER_PRINT)
-
-	gfs_meta_header_print(&lh->lh_header);
-
-	pv(lh, lh_flags, "0x%.8X");
-	pv(lh, lh_pad, "%u");
-
-	pv(lh, lh_first, "%"PRIu64);
-	pv(lh, lh_sequence, "%"PRIu64);
-
-	pv(lh, lh_tail, "%"PRIu64);
-	pv(lh, lh_last_dump, "%"PRIu64);
-
-	pa(lh, lh_reserved, 64);
-
-	RET(GFN_LOG_HEADER_PRINT);
-}
-
-/**
- * gfs_desc_in - Read in a log descriptor
- * @desc: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_desc_in(struct gfs_log_descriptor *desc, char *buf)
-{
-	ENTER(GFN_DESC_IN)
-	struct gfs_log_descriptor *str = (struct gfs_log_descriptor *)buf;
-
-	gfs_meta_header_in(&desc->ld_header, buf);
-
-	CPIN_32(desc, str, ld_type);
-	CPIN_32(desc, str, ld_length);
-	CPIN_32(desc, str, ld_data1);
-	CPIN_32(desc, str, ld_data2);
-
-	CPIN_08(desc, str, ld_reserved, 64);
-
-	RET(GFN_DESC_IN);
-}
-
-/**
- * gfs_desc_out - Write out a log descriptor
- * @desc: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_desc_out(struct gfs_log_descriptor *desc, char *buf)
-{
-	ENTER(GFN_DESC_OUT)
-	struct gfs_log_descriptor *str = (struct gfs_log_descriptor *)buf;
-
-	gfs_meta_header_out(&desc->ld_header, buf);
-
-	CPOUT_32(desc, str, ld_type);
-	CPOUT_32(desc, str, ld_length);
-	CPOUT_32(desc, str, ld_data1);
-	CPOUT_32(desc, str, ld_data2);
-
-	CPOUT_08(desc, str, ld_reserved, 64);
-
-	RET(GFN_DESC_OUT);
-}
-
-/**
- * gfs_desc_print - Print out a log descriptor
- * @ld: the cpu-order buffer
- *
- */
-
-void
-gfs_desc_print(struct gfs_log_descriptor *ld)
-{
-	ENTER(GFN_DESC_PRINT)
-
-	gfs_meta_header_print(&ld->ld_header);
-
-	pv(ld, ld_type, "%u");
-	pv(ld, ld_length, "%u");
-	pv(ld, ld_data1, "%u");
-	pv(ld, ld_data2, "%u");
-
-	pa(ld, ld_reserved, 64);
-
-	RET(GFN_DESC_PRINT);
-}
-
-/**
- * gfs_block_tag_in - Read in a block tag
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_block_tag_in(struct gfs_block_tag *tag, char *buf)
-{
-	ENTER(GFN_BLOCK_TAG_IN)
-	struct gfs_block_tag *str = (struct gfs_block_tag *)buf;
-
-	CPIN_64(tag, str, bt_blkno);
-	CPIN_32(tag, str, bt_flags);
-	CPIN_32(tag, str, bt_pad);
-
-	RET(GFN_BLOCK_TAG_IN);
-}
-
-/**
- * gfs_block_tag_out - Write out a block tag
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_block_tag_out(struct gfs_block_tag *tag, char *buf)
-{
-	ENTER(GFN_BLOCK_TAG_OUT)
-	struct gfs_block_tag *str = (struct gfs_block_tag *)buf;
-
-	CPOUT_64(tag, str, bt_blkno);
-	CPOUT_32(tag, str, bt_flags);
-	CPOUT_32(tag, str, bt_pad);
-
-	RET(GFN_BLOCK_TAG_OUT);
-}
-
-/**
- * gfs_block_tag_print - Print out a block tag
- * @tag: the cpu-order buffer
- *
- */
-
-void
-gfs_block_tag_print(struct gfs_block_tag *tag)
-{
-	ENTER(GFN_BLOCK_TAG_PRINT)
-
-	pv(tag, bt_blkno, "%"PRIu64);
-	pv(tag, bt_flags, "%u");
-	pv(tag, bt_pad, "%u");
-
-	RET(GFN_BLOCK_TAG_PRINT);
-}
-
-/**
- * gfs_quota_tag_in - Read in a quota tag
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_quota_tag_in(struct gfs_quota_tag *tag, char *buf)
-{
-	ENTER(GFN_QUOTA_TAG_IN)
-	struct gfs_quota_tag *str = (struct gfs_quota_tag *)buf;
-
-	CPIN_64(tag, str, qt_change);
-	CPIN_32(tag, str, qt_flags);
-	CPIN_32(tag, str, qt_id);
-
-	RET(GFN_QUOTA_TAG_IN);
-}
-
-/**
- * gfs_quota_tag_out - Write out a quota tag
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_quota_tag_out(struct gfs_quota_tag *tag, char *buf)
-{
-	ENTER(GFN_QUOTA_TAG_OUT)
-	struct gfs_quota_tag *str = (struct gfs_quota_tag *)buf;
-
-	CPOUT_64(tag, str, qt_change);
-	CPOUT_32(tag, str, qt_flags);
-	CPOUT_32(tag, str, qt_id);
-
-	RET(GFN_QUOTA_TAG_OUT);
-}
-
-/**
- * gfs_quota_tag_print - Print out a quota tag
- * @tag: the cpu-order buffer
- *
- */
-
-void
-gfs_quota_tag_print(struct gfs_quota_tag *tag)
-{
-	ENTER(GFN_QUOTA_TAG_PRINT)
-
-	pv(tag, qt_change, "%"PRId64);
-	pv(tag, qt_flags, "0x%.8X");
-	pv(tag, qt_id, "%u");
-
-	RET(GFN_QUOTA_TAG_PRINT);
-}
-
-/**
- * gfs_ea_header_in - Read in a Extended Attribute header
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_ea_header_in(struct gfs_ea_header *ea, char *buf)
-{
-	ENTER(GFN_EA_HEADER_IN)
-	struct gfs_ea_header *str = (struct gfs_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;
-	CPIN_32(ea, str, ea_pad);
-
-	RET(GFN_EA_HEADER_IN);
-}
-
-/**
- * gfs_ea_header_out - Write out a Extended Attribute header
- * @ea: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_ea_header_out(struct gfs_ea_header *ea, char *buf)
-{
-	ENTER(GFN_EA_HEADER_OUT)
-	struct gfs_ea_header *str = (struct gfs_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;
-	CPOUT_32(ea, str, ea_pad);
-
-	RET(GFN_EA_HEADER_OUT);
-}
-
-/**
- * gfs_ea_header_printt - Print out a Extended Attribute header
- * @ea: the cpu-order buffer
- *
- */
-
-void
-gfs_ea_header_print(struct gfs_ea_header *ea, char *name)
-{
-	ENTER(GFN_EA_HEADER_PRINT)
-	char buf[GFS_EA_MAX_NAME_LEN + 1];
-
-	pv(ea, ea_rec_len, "%u");
-	pv(ea, ea_data_len, "%u");
-	pv(ea, ea_name_len, "%u");
-	pv(ea, ea_type, "%u");
-	pv(ea, ea_flags, "%u");
-	pv(ea, ea_num_ptrs, "%u");
-	pv(ea, ea_pad, "%u");
-
-	memset(buf, 0, GFS_EA_MAX_NAME_LEN + 1);
-	memcpy(buf, name, ea->ea_name_len);
-	printk("  name = %s\n", buf);
-
-	RET(GFN_EA_HEADER_PRINT);
-}
-
-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
-};
-
-/**
- * gfs_dir_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.
- *
- * 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
-gfs_dir_hash(const char *data, int len)
-{
-	ENTER(GFN_DIR_HASH)
-	uint32_t hash = 0xFFFFFFFF;
-
-	for (; len--; data++)
-		hash = crc_32_tab[(hash ^ *data) & 0xFF] ^ (hash >> 8);
-
-	hash = ~hash;
-
-	RETURN(GFN_DIR_HASH, hash);
-}
-
-#endif  /* WANT_GFS_CONVERSION_FUNCTIONS */
-
diff --git a/gfs/gfs_fsck/pass1.c b/gfs/gfs_fsck/pass1.c
deleted file mode 100644
index 17e6740..0000000
--- a/gfs/gfs_fsck/pass1.c
+++ /dev/null
@@ -1,885 +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 "fsck_incore.h"
-#include "fsck.h"
-#include "bio.h"
-#include "fs_dir.h"
-#include "fs_inode.h"
-#include "util.h"
-#include "block_list.h"
-#include "log.h"
-#include "inode_hash.h"
-#include "inode.h"
-#include "link.h"
-#include "metawalk.h"
-
-struct block_count {
-	uint64_t indir_count;
-	uint64_t data_count;
-	uint64_t ea_count;
-};
-
-static int leaf(struct fsck_inode *ip, uint64_t block, osi_buf_t *bh,
-		void *private)
-{
-	struct fsck_sb *sdp = ip->i_sbd;
-	struct block_count *bc = (struct block_count *) private;
-
-	log_debug("\tLeaf block at %15"PRIu64"\n", BH_BLKNO(bh));
-	block_set(sdp->bl, BH_BLKNO(bh), leaf_blk);
-	bc->indir_count++;
-
-	return 0;
-}
-
-static int check_metalist(struct fsck_inode *ip, uint64_t block,
-			  osi_buf_t **bh, void *private)
-{
-	struct fsck_sb *sdp = ip->i_sbd;
-	struct block_query q = {0};
-	int found_dup = 0;
-	osi_buf_t *nbh;
-	struct block_count *bc = (struct block_count *)private;
-
-	*bh = NULL;
-
-	if (check_range(ip->i_sbd, block)){ /* blk outside of FS */
-		block_set(sdp->bl, ip->i_di.di_num.no_addr, bad_block);
-		log_debug("Bad indirect block pointer (out of range).\n");
-
-		return 1;
-        }
-	if(block_check(sdp->bl, block, &q)) {
-		stack;
-		return -1;
-	}
-	if(q.block_type != block_free) {
-		log_debug("Found duplicate block in indirect block -"
-			  " was marked %d\n", q.block_type);
-		block_mark(sdp->bl, block, dup_block);
-		found_dup = 1;
-	}
-        get_and_read_buf(ip->i_sbd, block, &nbh, 0);
-
-        /** Attention -- experimental code **/
-        if (check_meta(nbh, GFS_METATYPE_IN)){
-		log_debug("Bad indirect block pointer "
-			"(points to something that is not an indirect block).\n");
-		if(!found_dup) {
-			block_set(sdp->bl, block, meta_inval);
-			relse_buf(ip->i_sbd, nbh);
-			return 1;
-		}
-
-		relse_buf(ip->i_sbd, nbh);
-        }else{  /* blk check ok */
-		*bh = nbh;
-        }
-        /** Attention -- experimental code end **/
-
-	block_set(sdp->bl, block, indir_blk);
-	bc->indir_count++;
-
-	return 0;
-}
-
-
-
-static int check_data(struct fsck_inode *ip, uint64_t block, void *private)
-{
-	struct fsck_sb *sdp = ip->i_sbd;
-	struct block_query q = {0};
-	osi_buf_t *data_bh;
-	struct block_count *bc = (struct block_count *) private;
-
-	if (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 */
-		block_set(ip->i_sbd->bl, ip->i_di.di_num.no_addr, bad_block);
-
-		return 1;
-	}
-
-	if (ip->i_di.di_flags & GFS_DIF_JDATA){
-		/* Journaled data *is* metadata */
-		if(get_and_read_buf(ip->i_sbd, block, &data_bh, 0)) {
-			stack;
-			block_set(sdp->bl, ip->i_di.di_num.no_addr, meta_inval);
-			return 1;
-		}
-		if(check_meta(data_bh, GFS_METATYPE_JD)) {
-			log_err("Block #%"PRIu64" in inode %"PRIu64" does not have "
-				"correct meta header. is %u should be %u\n",
-				block, ip->i_di.di_num.no_addr,
-				gfs32_to_cpu(((struct gfs_meta_header *)
-					      BH_DATA((data_bh)))->mh_type),
-				GFS_METATYPE_JD);
-			relse_buf(sdp, data_bh);
-			block_set(sdp->bl, ip->i_di.di_num.no_addr, meta_inval);
-			return 1;
-		}
-
-		if(block_check(sdp->bl, block, &q)) {
-			stack;
-			relse_buf(sdp, data_bh);
-			return -1;
-		}
-		if(q.block_type != block_free) {
-			log_debug("Found duplicate block at %"
-				  PRIu64"\n", block);
-			block_mark(sdp->bl, block, dup_block);
-			bc->data_count++;
-			relse_buf(sdp, data_bh);
-			return 1;
-		}
-		log_debug("Setting %"PRIu64 " to journal block\n", block);
-		block_set(sdp->bl, block, journal_blk);
-		bc->data_count++;
-		relse_buf(sdp, data_bh);
-	}
-	else {
-		if(block_check(sdp->bl, block, &q)) {
-			stack;
-			return -1;
-		}
-		if(q.block_type != block_free) {
-			log_debug("Found duplicate block at %"
-				  PRIu64"\n", block);
-			block_mark(sdp->bl, block, dup_block);
-			bc->data_count++;
-			return 1;
-		}
-		log_debug("Setting %"PRIu64 " to data block\n", block);
-		block_set(sdp->bl, block, block_used);
-		bc->data_count++;
-	}
-
-	return 0;
-}
-
-static int check_eattr_indir(struct fsck_inode *ip, uint64_t indirect,
-			     uint64_t parent, osi_buf_t **bh, void *private)
-{
-	struct fsck_sb *sdp = ip->i_sbd;
-	int ret = 0;
-	struct 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 */
-	block_set(sdp->bl, ip->i_num.no_addr, eattr_block);
-
-	if(check_range(sdp, indirect)) {
-		/*log_warn("EA indirect block #%"PRIu64" is out of range.\n",
-			indirect);
-			block_set(sdp->bl, parent, bad_block);*/
-		/* Doesn't help to mark this here - this gets checked
-		 * in pass1c */
-		ret = 1;
-	}
-	else if(block_check(sdp->bl, indirect, &q)) {
-		stack;
-		ret = -1;
-	}
-	else if(q.block_type != block_free) {
-		log_debug("Duplicate block found at #%"PRIu64".\n",
-			  indirect);
-		block_set(sdp->bl, indirect, dup_block);
-		bc->ea_count++;
-		ret = 1;
-	}
-	else if(get_and_read_buf(sdp, indirect, bh, 0)) {
-		log_warn("Unable to read EA indirect block #%"PRIu64".\n",
-			indirect);
-		block_set(sdp->bl, indirect, meta_inval);
-		ret = 1;
-	}
-	else if(check_meta(*bh, GFS_METATYPE_IN)) {
-		log_warn("EA indirect block has incorrect type.\n");
-		block_set(sdp->bl, BH_BLKNO(*bh), meta_inval);
-		ret = 1;
-	}
-	else {
-		/* FIXME: do i need to differentiate this as an ea_indir? */
-		block_set(sdp->bl, BH_BLKNO(*bh), indir_blk);
-		bc->ea_count++;
-	}
-	return ret;
-}
-
-/**
- * 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 gfs meta header of type GFS_METATYPE_EA
- *
- * Returns: 0 if correct[able], -1 if removal is needed
- */
-static int check_extended_leaf_eattr(struct fsck_inode *ip, uint64_t *data_ptr,
-				     osi_buf_t *leaf_bh,
-				     struct gfs_ea_header *ea_hdr,
-				     struct gfs_ea_header *ea_hdr_prev,
-				     void *private)
-{
-	osi_buf_t *el_buf;
-	struct fsck_sb *sdp = ip->i_sbd;
-	struct block_query q;
-	uint64_t el_blk = gfs64_to_cpu(*data_ptr);
-	struct block_count *bc = (struct block_count *) private;
-
-	if(check_range(sdp, el_blk)){
-		log_err("EA extended leaf block #%"PRIu64" "
-			"is out of range.\n",
-			el_blk);
-		block_set(sdp->bl, ip->i_di.di_eattr, bad_block);
-		return 1;
-	}
-
-	if(block_check(sdp->bl, el_blk, &q)) {
-		stack;
-		return -1;
-	}
-	if(q.block_type != block_free) {
-		block_set(sdp->bl, el_blk, dup_block);
-		bc->ea_count++;
-		return 1;
-	}
-
-	if(get_and_read_buf(sdp, el_blk, &el_buf, 0)){
-		log_err("Unable to check extended leaf block.\n");
-		block_set(sdp->bl, el_blk, meta_inval);
-		return 1;
-	}
-
-	if(check_meta(el_buf, GFS_METATYPE_ED)) {
-		log_err("EA extended leaf block has incorrect type.\n");
-		relse_buf(sdp, el_buf);
-		block_set(sdp->bl, el_blk, meta_inval);
-		return 1;
-	}
-
-	block_set(sdp->bl, el_blk, meta_eattr);
-	bc->ea_count++;
-	relse_buf(sdp, el_buf);
-	return 0;
-}
-
-static int check_eattr_leaf(struct fsck_inode *ip, uint64_t block,
-			    uint64_t parent, osi_buf_t **bh, void *private)
-{
-	struct fsck_sb *sdp = ip->i_sbd;
-	osi_buf_t *leaf_bh;
-	int ret = 0;
-	struct 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 */
-	block_set(sdp->bl, ip->i_num.no_addr, eattr_block);
-
-	if(check_range(sdp, block)){
-		log_warn("EA leaf block #%"PRIu64" in inode %"PRIu64
-			 " is out of range.\n",
-			 ip->i_num.no_addr, block);
-		block_set(sdp->bl, ip->i_di.di_eattr, bad_block);
-		ret = 1;
-	}
-	else if(block_check(sdp->bl, block, &q)) {
-		stack;
-		return -1;
-	}
-	else if(q.block_type != block_free) {
-		log_debug("Duplicate block found at #%"PRIu64".\n",
-			  block);
-		block_set(sdp->bl, block, dup_block);
-		bc->ea_count++;
-	}
-	else if(get_and_read_buf(sdp, block, &leaf_bh, 0)){
-		log_warn("Unable to read EA leaf block #%"PRIu64".\n",
-			 block);
-		block_set(sdp->bl, block, meta_inval);
-		ret = 1;
-	} else if(check_meta(leaf_bh, GFS_METATYPE_EA)) {
-		log_warn("EA leaf block has incorrect type.\n");
-		block_set(sdp->bl, BH_BLKNO(leaf_bh), meta_inval);
-		relse_buf(sdp, leaf_bh);
-		ret = 1;
-	}
-	else {
-		block_set(sdp->bl, BH_BLKNO(leaf_bh), meta_eattr);
-		bc->ea_count++;
-	}
-
-	*bh = leaf_bh;
-
-	return ret;
-}
-
-static int check_eattr_entries(struct fsck_inode *ip,
-			       osi_buf_t *leaf_bh,
-			       struct gfs_ea_header *ea_hdr,
-			       struct gfs_ea_header *ea_hdr_prev,
-			       void *private)
-{
-	struct fsck_sb *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 gfs_ea_header),
-		ea_hdr->ea_name_len);
-
-	if(!GFS_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 avail_size;
-		int max_ptrs;
-
-		avail_size = sdp->sb.sb_bsize - sizeof(struct gfs_meta_header);
-		max_ptrs = (gfs32_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;
-}
-
-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,
-};
-
-int clear_metalist(struct fsck_inode *ip, uint64_t block,
-		   osi_buf_t **bh, void *private)
-{
-	struct fsck_sb *sdp = ip->i_sbd;
-	struct block_query q = {0};
-
-	*bh = NULL;
-
-	if(block_check(sdp->bl, block, &q)) {
-		stack;
-		return -1;
-	}
-	if(!q.dup_block) {
-		block_set(sdp->bl, block, block_free);
-		return 0;
-	}
-	return 0;
-}
-
-int clear_data(struct fsck_inode *ip, uint64_t block, void *private)
-{
-	struct fsck_sb *sdp = ip->i_sbd;
-	struct block_query q = {0};
-
-	if(block_check(sdp->bl, block, &q)) {
-		stack;
-		return -1;
-	}
-	if(!q.dup_block) {
-		block_set(sdp->bl, block, block_free);
-		return 0;
-	}
-	return 0;
-
-}
-
-int clear_leaf(struct fsck_inode *ip, uint64_t block,
-	       osi_buf_t *bh, void *private)
-{
-
-	struct fsck_sb *sdp = ip->i_sbd;
-	struct block_query q = {0};
-	log_crit("Clearing leaf %"PRIu64"\n", block);
-
-	if(block_check(sdp->bl, block, &q)) {
-		stack;
-		return -1;
-	}
-	if(!q.dup_block) {
-		log_crit("Setting leaf invalid\n");
-		if(block_set(sdp->bl, block, block_free)) {
-			stack;
-			return -1;
-		}
-		return 0;
-	}
-	return 0;
-
-}
-
-int add_to_dir_list(struct fsck_sb *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
-			" which is already in list\n", block);
-		return -1;
-	}
-
-	if(!(newdi = (struct dir_info *) malloc(sizeof(*newdi)))) {
-		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(sbp->dir_hash, block, newdi);
-
-	return 0;
-}
-
-
-int handle_di(struct fsck_sb *sdp, osi_buf_t *bh, uint64_t block, int mfree)
-{
-	struct block_query q = {0};
-	struct fsck_inode *ip;
-	int error;
-	struct block_count bc = {0};
-	struct metawalk_fxns invalidate_metatree = {0};
-	invalidate_metatree.check_metalist = clear_metalist;
-	invalidate_metatree.check_data = clear_data;
-	invalidate_metatree.check_leaf = clear_leaf;
-
-	if(copyin_inode(sdp, bh, &ip)) {
-		stack;
-		return -1;
-	}
-
-	if (ip->i_di.di_flags & GFS_DIF_UNUSED){
-		if(mfree) {
-			if(block_set(sdp->bl, block, meta_free)) {
-				stack;
-				goto fail;
-			}
-			goto success;
-		} else {
-			log_err("Found unused inode marked in-use\n");
-			if(query(sdp, "Clear unused inode at block %"
-				 PRIu64"? (y/n) ", block)) {
-				if(block_set(sdp->bl, block, meta_inval)) {
-					stack;
-					goto fail;
-				}
-				goto success;
-			} else {
-				log_err("Unused inode still marked in-use\n");
-			}
-		}
-
-	} else {
-		if(mfree) {
-			if(block_set(sdp->bl, block, meta_free)) {
-				stack;
-				goto fail;
-			}
-			goto success;
-		}
-	}
-
-	if (ip->i_di.di_num.no_addr != block) {
-		log_err("Bad dinode Address.  "
-			"Found %"PRIu64", "
-			"Expected %"PRIu64"\n",
-			ip->i_di.di_num.no_addr, block);
-		if(query(sdp, "Fix address in inode at block %"
-			 PRIu64"? (y/n) ", block)) {
-			ip->i_di.di_num.no_addr =
-				ip->i_di.di_num.no_formal_ino =
-				block;
-			if(fs_copyout_dinode(ip)){
-				log_crit("Bad dinode address can not be reset.\n");
-				goto fail;
-			} else {
-				log_err("Bad dinode address reset.\n");
-			}
-		} else {
-			log_err("Address in inode at block %"PRIu64
-				 " not fixed\n", block);
-		}
-
-	}
-
-	if(block_check(sdp->bl, block, &q)) {
-		stack;
-		goto fail;
-	}
-	if(q.block_type != block_free) {
-		log_debug("Found duplicate block at %"PRIu64"\n",
-			  block);
-		if(block_mark(sdp->bl, block, dup_block)) {
-			stack;
-			goto fail;
-		}
-		goto success;
-	}
-
-	switch(ip->i_di.di_type) {
-
-	case GFS_FILE_DIR:
-		if(block_set(sdp->bl, block, inode_dir)) {
-			stack;
-			goto fail;
-		}
-		if(add_to_dir_list(sdp, block)) {
-			stack;
-			goto fail;
-		}
-		break;
-	case GFS_FILE_REG:
-		if(block_set(sdp->bl, block, inode_file)) {
-			stack;
-			goto fail;
-		}
-		break;
-	case GFS_FILE_LNK:
-		if(block_set(sdp->bl, block, inode_lnk)) {
-			stack;
-			goto fail;
-		}
-		break;
-	case GFS_FILE_BLK:
-		if(block_set(sdp->bl, block, inode_blk)) {
-			stack;
-			goto fail;
-		}
-		break;
-	case GFS_FILE_CHR:
-		if(block_set(sdp->bl, block, inode_chr)) {
-			stack;
-			goto fail;
-		}
-		break;
-	case GFS_FILE_FIFO:
-		if(block_set(sdp->bl, block, inode_fifo)) {
-			stack;
-			goto fail;
-		}
-		break;
-	case GFS_FILE_SOCK:
-		if(block_set(sdp->bl, block, inode_sock)) {
-			stack;
-			goto fail;
-		}
-		break;
-	default:
-		if(block_set(sdp->bl, block, meta_inval)) {
-			stack;
-			goto fail;
-		}
-		goto success;
-	}
-	if(set_link_count(ip->i_sbd, ip->i_num.no_formal_ino,
-			  ip->i_di.di_nlink)) {
-		stack;
-		goto fail;
-	}
-
-	/* 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" has bad height  "
-			 "Found %u, Expected >= %u\n",
-			 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(block_set(sdp->bl, block, meta_inval)) {
-			stack;
-			goto fail;
-		}
-		goto success;
-	}
-
-	if (ip->i_di.di_type == (GFS_FILE_DIR &&
-				 (ip->i_di.di_flags & GFS_DIF_EXHASH)))
-	{
-		if (((1 << ip->i_di.di_depth) * sizeof(uint64_t)) !=
-		    ip->i_di.di_size)
-		{
-			log_warn("Directory dinode #%"PRIu64" has bad depth.  "
-				 "Found %u, Expected %u\n",
-				 ip->i_di.di_num.no_addr, ip->i_di.di_depth,
-				 (1 >> (ip->i_di.di_size/sizeof(uint64))));
-			/* once implemented, remove continue statement */
-			log_warn("Marking inode invalid\n");
-			if(block_set(sdp->bl, block, meta_inval)) {
-				stack;
-				goto fail;
-			}
-			goto success;
-		}
-	}
-
-	pass1_fxns.private = &bc;
-
-	error = check_metatree(ip, &pass1_fxns);
-	if(error < 0) {
-		return 0;
-	}
-	if(error > 0) {
-		log_warn("Marking inode invalid\n");
-		/* FIXME: Must set all leaves invalid as well */
-		check_metatree(ip, &invalidate_metatree);
-		block_set(ip->i_sbd->bl, ip->i_di.di_num.no_addr, meta_inval);
-		return 0;
-	}
-
-	/* FIXME: is this correct? */
-	if(check_inode_eattr(ip, &pass1_fxns) < 0){
-		osi_buf_t	*di_bh;
-		ip->i_di.di_eattr = 0;
-		if(get_and_read_buf(sdp, ip->i_di.di_num.no_addr, &di_bh, 0)){
-			stack;
-			log_crit("Bad EA reference remains.\n");
-		} else {
-			gfs_dinode_out(&ip->i_di, BH_DATA(di_bh));
-			if(write_buf(ip->i_sbd, di_bh, 0) < 0){
-				stack;
-				log_crit("Bad EA reference remains.\n");
-			} else {
-				log_warn("Bad EA reference cleared.\n");
-			}
-			relse_buf(sdp, di_bh);
-		}
-	}
-
-	if(ip->i_di.di_blocks != (1 + bc.indir_count + bc.data_count + bc.ea_count)) {
-		osi_buf_t	*di_bh;
-		log_err("Ondisk block count does not match what fsck"
-			" found for inode %"PRIu64"\n", ip->i_di.di_num.no_addr);
-		if(query(sdp, "Fix ondisk block count? (y/n) ")) {
-			ip->i_di.di_blocks = 1 + bc.indir_count +
-				bc.data_count +
-				bc.ea_count;
-			if(get_and_read_buf(sdp, ip->i_di.di_num.no_addr,
-					    &di_bh, 0)){
-				stack;
-				log_crit("Bad block count remains\n");
-			} else {
-				gfs_dinode_out(&ip->i_di, BH_DATA(di_bh));
-				if(write_buf(ip->i_sbd, di_bh, 0) < 0){
-					stack;
-					log_crit("Bad block count remains\n");
-				} else {
-					log_warn("Bad block count fixed\n");
-				}
-				relse_buf(sdp, di_bh);
-			}
-		} else {
-			log_err("Bad block count for %"PRIu64" not fixed\n",
-				ip->i_di.di_num.no_addr);
-		}
-	}
-
- success:
-	free(ip);
-	return 0;
-
- fail:
-	free(ip);
-	return -1;
-
-}
-
-
-int scan_meta(struct fsck_sb *sdp, osi_buf_t *bh, uint64_t block, int mfree)
-{
-
-	if (check_meta(bh, 0)) {
-		log_debug("Found invalid metadata at %"PRIu64"\n", block);
-		if(block_set(sdp->bl, block, meta_inval)) {
-			stack;
-			return -1;
-		}
-		return 0;
-	}
-
-	log_debug("Checking metadata block %"PRIu64"\n", block);
-
-	if (!check_type(bh, GFS_METATYPE_DI)) {
-		if(handle_di(sdp, bh, block, mfree)) {
-			stack;
-			return -1;
-		}
-	}
-	else if (!check_type(bh, GFS_METATYPE_NONE)) {
-		if(block_set(sdp->bl, block, meta_free)) {
-			stack;
-			return -1;
-		}
-	} else {
-		log_debug("Metadata block %"PRIu64
-			  " not an inode or free metadata\n",
-			  block);
-	}
-	/* Ignore everything else - they should be hit by the
-	 * handle_di step */
-
-	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 fsck_sb *sbp)
-{
-	osi_buf_t *bh;
-	osi_list_t *tmp;
-	uint64_t block;
-	struct fsck_rgrp *rgd;
-	int first;
-	uint64_t i;
-	uint64_t j;
-	uint64_t blk_count;
-	uint64_t offset;
-	uint64_t rg_count = 0;
-	int mfree = 0;
-
-	/* FIXME: What other metadata should we look for? */
-
-	/* Mark the journal blocks as 'other metadata' */
-	for (i = 0; i < sbp->journals; i++) {
-		struct gfs_jindex *ji;
-		ji = &sbp->jindex[i];
-		for(j = ji->ji_addr;
-		    j < ji->ji_addr + (ji->ji_nsegment * sbp->sb.sb_seg_size);
-		    j++) {
-			if(block_set(sbp->bl, j, journal_blk)) {
-				stack;
-				return -1;
-			}
-		}
-	}
-
-
-	/* 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 fsck_rgrp, rd_list);
-		if(fs_rgrp_read(rgd, FALSE)){
-			stack;
-			return -1;
-		}
-		log_debug("RG at %"PRIu64" is %u long\n", rgd->rd_ri.ri_addr,
-				  rgd->rd_ri.ri_length);
-		for (i = 0; i < rgd->rd_ri.ri_length; i++) {
-			if(block_set(sbp->bl, rgd->rd_ri.ri_addr + i,
-				     meta_other)){
-				stack;
-				return -1;
-			}
-		}
-
-		offset = sizeof(struct gfs_rgrp);
-		blk_count = 1;
-
-		first = 1;
-
-		while (1) {
-
-			/* "block" is relative to the entire file system */
-			if(next_rg_meta_free(rgd, &block, first, &mfree))
-				break;
-
-			warm_fuzzy_stuff(block);
-			if (fsck_abort) /* if asked to abort */
-				return 0;
-			if (skip_this_pass) {
-				printf("Skipping pass 1 is not a good idea.\n");
-				skip_this_pass = FALSE;
-				fflush(stdout);
-			}
-			if(get_and_read_buf(sbp, block, &bh, 0)){
-				stack;
-				log_crit("Unable to retrieve block %"PRIu64
-					 "\n", block);
-				fs_rgrp_relse(rgd);
-				return -1;
-			}
-
-			if(scan_meta(sbp, bh, block, mfree)) {
-				stack;
-				relse_buf(sbp, bh);
-				fs_rgrp_relse(rgd);
-				return -1;
-			}
-			relse_buf(sbp, bh);
-			first = 0;
-		}
-		fs_rgrp_relse(rgd);
-	}
-
-	return 0;
-}
diff --git a/gfs/gfs_fsck/pass1b.c b/gfs/gfs_fsck/pass1b.c
deleted file mode 100644
index 39d437d..0000000
--- a/gfs/gfs_fsck/pass1b.c
+++ /dev/null
@@ -1,521 +0,0 @@
-#include "fsck_incore.h"
-#include "fsck.h"
-#include "osi_list.h"
-#include "bio.h"
-#include "fs_inode.h"
-#include "block_list.h"
-#include "util.h"
-#include "inode.h"
-#include "inode_hash.h"
-#include "metawalk.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 fsck_inode *ip, uint64_t block,
-			  osi_buf_t **bh, void *private)
-{
-	inc_if_found(block, 1, private);
-
-	return 0;
-}
-
-static int check_data(struct fsck_inode *ip, uint64_t block, void *private)
-{
-	inc_if_found(block, 1, private);
-
-	return 0;
-}
-
-static int check_eattr_indir(struct fsck_inode *ip, uint64_t block,
-			     uint64_t parent, osi_buf_t **bh, void *private)
-{
-	struct fsck_sb *sbp = ip->i_sbd;
-	osi_buf_t *indir_bh = NULL;
-
-	inc_if_found(block, 0, private);
-	if(get_and_read_buf(sbp, block, &indir_bh, 0)){
-		log_warn("Unable to read EA leaf block #%"PRIu64".\n",
-			 block);
-		return 1;
-	}
-
-	*bh = indir_bh;
-
-	return 0;
-}
-
-static int check_eattr_leaf(struct fsck_inode *ip, uint64_t block,
-			    uint64_t parent, osi_buf_t **bh, void *private)
-{
-	struct fsck_sb *sbp = ip->i_sbd;
-	osi_buf_t *leaf_bh = NULL;
-
-	inc_if_found(block, 0, private);
-	if(get_and_read_buf(sbp, block, &leaf_bh, 0)){
-		log_warn("Unable to read EA leaf block #%"PRIu64".\n",
-			 block);
-		return 1;
-	}
-
-	*bh = leaf_bh;
-	return 0;
-}
-
-static int check_eattr_entry(struct fsck_inode *ip, osi_buf_t *leaf_bh,
-			     struct gfs_ea_header *ea_hdr,
-			     struct gfs_ea_header *ea_hdr_prev,
-			     void *private)
-{
-	return 0;
-}
-
-static int check_eattr_extentry(struct fsck_inode *ip, uint64_t *ea_data_ptr,
-				osi_buf_t *leaf_bh,
-				struct gfs_ea_header *ea_hdr,
-				struct gfs_ea_header *ea_hdr_prev,
-				void *private)
-{
-	uint64_t block = gfs64_to_cpu(*ea_data_ptr);
-
-	inc_if_found(block, 0, private);
-
-	return 0;
-}
-
-static int find_dentry(struct fsck_inode *ip, struct gfs_dirent *de,
-		       struct gfs_dirent *prev,
-		       osi_buf_t *bh, char *filename, int *update,
-		       uint16_t *count, void *priv)
-{
-	osi_list_t *tmp1, *tmp2;
-	struct blocks *b;
-	struct inode_with_dups *id;
-	osi_list_foreach(tmp1, &ip->i_sbd->dup_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
-					  " is in file or directory %"PRIu64
-					  " named %s\n", id->block_no,
-					  ip->i_di.di_num.no_addr, filename);
-				/* If there are duplicates of
-				 * duplicates, I guess we'll miss them
-				 * here */
-				break;
-			}
-		}
-	}
-	return 0;
-}
-
-static int clear_dup_metalist(struct fsck_inode *ip, uint64_t block,
-			      osi_buf_t **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"\n",
-			dh->id->name ? dh->id->name : "",
-			dh->id->parent);
-		inode_hash_remove(ip->i_sbd->inode_hash, ip->i_di.di_num.no_addr);
-		/* Setting the block to invalid means the inode is
-		 * cleared in pass2 */
-		block_set(ip->i_sbd->bl, ip->i_di.di_num.no_addr, meta_inval);
-	}
-	return 0;
-}
-static int clear_dup_data(struct fsck_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\" (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"\n",
-			dh->id->name ? dh->id->name : "",
-			dh->id->parent);
-		inode_hash_remove(ip->i_sbd->inode_hash, ip->i_di.di_num.no_addr);
-		/* Setting the block to invalid means the inode is
-		 * cleared in pass2 */
-		block_set(ip->i_sbd->bl, ip->i_di.di_num.no_addr, meta_inval);
-	}
-
-	return 0;
-}
-static int clear_dup_eattr_indir(struct fsck_inode *ip, uint64_t block,
-				 uint64_t parent, osi_buf_t **bh,
-				 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 */
-	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"\n",
-			dh->id->name ? dh->id->name : "",
-			dh->id->parent);
-		block_set(ip->i_sbd->bl, ip->i_di.di_eattr, meta_inval);
-	}
-
-	return 0;
-}
-static int clear_dup_eattr_leaf(struct fsck_inode *ip, uint64_t block,
-				uint64_t parent, osi_buf_t **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"\n",
-			dh->id->name ? dh->id->name : "",
-			dh->id->parent);
-
-		/* mark the main eattr block invalid */
-		block_set(ip->i_sbd->bl, ip->i_di.di_eattr, meta_inval);
-	}
-
-	return 0;
-}
-
-static int clear_eattr_entry (struct fsck_inode *ip,
-		       osi_buf_t *leaf_bh,
-		       struct gfs_ea_header *ea_hdr,
-		       struct gfs_ea_header *ea_hdr_prev,
-		       void *private)
-{
-	struct fsck_sb *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 gfs_ea_header),
-		ea_hdr->ea_name_len);
-
-	if(!GFS_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 avail_size;
-		int max_ptrs;
-
-		avail_size = sdp->sb.sb_bsize - sizeof(struct gfs_meta_header);
-		max_ptrs = (gfs32_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 fsck_inode *ip, uint64_t *ea_data_ptr,
-			 osi_buf_t *leaf_bh, struct gfs_ea_header *ea_hdr,
-			 struct gfs_ea_header *ea_hdr_prev, void *private)
-{
-	uint64_t block = gfs64_to_cpu(*ea_data_ptr);
-	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"\n",
-			dh->id->name ? dh->id->name : "",
-			dh->id->parent);
-		/* mark the main eattr block invalid */
-		block_set(ip->i_sbd->bl, ip->i_di.di_eattr, meta_inval);
-	}
-
-	return 0;
-
-}
-
-/* Finds all references to duplicate blocks in the metadata */
-int find_block_ref(struct fsck_sb *sbp, uint64_t inode, struct blocks *b)
-{
-	struct fsck_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,
-	};
-
-	if(load_inode(sbp, inode, &ip)) {
-		stack;
-		return -1;
-	}
-	log_info("Checking inode %"PRIu64"'s metatree for references to block %"PRIu64"\n",
-		 inode, b->block_no);
-	if(check_metatree(ip, &find_refs)) {
-		stack;
-		free_inode(&ip);
-		return -1;
-	}
-	log_info("Done checking metatree\n");
-
-	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
-			  " in inode #%"PRIu64"\n",
-			  myfi.found, b->block_no, 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);
-		free_inode(&ip);
-		return 0;
-	}
-	free_inode(&ip);
-	return 0;
-}
-
-/* Finds all blocks marked in the duplicate block bitmap */
-int find_dup_blocks(struct fsck_sb *sbp)
-{
-	uint64_t block_no = 0;
-	struct blocks *b;
-
-	while (!find_next_block_type(sbp->bl, dup_block, &block_no)) {
-		if(!(b = malloc(sizeof(*b)))) {
-			log_crit("Unable to allocate blocks structure\n");
-			return -1;
-		}
-		if(!memset(b, 0, sizeof(*b))) {
-			log_crit("Unable to zero blocks structure\n");
-			return -1;
-		}
-		b->block_no = block_no;
-		osi_list_init(&b->ref_inode_list);
-		log_notice("Found dup block at %"PRIu64"\n", block_no);
-		osi_list_add(&b->list, &sbp->dup_list);
-		block_no++;
-	}
-	return 0;
-}
-
-
-
-int handle_dup_blk(struct fsck_sb *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 fsck_inode *ip;
-	struct dup_handler dh = {0};
-
-	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" has %d inodes referencing it for"
-		   "a total of %d duplicate references\n",
-		   b->block_no, 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
-			 "\n", id->name, id->dup_count, b->block_no);
-		/* FIXME: User input */
-		log_warn("Clearing...\n");
-		load_inode(sbp, id->block_no, &ip);
-		dh.b = b;
-		dh.id = id;
-		clear_dup_fxns.private = (void *) &dh;
-		/* Clear the EAs for the inode first */
-		check_inode_eattr(ip, &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);
-
-		free_inode(&ip);
-		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 fsck_sb *sbp)
-{
-	struct blocks *b;
-	uint64_t i;
-	struct block_query q;
-	osi_list_t *tmp;
-	struct metawalk_fxns find_dirents = {0};
-	find_dirents.check_dentry = &find_dentry;
-	int rc = 0;
-
-	osi_list_init(&sbp->dup_list);
-	/* Shove all blocks marked as duplicated into a list */
-	log_info("Looking for duplicate blocks...\n");
-	find_dup_blocks(sbp);
-
-	/* If there were no dups in the bitmap, we don't need to do anymore */
-	if(osi_list_empty(&sbp->dup_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" blocks total\n", sbp->last_fs_block);
-	for(i = 0; i < sbp->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" for inodes\n", i);
-		if(block_check(sbp->bl, i, &q)) {
-			stack;
-			rc = -1;
-			goto out;
-		}
-		if((q.block_type == inode_dir) ||
-		   (q.block_type == inode_file) ||
-		   (q.block_type == inode_lnk) ||
-		   (q.block_type == inode_blk) ||
-		   (q.block_type == inode_chr) ||
-		   (q.block_type == inode_fifo) ||
-		   (q.block_type == inode_sock)) {
-			osi_list_foreach(tmp, &sbp->dup_list) {
-				b = osi_list_entry(tmp, struct blocks, list);
-				if(find_block_ref(sbp, i, b)) {
-					stack;
-					rc = -1;
-					goto out;
-				}
-			}
-		}
-		if(q.block_type == 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:
-	/*osi_list_foreach(tmp, &sbp->dup_list) {*/
-	while (!osi_list_empty(&sbp->dup_list)) {
-		b = osi_list_entry(sbp->dup_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/gfs/gfs_fsck/pass1c.c b/gfs/gfs_fsck/pass1c.c
deleted file mode 100644
index e65b862..0000000
--- a/gfs/gfs_fsck/pass1c.c
+++ /dev/null
@@ -1,274 +0,0 @@
-#include "fsck.h"
-#include "fsck_incore.h"
-#include "bio.h"
-#include "inode.h"
-#include "util.h"
-#include "block_list.h"
-#include "metawalk.h"
-
-static int remove_eattr_entry(struct fsck_sb *sdp, osi_buf_t *leaf_bh,
-			struct gfs_ea_header *curr,
-			struct gfs_ea_header *prev)
-{
-	log_warn("Removing EA located in block #%"PRIu64".\n",
-		 BH_BLKNO(leaf_bh));
-	if(!prev){
-		curr->ea_type = GFS_EATYPE_UNUSED;
-	} else {
-		prev->ea_rec_len =
-			cpu_to_gfs32(gfs32_to_cpu(curr->ea_rec_len) +
-				     gfs32_to_cpu(prev->ea_rec_len));
-		if (curr->ea_flags & GFS_EAFLAG_LAST)
-			prev->ea_flags |= GFS_EAFLAG_LAST;	
-	}
-	if(write_buf(sdp, leaf_bh, 0)){
-		stack;
-		log_err("EA removal failed.\n");
-		return -1;
-	}
-	return 0;
-}
-
-int check_eattr_indir(struct fsck_inode *ip, uint64_t block,
-		      uint64_t parent, osi_buf_t **bh,
-		      void *private)
-{
-	int *update = (int *) private;
-	struct fsck_sb *sbp = ip->i_sbd;
-	struct block_query q;
-	osi_buf_t *indir_bh;
-
-	if(check_range(sbp, block)) {
-		log_err("Extended attributes indirect block out of range...removing\n");
-		ip->i_di.di_eattr = 0;
-		*update = 1;
-		return 1;
-	}
-	else if (block_check(sbp->bl, block, &q)) {
-		stack;
-		return -1;
-	}
-	else if(q.block_type != indir_blk) {
-		log_err("Extended attributes indirect block invalid...removing\n");
-		ip->i_di.di_eattr = 0;
-		*update = 1;
-		return 1;
-	}
-	else if(get_and_read_buf(sbp, block, &indir_bh, 0)){
-		log_warn("Unable to read EA leaf block #%"PRIu64".\n",
-			 block);
-		ip->i_di.di_eattr = 0;
-		*update = 1;
-		return 1;
-	}
-
-	*bh = indir_bh;
-	return 0;
-}
-int check_eattr_leaf(struct fsck_inode *ip, uint64_t block,
-		     uint64_t parent, osi_buf_t **bh, void *private)
-{
-	int *update = (int *) private;
-	struct fsck_sb *sbp = ip->i_sbd;
-	struct block_query q;
-	osi_buf_t *leaf_bh;
-
-	if(check_range(sbp, block)) {
-		log_err("Extended attributes block out of range...removing\n");
-		ip->i_di.di_eattr = 0;
-		*update = 1;
-		return 1;
-	}
-	else if (block_check(sbp->bl, block, &q)) {
-		stack;
-		return -1;
-	}
-	else if(q.block_type != meta_eattr) {
-		log_err("Extended attributes block invalid...removing\n");
-		ip->i_di.di_eattr = 0;
-		*update = 1;
-		return 1;
-	}
-	else if(get_and_read_buf(sbp, block, &leaf_bh, 0)){
-		log_warn("Unable to read EA leaf block #%"PRIu64".\n",
-			 block);
-		ip->i_di.di_eattr = 0;
-		*update = 1;
-		return 1;
-	}
-
-	*bh = leaf_bh;
-
-	return 0;
-
-}
-
-
-static int check_eattr_entry(struct fsck_inode *ip,
-			     osi_buf_t *leaf_bh,
-			     struct gfs_ea_header *ea_hdr,
-			     struct gfs_ea_header *ea_hdr_prev,
-			     void *private)
-{
-	struct fsck_sb *sdp = ip->i_sbd;
-	char ea_name[256];
-	uint32_t offset = (uint32_t)(((unsigned long)ea_hdr) -
-			                  ((unsigned long)BH_DATA(leaf_bh)));
-	uint32_t max_size = sdp->sb.sb_bsize;
-	if(!ea_hdr->ea_rec_len){
-		log_err("EA has rec length == 0\n");
-		ea_hdr->ea_flags |= GFS_EAFLAG_LAST;
-		ea_hdr->ea_rec_len = cpu_to_gfs32(max_size - offset);
-		if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){
-			stack;
-			return -1;
-		}
-		return 1;
-	}
-	if(offset + gfs32_to_cpu(ea_hdr->ea_rec_len) > max_size){
-		log_err("EA rec length too long\n");
-		ea_hdr->ea_flags |= GFS_EAFLAG_LAST;
-		ea_hdr->ea_rec_len = cpu_to_gfs32(max_size - offset);
-		if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){
-			stack;
-			return -1;
-		}
-		return 1;
-	}
-	if(offset + gfs32_to_cpu(ea_hdr->ea_rec_len) == max_size &&
-	   (ea_hdr->ea_flags & GFS_EAFLAG_LAST) == 0){
-		log_err("last EA has no last entry flag\n");
-		ea_hdr->ea_flags |= GFS_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 gfs_ea_header),
-		ea_hdr->ea_name_len);
-
-	if(!GFS_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, GFS_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 avail_size;
-		int max_ptrs;
-
-		avail_size = sdp->sb.sb_bsize - sizeof(struct gfs_meta_header);
-		max_ptrs = (gfs32_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 fsck_inode *ip, uint64_t *ea_ptr,
-			 osi_buf_t *leaf_bh,
-			 struct gfs_ea_header *ea_hdr,
-			 struct gfs_ea_header *ea_hdr_prev,
-			 void *private)
-{
-	struct block_query q;
-	struct fsck_sb *sbp = ip->i_sbd;
-	if(block_check(sbp->bl, gfs64_to_cpu(*ea_ptr), &q)) {
-		stack;
-		return -1;
-	}
-	if(q.block_type != 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 fsck_sb *sbp)
-{
-	uint64_t block_no = 0;
-	osi_buf_t *bh;
-	struct fsck_inode *ip = NULL;
-	int update = 0;
-	struct metawalk_fxns pass1c_fxns = { 0 };
-	int error = 0;
-
-	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 = (void *) &update;
-
-	log_info("Looking for inodes containing ea blocks...\n");
-	while (!find_next_block_type(sbp->bl, eattr_block, &block_no)) {
-
-		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
-			return 0;
-		log_info("EA in inode %"PRIu64"\n", block_no);
-		if(get_and_read_buf(sbp, block_no, &bh, 0)) {
-			stack;
-			return -1;
-		}
-		if(copyin_inode(sbp, bh, &ip)) {
-			stack;
-			return -1;
-		}
-
-		log_debug("Found eattr at %"PRIu64"\n", ip->i_di.di_eattr);
-		/* FIXME: Handle walking the eattr here */
-		error = check_inode_eattr(ip, &pass1c_fxns);
-		if(error < 0) {
-			stack;
-			return -1;
-		}
-
-		if(update) {
-			gfs_dinode_out(&ip->i_di, BH_DATA(bh));
-			write_buf(sbp, bh, 0);
-		}
-
-		free_inode(&ip);
-		relse_buf(sbp, bh);
-
-		block_no++;
-	}
-	return 0;
-}
diff --git a/gfs/gfs_fsck/pass2.c b/gfs/gfs_fsck/pass2.c
deleted file mode 100644
index 450f26f..0000000
--- a/gfs/gfs_fsck/pass2.c
+++ /dev/null
@@ -1,888 +0,0 @@
-#include "stdio.h"
-#include "fsck_incore.h"
-#include "fsck.h"
-#include "block_list.h"
-#include "bio.h"
-#include "fs_inode.h"
-#include "fs_dir.h"
-#include "util.h"
-#include "log.h"
-#include "inode_hash.h"
-#include "inode.h"
-#include "link.h"
-#include "metawalk.h"
-#include "eattr.h"
-
-#define MAX_FILENAME 256
-
-struct dir_status {
-	uint8_t dotdir:1;
-	uint8_t dotdotdir:1;
-	struct block_query q;
-	uint32_t entry_count;
-};
-
-
-/* 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 fsck_sb *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 (%"PRIu64
-					") already contains"
-					" this child - checking %"PRIu64"\n",
-					di->treewalk_parent, parentblock);
-				return 1;
-			}
-			di->treewalk_parent = parentblock;
-		}
-	} else {
-		log_err("Unable to find block %"PRIu64" in dir_info list\n",
-			childblock);
-		return -1;
-	}
-
-	return 0;
-}
-
-/* Set's the child's '..' directory inode number in dir_info structure */
-int set_dotdot_dir(struct fsck_sb *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->sb.sb_root_di.no_addr
-			   != di->dinode) {
-				/* This should never happen */
-				log_crit("dotdot parent already set for"
-					 " block %"PRIu64" -> %"PRIu64"\n",
-					 childblock, di->dotdot_parent);
-				return -1;
-			}
-			di->dotdot_parent = parentblock;
-		}
-	} else {
-		log_err("Unable to find block %"PRIu64" in dir_info list\n",
-			childblock);
-		return -1;
-	}
-
-	return 0;
-
-}
-
-static int check_eattr_indir(struct fsck_inode *ip, uint64_t block,
-			    uint64_t parent, osi_buf_t **bh, void *private)
-{
-
-	return 0;
-}
-static int check_eattr_leaf(struct fsck_inode *ip, uint64_t block,
-			    uint64_t parent, osi_buf_t **bh, void *private)
-{
-	osi_buf_t *leaf_bh;
-
-	if(get_and_read_buf(ip->i_sbd, block, &leaf_bh, 0)){
-		log_warn("Unable to read EA leaf block #%"PRIu64".\n",
-			 block);
-		block_set(ip->i_sbd->bl, block, meta_inval);
-		return 1;
-	}
-
-
-	return 0;
-}
-
-static int check_file_type(uint16_t de_type, uint8_t block_type) {
-	switch(block_type) {
-	case inode_dir:
-		if(de_type != GFS_FILE_DIR)
-			return 1;
-		break;
-	case inode_file:
-		if(de_type != GFS_FILE_REG)
-			return 1;
-		break;
-	case inode_lnk:
-		if(de_type != GFS_FILE_LNK)
-			return 1;
-		break;
-	case inode_blk:
-		if(de_type != GFS_FILE_BLK)
-			return 1;
-		break;
-	case inode_chr:
-		if(de_type != GFS_FILE_CHR)
-			return 1;
-		break;
-	case inode_fifo:
-		if(de_type != GFS_FILE_FIFO)
-			return 1;
-		break;
-	case inode_sock:
-		if(de_type != GFS_FILE_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 fsck_inode *ip, struct gfs_dirent *dent,
-		 struct gfs_dirent *prev_de,
-		 osi_buf_t *bh, char *filename, int *update,
-		 uint16_t *count, void *priv)
-{
-	struct fsck_sb *sbp = ip->i_sbd;
-	struct block_query q = {0};
-	char tmp_name[MAX_FILENAME];
-	uint64_t entryblock;
-	struct dir_status *ds = (struct dir_status *) priv;
-	int error;
-	struct fsck_inode *entry_ip = NULL;
-	struct metawalk_fxns clear_eattrs = {0};
-	struct gfs_dirent dentry, *de;
-
-	memset(&dentry, 0, sizeof(struct gfs_dirent));
-	gfs_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 < GFS_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);
-		block_set(sbp->bl, ip->i_num.no_addr, meta_inval);
-		return 1;
-		/* FIXME: should probably delete the entry here at the
-		 * very least - maybe look at attempting to fix it */
-	}
-
-	if (de->de_hash != gfs_dir_hash(filename, de->de_name_len)){
-	        log_err("Dir entry with bad hash or name length\n"
-			 "\tHash found         = %u\n"
-			 "\tName found         = %s\n"
-			 "\tName length found  = %u\n"
-			 "\tHash expected      = %u\n",
-			 de->de_hash,
-			 filename,
-			 de->de_name_len,
-			 gfs_dir_hash(filename, de->de_name_len));
-		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(check_range(ip->i_sbd, entryblock)) {
-		log_err("Block # referenced by directory entry %s is out of range\n",
-			tmp_name);
-		if(query(ip->i_sbd, "Clear directory entry tp out of range block? (y/n) ")) {
-			log_err("Clearing %s\n", tmp_name);
-			if(dirent_del(ip, bh, prev_de, dent))
-				log_err("Error encountered while removing bad "
-					"directory entry.  Skipping.\n");
-			return 1;
-		} else {
-			log_err("Directory entry to out of range block remains\n");
-			*update = 1;
-			(*count)++;
-			ds->entry_count++;
-			return 0;
-		}
-	}
-	if(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(sbp, "Clear entry to inode containing bad blocks? (y/n)")) {
-
-			load_inode(sbp, de->de_inum.no_addr, &entry_ip);
-			check_inode_eattr(entry_ip, &clear_eattrs);
-			free_inode(&entry_ip);
-
-			/* FIXME: make sure all blocks referenced by
-			 * this inode are cleared in the bitmap */
-
-			dirent_del(ip, bh, prev_de, dent);
-
-			block_set(sbp->bl, de->de_inum.no_addr, meta_inval);
-			return 1;
-		} else {
-			log_warn("Entry to inode containing bad blocks remains\n");
-			*update = 1;
-			(*count)++;
-			ds->entry_count++;
-			return 0;
-		}
-
-	}
-	if(q.block_type != inode_dir && q.block_type != inode_file &&
-	   q.block_type != inode_lnk && q.block_type != inode_blk &&
-	   q.block_type != inode_chr && q.block_type != inode_fifo &&
-	   q.block_type != inode_sock) {
-		log_err("Found directory entry '%s' in block %"
-			PRIu64" to something"
-			" not a file or directory!\n", tmp_name,
-			ip->i_num.no_addr);
-		log_debug("block #%"PRIu64" in %"PRIu64"\n",
-			  de->de_inum.no_addr, ip->i_num.no_addr);
-
-		if(query(sbp, "Clear directory entry to non-inode block? (y/n) ")) {
-			/* FIXME: make sure all blocks referenced by
-			 * this inode are cleared in the bitmap */
-
-			if(dirent_del(ip, bh, prev_de, dent))
-				log_err("Error encountered while removing bad "
-					"directory entry.  Skipping.\n");
-			log_warn("Directory entry '%s' cleared\n", tmp_name);
-			return 1;
-		} else {
-			log_err("Directory entry to non-inode block remains\n");
-			*update = 1;
-			(*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 in dir entry (%s, %"PRIu64") conflicts with "
-			 "type in dinode. (Dir entry is stale.)\n",
-			 tmp_name, de->de_inum.no_addr);
-		if(query(sbp, "Clear stale directory entry? (y/n) ")) {
-			load_inode(sbp, de->de_inum.no_addr, &entry_ip);
-			check_inode_eattr(entry_ip, &clear_eattrs);
-			free_inode(&entry_ip);
-
-			if(dirent_del(ip, bh, prev_de, dent))
-				log_err("Error encountered while removing bad "
-					"directory entry.  Skipping.\n");
-			return 1;
-		} else {
-			log_err("Stale directory entry remains\n");
-			*update  = 1;
-			(*count)++;
-			ds->entry_count++;
-			return 0;
-		}
-	}
-
-
-	if(!strcmp(".", tmp_name)) {
-		log_debug("Found . dentry\n");
-
-		if(ds->dotdir) {
-			log_err("already found '.' entry\n");
-			if(query(sbp, "Clear duplicate '.' entry? (y/n) ")) {
-
-				load_inode(sbp, de->de_inum.no_addr, &entry_ip);
-				check_inode_eattr(entry_ip, &clear_eattrs);
-				free_inode(&entry_ip);
-
-				dirent_del(ip, bh, prev_de, dent);
-				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);
-				*update  = 1;
-				(*count)++;
-				ds->entry_count++;
-				return 0;
-			}
-		}
-
-		/* GFS does not rely on '.' being in a certain
-		 * location */
-
-		/* check that '.' refers to this inode */
-		if(de->de_inum.no_addr != ip->i_num.no_addr) {
-			log_err("'.' entry's value incorrect."
-				"  Points to %"PRIu64
-				" when it should point to %"
-				PRIu64".\n",
-				de->de_inum.no_addr,
-				ip->i_num.no_addr);
-			if(query(sbp, "remove '.' reference? (y/n) ")) {
-				load_inode(sbp, de->de_inum.no_addr, &entry_ip);
-				check_inode_eattr(entry_ip, &clear_eattrs);
-				free_inode(&entry_ip);
-
-				dirent_del(ip, bh, prev_de, dent);
-				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);
-				*update = 1;
-				(*count)++;
-				ds->entry_count++;
-				return 0;
-			}
-		}
-
-		ds->dotdir = 1;
-		increment_link(sbp, de->de_inum.no_addr);
-		*update = 1;
-		(*count)++;
-		ds->entry_count++;
-
-		return 0;
-	}
-	if(!strcmp("..", tmp_name)) {
-		log_debug("Found .. dentry\n");
-		if(ds->dotdotdir) {
-			log_err("already found '..' entry\n");
-			if(query(sbp, "Clear duplicate '..' entry? (y/n) ")) {
-
-				load_inode(sbp, de->de_inum.no_addr, &entry_ip);
-				check_inode_eattr(entry_ip, &clear_eattrs);
-				free_inode(&entry_ip);
-
-				dirent_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);
-				*update  = 1;
-				(*count)++;
-				ds->entry_count++;
-				return 0;
-			}
-		}
-
-		if(q.block_type != inode_dir) {
-			log_err("Found '..' entry pointing to"
-				" something that's not a directory");
-			if(query(sbp, "Clear bad '..' directory entry? (y/n) ")) {
-				load_inode(sbp, de->de_inum.no_addr, &entry_ip);
-				check_inode_eattr(entry_ip, &clear_eattrs);
-				free_inode(&entry_ip);
-
-				dirent_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);
-				*update  = 1;
-				(*count)++;
-				ds->entry_count++;
-				return 0;
-			}
-		}
-		/* GFS 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_num.no_addr,
-				  entryblock)) {
-			stack;
-			return -1;
-		}
-
-		ds->dotdotdir = 1;
-		increment_link(sbp, de->de_inum.no_addr);
-		*update = 1;
-		(*count)++;
-		ds->entry_count++;
-		return 0;
-	}
-
-	/* After this point we're only concerned with
-	 * directories */
-	if(q.block_type != inode_dir) {
-		log_debug("Found non-dir inode dentry\n");
-		increment_link(sbp, de->de_inum.no_addr);
-		*update = 1;
-		(*count)++;
-		ds->entry_count++;
-		return 0;
-	}
-
-	log_debug("Found plain directory dentry\n");
-	error = set_parent_dir(sbp, entryblock, ip->i_num.no_addr);
-	if(error > 0) {
-		log_err("Hard link to block %"PRIu64" detected.\n", filename, entryblock);
-
-		if(query(sbp, "Clear hard link to directory? (y/n) ")) {
-			*update = 1;
-
-			dirent_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");
-			*update = 1;
-			(*count)++;
-			ds->entry_count++;
-			return 0;
-		}
-	}
-	else if (error < 0) {
-		stack;
-		return -1;
-	}
-	increment_link(sbp, de->de_inum.no_addr);
-	*update = 1;
-	(*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,
-};
-
-
-
-
-int build_rooti(struct fsck_sb *sbp)
-{
-	struct fsck_inode *ip;
-	osi_buf_t *bh;
-	get_and_read_buf(sbp, GFS_SB_ADDR >> sbp->fsb2bb_shift, &bh, 0);
-	/* Create a new inode ondisk */
-	create_inode(sbp, GFS_FILE_DIR, &ip);
-	/* Attach it to the superblock's sb_root_di address */
-	sbp->sb.sb_root_di.no_addr =
-		sbp->sb.sb_root_di.no_formal_ino = ip->i_num.no_addr;
-	/* Write out sb change */
-	gfs_sb_out(&sbp->sb, BH_DATA(bh));
-	write_buf(sbp, bh, 1);
-	relse_buf(sbp, bh);
-	sbp->rooti = ip;
-
-	if(fs_dir_add(ip, &(osi_filename_t){(unsigned char *)".", 1},
-		      &(ip->i_num), ip->i_di.di_type)){
-		stack;
-		log_err("Unable to add \".\" entry to new root inode\n");
-		return -1;
-	}
-
-	if(fs_dir_add(ip, &(osi_filename_t){(unsigned char *)"..", 2},
-		      &ip->i_num, ip->i_di.di_type)){
-		stack;
-		log_err("Unable to add \"..\" entry to new root inode\n");
-		return -1;
-	}
-
-	block_set(sbp->bl, ip->i_num.no_addr, inode_dir);
-	add_to_dir_list(sbp, ip->i_num.no_addr);
-
-	/* Attach l+f to it */
-	if(fs_mkdir(sbp->rooti, "l+f", 00700, &(sbp->lf_dip))){
-		log_err("Unable to create/locate l+f directory.\n");
-		return -1;
-	}
-
-	if(sbp->lf_dip){
-		log_debug("Lost and Found directory inode is at "
-			  "block #%"PRIu64".\n",
-			  sbp->lf_dip->i_num.no_addr);
-	}
-	block_set(sbp->bl, sbp->lf_dip->i_num.no_addr, inode_dir);
-
-	add_to_dir_list(sbp, sbp->lf_dip->i_num.no_addr);
-
-	return 0;
-}
-
-/* Check root inode and verify it's in the bitmap */
-int check_root_dir(struct fsck_sb *sbp)
-{
-	uint64_t rootblock;
-	struct dir_status ds = {0};
-	struct fsck_inode *ip;
-	osi_buf_t b, *bh = &b;
-	osi_filename_t filename;
-	char tmp_name[256];
-	int update=0, error = 0;
-	/* Read in the root inode, look at its dentries, and start
-	 * reading through them */
-	rootblock = sbp->sb.sb_root_di.no_addr;
-
-	/* FIXME: check this block's validity */
-
-	if(block_check(sbp->bl, rootblock, &ds.q)) {
-		log_crit("Can't get root block %"PRIu64" from block list\n",
-			 rootblock);
-		/* FIXME: Need to check if the root block is out of
-		 * the fs range and if it is, rebuild it.  Still can
-		 * error out if the root block number is valid, but
-		 * block_check fails */
-		return -1;
-/*		if(build_rooti(sbp)) {
-			stack;
-			return -1;
-			}*/
-	}
-
-	/* if there are errors with the root inode here, we need to
-	 * create a new root inode and get it all setup - of course,
-	 * everything will be in l+f then, but we *need* a root inode
-	 * before we can do any of that.
-	 */
-	if(ds.q.block_type != inode_dir) {
-		log_err("Block %"PRIu64" marked as root inode in"
-			" superblock not a directory\n", rootblock);
-		if(query(sbp, "Create new root inode? (y/n) ")) {
-			if(build_rooti(sbp)) {
-				stack;
-				return -1;
-			}
-		} else {
-			log_err("Cannot continue without valid root inode\n");
-			return -1;
-		}
-	}
-
-	rootblock = sbp->sb.sb_root_di.no_addr;
-	pass2_fxns.private = (void *) &ds;
-	if(ds.q.bad_block) {
-		/* First check that the directory's metatree is valid */
-		load_inode(sbp, rootblock, &ip);
-		if(check_metatree(ip, &pass2_fxns)) {
-			stack;
-			free_inode(&ip);
-			return -1;
-		}
-		free_inode(&ip);
-	}
-	error = check_dir(sbp, rootblock, &pass2_fxns);
-	if(error < 0) {
-		stack;
-		return -1;
-	}
-	if (error > 0) {
-		block_set(sbp->bl, rootblock, meta_inval);
-	}
-
-	if(get_and_read_buf(sbp, rootblock, &bh, 0)){
-		log_err("Unable to retrieve block #%"PRIu64"\n",
-			rootblock);
-		block_set(sbp->bl, rootblock, meta_inval);
-		return -1;
-	}
-
-	if(copyin_inode(sbp, bh, &ip)) {
-		stack;
-		relse_buf(sbp, bh);
-		return -1;
-	}
-
-	if(check_inode_eattr(ip, &pass2_fxns)) {
-		stack;
-		return -1;
-	}
-	/* FIXME: Should not have to do this here - fs_dir_add reads
-	 * the buffer too though, and commits the change to disk, so I
-	 * have to reread the buffer after calling it if I'm going to
-	 * make more changes */
-	relse_buf(sbp, bh);
-
-	if(!ds.dotdir) {
-		log_err("No '.' entry found\n");
-		sprintf(tmp_name, ".");
-		filename.len = strlen(tmp_name);  /* no trailing NULL */
-		if(!(filename.name = malloc(sizeof(char) * filename.len))) {
-			log_err("Unable to allocate name string\n");
-			stack;
-			return -1;
-		}
-		if(!(memset(filename.name, 0, sizeof(char) * filename.len))) {
-			log_err("Unable to zero name string\n");
-			stack;
-			return -1;
-		}
-		memcpy(filename.name, tmp_name, filename.len);
-		log_warn("Adding '.' entry\n");
-		if(fs_dir_add(ip, &filename, &(ip->i_num),
-			      ip->i_di.di_type)){
-			log_err("Failed to link \".\" entry to directory.\n");
-			return -1;
-		}
-
-		increment_link(ip->i_sbd, ip->i_num.no_addr);
-		ds.entry_count++;
-		free(filename.name);
-		update = 1;
-	}
-	free_inode(&ip);
-	if(get_and_read_buf(sbp, rootblock, &bh, 0)){
-		log_err("Unable to retrieve block #%"PRIu64"\n",
-			rootblock);
-		block_set(sbp->bl, rootblock, meta_inval);
-		return -1;
-	}
-
-	if(copyin_inode(sbp, bh, &ip)) {
-		stack;
-		relse_buf(sbp, bh);
-		return -1;
-	}
-
-	if(ip->i_di.di_entries != ds.entry_count) {
-		log_err("Entries is %d - should be %d for %"PRIu64"\n",
-			ip->i_di.di_entries, ds.entry_count, ip->i_di.di_num.no_addr);
-		if(query(sbp, "Fix entries for %"PRIu64"? (y/n) ",
-			 ip->i_di.di_num.no_addr)) {
-			ip->i_di.di_entries = ds.entry_count;
-			log_warn("Entries updated\n");
-			update = 1;
-		} else {
-			log_err("Entries for %"PRIu64" left out of sync\n",
-				ip->i_di.di_num.no_addr);
-		}
-	}
-
-	if(update) {
-		gfs_dinode_out(&ip->i_di, BH_DATA(bh));
-		write_buf(sbp, bh, 0);
-	}
-
-	free_inode(&ip);
-	relse_buf(sbp, bh);
-	return 0;
-}
-
-/* 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 fsck_sb *sbp, struct options *opts)
-{
-	uint64_t i;
-	struct block_query q;
-	struct dir_status ds = {0};
-	struct fsck_inode *ip;
-	osi_buf_t b, *bh = &b;
-	osi_filename_t filename;
-	char tmp_name[256];
-	if(check_root_dir(sbp)) {
-		stack;
-		return -1;
-	}
-	int error = 0;
-
-	log_info("Checking directory inodes.\n");
-	/* Grab each directory inode, and run checks on it */
-	for(i = 0; i < sbp->last_fs_block; i++) {
-
-		warm_fuzzy_stuff(i);
-		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
-			return 0;
-
-		/* Skip the root inode - it's checked above */
-		if(i == sbp->sb.sb_root_di.no_addr)
-			continue;
-
-		if(block_check(sbp->bl, i, &q)) {
-			log_err("Can't get block %"PRIu64 " from block list\n",
-				i);
-			return -1;
-		}
-
-		if(q.block_type != inode_dir)
-			continue;
-
-		log_debug("Checking directory inode at block %"PRIu64"\n", 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 */
-			load_inode(sbp, i, &ip);
-			if(check_metatree(ip, &pass2_fxns)) {
-				stack;
-				free_inode(&ip);
-				return -1;
-			}
-			free_inode(&ip);
-		}
-		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(sbp, "Remove directory entry for bad"
-					 " inode %"PRIu64" in %"PRIu64
-					 "? (y/n)", i, 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" in %"PRIu64"\n",
-							 i, di->treewalk_parent);
-					}
-					log_warn("Directory entry removed\n");
-				} else {
-					log_err("Directory entry to invalid inode remains\n");
-				}
-			}
-			block_set(sbp->bl, i, meta_inval);
-		}
-		if(get_and_read_buf(sbp, i, &bh, 0)){
-			/* This shouldn't happen since we were able to
-			 * read it before */
-			log_err("Unable to retrieve block #%"PRIu64
-				" for directory\n",
-				i);
-			return -1;
-		}
-
-		if(copyin_inode(sbp, bh, &ip)) {
-			stack;
-			relse_buf(sbp, bh);
-			return -1;
-		}
-		/* FIXME: Should not have to do this here - fs_dir_add reads
-		 * the buffer too though, and commits the change to disk, so I
-		 * have to reread the buffer after calling it if I'm going to
-		 * make more changes */
-		relse_buf(sbp, bh);
-
-		if(!ds.dotdir) {
-			log_err("No '.' entry found\n");
-			sprintf(tmp_name, ".");
-			filename.len = strlen(tmp_name);  /* no trailing NULL */
-			if(!(filename.name = malloc(sizeof(char) * filename.len))) {
-				log_err("Unable to allocate name string\n");
-				stack;
-				return -1;
-			}
-			if(!memset(filename.name, 0, sizeof(char) * filename.len)) {
-				log_err("Unable to zero name string\n");
-				stack;
-				return -1;
-			}
-			memcpy(filename.name, tmp_name, filename.len);
-
-			if(fs_dir_add(ip, &filename, &(ip->i_num),
-				      ip->i_di.di_type)){
-				log_err("Failed to link \".\" entry to directory.\n");
-				return -1;
-			}
-
-			increment_link(ip->i_sbd, ip->i_num.no_addr);
-			ds.entry_count++;
-			free(filename.name);
-
-		}
-		free_inode(&ip);
-
-		if(get_and_read_buf(sbp, i, &bh, 0)){
-			log_err("Unable to retrieve block #%"PRIu64"\n",
-				i);
-			block_set(sbp->bl, i, meta_inval);
-			return -1;
-		}
-
-		if(copyin_inode(sbp, bh, &ip)) {
-			stack;
-			relse_buf(sbp, bh);
-			return -1;
-		}
-		if(ip->i_di.di_entries != ds.entry_count) {
-			log_err("Entries is %d - should be %d for %"PRIu64"\n",
-				ip->i_di.di_entries, ds.entry_count,
-				ip->i_di.di_num.no_addr);
-			ip->i_di.di_entries = ds.entry_count;
-			gfs_dinode_out(&ip->i_di, BH_DATA(bh));
-			write_buf(sbp, bh, 0);
-		}
-		free_inode(&ip);
-		relse_buf(sbp, bh);
-	}
-	return 0;
-}
-
-
-
diff --git a/gfs/gfs_fsck/pass3.c b/gfs/gfs_fsck/pass3.c
deleted file mode 100644
index 3991147..0000000
--- a/gfs/gfs_fsck/pass3.c
+++ /dev/null
@@ -1,274 +0,0 @@
-#include <stdio.h>
-#include "osi_list.h"
-#include "fsck_incore.h"
-#include "fsck.h"
-#include "inode.h"
-#include "lost_n_found.h"
-#include "block_list.h"
-#include "fs_dir.h"
-#include "link.h"
-#include "metawalk.h"
-
-static int attach_dotdot_to(struct fsck_sb *sbp, uint64_t newdotdot,
-			    uint64_t olddotdot, uint64_t block)
-{
-	osi_filename_t filename;
-	struct fsck_inode *ip, *pip;
-
-	load_inode(sbp, block, &ip);
-	load_inode(sbp, newdotdot, &pip);
-	/* 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.name = malloc(sizeof(char) * filename.len))) {
-		log_err("Unable to allocate name\n");
-		stack;
-		return -1;
-	}
-	if(!memset(filename.name, 0, sizeof(char) * filename.len)) {
-		log_err("Unable to zero name\n");
-		stack;
-		return -1;
-	}
-	memcpy(filename.name, "..", filename.len);
-	if(fs_dirent_del(ip, NULL, &filename)){
-		log_warn("Unable to remove \"..\" directory entry.\n");
-	}
-	else {
-		decrement_link(sbp, olddotdot);
-	}
-	if(fs_dir_add(ip, &filename, &pip->i_num,
-		      pip->i_di.di_type)){
-		log_err("Failed to link \"..\" entry to directory.\n");
-		block_set(ip->i_sbd->bl, ip->i_num.no_addr, meta_inval);
-		free_inode(&ip);
-		free_inode(&pip);
-		return -1;
-	}
-	increment_link(sbp, newdotdot);
-	free_inode(&ip);
-	free_inode(&pip);
-	return 0;
-}
-
-struct dir_info *mark_and_return_parent(struct fsck_sb *sbp,
-					struct dir_info *di)
-{
-	struct dir_info *pdi;
-
-	struct block_query q_dotdot, q_treewalk;
-
-	di->checked = 1;
-
-	if(!di->treewalk_parent) {
-		return NULL;
-	}
-
-	if(di->dotdot_parent != di->treewalk_parent) {
-		log_warn(".. and treewalk conections are not the same for %"PRIu64
-			 "\n", di->dinode);
-		log_notice("%"PRIu64" %"PRIu64"\n", di->dotdot_parent, di->treewalk_parent);
-		if(block_check(sbp->bl, di->dotdot_parent, &q_dotdot)) {
-			log_err("Unable to find block %"PRIu64
-				" in block map\n",
-				di->dotdot_parent);
-			return NULL;
-		}
-		if(block_check(sbp->bl, di->treewalk_parent, &q_treewalk)) {
-			log_err("Unable to find block %"PRIu64
-				" in block map\n",
-				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 l+f
-		 */
-		if(q_dotdot.block_type != inode_dir) {
-			if(q_treewalk.block_type != inode_dir) {
-				log_err( "Orphaned directory, move to l+f\n");
-				return NULL;
-			}
-			else {
-				log_warn("Treewalk parent is correct,"
-					 " fixing dotdot -> %"PRIu64"\n",
-					 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 != inode_dir) {
-				int error = 0;
-				log_warn(".. parent is valid, but treewalk"
-					 "is bad - reattaching to l+f");
-
-				/* FIXME: add a dinode for this entry instead? */
-				if(query(sbp, "Remove directory entry for bad"
-					 " inode %"PRIu64" in %"PRIu64
-					 "? (y/n)", di->dinode,
-					 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 %"
-							 PRIu64" in %"PRIu64"\n",
-							 di->dinode, 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(block_check(sbp->bl, di->dotdot_parent, &q_dotdot)) {
-			log_err("Unable to find parent block %"PRIu64
-				" in block map\n",
-				di->dotdot_parent);
-			return NULL;
-		}
-		if(q_dotdot.block_type != inode_dir) {
-			log_err("Orphaned directory, move to l+f (Block #%"
-				PRIu64")\n", 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 fsck_sb *sbp, struct options *opts)
-{
-	osi_list_t *tmp;
-	struct dir_info *di, *tdi;
-	struct fsck_inode *ip;
-	struct block_query q;
-	int i;
-
-	find_di(sbp, sbp->sb.sb_root_di.no_addr, &di);
-	if(di) {
-		log_info("Marking root 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, &sbp->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(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(sbp, "Clear unlinked directory with bad blocks? (y/n) ")) {
-						block_set(sbp->bl, di->dinode, block_free);
-						break;
-					} else {
-						log_err("Unlinked directory with bad blocks remains\n");
-					}
-				}
-				if(q.block_type != inode_dir &&
-				   q.block_type != inode_file &&
-				   q.block_type != inode_lnk &&
-				   q.block_type != inode_blk &&
-				   q.block_type != inode_chr &&
-				   q.block_type != inode_fifo &&
-				   q.block_type != inode_sock) {
-					log_err("Unlinked block marked as inode not an inode\n");
-					block_set(sbp->bl, di->dinode, block_free);
-					log_err("Cleared\n");
-					break;
-				}
-
-				log_err("Found unlinked directory %"PRIu64"\n", di->dinode);
-				load_inode(sbp, di->dinode, &ip);
-				/* 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(sbp, "Remove zero-size unlinked directory? (y/n) ")) {
-						block_set(sbp->bl, di->dinode, block_free);
-						free_inode(&ip);
-						break;
-					} else {
-						log_err("Zero-size unlinked directory remains\n");
-					}
-				}
-				if(query(sbp, "Add unlinked directory to l+f? (y/n) ")) {
-					if(add_inode_to_lf(ip)) {
-						stack;
-						return -1;
-					}
-					log_warn("Directory relinked to l+f\n");
-				} else {
-					log_err("Unlinked directory remains unlinked\n");
-				}
-				free_inode(&ip);
-				break;
-			}
-			else {
-				log_debug("Directory at block %" PRIu64 " connected\n",
-						 di->dinode);
-			}
-			di = tdi;
-		}
-	}
-	}
-	if(sbp->lf_dip)
-		log_debug("At end of pass3, l+f entries is %u\n",
-			  sbp->lf_dip->i_di.di_entries);
-	return 0;
-}
diff --git a/gfs/gfs_fsck/pass4.c b/gfs/gfs_fsck/pass4.c
deleted file mode 100644
index bb9d61d..0000000
--- a/gfs/gfs_fsck/pass4.c
+++ /dev/null
@@ -1,181 +0,0 @@
-#include "stdio.h"
-#include "fsck_incore.h"
-#include "fsck.h"
-#include "bio.h"
-#include "fs_inode.h"
-#include "inode_hash.h"
-#include "inode.h"
-#include "lost_n_found.h"
-
-/* Updates the link count of an inode to what the fsck has seen for
- * link count */
-int fix_inode_count(struct fsck_sb *sbp, struct inode_info *ii,
-		    struct fsck_inode *ip)
-{
-	log_info("Fixing inode count for %"PRIu64"\n",
-		 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" to have %u links\n",
-		  ip->i_di.di_num.no_addr, ii->counted_links);
-
-	fs_copyout_dinode(ip);
-
-	return 0;
-}
-
-int scan_inode_list(struct fsck_sb *sbp, osi_list_t *list) {
-	osi_list_t *tmp;
-	struct inode_info *ii;
-	struct fsck_inode *ip;
-	int lf_addition = 0;
-	struct block_query q;
-
-	/* 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;
-		if(!(ii = osi_list_entry(tmp, struct inode_info, list))) {
-			log_crit("osi_list_foreach broken in scan_info_list!!\n");
-			exit(1);
-		}
-		/* Don't check reference counts on the special gfs files */
-		if((ii->inode == sbp->sb.sb_rindex_di.no_addr) ||
-		   (ii->inode == sbp->sb.sb_jindex_di.no_addr) ||
-		   (ii->inode == sbp->sb.sb_quota_di.no_addr) ||
-		   (ii->inode == sbp->sb.sb_license_di.no_addr))
-			continue;
-		log_debug("Checking reference count on inode at block %"PRIu64
-				  "\n", ii->inode);
-		if(ii->counted_links == 0) {
-			log_err("Found unlinked inode at %"PRIu64"\n",
-				ii->inode);
-			if(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(sbp, "Clear unlinked inode with bad blocks? (y/n) ")) {
-					block_set(sbp->bl, ii->inode, block_free);
-					continue;
-				} else {
-					log_err("Unlinked inode with bad blocks not cleared\n");
-				}
-			}
-			if(q.block_type != inode_dir &&
-			   q.block_type != inode_file &&
-			   q.block_type != inode_lnk &&
-			   q.block_type != inode_blk &&
-			   q.block_type != inode_chr &&
-			   q.block_type != inode_fifo &&
-			   q.block_type != inode_sock) {
-				log_err("Unlinked block marked as inode not an inode\n");
-				block_set(sbp->bl, ii->inode, block_free);
-				log_err("Cleared\n");
-				continue;
-			}
-			if(load_inode(sbp, ii->inode, &ip)) {
-				stack;
-				return -1;
-			}
-			/* 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(sbp, "Clear zero-size unlinked inode? (y/n) ")) {
-					block_set(sbp->bl, ii->inode, block_free);
-					free_inode(&ip);
-					continue;
-				}
-
-			}
-			if(query(sbp, "Add unlinked inode to l+f? (y/n)")) {
-				if(add_inode_to_lf(ip)) {
-					stack;
-					free_inode(&ip);
-					return -1;
-				}
-				else {
-					fix_inode_count(sbp, ii, ip);
-					lf_addition = 1;
-				}
-			} else {
-				log_err("Unlinked inode left unlinked\n");
-			}
-			free_inode(&ip);
-		}
-		else if(ii->link_count != ii->counted_links) {
-			log_err("Link count inconsistent for inode %"PRIu64
-				" - %u %u\n",
-				ii->inode, ii->link_count, ii->counted_links);
-			/* Read in the inode, adjust the link count,
-			 * and write it back out */
-			if(query(sbp, "Update link count for inode %"
-				 PRIu64"? (y/n) ", ii->inode)) {
-				load_inode(sbp, ii->inode, &ip);
-				fix_inode_count(sbp, ii, ip);
-				free_inode(&ip);
-				log_warn("Link count updated for inode %"
-					 PRIu64"\n", ii->inode);
-			} else {
-				log_err("Link count for inode %"
-					PRIu64" still incorrect\n", ii->inode);
-			}
-		}
-		log_debug("block %"PRIu64" has link count %d\n", ii->inode,
-			  ii->link_count);
-	}
-
-	if (lf_addition) {
-		if(!(ii = inode_hash_search(sbp->inode_hash,
-					    sbp->lf_dip->i_num.no_addr))) {
-			log_crit("Unable to find l+f inode in inode_hash!!\n");
-			return -1;
-		} else {
-			fix_inode_count(sbp, ii, sbp->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 fsck_sb *sbp, struct options *opts)
-{
-	uint32_t i;
-	osi_list_t *list;
-	if(sbp->lf_dip)
-		log_debug("At beginning of pass4, l+f entries is %u\n",
-			  sbp->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 = &sbp->inode_hash[i];
-		if(scan_inode_list(sbp, list)) {
-			stack;
-			return -1;
-		}
-	}
-
-	if(sbp->lf_dip)
-		log_debug("At end of pass4, l+f entries is %u\n",
-			  sbp->lf_dip->i_di.di_entries);
-	return 0;
-}
diff --git a/gfs/gfs_fsck/pass5.c b/gfs/gfs_fsck/pass5.c
deleted file mode 100644
index 86c9cc3..0000000
--- a/gfs/gfs_fsck/pass5.c
+++ /dev/null
@@ -1,365 +0,0 @@
-#include <stdio.h>
-#include "fsck_incore.h"
-#include "fsck.h"
-#include "ondisk.h"
-#include "fs_bits.h"
-#include "bio.h"
-#include "util.h"
-
-#ifdef DEBUG
-int rgrp_countbits(unsigned char *buffer, unsigned int buflen,
-		   uint32_t *bit_array)
-{
-	unsigned char *byte, *end;
-	unsigned int bit;
-	unsigned char state;
-
-	byte = buffer;
-	bit = 0;
-	end = buffer + buflen;
-
-	while (byte < end){
-		state = ((*byte >> bit) & GFS_BIT_MASK);
-		switch (state) {
-		case GFS_BLKST_FREE:
-			bit_array[0]++;
-			break;
-		case GFS_BLKST_USED:
-			bit_array[1]++;
-			break;
-		case GFS_BLKST_FREEMETA:
-			bit_array[2]++;
-			break;
-		case GFS_BLKST_USEDMETA:
-			bit_array[3]++;
-			break;
-		default:
-			log_err("Invalid state %d found at byte %u, bit %u\n",
-				state, byte, bit);
-			return -1;
-			break;
-		}
-
-		bit += GFS_BIT_SIZE;
-		if (bit >= 8){
-			bit = 0;
-			byte++;
-		}
-	}
-	return 0;
-}
-
-int fsck_countbits(struct fsck_sb *sbp, uint64_t start_blk, uint64_t count,
-		   uint32_t *bit_array)
-{
-	uint64_t i;
-	struct block_query q;
-	for(i = start_blk; i < start_blk+count; i++) {
-		block_check(sbp->bl, i, &q);
-		switch(q.block_type) {
-		case block_free:
-			bit_array[0]++;
-			break;
-		case block_used:
-			bit_array[1]++;
-			break;
-		case meta_free:
-		case meta_inval:
-			bit_array[2]++;
-			break;
-		case indir_blk:
-		case inode_dir:
-		case inode_file:
-		case leaf_blk:
-		case journal_blk:
-		case meta_other:
-		case meta_eattr:
-			bit_array[3]++;
-			break;
-		default:
-			log_err("Invalid state %d found at block%"PRIu64"\n",
-				q.block_type, i);
-			return -1;
-			break;
-		}
-	}
-	return 0;
-}
-
-
-int count_bmaps(struct fsck_rgrp *rgp)
-{
-	uint32_t i;
-	uint32_t bit_array_rgrp[4] = {0};
-	uint32_t bit_array_fsck[4] = {0};
-	fs_bitmap_t *bits;
-
-	for(i = 0; i < rgp->rd_ri.ri_length; i++) {
-		bits = &rgp->rd_bits[i];
-		rgrp_countbits(BH_DATA(rgp->rd_bh[i]) + bits->bi_offset,
-			       bits->bi_len, bit_array_rgrp);
-	}
-	log_err("rgrp: free %u used %u meta_free %u meta_used %u\n",
-		bit_array_rgrp[0], bit_array_rgrp[1],
-		bit_array_rgrp[2], bit_array_rgrp[3]);
-	fsck_countbits(rgp->rd_sbd, rgp->rd_ri.ri_data1,
-		       rgp->rd_ri.ri_data, bit_array_fsck);
-	log_err("fsck: free %u used %u meta_free %u meta_used %u\n",
-		bit_array_fsck[0], bit_array_fsck[1],
-		bit_array_fsck[2], bit_array_fsck[3]);
-
-	for(i = 0; i < 4; i++) {
-		if(bit_array_rgrp[i] != bit_array_fsck[i]) {
-			log_err("Bitmap count in index %d differ: "
-				"ondisk %d, fsck %d\n", i,
-				bit_array_rgrp[i], bit_array_fsck[i]);
-		}
-	}
-	return 0;
-}
-#endif /* DEBUG */
-
-int convert_mark(enum mark_block mark, uint32_t *count)
-{
-	switch(mark) {
-
-	case meta_inval:
-		/* Convert invalid metadata to free blocks */
-	case block_free:
-		count[0]++;
-		return GFS_BLKST_FREE;
-
-	case meta_free:
-		count[4]++;
-		return GFS_BLKST_FREEMETA;
-
-	case block_used:
-		return GFS_BLKST_USED;
-
-	case inode_dir:
-	case inode_file:
-	case inode_lnk:
-	case inode_blk:
-	case inode_chr:
-	case inode_fifo:
-	case inode_sock:
-		count[1]++;
-		return GFS_BLKST_USEDMETA;
-
-	case indir_blk:
-	case leaf_blk:
-	case journal_blk:
-	case meta_other:
-	case meta_eattr:
-		count[3]++;
-		return GFS_BLKST_USEDMETA;
-
-	default:
-		log_err("Invalid state %d found\n", mark);
-		return -1;
-
-	}
-	return -1;
-}
-
-
-int check_block_status(struct fsck_sb *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 block_query q;
-	uint64_t block;
-
-	byte = (unsigned char *)buffer;
-	bit = 0;
-	end = (unsigned char *)buffer + buflen;
-
-	while(byte < end) {
-		rg_status = ((*byte >> bit) & GFS_BIT_MASK);
-		block = rg_data + *rg_block;
-		log_debug("Checking block %" PRIu64 "\n", block);
-		warm_fuzzy_stuff(block);
-		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
-			return 0;
-		block_check(sbp->bl, block, &q);
-
-		block_status = convert_mark(q.block_type, count);
-
-		if(rg_status != block_status) {
-			log_debug("Ondisk is %u - FSCK thinks it is %u (%u)\n",
-				  rg_status, block_status, q.block_type);
-			if((rg_status == GFS_BLKST_FREEMETA) &&
-			   (block_status == GFS_BLKST_FREE)) {
-				log_info("Converting free metadata block at %"
-					 PRIu64" to a free data block\n", block);
-				if(!sbp->opts->no) {
-					if(fs_set_bitmap(sbp, block, block_status)) {
-						log_warn("Failed to convert free metadata block to free data block at %PRIu64.\n", block);
-					}
-					else {
-						log_info("Succeeded.\n");
-					}
-				}
-			}
-			else {
-
-				log_err("ondisk and fsck bitmaps differ at"
-					" block %"PRIu64"\n", block);
-
-				if(query(sbp, "Fix bitmap for block %"
-					 PRIu64"? (y/n) ", block)) {
-					if(fs_set_bitmap(sbp, block, block_status)) {
-						log_err("Failed.\n");
-					}
-					else {
-						log_err("Succeeded.\n");
-					}
-				} else {
-					log_err("Bitmap at block %"PRIu64
-						" left inconsistent\n", block);
-				}
-			}
-		}
-		(*rg_block)++;
-		bit += GFS_BIT_SIZE;
-		if (bit >= 8){
-			bit = 0;
-			byte++;
-		}
-	}
-
-	return 0;
-}
-
-#define FREE_COUNT       1
-#define USED_INODE_COUNT 2
-#define FREE_INODE_COUNT 4
-#define USED_META_COUNT  8
-#define FREE_META_COUNT  16
-#define CONVERT_FREEMETA_TO_FREE (FREE_COUNT | FREE_META_COUNT)
-
-int update_rgrp(struct fsck_rgrp *rgp, uint32_t *count, int rgcount)
-{
-	uint32_t i;
-	fs_bitmap_t *bits;
-	uint64_t rg_block = 0;
-	uint8_t bmap = 0;
-
-	for(i = 0; i < rgp->rd_ri.ri_length; i++) {
-		bits = &rgp->rd_bits[i];
-
-		/* update the bitmaps */
-		check_block_status(rgp->rd_sbd,
-				   BH_DATA(rgp->rd_bh[i]) + bits->bi_offset,
-				   bits->bi_len, &rg_block,
-				   rgp->rd_ri.ri_data1, count);
-		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
-			return 0;
-	}
-
-	/* Compare the rgrps counters with what we found */
-	if(rgp->rd_rg.rg_free != count[0]) {
-		bmap |= FREE_COUNT;
-	}
-	if(rgp->rd_rg.rg_useddi != count[1]) {
-		bmap |= USED_INODE_COUNT;
-	}
-	if(rgp->rd_rg.rg_freedi != count[2]) {
-		bmap |= FREE_INODE_COUNT;
-	}
-	if(rgp->rd_rg.rg_usedmeta != count[3]) {
-		bmap |= USED_META_COUNT;
-	}
-	if(rgp->rd_rg.rg_freemeta != count[4]) {
-		bmap |= FREE_META_COUNT;
-	}
-
-	if(bmap && !(bmap & ~CONVERT_FREEMETA_TO_FREE)) {
-		log_notice("Converting %d unused metadata blocks to free data blocks...\n",
-			   rgp->rd_rg.rg_freemeta - count[4]);
-		rgp->rd_rg.rg_free = count[0];
-		rgp->rd_rg.rg_freemeta = count[4];
-		gfs_rgrp_out(&rgp->rd_rg, BH_DATA(rgp->rd_bh[0]));
-		if(!rgp->rd_sbd->opts->no) {
-			write_buf(rgp->rd_sbd, rgp->rd_bh[0], 0);
-		}
-	} else if(bmap) {
-		/* actually adjust counters and write out to disk */
-		if(bmap & FREE_COUNT) {
-			log_err("RG #%d free count inconsistent: is %u should be %u\n",
-					rgcount, rgp->rd_rg.rg_free, count[0] );
-			rgp->rd_rg.rg_free = count[0];
-		}
-		if(bmap & USED_INODE_COUNT) {
-			log_err("RG #%d used inode count inconsistent: is %u should be %u\n",
-				rgcount, rgp->rd_rg.rg_useddi, count[1]);
-			rgp->rd_rg.rg_useddi = count[1];
-		}
-		if(bmap & FREE_INODE_COUNT) {
-			log_err("RG #%d free inode count inconsistent: is %u should be %u\n",
-				rgcount, rgp->rd_rg.rg_freedi, count[2]);
-			rgp->rd_rg.rg_freedi = count[2];
-		}
-		if(bmap & USED_META_COUNT) {
-			log_err("RG #%d used meta count inconsistent: is %u should be %u\n",
-				rgcount, rgp->rd_rg.rg_usedmeta, count[3]);
-			rgp->rd_rg.rg_usedmeta = count[3];
-		}
-		if(bmap & FREE_META_COUNT) {
-			log_err("RG #%d free meta count inconsistent: is %u should be %u\n",
-				rgcount, rgp->rd_rg.rg_freemeta, count[4]);
-			rgp->rd_rg.rg_freemeta = count[4];
-		}
-
-		if(query(rgp->rd_sbd,
-			 "Update resource group counts? (y/n) ")) {
-			log_warn("Resource group counts updated\n");
-			/* write out the rgrp */
-			gfs_rgrp_out(&rgp->rd_rg, BH_DATA(rgp->rd_bh[0]));
-			write_buf(rgp->rd_sbd, rgp->rd_bh[0], 0);
-		} else {
-			log_err("Resource group counts left inconsistent\n");
-		}
-	}
-
-	return 0;
-}
-
-/**
- * pass5 - check resource groups
- *
- * fix free block maps
- * fix used inode maps
- */
-int pass5(struct fsck_sb *sbp, struct options *opts)
-{
-	osi_list_t *tmp;
-	struct fsck_rgrp *rgp = NULL;
-	uint32_t count[5];
-	uint64_t rg_count = 1;
-
-	/* Reconcile RG bitmaps with fsck bitmap */
-	for(tmp = sbp->rglist.next; tmp != &sbp->rglist; tmp = tmp->next){
-		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
-			return 0;
-		log_info("Updating Resource Group %"PRIu64"\n", rg_count);
-		memset(count, 0, sizeof(*count) * 5);
-		rgp = osi_list_entry(tmp, struct fsck_rgrp, rd_list);
-
-		if(fs_rgrp_read(rgp, FALSE)){
-			stack;
-			return -1;
-		}
-		/* Compare the bitmaps and report the differences */
-		update_rgrp(rgp, count, rg_count);
-		rg_count++;
-		fs_rgrp_relse(rgp);
-	}
-	/* Fix up superblock info based on this - don't think there's
-	 * anything to do here... */
-
-
-	return 0;
-}
diff --git a/gfs/gfs_fsck/rgrp.c b/gfs/gfs_fsck/rgrp.c
deleted file mode 100644
index dcbb2cc..0000000
--- a/gfs/gfs_fsck/rgrp.c
+++ /dev/null
@@ -1,632 +0,0 @@
-#include "util.h"
-#include "bio.h"
-#include "fs_bits.h"
-#include "fs_inode.h"
-#include "fsck_incore.h"
-#include "fsck.h"
-#include "rgrp.h"
-#include "inode.h"
-
-/**
- * fs_compute_bitstructs - Compute the bitmap sizes
- * @rgd: The resource group descriptor
- *
- * Returns: 0 on success, -1 on error
- */
-int fs_compute_bitstructs(struct fsck_rgrp *rgd)
-{
-	struct fsck_sb *sdp = rgd->rd_sbd;
-	fs_bitmap_t *bits;
-	uint32 length = rgd->rd_ri.ri_length;
-	uint32 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) {
-		log_err("Invalid length %u found in rindex.\n", length);
-		return -1;
-	}
-	if(!(rgd->rd_bits = (fs_bitmap_t *)malloc(length * sizeof(fs_bitmap_t)))) {
-		log_err("Unable to allocate bitmap structure\n");
-		stack;
-		return -1;
-	}
-	if(!memset(rgd->rd_bits, 0, length * sizeof(fs_bitmap_t))) {
-		free(rgd->rd_bits);
-		log_err("Unable to zero bitmap structure\n");
-		stack;
-		return -1;
-	}
-	
-	bytes_left = rgd->rd_ri.ri_bitbytes;
-
-	for (x = 0; x < length; x++){
-		bits = &rgd->rd_bits[x];
-
-		if (length == 1){
-			bytes = bytes_left;
-			bits->bi_offset = sizeof(struct gfs_rgrp);
-			bits->bi_start = 0;
-			bits->bi_len = bytes;
-		}
-		else if (x == 0){
-			bytes = sdp->sb.sb_bsize - sizeof(struct gfs_rgrp);
-			bits->bi_offset = sizeof(struct gfs_rgrp);
-			bits->bi_start = 0;
-			bits->bi_len = bytes;
-		}
-		else if (x + 1 == length){
-			bytes = bytes_left;
-			bits->bi_offset = sizeof(struct gfs_meta_header);
-			bits->bi_start = rgd->rd_ri.ri_bitbytes - bytes_left;
-			bits->bi_len = bytes;
-		}
-		else{
-			bytes = sdp->sb.sb_bsize - sizeof(struct gfs_meta_header);
-			bits->bi_offset = sizeof(struct gfs_meta_header);
-			bits->bi_start = rgd->rd_ri.ri_bitbytes - bytes_left;
-			bits->bi_len = bytes;
-		}
-
-		bytes_left -= bytes;
-	}
-
-	if(bytes_left){
-		log_err( "fs_compute_bitstructs:  Too many blocks in rgrp to "
-			"fit into available bitmap.\n");
-		free(rgd->rd_bits);
-		return -1;
-	}
-
-	if((rgd->rd_bits[length - 1].bi_start +
-	    rgd->rd_bits[length - 1].bi_len) * GFS_NBBY != rgd->rd_ri.ri_data){
-		log_err( "fs_compute_bitstructs:  # of blks in rgrp do not equal "
-			"# of blks represented in bitmap.\n"
-			"\tbi_start = %u\n"
-			"\tbi_len   = %u\n"
-			"\tGFS_NBBY = %u\n"
-			"\tri_data  = %u\n",
-			rgd->rd_bits[length - 1].bi_start,
-			rgd->rd_bits[length - 1].bi_len,
-			GFS_NBBY,
-			rgd->rd_ri.ri_data);
-		free(rgd->rd_bits);
-		return -1;
-	}
-
-
-	if(!(rgd->rd_bh = (osi_buf_t **)malloc(length * sizeof(osi_buf_t *)))) {
-		log_err("Unable to allocate osi_buf structure\n");
-		stack;
-		free(rgd->rd_bits);
-		return -1;
-	}
-	if(!memset(rgd->rd_bh, 0, length * sizeof(osi_buf_t *))) {
-		log_err("Unable to zero osi_buf structure\n");
-		stack;
-		free(rgd->rd_bits);
-		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 fsck_rgrp *fs_blk2rgrpd(struct fsck_sb *sdp, uint64 blk)
-{
-	osi_list_t *tmp;
-	struct fsck_rgrp *rgd = NULL;
-	struct gfs_rindex *ri;
-
-	for(tmp = sdp->rglist.next; tmp != &sdp->rglist; tmp = tmp->next){
-		rgd = osi_list_entry(tmp, struct fsck_rgrp, rd_list);
-		ri = &rgd->rd_ri;
-
-		if (ri->ri_data1 <= blk && blk < ri->ri_data1 + ri->ri_data){
-			break;
-		} else
-			rgd = NULL;
-	}
-	return rgd;
-}
-
-/**
- * fs_rgrp_read - read in the resource group information from disk.
- * @rgd - resource group structure
- * @repair_if_corrupted - If TRUE, rgrps found to be corrupt should be repaired
- *                 according to the index.  If FALSE, no corruption is fixed.
- */
-int fs_rgrp_read(struct fsck_rgrp *rgd, int repair_if_corrupted)
-{
-	struct fsck_sb *sdp = rgd->rd_sbd;
-	unsigned int x, length = rgd->rd_ri.ri_length;
-	int error;
-
-	if(rgd->rd_open_count){
-		log_debug("rgrp already read...\n");
-		rgd->rd_open_count++;
-		return 0;
-	}
-
-	for (x = 0; x < length; x++){
-		if(rgd->rd_bh[x]){
-			log_err("Programmer error!  Bitmaps are already present in rgrp.\n");
-			exit(1);
-		}
-		error = get_and_read_buf(sdp, rgd->rd_ri.ri_addr + x,
-								 &(rgd->rd_bh[x]), 0);
-		if (error) {
-		  	log_err("Unable to read rgrp from disk.\n"); 
-		  	goto fail;
-		}
-
-		if(check_meta(rgd->rd_bh[x], (x) ? GFS_METATYPE_RB : GFS_METATYPE_RG)){
-			log_err("Block #%"PRIu64" (0x%"PRIx64") (%d of %d) is neither"
-					" GFS_METATYPE_RB nor GFS_METATYPE_RG.\n",
-					BH_BLKNO(rgd->rd_bh[x]), BH_BLKNO(rgd->rd_bh[x]),
-					(int)x+1, (int)length);
-			if (repair_if_corrupted) {
-				if (query(sdp, "Fix the RG? (y/n)")) {
-					log_err("Attempting to repair the RG.\n");
-					if (x) {
-						struct gfs_meta_header mh;
-
-						memset(&mh, 0, sizeof(mh));
-						mh.mh_magic = GFS_MAGIC;
-						mh.mh_type = GFS_METATYPE_RB;
-						mh.mh_format = GFS_FORMAT_RB;
-						gfs_meta_header_out(&mh,
-								    BH_DATA(rgd->rd_bh[x]));
-					} else {
-						memset(&rgd->rd_rg, 0,
-						       sizeof(struct gfs_rgrp));
-						rgd->rd_rg.rg_header.mh_magic =
-							GFS_MAGIC;
-						rgd->rd_rg.rg_header.mh_type =
-							GFS_METATYPE_RG;
-						rgd->rd_rg.rg_header.mh_format =
-							GFS_FORMAT_RG;
-						rgd->rd_rg.rg_free =
-							rgd->rd_ri.ri_data;
-						gfs_rgrp_out(&rgd->rd_rg,
-							     BH_DATA(rgd->rd_bh[x]));
-					}
-					write_buf(sdp, rgd->rd_bh[x], BW_WAIT);
-				}
-			}
-			else {
-				error = -1;
-				goto fail;
-			}
-		}
-	}
-
-	gfs_rgrp_in(&rgd->rd_rg, BH_DATA(rgd->rd_bh[0]));
-	rgd->rd_open_count = 1;
-
-	return 0;
-
- fail:
-	for (x = 0; x < length; x++){
-		if (rgd->rd_bh[x]) {
-			relse_buf(sdp, rgd->rd_bh[x]);
-			rgd->rd_bh[x] = NULL;
-		}
-	}
-
-	log_err("Resource group or index is corrupted.\n");
-	return error;
-}
-
-void fs_rgrp_relse(struct fsck_rgrp *rgd)
-{
-	int x, length = rgd->rd_ri.ri_length;
-
-	rgd->rd_open_count--;
-	if(rgd->rd_open_count){
-		log_debug("rgrp still held...\n");
-	} else {
-		for (x = 0; x < length; x++){
-			if (rgd->rd_bh[x]) {
-				relse_buf(rgd->rd_sbd, rgd->rd_bh[x]);
-				rgd->rd_bh[x] = NULL;
-			}
-		}
-	}
-}
-
-#if 0 /* no one calls this, so don't waste memory for it: */
-/**
- * rgrp_verify - Verify that a resource group is consistent
- * @sdp: the filesystem
- * @rgd: the rgrp
- *
- * Returns: 0 if ok, -1 on error
- */
-int fs_rgrp_verify(struct fsck_rgrp *rgd)
-{
-	fs_bitmap_t *bits = NULL;
-	uint32 length = rgd->rd_ri.ri_length;
-	uint32 count[4], tmp;
-	int buf, x;
-
-	for (x = 0; x < 4; x++){
-		count[x] = 0;
-
-		for (buf = 0; buf < length; buf++){
-			bits = &rgd->rd_bits[buf];
-			count[x] += fs_bitcount(BH_DATA(rgd->rd_bh[buf]) + bits->bi_offset,
-						bits->bi_len, x);
-		}
-	}
-
-	if(count[0] != rgd->rd_rg.rg_free){
-		log_err("free data mismatch:  %u != %u\n",
-			count[0], rgd->rd_rg.rg_free);
-		return -1;
-	}
-
-	tmp = rgd->rd_ri.ri_data -
-		(rgd->rd_rg.rg_usedmeta + rgd->rd_rg.rg_freemeta) -
-		(rgd->rd_rg.rg_useddi + rgd->rd_rg.rg_freedi) -
-		rgd->rd_rg.rg_free;
-
-	if(count[1] != tmp){
-		log_err("used data mismatch:  %u != %u\n",
-			count[1], tmp);
-		return -1;
-	}
-	if(count[2] != rgd->rd_rg.rg_freemeta){
-		log_err("free metadata mismatch:  %u != %u\n",
-			count[2], rgd->rd_rg.rg_freemeta);
-		return -1;
-	}
-
-	tmp = rgd->rd_rg.rg_usedmeta +
-		(rgd->rd_rg.rg_useddi + rgd->rd_rg.rg_freedi);
-
-	if(count[3] != tmp){
-		log_err("used metadata mismatch:  %u != %u\n",
-			count[3], tmp);
-		return -1;
-	}
-	return 0;
-}
-#endif
-
-/**
- * fs_rgrp_recount - adjust block tracking numbers
- * rgd: resource group
- *
- * The resource groups keep track of how many free blocks, used blocks,
- * etc there are.  This function readjusts those numbers based on the
- * current state of the bitmap.
- *
- * Returns: 0 on success, -1 on failure
- */
-int fs_rgrp_recount(struct fsck_rgrp *rgd){
-	int i,j;
-	fs_bitmap_t *bits = NULL;
-	uint32 length = rgd->rd_ri.ri_length;
-	uint32 count[4], tmp;
-
-	for(i=0; i < 4; i++){
-		count[i] = 0;
-		for(j = 0; j < length; j++){
-			bits = &rgd->rd_bits[j];
-			count[i] += fs_bitcount((unsigned char *)
-						BH_DATA(rgd->rd_bh[j]) +
-						bits->bi_offset,
-						bits->bi_len, i);
-		}
-	}
-	if(count[0] != rgd->rd_rg.rg_free){
-		log_warn("\tAdjusting free block count (%u -> %u).\n",
-			rgd->rd_rg.rg_free, count[0]);
-		rgd->rd_rg.rg_free = count[0];
-	}
-	if(count[2] != rgd->rd_rg.rg_freemeta){
-		log_warn("\tAdjusting freemeta block count (%u -> %u).\n",
-		       rgd->rd_rg.rg_freemeta, count[2]);
-		rgd->rd_rg.rg_freemeta = count[2];
-	}
-	tmp = rgd->rd_rg.rg_usedmeta +
-		(rgd->rd_rg.rg_useddi + rgd->rd_rg.rg_freedi);
-
-	if(count[3] != tmp){
-		int first = 1;
-		struct fsck_sb *sdp = rgd->rd_sbd;
-		uint32 useddi = 0;
-		uint32 freedi = 0;
-		uint64 block;
-		struct fsck_inode *ip;
-
-		while (1){  /* count the used dinodes */
-			if(next_rg_metatype(rgd, &block,
-					    GFS_METATYPE_DI, first)){
-				break;
-			}
-			first = 0;
-			if(load_inode(sdp, block, &ip)) {
-				stack;
-				continue;
-			}
-
-			if (ip->i_di.di_flags & GFS_DIF_UNUSED){
-				freedi++;
-				continue;
-			}
-			free_inode(&ip);
-			useddi++;
-		}
-
-		if(useddi != rgd->rd_rg.rg_useddi){
-			log_warn("\tAdjusting used dinode block count (%u -> %u).\n",
-				rgd->rd_rg.rg_useddi, useddi);
-			rgd->rd_rg.rg_useddi = useddi;
-		}
-		if(freedi != rgd->rd_rg.rg_freedi){
-			log_warn("\tAdjusting free dinode block count (%u -> %u).\n",
-				rgd->rd_rg.rg_freedi, freedi);
-			rgd->rd_rg.rg_freedi = freedi;
-		}
-		if(rgd->rd_rg.rg_usedmeta != count[3] - (freedi + useddi)){
-			log_warn("\tAdjusting used meta block count (%u -> %u).\n",
-				rgd->rd_rg.rg_usedmeta,
-				(count[3] - (freedi + useddi)));
-			rgd->rd_rg.rg_usedmeta = count[3] - (freedi + useddi);
-		}
-	}
-
-	tmp = rgd->rd_ri.ri_data -
-		(rgd->rd_rg.rg_usedmeta + rgd->rd_rg.rg_freemeta) -
-		(rgd->rd_rg.rg_useddi + rgd->rd_rg.rg_freedi) -
-		rgd->rd_rg.rg_free;
-
-	if(count[1] != tmp){
-		log_err("Could not reconcile rgrp block counts.\n");
-		return -1;
-	}
-	return 0;
-}
-
-
-
-/**
- * clump_alloc - Allocate a clump of metadata
- * @rgd: the resource group descriptor
- * @goal: the goal block in the RG
- *
- * Returns: 0 on success, -1 on failure
- */
-int clump_alloc(struct fsck_rgrp *rgd, uint32 goal)
-{
-	struct fsck_sb *sdp = rgd->rd_sbd;
-	struct gfs_meta_header mh;
-	osi_buf_t *bh[GFS_META_CLUMP] = {0};
-	uint32 block;
-	int i,j;
-	int error = 0;
-
-	memset(&mh, 0, sizeof(struct gfs_meta_header));
-	mh.mh_magic = GFS_MAGIC;
-	mh.mh_type = GFS_METATYPE_NONE;
-
-	if(rgd->rd_rg.rg_free < GFS_META_CLUMP){
-		log_debug(" Not enough free blocks in rgrp.\n");
-		return -1;
-	}
-
-	for (i = 0; i < GFS_META_CLUMP; i++){
-		block = fs_blkalloc_internal(rgd, goal,
-					     GFS_BLKST_FREE,
-					     GFS_BLKST_FREEMETA, TRUE);
-		log_debug("Got block %u\n", block);
-
-		if(block == BFITNOENT) {
-			log_err("Unable to get enough blocks\n");
-			goto fail;
-		}
-		block += rgd->rd_ri.ri_data1;
-		block_set(rgd->rd_sbd->bl, block, meta_free);
-		if(get_buf(sdp, block, &(bh[i]))){
-			log_err("Unable to allocate new buffer.\n");
-			goto fail;
-		}
-		gfs_meta_header_out(&mh, BH_DATA(bh[i]));
-
-		goal = block;
-	}
-
-	log_debug("64 Meta blocks (%"PRIu64" - %"PRIu64"), allocated in rgrp 0x%lx\n",
-		(rgd->rd_ri.ri_data1 + block)-63,
-		(rgd->rd_ri.ri_data1 + block),
-		(unsigned long)rgd);
-	for (j = 0; j < GFS_META_CLUMP; j++){
-
-		error = write_buf(sdp, bh[j], BW_WAIT);
-		if (error){
-			log_err("Unable to write allocated metablock to disk.\n");
-			goto fail;
-		}
-	}
-
-	if(rgd->rd_rg.rg_free < GFS_META_CLUMP){
-		log_err("More blocks were allocated from rgrp "
-			"than are available.\n");
-		goto fail;
-	}
-	rgd->rd_rg.rg_free -= GFS_META_CLUMP;
-	rgd->rd_rg.rg_freemeta += GFS_META_CLUMP;
-
-	for (i = 0; i < GFS_META_CLUMP; i++)
-		relse_buf(sdp, bh[i]);
-
-	return 0;
-
- fail:
-	log_debug("clump_alloc failing...\n");
-	for(--i; i >=0; i--){
-		fs_set_bitmap(sdp, BH_BLKNO(bh[i]), GFS_BLKST_FREE);
-		/*relse_buf(sdp, bh[i]);*/
-	}
-	return -1;
-}
-
-
-/**
- * fs_blkalloc - Allocate a data block
- * @ip: the inode to allocate the data block for
- * @block: the block allocated
- *
- * Returns: 0 on success, -1 on failure
- */
-int fs_blkalloc(struct fsck_inode *ip, uint64 *block)
-{
-	osi_list_t *tmp;
-	struct fsck_sb *sdp = ip->i_sbd;
-	struct fsck_rgrp *rgd;
-	uint32 goal;
-	int same;
-
-	for(tmp = sdp->rglist.next; tmp != &sdp->rglist; tmp = tmp->next){
-		rgd = osi_list_entry(tmp, struct fsck_rgrp, rd_list);
-
-		if(!rgd){
-			log_err( "fs_blkalloc:  Bad rgrp list!\n");
-			return -1;
-		}
-
-		if(fs_rgrp_read(rgd, FALSE)){
-			log_err( "fs_blkalloc:  Unable to read rgrp.\n");
-			return -1;
-		}
-
-		if(!rgd->rd_rg.rg_free){
-			fs_rgrp_relse(rgd);
-			continue;
-		}
-
-		same = (rgd->rd_ri.ri_addr == ip->i_di.di_goal_rgrp);
-		goal = (same) ? ip->i_di.di_goal_dblk : 0;
-
-		*block = fs_blkalloc_internal(rgd, goal,
-					      GFS_BLKST_FREE,
-					      GFS_BLKST_USED, TRUE);
-
-		log_debug("Got block %"PRIu64"\n", *block);
-		if(*block == BFITNOENT) {
-			fs_rgrp_relse(rgd);
-			continue;
-		}
-		if (!same){
-			ip->i_di.di_goal_rgrp = rgd->rd_ri.ri_addr;
-			ip->i_di.di_goal_mblk = 0;
-		}
-
-		*block += rgd->rd_ri.ri_data1;
-		ip->i_di.di_goal_dblk = *block;
-
-		rgd->rd_rg.rg_free--;
-
-		gfs_rgrp_out(&rgd->rd_rg, BH_DATA(rgd->rd_bh[0]));
-		if(write_buf(sdp, rgd->rd_bh[0], 0)){
-			log_err( "Unable to write out rgrp block #%"
-				PRIu64".\n",
-				BH_BLKNO(rgd->rd_bh[0]));
-			fs_rgrp_relse(rgd);
-			return -1;
-		}
-		fs_rgrp_relse(rgd);
-		return 0;
-	}
-
-	return 1;
-}
-
-
-/**
- * fs_metaalloc - Allocate a metadata block to a file
- * @ip:  the file
- * @block: the block allocated
- *
- * Returns: 0 on success, -1 on failure
- */
-int fs_metaalloc(struct fsck_inode *ip, uint64 *block)
-{
-	osi_list_t *tmp;
-	struct fsck_sb *sdp = ip->i_sbd;
-	struct fsck_rgrp *rgd;
-	uint32 goal;
-	int same;
-	int error = 0;
-
-	/* ATTENTION -- maybe we should try to allocate from goal rgrp first */
-	for(tmp = sdp->rglist.next; tmp != &sdp->rglist; tmp = tmp->next){
-		rgd = osi_list_entry(tmp, struct fsck_rgrp, rd_list);
-
-		if(!rgd){
-			log_err( "fs_metaalloc:  Bad rgrp list!\n");
-			return -1;
-		}
-
-		if(fs_rgrp_read(rgd, FALSE)){
-			log_err( "fs_metaalloc:  Unable to read rgrp.\n");
-			return -1;
-		}
-
-		same = (rgd->rd_ri.ri_addr == ip->i_di.di_goal_rgrp);
-		goal = (same) ? ip->i_di.di_goal_mblk : 0;
-
-		if (!rgd->rd_rg.rg_freemeta){
-			error = clump_alloc(rgd, goal);
-			if (error){
-				fs_rgrp_relse(rgd);
-				continue;
-			}
-		}
-
-
-		if(!rgd->rd_rg.rg_freemeta){
-			fs_rgrp_relse(rgd);
-			continue;
-		}
-		*block = fs_blkalloc_internal(rgd, goal,
-					      GFS_BLKST_FREEMETA,
-					      GFS_BLKST_USEDMETA, TRUE);
-		log_debug("Got block %"PRIu64"\n", *block);
-		if(*block == BFITNOENT) {
-			fs_rgrp_relse(rgd);
-			continue;
-		}
-		if (!same){
-			ip->i_di.di_goal_rgrp = rgd->rd_ri.ri_addr;
-			ip->i_di.di_goal_dblk = 0;
-		}
-		*block += rgd->rd_ri.ri_data1;
-		ip->i_di.di_goal_mblk = *block;
-
-		rgd->rd_rg.rg_freemeta--;
-		rgd->rd_rg.rg_usedmeta++;
-
-		gfs_rgrp_out(&rgd->rd_rg, BH_DATA(rgd->rd_bh[0]));
-		write_buf(sdp, rgd->rd_bh[0], 0);
-		fs_rgrp_relse(rgd);
-		/* if we made it this far, then we are ok */
-		return 0;
-	}
-
-	return -1;
-}
diff --git a/gfs/gfs_fsck/rgrp.h b/gfs/gfs_fsck/rgrp.h
deleted file mode 100644
index 1312ba6..0000000
--- a/gfs/gfs_fsck/rgrp.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _RGRP_H
-#define _RGRP_H
-
-struct fsck_sb;
-struct fsck_rgrp;
-struct fsck_inode;
-
-int fs_compute_bitstructs(struct fsck_rgrp *rgd);
-struct fsck_rgrp *fs_blk2rgrpd(struct fsck_sb *sdp, uint64_t blk);
-
-int fs_rgrp_read(struct fsck_rgrp *rgd, int repair_if_corrupted);
-void fs_rgrp_relse(struct fsck_rgrp *rgd);
-int fs_rgrp_verify(struct fsck_rgrp *rgd);
-int fs_rgrp_recount(struct fsck_rgrp *rgd);
-
-int clump_alloc(struct fsck_rgrp *rgd, uint32_t goal);
-int fs_blkalloc(struct fsck_inode *ip, uint64_t *block);
-int fs_metaalloc(struct fsck_inode *ip, uint64_t *block);
-
-#endif /* _RGRP_H */
diff --git a/gfs/gfs_fsck/super.c b/gfs/gfs_fsck/super.c
deleted file mode 100644
index cf01988..0000000
--- a/gfs/gfs_fsck/super.c
+++ /dev/null
@@ -1,1369 +0,0 @@
-#include <unistd.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <errno.h>
-
-#include "osi_list.h"
-#include "osi_user.h"
-#include "bio.h"
-#include "util.h"
-#include "file.h"
-#include "rgrp.h"
-#include "fsck.h"
-#include "ondisk.h"
-#include "super.h"
-#include "fsck_incore.h"
-
-#ifndef BLKGETSIZE64
-#define BLKGETSIZE64 _IOR(0x12, 114, size_t)
-#endif
-
-#define DIV_RU(x, y) (((x) + (y) - 1) / (y))
-#define ri_compare(rg, ondisk, expected, field, fmt)	\
-	if (ondisk.field != expected.field) { \
-		log_warn("rgindex #%d " #field " discrepancy: index 0x%" fmt \
-				 " != expected: 0x%" fmt "\n", \
-				 rg + 1, ondisk.field, expected.field);	\
-		ondisk.field = expected.field; \
-		rgindex_modified = TRUE; \
-	}
-
-static uint64 total_journal_space;
-
-/**
- * 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
- */
-static int check_sb(struct fsck_sb *sdp, struct gfs_sb *sb)
-{
-	int error = 0;
-	if (sb->sb_header.mh_magic != GFS_MAGIC ||
-	    sb->sb_header.mh_type != GFS_METATYPE_SB){
-		log_crit("Either the super block is corrupted, or this "
-			 "is not a GFS filesystem\n");
-		log_debug("Header magic: %X Header Type: %X\n",
-			  sb->sb_header.mh_magic,
-			  sb->sb_header.mh_type);
-		error = -EINVAL;
-		goto out;
-	}
-
-	/*  If format numbers match exactly, we're done.  */
-	if (sb->sb_fs_format != GFS_FORMAT_FS ||
-	    sb->sb_multihost_format != GFS_FORMAT_MULTI){
-		log_warn("Old file system detected.\n");
-	}
-
- out:
-	return error;
-}
-
-
-/*
- * 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 fsck_sb *sdp)
-{
-	osi_buf_t *bh;
-	uint64 space = 0;
-	unsigned int x;
-	int error;
-	error = get_and_read_buf(sdp, GFS_SB_ADDR >> sdp->fsb2bb_shift, &bh, 0);
-	if (error){
-		log_crit("Unable to read superblock\n");
-		goto out;
-	}
-
-	gfs_sb_in(&sdp->sb, BH_DATA(bh));
-
-	relse_buf(sdp, bh);
-
-	error = check_sb(sdp, &sdp->sb);
-	if (error)
-		goto out;
-
-/* FIXME: Need to verify all this */
-	/* FIXME: What's this 9? */
-	sdp->fsb2bb_shift = sdp->sb.sb_bsize_shift - 9;
-	sdp->diptrs =
-		(sdp->sb.sb_bsize - sizeof(struct gfs_dinode)) /
-		sizeof(uint64);
-	sdp->inptrs =
-		(sdp->sb.sb_bsize - sizeof(struct gfs_indirect)) /
-		sizeof(uint64);
-	sdp->jbsize = sdp->sb.sb_bsize - sizeof(struct gfs_meta_header);
-	/* FIXME: Why is this /2 */
-	sdp->hash_bsize = sdp->sb.sb_bsize / 2;
-	sdp->hash_ptrs = sdp->hash_bsize / sizeof(uint64);
-	sdp->heightsize[0] = sdp->sb.sb_bsize -
-		sizeof(struct gfs_dinode);
-	sdp->heightsize[1] = sdp->sb.sb_bsize * sdp->diptrs;
-	for (x = 2; ; x++){
-		space = sdp->heightsize[x - 1] * sdp->inptrs;
-		/* FIXME: Do we really need this first check?? */
-		if (space / sdp->inptrs != sdp->heightsize[x - 1] ||
-		    space % sdp->inptrs != 0)
-			break;
-		sdp->heightsize[x] = space;
-	}
-	sdp->max_height = x;
-	if(sdp->max_height > GFS_MAX_META_HEIGHT){
-		log_err("Bad max metadata height.\n");
-		error = -1;
-		goto out;
-	}
-
-	sdp->jheightsize[0] = sdp->sb.sb_bsize -
-		sizeof(struct gfs_dinode);
-	sdp->jheightsize[1] = sdp->jbsize * sdp->diptrs;
-	for (x = 2; ; x++){
-		space = sdp->jheightsize[x - 1] * sdp->inptrs;
-		if (space / sdp->inptrs != sdp->jheightsize[x - 1] ||
-		    space % sdp->inptrs != 0)
-			break;
-		sdp->jheightsize[x] = space;
-	}
-	sdp->max_jheight = x;
-	if(sdp->max_jheight > GFS_MAX_META_HEIGHT){
-		log_err("Bad max jheight.\n");
-		error = -1;
-	}
-
- out:
-
-	return error;
-}
-
-
-/*
- * ji_update - fill in journal info
- * ip: the journal index inode
- *
- * Given the inode for the journal index, read in all
- * the journal indexes.
- *
- * Returns: 0 on success, -1 on failure
- */
-int ji_update(struct fsck_sb *sdp)
-{
-	struct fsck_inode *ip = sdp->jiinode;
-	char buf[sizeof(struct gfs_jindex)];
-	unsigned int j;
-	int error=0;
-
-
-	if(ip->i_di.di_size % sizeof(struct gfs_jindex) != 0){
-		log_err("The size reported in the journal index"
-			" inode is not a\n"
-			 "\tmultiple of the size of a journal index.\n");
-		return -1;
-	}
-
-	if(!(sdp->jindex = (struct gfs_jindex *)malloc(ip->i_di.di_size))) {
-		log_err("Unable to allocate journal index\n");
-		return -1;
-	}
-	if(!memset(sdp->jindex, 0, ip->i_di.di_size)) {
-		log_err("Unable to zero journal index\n");
-		return -1;
-	}
-	total_journal_space = 0;
-
-	for (j = 0; ; j++) {
-		struct gfs_jindex *journ;
-		error = readi(ip, buf, j * sizeof(struct gfs_jindex),
-				 sizeof(struct gfs_jindex));
-		if(!error)
-			break;
-		if (error != sizeof(struct gfs_jindex)){
-			log_err("An error occurred while reading the"
-				" journal index file.\n");
-			goto fail;
-		}
-
-		journ = sdp->jindex + j;
-		gfs_jindex_in(journ, buf);
-		total_journal_space += journ->ji_nsegment * sdp->sb.sb_seg_size;
-	}
-
-
-	if(j * sizeof(struct gfs_jindex) != ip->i_di.di_size){
-		log_err("journal inode size invalid\n");
-		log_debug("j * sizeof(struct gfs_jindex) !="
-			  " ip->i_di.di_size\n");
-		log_debug("%d != %d\n",
-			  j * sizeof(struct gfs_jindex), ip->i_di.di_size);
-		goto fail;
-	}
-	sdp->journals = j;
-	log_debug("%d journals found.\n", j);
-
-	return 0;
-
- fail:
-	free(sdp->jindex);
-	return -1;
-}
-
-/* Print out debugging information in same format as gfs_edit. */
-int hexdump(uint64 startaddr, const unsigned char *lpBuffer, int len)
-{
-	const unsigned char *pointer, *ptr2;
-	int i;
-	uint64 l;
-
-	pointer = (unsigned char *)lpBuffer;
-	ptr2 = (unsigned char *)lpBuffer;
-	l = 0;
-	while (l < len) {
-		log_info("%.8" PRIX64, startaddr + l);
-		for (i = 0; i < 16; i++) { /* first print it in hex */
-			if (i % 4 == 0)
-				log_info(" ");
-			log_info("%02X", *pointer);
-			pointer++;
-		}
-		log_info(" [");
-		for (i = 0; i < 16; i++) { /* now print it in character format */
-			if ((*ptr2 >= ' ') && (*ptr2 <= '~'))
-				log_info("%c", *ptr2);
-			else
-				log_info(".");
-			ptr2++;
-		}
-		log_info("] \n");
-		l += 16;
-	}
-	return (len);
-}
-
-
-/**
- * rgrplength2bitblocks - Stolen from gfs_mkfs.
- *
- * @sdp:    the superblock
- * @length: the number of blocks in a RG
- *
- * Give a number of blocks in a RG, figure out the number of blocks
- * needed for bitmaps.
- *
- * Returns: the number of bitmap blocks
- */
-
-uint32 rgrplength2bitblocks(struct fsck_sb *sdp, uint32 length)
-{
-	uint32 bitbytes;
-	uint32 old_blocks = 0, blocks;
-	int tries = 0;
-	
-	for (;;) {
-		bitbytes = (length - old_blocks) / GFS_NBBY;
-		blocks = 1;
-
-		if (bitbytes > sdp->sb.sb_bsize - sizeof(struct gfs_rgrp)) {
-			bitbytes -= sdp->sb.sb_bsize - sizeof(struct gfs_rgrp);
-			blocks += DIV_RU(bitbytes, (sdp->sb.sb_bsize -
-					      sizeof(struct gfs_meta_header)));
-		}
-		if (blocks == old_blocks)
-			break;
-		old_blocks = blocks;
-		if (tries++ > 10) {
-			blocks = 0;
-			break;
-		}
-	}
-	return blocks;
-}
-
-/*
- * gfs_rgindex_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.  In other words, we can't trust the RG index
- * is completely sane, and the RGs don't fit on nice neat fs boundaries.
- * So we have no choice but to go through the count them by hand.
- * We've tried twice to recover the RGs and RG index, and failed.  This is
- * our last chance to remedy the situation.
- *
- * In some cases, we have no choice but to trust the rgindex file.  Since
- * it is completely hidden from the users, if we find an inconsistency,
- * it's safer to assume the index is correct and the RG is corrupt rather
- * than the RG is correct and the index is bad.  This routine goes to great
- * lengths to determine which is the case and figure it out regardless.
- *
- * 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 GFS filesystem is built by gfs_mkfs into several "subdevices."
- * These are just logical divisions of the logical volume.  The gfs_mkfs
- * program considers two types of subdevices: RG-subdevices and journal
- * subdevices.  RG subdevices contain one or more RGs.  Journal subdevices
- * contain one or more journals.  For the purposes of gfs_fsck, when I talk
- * about subdevices, I'm talking about RG-subdevices only.  For a freshly
- * created GFS filesystem, the logical volume will be broken apart like this:
- *
- * RG-subdevice 0: n Resource Groups
- * Journal subdevice
- * RG-subdevice 1: n Resource Groups (same as RG-subdevice 0)
- *
- * If the filesystem has been resized via gfs_grow, there will be more
- * RG-subdevices containing more RGs.  However, gfs_fsck treats them all
- * as "subdevice 2."
- *
- * NOTE: When giving messages to the users, I am referring to them as
- * "sections" 1, 2, and 3 because "subdevice" sounds too confusing.
- *
- * If an RG is not found at a predicted location, it either means that
- * there is a corrupted RG, or else the RG has been added after the fact
- * by gfs_grow.  We can only predict the locations for RGs within a subdevice,
- * but the subdevice boundaries are not that predictable.  (Actually, they
- * are, but since we're dealing with a likely corrupt filesystem, I don't
- * want to rely on good data too much to do it this way.)
- *
- * I am, however, going to rely on the fact that the first original subdevice
- * will have the same number of RGs as the second original subdevice.
- * Other RGs found after that will be considered "extra."
- */
-int gfs_rgindex_rebuild(struct fsck_sb *sdp, osi_list_t *ret_list,
-			unsigned int *num_rgs)
-{
-	osi_buf_t *bh; /* buffer handle */
-	uint64 subdevice_size, fs_total_size;
-	int number_of_rgs; /* #RGs this subdevice.
-						  min of 2 per segment * 2 segments = 4 */
-	int rg_number; /* real RG number (0 - x) */
-	int subd;
-	int error, corrupt_rgs;
-	int rgi, rgs_per_subd;
-	uint64 blok, block_of_last_rg;
-	uint64 block_bump;
-	uint64 shortest_dist_btwn_rgs[2]; /* one for each subdevice */
-	uint64 first_rg_dist[2], initial_first_rg_dist[2];
-	struct fsck_rgrp *calc_rgd, *prev_rgd;
-	struct gfs_rgrp tmp_rgrp;
-	osi_list_t *tmp;
-	int rg_was_fnd = FALSE;
-	struct gfs_rindex buf, tmpndx;
-	uint64 fs_size_from_rgindex = 0;
-	int index_entries_per_subd = 0, subd_ndx_entry, rg;
-	uint64_t last_known_ri_addr = 0, prev_known_ri_addr = 0;
-	uint32_t last_known_ri_length = 0;
-	uint32_t last_known_ri_data = 0;
-	int section3_bump_size = 0;
-	uint64 start_block, end_block = 0;
-
-	osi_list_init(ret_list);
-	*num_rgs = 0;
-	/* Get the total size of the device */
-	error = ioctl(sdp->diskfd, BLKGETSIZE64,
-				  &fs_total_size); /* Size in bytes */
-	fs_total_size /= sdp->sb.sb_bsize;
-	log_debug("fs_total_size = 0x%" PRIX64 " blocks.\n", fs_total_size);
-	block_of_last_rg = 0;
-	subdevice_size = 0;
-	rgs_per_subd = 0;
-	/* ----------------------------------------------------------------- */
-	/* First, figure out the exact end of the second subdevice.          */
-	/* That will tell us where the third RG-subdevice should start.      */
-	/* We need to keep track of how many entries are in the index before */
-	/* we hit the journal blocks.  That will tell us how many index      */
-	/* entries will be in the first subdevice, and the second subdevice  */
-	/* should have the same number.  After that, we don't care.          */
-	/* Note: we're using values in the rgindex, even though we don't     */
-	/* trust it.  We're relatively okay because we're just trying to     */
-	/* find the highest RG value for the second subdevice.               */
-	/* ----------------------------------------------------------------- */
-	subd = 0;
-	index_entries_per_subd = 0;
-	subd_ndx_entry = 0;
-	for (rg = 0; ; rg++) {
-		uint64 end_of_rg;
-		
-		error = readi(sdp->riinode,
-					  (char *)&buf, rg * sizeof(struct gfs_rindex),
-					  sizeof(struct gfs_rindex));
-		if (!error) /* if end of file */
-			break; /* stop looking */
-		gfs_rindex_in(&tmpndx, (char *)&buf); /* read in the index */
-		subd_ndx_entry++;
-		if (!subd) { /* if we're still in the first subdevice */
-			if (tmpndx.ri_addr >= sdp->jindex->ji_addr + total_journal_space) {
-				subd++; /* this rgindex belongs to the second subdevice */
-				prev_known_ri_addr = 0;
-				last_known_ri_addr = 0;
-				subd_ndx_entry = 1;
-			}
-			else {
-				index_entries_per_subd++;
-				/* Check if this is the last index entry for subdevice */
-				if (tmpndx.ri_addr + tmpndx.ri_length + tmpndx.ri_data >= 
-					sdp->jindex->ji_addr - GFS_NBBY) {
-					subd++; /* NEXT rgindex belongs to the second subdevice */
-					subd_ndx_entry = 0;
-					prev_known_ri_addr = 0;
-					last_known_ri_addr = 0;
-					continue;
-				}
-			}
-		}
-		end_of_rg = tmpndx.ri_addr + tmpndx.ri_length + tmpndx.ri_data;
-		/* ----------------------------------------------------------------- */
-		/* Make sure the rgindex looks relatively sane.  After all,          */
-		/* at this stage of the game, we don't trust it.                     */
-		/* ----------------------------------------------------------------- */
-		if (subd && end_of_rg > sdp->jindex->ji_addr + total_journal_space &&
-			end_of_rg <= fs_total_size) { /* looks relatively sane */
-			/* Save some data values we can fall back on: */
-			prev_known_ri_addr = last_known_ri_addr;
-			last_known_ri_addr = tmpndx.ri_addr;
-			last_known_ri_length = tmpndx.ri_length;
-			last_known_ri_data = tmpndx.ri_data;
-			if (fs_size_from_rgindex < end_of_rg)
-				fs_size_from_rgindex = end_of_rg;
-			/* Quit after we hit the same number of entries as 1st subdevice */
-			if (subd_ndx_entry >= index_entries_per_subd)
-				break;
-		}
-		else if (!subd && end_of_rg < sdp->jindex->ji_addr &&
-				 end_of_rg > 0) { /* looks relatively sane */
-			/* Save some data values we can fall back on: */
-			prev_known_ri_addr = last_known_ri_addr;
-			last_known_ri_addr = tmpndx.ri_addr;
-			last_known_ri_length = tmpndx.ri_length;
-			last_known_ri_data = tmpndx.ri_data;
-			if (fs_size_from_rgindex < end_of_rg)
-				fs_size_from_rgindex = end_of_rg;
-		}
-		else { /* Otherwise we have a corrupt index entry */
-			log_debug("Likely damage to rgindex entry %d.\n",
-					  subd_ndx_entry + (subd * index_entries_per_subd));
-			if (prev_known_ri_addr) {
-				/* Try to extrapolate from the previous one */
-				tmpndx.ri_addr = last_known_ri_addr + 
-					(last_known_ri_addr - prev_known_ri_addr);
-				tmpndx.ri_length = last_known_ri_length;
-				tmpndx.ri_data = last_known_ri_data;
-				log_debug("Extrapolating addr=0x%" PRIx64 ", length=0x%x, "
-						  "data=%x\n", tmpndx.ri_addr,
-						  tmpndx.ri_length, tmpndx.ri_data);
-				end_of_rg = tmpndx.ri_addr + tmpndx.ri_length +
-					tmpndx.ri_data;
-				if (end_of_rg > sdp->jindex->ji_addr +
-					total_journal_space &&
-					end_of_rg <= fs_total_size) { /* looks relatively okay */
-					/* Adjust data values we can fall back on: */
-					last_known_ri_addr = tmpndx.ri_addr;
-					if (fs_size_from_rgindex < end_of_rg)
-						fs_size_from_rgindex = end_of_rg;
-					/* Quit after we hit the same number of entries as
-					   the first subdevice/section */
-					if (subd_ndx_entry >= index_entries_per_subd)
-						break;
-				}
-			} /* if we have a good previous */
-			else {
-				log_debug("Not enough data to figure it out--skipped.\n");
-			}
-		} /* corrupt RG index entry */
-	} /* for all RGs in the index */
-	log_debug("Index entries/section=%d, third section addr = 0x%"PRIx64"\n",
-			  index_entries_per_subd, fs_size_from_rgindex);
-	initial_first_rg_dist[0] = first_rg_dist[0] = sdp->jindex->ji_addr -
-		((GFS_SB_ADDR >> sdp->fsb2bb_shift) + 1);
-	initial_first_rg_dist[1] = first_rg_dist[1] = sdp->jindex->ji_addr;
-	/* ----------------------------------------------------------------- */
-	/* Now let's figure out the space between RGs for the first subd,    */
-	/* and the second subd.  Subsequent RGs will be unpredictable.       */
-	/* We need to know the distance between RGs because if one is        */
-	/* corrupt or overwritten, we need to salvage it at the correct      */
-	/* location.  For example, if RG #2 is nuked, at first glance, it    */
-	/* appears as if our RGs are twice as far apart as they should be.   */
-	/* So we should chase down a couple to get more than one opinion.    */
-	/* If several RGs are nuked, sorry, I'll only go so far to recover.  */
-	/* This check will be slower because we have to read blocks 1 by 1.  */
-	/* Luckily, we only have to do a few this way.                       */
-	/* Later, we can bump ahead by the amount we find here.              */
-	/* ----------------------------------------------------------------- */
-	subdevice_size = sdp->jindex->ji_addr; /* addr of first journal */;
-	for (subd = 0; subd < 2; subd++) {
-		if (!subd)
-			start_block = (GFS_SB_ADDR >> sdp->fsb2bb_shift) + 1;
-		else
-			start_block = sdp->jindex->ji_addr + total_journal_space;
-		block_of_last_rg = start_block;
-		number_of_rgs = 0;
-		shortest_dist_btwn_rgs[subd] = subdevice_size;
-		for (blok = start_block; blok < fs_total_size; blok++) {
-			error = get_and_read_buf(sdp, blok, &bh, 0);
-			if (error){
-				log_crit("Unable to read block 0x%" PRIX64 "\n", blok);
-				return -1;
-			}
-			if ((blok == start_block) || /* If first RG block or */
-				!check_type(bh, GFS_METATYPE_RG)) { /* we found an RG */
-				log_debug("%d:RG found at block 0x%" PRIx64 "\n", subd + 1,
-						  blok);
-				/* If we spilled into the next subdevice, quit. */
-				if (blok + GFS_NBBY >= start_block + subdevice_size) {
-					log_debug("This is in the next subdevice--skipping.\n");
-					break;
-				}
-				gfs_rgrp_in(&tmp_rgrp, BH_DATA(bh));
-				if (blok == start_block) {
-					shortest_dist_btwn_rgs[subd] = subdevice_size;
-					log_debug("Start of section %d.\n", subd + 1);
-				}
-				else {
-					uint64 rgdist;
-
-					rgdist = blok - block_of_last_rg;
-					log_debug("%d:dist 0x%" PRIx64 " = 0x% " PRIx64
-							  " - 0x%" PRIx64, subd + 1, rgdist,
-							  blok, block_of_last_rg);
-					/* ----------------------------------------------------- */
-					/* We found another 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 whole subdevice size).        */
-					/* The first rg distance is different from the rest      */
-					/* because of the superblock and 64K dead space          */
-					/* ----------------------------------------------------- */
-					if (first_rg_dist[subd] == initial_first_rg_dist[subd])
-						first_rg_dist[subd] = rgdist;
-					if (rgdist < shortest_dist_btwn_rgs[subd])
-					{
-						shortest_dist_btwn_rgs[subd] = rgdist;
-						log_debug("(shortest so far)\n");
-					}
-					else
-						log_debug("\n");
-				}
-				number_of_rgs++; /* number of RGs this subdevice */
-				/* --------------------------------------------------------- */
-				/* Check to see if we're the last RG we want to examine.     */
-				/* If so, forget checking the next index entry and exit.     */
-				/* (The next index entry may be for the next RG anyway).     */
-				/* --------------------------------------------------------- */
-				if (number_of_rgs >= 4 ||
-					number_of_rgs >= index_entries_per_subd)
-					break;
-				/* --------------------------------------------------------- */
-				/* Read in the index entry for the NEXT RG in line and       */
-				/* compare the RG size difference with what we know.         */
-				/* --------------------------------------------------------- */
-				rg_number = number_of_rgs + (subd * index_entries_per_subd);
-				error = readi(sdp->riinode, (char *)&buf,
-							  rg_number * sizeof(struct gfs_rindex),
-							  sizeof(struct gfs_rindex));
-				if (error) { /* if we read some data (no error really) */
-					gfs_rindex_in(&tmpndx, (char *)&buf);
-					if (tmpndx.ri_addr > start_block &&
-						tmpndx.ri_addr < fs_total_size &&
-						tmpndx.ri_addr != blok &&
-						tmpndx.ri_addr - blok < 
-						shortest_dist_btwn_rgs[subd]) {
-						shortest_dist_btwn_rgs[subd] =
-							tmpndx.ri_addr - blok;
-						log_debug("Section %d RG %d(%d): shortest=0x%"PRIx64
-								  "\n", subd + 1, number_of_rgs, rg_number,
-								  shortest_dist_btwn_rgs[subd]);
-					}
-				}
-				block_of_last_rg = blok;
-				/* --------------------------------------------------------- */
-				/* We can't just check every block because some of the files */
-				/* in the fs (i.e. inside an RG) might have data that looks  */
-				/* exactly like a valid RG. Sounds farfetched, but it's not, */
-				/* based on my own experiences.                              */
-				/* In my experience, the RG locations are spaced differently */
-				/* from their used and free space numbers because of the way */
-				/* gfs_mkfs puts them.  In other words, the RG locations     */
-				/* according to the index will be different from the sum of  */
-				/* the space they take.  Why?  I don't know, but maybe it    */
-				/* has to do with the variable size of bitmaps.              */
-				/* At any rate, used+free can get us close, but not exact.   */
-				/* Therefore, we have to search for the RG after that.       */
-				/* --------------------------------------------------------- */
-				if (!error &&
-					((tmp_rgrp.rg_useddi + tmp_rgrp.rg_free + 1) >> 2) ==
-					(tmpndx.ri_addr >> 2)) {
-					blok = tmpndx.ri_addr - 1; /* go by the index */
-					log_debug("I(0x%" PRIx64 ")\n", blok);
-				}
-				/* If this is the second section, we know for sure that */
-				/* the block length can't be smaller than section 1's   */
-				/* rg length. Might as well skip ahead.                 */
-				else if (subd == 1) {
-					blok += shortest_dist_btwn_rgs[0];
-					log_debug("2(0x%" PRIx64 ")\n", blok);
-				} else {
-					blok += tmp_rgrp.rg_useddi + tmp_rgrp.rg_free;
-					log_debug("R(0x%" PRIx64 ")\n", blok);
-				}
-			} /* If first RG block or RG */
-			relse_buf(sdp, bh); /* release the read buffer */
-		} /* for blok */
-		/* -------------------------------------------------------------- */
-		/* 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).  */
-		/* -------------------------------------------------------------- */
-		if (first_rg_dist[subd] >= shortest_dist_btwn_rgs[subd] +
-			(shortest_dist_btwn_rgs[subd] / 4)) {
-			log_debug("%d:Shortest dist is: 0x%" PRIx64 "\n", subd + 1,
-					  shortest_dist_btwn_rgs[subd]);
-			/* read in the second RG index entry for this subd. */
-			readi(sdp->riinode, (char *)&buf,
-				  (1 + (subd * index_entries_per_subd)) *
-				  sizeof(struct gfs_rindex),
-				  sizeof(struct gfs_rindex));
-			gfs_rindex_in(&tmpndx, (char *)&buf);
-			if (tmpndx.ri_addr > start_block) { /* sanity check */
-				log_warn("RG %d is damaged: recomputing RG dist from index: ",
-						 2 + (subd * index_entries_per_subd));
-				first_rg_dist[subd] = tmpndx.ri_addr - start_block;
-				log_warn("0x%" PRIx64 "\n", first_rg_dist[subd]);
-			}
-			else {
-				log_warn("RG index %d is damaged: extrapolating RG dist: ",
-						 2 + (subd * index_entries_per_subd));
-				first_rg_dist[subd] = (subdevice_size - start_block) %
-					((index_entries_per_subd - 1) * 
-					 shortest_dist_btwn_rgs[subd]);
-				log_warn("0x%" PRIx64 "\n", first_rg_dist[subd]);
-			}
-		} /* if first RG distance is within tolerance */
-		log_debug("First RG distance: 0x%" PRIx64 "\n", first_rg_dist[subd]);
-		log_debug("Section %d: distance between RGs: 0x%" PRIx64 "\n",
-				 subd + 1, shortest_dist_btwn_rgs[subd]);
-		log_debug("Section size: 0x%" PRIx64 "\n", subdevice_size);
-		/* If our rindex was all bad, we may have an improper count of RGs per
-		   section.  We may also not know where the third section should start.
-		   We need those for later. */
-		if (subd == 0) {
-			if (shortest_dist_btwn_rgs[subd] != 0) {
-				unsigned long long blocks_b4_sb;
-				unsigned long long index_entries;
-
-				blocks_b4_sb = (16 * (4096 / sdp->sb.sb_bsize));
-				index_entries = (subdevice_size - blocks_b4_sb) /
-					shortest_dist_btwn_rgs[subd];
-				if (index_entries_per_subd != index_entries) {
-					log_debug("rindex entries per section "
-						  "changed from %lld to %lld\n",
-						  index_entries_per_subd,
-						  index_entries);
-					index_entries_per_subd = index_entries;
-				}
-			}
-			if (fs_size_from_rgindex == 0) {
-				fs_size_from_rgindex = (sdp->jindex->ji_addr +
-							total_journal_space) +
-					subdevice_size;
-				log_debug("Fixed zero fs_size_from_rgindex "
-					  "due to rindex corruption.\n");
-				log_debug("New fs_size_from_rgindex value: "
-					  "%lld (0x%" PRIx64 ")\n",
-					  fs_size_from_rgindex,
-					  fs_size_from_rgindex);
-			}
-		}
-	} /* for subd */
-	number_of_rgs = 0; /* reset this because it is reused below */
-	/* ----------------------------------------------------------------- */
-	/* Start reading the filesystem starting with the block after the    */
-	/* superblock, which should be the first RG.                         */
-	/* The problem is that gfs_grow puts the RGs at unpredictable        */
-	/* locations.  If the fs was only grown once, that would be          */
-	/* predictable.  But if it grows twice, by different amounts, then   */
-	/* our RGs could be anywhere.  After carefully studying the problem  */
-	/* I've determined that the best thing we can do is to trust the     */
-	/* rgindex and hope to God it's correct.  That's the only way we're  */
-	/* going to be able to recover RGs in the third section.             */
-	/* ----------------------------------------------------------------- */
-	block_bump = first_rg_dist[0];
-	corrupt_rgs = 0;
-	for (subd = 0; subd < 3; subd++) { /* third subdevice is for all RGs
-					      extended past the normal 2 with
-					      gfs_grow, etc. */
-		prev_rgd = NULL;
-		if (subd == 0) {
-			start_block = (GFS_SB_ADDR >> sdp->fsb2bb_shift) + 1;
-			end_block = subdevice_size - 1;
-		}
-		else if (subd == 1) {
-			start_block = sdp->jindex->ji_addr + total_journal_space;
-			/* Moral dilemma: should we go to the last block or should */
-			/* we trust the index?  If they're close to one another,   */
-			/* let's use the index.                                    */
-			if ((fs_size_from_rgindex >> 2) ==
-				((start_block + subdevice_size - 1) >> 2)) /* if we're close */
-				end_block = fs_size_from_rgindex - 1;  /* trust the index */
-			else                                       /* otherwise */
-				end_block = start_block + subdevice_size - 1; /* go to end */
-		}
-		else {
-			/* Section 3 should start the block after section 2.  However,     */
-			/* gfs_grow sometimes foolishly decides to put it as much as three */
-			/* blocks early. So we need to check for this special case.        */
-			for (start_block = end_block - 2;
-			     start_block < end_block + 1; start_block++) {
-				error = get_and_read_buf(sdp, start_block, &bh, 0);
-				rg_was_fnd = (!check_type(bh, GFS_METATYPE_RG));
-				relse_buf(sdp, bh); /* release the read buffer */
-				if (rg_was_fnd)
-					break;
-			}
-			end_block = fs_total_size - 1;
-			if (start_block + GFS_NBBY >= end_block)
-				break;
-		}
-		log_warn("Section %d: 0x%" PRIx64 " - 0x%" PRIx64 "\n", subd + 1,
-				 start_block, end_block);
-		for (blok = start_block; blok <= end_block; blok += block_bump) {
-			uint64 fwd_block;
-			int bitmap_was_fnd;
-
-			log_debug("Block 0x%" PRIx64 "\n", blok);
-			error = get_and_read_buf(sdp, blok, &bh, 0);
-			if (error) {
-				log_crit("Unable to read block 0x%" PRIX64 "\n", blok);
-				return -1;
-			}
-			rg_was_fnd = (!check_type(bh, GFS_METATYPE_RG));
-			relse_buf(sdp, bh); /* release the read buffer */
-			if (!rg_was_fnd && subd == 2) {
-				if (section3_bump_size) {
-					log_warn("Lost track of Section 3 rg length.\n");
-					blok -= block_bump; /* back up in case we overshot it */
-					section3_bump_size = 0;
-					block_bump = 1;
-				}
-				if (block_bump == 1)
-					continue;
-			}
-			/* ------------------------------------------------------------- */
-			/* For the first and second subdevice, we know the RG size.      */
-			/* Since we're bumping by that amount, this better be an RG.     */
-			/* ------------------------------------------------------------- */
-			/* Allocate a new RG and index. */
-			calc_rgd = (struct fsck_rgrp *)malloc(sizeof(struct fsck_rgrp));
-			// FIXME: handle failed malloc
-			memset(calc_rgd, 0, sizeof(struct fsck_rgrp));
-			calc_rgd->rd_sbd = sdp; /* hopefully this is not used */
-			osi_list_add_prev(&calc_rgd->rd_list, ret_list);
-			calc_rgd->rd_ri.ri_length = 1;
-			calc_rgd->rd_ri.ri_addr = blok;
-			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 0x%" PRIx64 \
-							  "\n", blok);
-				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 = blok + 1; fwd_block < fs_total_size; 
-				 fwd_block++) {
-				error = get_and_read_buf(sdp, fwd_block, &bh, 0);
-				if (error){
-					log_crit("Unable to read block 0x%" PRIX64 "\n",
-							 fwd_block);
-					return -1;
-				}
-				bitmap_was_fnd = (!check_type(bh, GFS_METATYPE_RB));
-				relse_buf(sdp, bh);
-				if (bitmap_was_fnd) /* if a bitmap */
-					calc_rgd->rd_ri.ri_length++;
-				else
-					break; /* end of bitmap, so call it quits. */
-			} /* for subsequent bitmaps */
-			calc_rgd->rd_ri.ri_data1 = calc_rgd->rd_ri.ri_addr +
-				calc_rgd->rd_ri.ri_length;
-			if (prev_rgd) {
-				prev_rgd->rd_ri.ri_data = block_bump -
-					rgrplength2bitblocks(sdp, block_bump);
-				prev_rgd->rd_ri.ri_data -= prev_rgd->rd_ri.ri_data %
-					GFS_NBBY;
-				prev_rgd->rd_ri.ri_bitbytes = prev_rgd->rd_ri.ri_data /
-					GFS_NBBY;
-				log_debug("Prev ri_data set to: %" PRIx32 ".\n",
-						  prev_rgd->rd_ri.ri_data);
-				/*prev_rgd->rd_ri.ri_data = block_bump;*/
-			}
-			number_of_rgs++;
-			rgs_per_subd++;
-			block_of_last_rg = blok;
-			if (subd == 2) { /* if beyond the normal RGs into gfs_grow RGs  */
-				/* -------------------------------------------------------- */
-				/* RG location is rounded down to the nearest multiple of   */
-				/* GFS_NBBY, so RG location is only known within a 4 block  */
-				/* range.  It's better to use the rgindex to figure out     */
-				/* the address of the next RG and bump by the difference.   */
-				/* However, there's another complication:  gfs_grow has     */
-				/* been known to add RGs to the index in a non-ascending    */
-				/* order.  Therefore, we can't assume the Nth entry in the  */
-				/* index corresponds to the Nth RG on disk.  Wish it was.   */
-				/* Instead, we have to read all of the rgindex until we     */
-				/* find an entry that has the smallest address greater than */
-				/* the block we're on (blok).                               */
-				/* -------------------------------------------------------- */
-				if (section3_bump_size == 0) {
-					uint64_t rgndx_next_block, highest_riaddr;
-
-					rgndx_next_block = end_block;
-					highest_riaddr = 0;
-					for (rgi = 0; ; rgi++) {
-						error = readi(sdp->riinode, (char *)&buf,
-							      rgi * sizeof(struct gfs_rindex),
-							      sizeof(struct gfs_rindex));
-						if (!error)      /* if end of the rgindex */
-							break;        /* stop processing for more RGs */
-						gfs_rindex_in(&tmpndx, (char *)&buf);
-						/* if this index entry is the next RG physically */
-						if (tmpndx.ri_addr > blok &&
-						    tmpndx.ri_addr < rgndx_next_block) {
-							rgndx_next_block = tmpndx.ri_addr; /* remember it */
-						}
-						if (tmpndx.ri_addr > highest_riaddr)
-							highest_riaddr= tmpndx.ri_addr;
-					}
-					/* A special exception must be made for the last RG because we */
-					/* won't have a "next highest" entry in the rindex.            */
-					if (blok == highest_riaddr)
-						block_bump = end_block - blok + 1;
-					else if (rgndx_next_block == end_block) {
-						if (block_bump != 1) {
-							log_warn("\nUnable to use rindex; "
-								 "doing block-by-block search.\n");
-							log_warn("This will be slow, so be patient.\n");
-							rgndx_next_block = blok + 1;
-							block_bump = 1;
-						} else {
-							if (prev_rgd &&
-							    block_bump != blok -
-							    prev_rgd->rd_ri.ri_addr) {
-								log_warn("I think I figured it out.\n");
-								block_bump = blok -
-									prev_rgd->rd_ri.ri_addr;
-								section3_bump_size = block_bump;
-							}
-						}
-					} else
-						block_bump = rgndx_next_block - blok;
-				}
-			}
-			else {
-				if (blok == start_block)
-					block_bump = first_rg_dist[subd];
-				else
-					block_bump = shortest_dist_btwn_rgs[subd];
-			}
-			if (block_bump == 1 && prev_rgd && subd == 2) {
-				uint64_t last_distance = blok - prev_rgd->rd_ri.ri_addr;
-
-				error = get_and_read_buf(sdp, blok + last_distance, &bh, 0);
-				rg_was_fnd = (!check_type(bh, GFS_METATYPE_RG));
-				relse_buf(sdp, bh); /* release the read buffer */
-				if (rg_was_fnd)
-					block_bump = last_distance;
-			}
-			log_warn("%c RG %d at block 0x%" PRIX64 " %s",
-					 (rg_was_fnd ? ' ' : '*'), number_of_rgs, blok,
-					 (rg_was_fnd ? "intact" : "*** DAMAGED ***"));
-			log_warn(" [length 0x%" PRIx64 "]\n", block_bump);
-			prev_rgd = calc_rgd;
-		} /* for blocks in subdevice */
-	} /* for subdevices */
-	/* ------------------------------------------------------------------- */
-	/* 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->rd_ri.ri_data) {
-		log_debug("Prev ri_data set to: %" PRIx32 ".\n", block_bump);
-		prev_rgd->rd_ri.ri_data = block_bump -
-			rgrplength2bitblocks(sdp, block_bump);
-		prev_rgd->rd_ri.ri_data -= prev_rgd->rd_ri.ri_data % GFS_NBBY;
-		prev_rgd->rd_ri.ri_bitbytes = prev_rgd->rd_ri.ri_data / GFS_NBBY;
-		prev_rgd = NULL; /* make sure we don't use it later */
-	}
-	/* else No previous to fix. */
-	/* ---------------------------- */
-	/* Now dump out the information */	
-	/* ---------------------------- */
-	log_debug("RG index rebuilt as follows:\n");
-	for (tmp = ret_list->next, rgi = 0; tmp != ret_list;
-		 tmp = tmp->next, rgi++) {
-		calc_rgd = osi_list_entry(tmp, struct fsck_rgrp, rd_list);
-		log_debug("%d: %x / 0x%" PRIx64 " / 0x%08X / 0x%08X\n",
-				 rgi + 1, calc_rgd->rd_ri.ri_length, calc_rgd->rd_ri.ri_data1,
-				 calc_rgd->rd_ri.ri_data, calc_rgd->rd_ri.ri_bitbytes);
-		/*memset(rgindex_buf_ondisk, 0, sizeof(rgindex_buf_ondisk));*/
-		/*gfs_rindex_out(&calc_rgd->rd_ri, rgindex_buf_ondisk);*/
-		/* Note: rgindex_buf_ondisk is ONLY used for debug to see what
-		   the entry would look like on disk. */
-		/*hexdump(rgi*sizeof(struct gfs_rindex), rgindex_buf_ondisk,
-		  sizeof(struct gfs_rindex));*/
-	}
-	*num_rgs = number_of_rgs;
-	log_debug("Number of RGs = %d.\n", number_of_rgs);
-	return 0;
-}
-
-/*
- * gfs_rgindex_calculate - calculate what the rgindex should look like
- *                         in a perfect world (trust_lvl == open_minded)
- *
- * Calculate what the rgindex should look like if no gfs_grow-like operations
- * were performed, so we can later check if all RG index entries are sane.
- *
- * This function goes in blind, assuming the entire rgindex is destroyed.
- * That way, we can rebuild it if really is trashed.
- *
- * However, this won't work if the filesystem has been extended or shrunk.
- * If the RGs aren't where we expect them to be, we have to take more drastic
- * measures to recover them.
- *
- * Assumes: journal index file is minimally sane.
- *
- * We need to check if the address and length values are okay.
- * First RG should start after the superblock at block #x11
- * Number of RGs=subdevice size / (2^rgsize/block size)
- *
- * Returns: 0 on success, -1 on failure
- * Sets:    ret_list to a linked list of fsck_rgrp structs representing
- *          what we think the rgindex should really look like.
- */
-int gfs_rgindex_calculate(struct fsck_sb *sdp, osi_list_t *ret_list,
-			  unsigned int *num_rgs)
-{
-	osi_buf_t *bh; /* buffer handle */
-	uint64 subdevice_size, adjust_subdevice_size, fs_total_size;
-	int number_of_rgs; /* min of 4 per segment * 2 segments = 8 */
-	int rgnum_within_subdevice;
-	int first_half;
-	int error;
-	int rgi, rgs_per_subd;
-	uint64 subdevice_start;
-	uint64 addr = 0, prev_addr, length = 0, prev_length;
-	uint64 blocks;
-	struct fsck_rgrp *calc_rgd;
-	char rgindex_buf_ondisk[sizeof(struct gfs_rindex)];
-	struct gfs_rindex buf, tmpndx;
-
-	osi_list_init(ret_list);
-	*num_rgs = 0;
-	/* Get the total size of the device */
-	error = ioctl(sdp->diskfd, BLKGETSIZE64,
-				  &fs_total_size); /* Size in bytes */
-	fs_total_size /= sdp->sb.sb_bsize;
-	log_debug("fs_total_size = 0x%" PRIX64 " blocks.\n", fs_total_size);
-
-	/* The end of the first subdevice is also where the first journal is.*/
-	subdevice_size = sdp->jindex->ji_addr; /* addr of 1st journal (blks) */
-	log_debug("subdevice_size = 0x%" PRIX64 ".\n", subdevice_size);
-
-	/* ----------------------------------------------------------------- */
-	/* Read the first block of the subdevice and make sure it's an RG.   */
-	/* ----------------------------------------------------------------- */
-	subdevice_start = fs_total_size - subdevice_size;
-	error = get_and_read_buf(sdp, subdevice_start, &bh, 0);
-	if (error){
-		log_crit("Unable to read start of last subdevice.\n");
-		return -1;
-	}
-	if(check_type(bh, GFS_METATYPE_RG)){
-		log_warn("The middle RG is not on an even boundary (fs has grown?)\n");
-		relse_buf(sdp, bh);
-		return -1;
-	}
-	log_debug("First RG is okay.\n");
-	/* --------------------------------------------------------------------- */
-	/* Calculate how many RGs there are supposed to be based on the          */
-	/* rgindex filesize.  Remember that our trust level is open-minded here. */
-	/* If the filesize of the rgindex file is not a multiple of our rgindex  */
-	/* structures, then something's wrong and we can't trust the index.      */
-	/* --------------------------------------------------------------------- */
-	number_of_rgs = sdp->riinode->i_di.di_size / sizeof(struct gfs_rindex);
-	*num_rgs = number_of_rgs;
-	log_warn("number_of_rgs = %d.\n", number_of_rgs);
-	if (sdp->riinode->i_di.di_size % sizeof(struct gfs_rindex)) {
-		log_warn("WARNING: rgindex file is corrupt.\n");
-		return -1;
-	}
-	/* --------------------------------------------------------------------- */
-	/* Check to see if the filesystem has been extended via gfs_grow.        */
-	/* If so, our assumptions will be wrong and we can't continue.           */
-	/* Instead, we need to progress to level 3 and dig deeper for the RGs.   */
-	/* We'll know if the filesystem has been extended by whether or not the  */
-	/* RG that's midway is on the wrong side of the journals.                */
-	/* For example, if we have 50 RGs, we'd expect 25 to be on one side of   */
-	/* the journals, and 25 to be on the other side.  If we find out that    */
-	/* RG number 25 (index 1, or 24 index 0) is on the other side, we grew.  */
-	/* --------------------------------------------------------------------- */
-	rgi = (number_of_rgs / 2) - 1;
-	error = readi(sdp->riinode,
-				  (char *)&buf, rgi * sizeof(struct gfs_rindex),
-				  sizeof(struct gfs_rindex));
-	if (!error) { /* if end of file */
-		log_warn("Error reading RG index.\n");
-		return -1; /* stop looking */
-	}
-	gfs_rindex_in(&tmpndx, (char *)&buf); /* read in the index entry. */
-	if (tmpndx.ri_addr >= sdp->jindex->ji_addr) { /* wrong side of journals */
-		log_warn("This filesystem has probably been resized by gfs_grow.\n");
-		return -1; /* stop looking */
-	}
-	/* --------------------------------------------------------------------- */
-	/* Now that we know how many RGs there should be, we can calculate       */
-	/* exactly where we think they should be and build our index with it.    */
-	/* --------------------------------------------------------------------- */
-	rgs_per_subd = (number_of_rgs / 2);
-	for (rgi = 0; rgi < number_of_rgs; rgi++) {
-
-		first_half = (rgi < rgs_per_subd ? 1 : 0);
-		adjust_subdevice_size = subdevice_size;
-		if (first_half) {
-			adjust_subdevice_size -= ((GFS_SB_ADDR >> sdp->fsb2bb_shift) + 1);
-			rgnum_within_subdevice = rgi;
-		}
-		else
-			rgnum_within_subdevice = rgi - rgs_per_subd;
-		prev_length = length;
-		if (rgnum_within_subdevice)
-			length = adjust_subdevice_size / rgs_per_subd;
-		else
-			length = adjust_subdevice_size - 
-				(rgs_per_subd - 1) * (adjust_subdevice_size / rgs_per_subd);
-		
-		calc_rgd = (struct fsck_rgrp *)malloc(sizeof(struct fsck_rgrp));
-		// FIXME: handle failed malloc
-		memset(calc_rgd, 0, sizeof(struct fsck_rgrp));
-		calc_rgd->rd_sbd = sdp; /* hopefully this is not used */
-		osi_list_add_prev(&calc_rgd->rd_list, ret_list);
-		prev_addr = addr;
-		if (!rgnum_within_subdevice) {
-			if (!rgi) {
-				/* The first RG immediately follows the superblock */
-				addr = (GFS_SB_ADDR >> sdp->fsb2bb_shift) + 1;
-			}
-			else /* First RG on second subdevice is at the beginning of it */
-				addr = subdevice_start;
-		}
-		else
-			addr = prev_addr + prev_length;
-		calc_rgd->rd_ri.ri_addr = addr;
-		log_debug("ri_addr[%d] = 0x%"PRIX64 " / ", rgi, 
-				  calc_rgd->rd_ri.ri_addr);
-		blocks = length - rgrplength2bitblocks(sdp, length);
-		blocks -= blocks % GFS_NBBY;
-		calc_rgd->rd_ri.ri_length = rgrplength2bitblocks(sdp, length);
-		calc_rgd->rd_ri.ri_data1 = calc_rgd->rd_ri.ri_addr +
-			calc_rgd->rd_ri.ri_length;
-		calc_rgd->rd_ri.ri_data = blocks;
-		calc_rgd->rd_ri.ri_bitbytes = calc_rgd->rd_ri.ri_data / GFS_NBBY;
-		log_info("%d / %08X / %08X / %08X\n", calc_rgd->rd_ri.ri_length,
-			   calc_rgd->rd_ri.ri_data1, calc_rgd->rd_ri.ri_data,
-			   calc_rgd->rd_ri.ri_bitbytes);
-		memset(rgindex_buf_ondisk, 0, sizeof(rgindex_buf_ondisk));
-		gfs_rindex_out(&calc_rgd->rd_ri, rgindex_buf_ondisk);
-		/* Note: rgindex_buf_ondisk is ONLY used for debug to see what the
-		   entry would look like on disk. */
-		hexdump(rgi*sizeof(struct gfs_rindex),
-			(unsigned char *)rgindex_buf_ondisk,
-			sizeof(struct gfs_rindex));
-	} /* for */
-	relse_buf(sdp, bh); /* release the read buffer if we have one */
-	return 0;
-}
-
-/*
- * ri_cleanup - free up the memory we previously allocated.
- */
-void ri_cleanup(osi_list_t *rglist)
-{
-	struct fsck_rgrp *rgd;
-
-	while(!osi_list_empty(rglist)){
-		rgd = osi_list_entry(rglist->next, struct fsck_rgrp, rd_list);
-		if(rgd->rd_bits)
-			free(rgd->rd_bits);
-		if(rgd->rd_bh)
-			free(rgd->rd_bh);
-		osi_list_del(&rgd->rd_list);
-		free(rgd);
-	}
-}
-
-/**
- * ri_update - attach rgrps to the super block
- * @sdp:
- *
- * Given the rgrp index inode, link in all rgrps into the super block
- * and be sure that they can be read.
- *
- * If we encounter problems with any RGs, it either means we have a corrupt
- * RG or a corrupt RG file entry (which is less likely).  We make up to three
- * attempts to do this.  First, we trust that the RG index is correct and
- * read the RGs.  If that fails, we become a little less trusting and
- * try to calculate what the RG index should look like in a perfect world.
- * If that doesn't work, we become even less trusting and go to great lengths
- * to figure out exactly where those RGs should be and what the index should
- * look like.
- *
- * Returns: 0 on success, -1 on failure.
- */
-int ri_update(struct fsck_sb *sdp)
-{
-	struct fsck_rgrp *rgd, *expected_rgd;
-	osi_list_t expected_rglist; /* List of expected resource groups */
-	osi_list_t *tmp;
-	struct gfs_rindex buf;
-	unsigned int rg, calc_rg_count;
-	int error, count1 = 0, count2 = 0;
-	int fix_grow_problems = 0, grow_problems = 0;
-	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
-						  gfs_grow or something.  Count the RGs by hand. */
-	} trust_lvl;
-
-	log_info("Validating Resource Group index.\n");
-	for (trust_lvl = blind_faith; trust_lvl <= distrust; trust_lvl++) {
-		log_info("Level %d check.\n", trust_lvl + 1);
-		count1 = count2 = 0;
-		/* ---------------------------------------------------------------- */
-		/* Step 1 - Calculate or figure out our own RG index                */
-		/* ---------------------------------------------------------------- */
-		if (trust_lvl == blind_faith) { /* For now, assume rgindex is gospel */
-			osi_list_init(&expected_rglist);
-			error = FALSE;
-		}
-		else if (trust_lvl == open_minded) { /* If we can't trust RG index */
-			/* Calculate our own RG index for comparison */
-			error = gfs_rgindex_calculate(sdp, &expected_rglist,
-										  &calc_rg_count);
-			if (error) { /* If calculated RGs don't reasonably match the fs */
-				log_info("(failed--trying again at level 3)\n");
-				ri_cleanup(&sdp->rglist);
-				continue; /* Try again, this time counting them manually */
-			}
-		}
-		else if (trust_lvl == distrust) { /* If we can't trust RG index */
-			error = gfs_rgindex_rebuild(sdp, &expected_rglist,
-										&calc_rg_count); /* count the RGs. */
-			if (error) { /* If calculated RGs don't reasonably match the fs */
-				log_info("(failed--giving up)\n");
-				goto fail; /* try again, this time counting them manually */
-			}
-		}
-		/* ---------------------------------------------------------------- */
-		/* Step 2 - Read the real RG index and check its integrity          */
-		/* ---------------------------------------------------------------- */
-		for (rg = 0; ; rg++) {
-			int rgindex_modified;
-
-			rgindex_modified = FALSE;
-			error = readi(sdp->riinode, (char *)&buf,
-						  rg * sizeof(struct gfs_rindex),
-						  sizeof(struct gfs_rindex));
-			if (!error) /* if no data was read */
-				break;  /* we found the end of the rg index file */
-			if (error != sizeof(struct gfs_rindex)) {
-				log_err("Unable to read resource group index #%u.\n", rg);
-				goto fail;
-			}
-			if (trust_lvl != blind_faith && osi_list_empty(&expected_rglist))
-				break;
-			
-			rgd = (struct fsck_rgrp *)malloc(sizeof(struct fsck_rgrp));
-			// FIXME: handle failed malloc
-			memset(rgd, 0, sizeof(struct fsck_rgrp));
-			rgd->rd_sbd = sdp;
-			osi_list_add_prev(&rgd->rd_list, &sdp->rglist);
-			gfs_rindex_in(&rgd->rd_ri, (char *)&buf);
-			if (trust_lvl != blind_faith) {
-				expected_rgd = osi_list_entry(expected_rglist.next,
-											  struct fsck_rgrp, rd_list);
-				/* --------------------------------------------------------- */
-				/* Now compare the index to the one we calculated / rebuilt  */
-				/* Since this is fsck and fsck's job is to fix filesystem    */
-				/* corruption, it's probably better to trust the calculated  */
-				/* value and discard what's reported on disk.                */
-				/* --------------------------------------------------------- */
-				ri_compare(rg, rgd->rd_ri, expected_rgd->rd_ri,
-						   ri_addr, PRIx64);
-				ri_compare(rg, rgd->rd_ri, expected_rgd->rd_ri,
-						   ri_length, PRIx32);
-				ri_compare(rg, rgd->rd_ri, expected_rgd->rd_ri,
-						   ri_data1, PRIx64);
-				ri_compare(rg, rgd->rd_ri, expected_rgd->rd_ri,
-						   ri_data, PRIx32);
-				ri_compare(rg, rgd->rd_ri, expected_rgd->rd_ri,
-						   ri_bitbytes, PRIx32);
-				/* If we modified the index, write it back to disk. */
-				if (rgindex_modified) {
-					if(query(sdp, "Fix the index? (y/n)")) {
-						gfs_rindex_out(&rgd->rd_ri, (char *)&buf);
-						error = writei(sdp->riinode, (char *)&buf,
-									   rg * sizeof(struct gfs_rindex),
-									   sizeof(struct gfs_rindex));
-						if (error != sizeof(struct gfs_rindex)) {
-							log_err("Unable to fix resource group index %u.\n",
-									rg + 1);
-							goto fail;
-						}
-					}
-					else
-						log_err("RG index not fixed.\n");
-				}
-				osi_list_del(&expected_rgd->rd_list);
-				free(expected_rgd);
-			} /* if we can't trust the rg index */
-			else { /* blind faith -- just check for the gfs_grow problem */
-				if (rgd->rd_ri.ri_data == (uint32_t)-4) {
-					if (!fix_grow_problems) {
-						log_err("A problem with the rindex file caused by gfs_grow was detected.\n");
-						if(query(sdp, "Fix the rindex problem? (y/n)"))
-							fix_grow_problems = 1;
-					}
-					/* Keep a counter in case we hit it more than once. */
-					grow_problems++;
-					osi_list_del(&rgd->rd_list); /* take it out of the equation */
-					free(rgd);
-					continue;
-				} else if (fix_grow_problems) {
-					/* Once we detect the gfs_grow rindex problem, we have to */
-					/* rewrite the entire rest of the rindex file, starting   */
-					/* with the entry AFTER the one that has the problem.     */
-					gfs_rindex_out(&rgd->rd_ri, (char *)&buf);
-					error = writei(sdp->riinode, (char *)&buf,
-						       (rg - grow_problems) *
-						       sizeof(struct gfs_rindex),
-						       sizeof(struct gfs_rindex));
-					if (error != sizeof(struct gfs_rindex)) {
-						log_err("Unable to fix rindex entry %u.\n",
-							rg + 1);
-						goto fail;
-					}
-				}
-			}
-			error = fs_compute_bitstructs(rgd);
-			if (error)
-				break;
-			rgd->rd_open_count = 0;
-			count1++;
-		} /* for all RGs in the index */
-		rg -= grow_problems;
-		if (!error) {
-			log_info("%u resource groups found.\n", rg);
-			if (trust_lvl != blind_faith && rg != calc_rg_count)
-				log_warn("Resource group count discrepancy. Index says %d. " \
-						 "Should be %d.\n", rg, calc_rg_count);
-			/* ------------------------------------------------------------- */
-			/* Step 3 - Read the real RGs and check their integrity.         */
-			/* Now we can somewhat trust the rgindex and the RG addresses,   */
-			/* so let's read them in, check them and optionally fix them.    */
-			/* ------------------------------------------------------------- */
-			error = FALSE;
-			for (tmp = sdp->rglist.next; !error && tmp != &sdp->rglist;
-				 tmp = tmp->next) {
-				rgd = osi_list_entry(tmp, struct fsck_rgrp, rd_list);
-				error = fs_rgrp_read(rgd, trust_lvl);
-				if (error)
-					log_err("Unable to read in rgrp descriptor.\n");
-				else
-					fs_rgrp_relse(rgd);
-				count2++;
-			}
-			if (!error && count1 != count2){
-				log_err("Rgrps allocated (%d) does not equal"
-						" rgrps read (%d).\n", count1, count2);
-				error = -1;
-			}
-			sdp->rgcount = count1;
-		}
-		if (fix_grow_problems) {
-			osi_buf_t *dibh;
-
-			get_and_read_buf(sdp, sdp->sb.sb_rindex_di.no_addr, &dibh, 0);
-			sdp->riinode->i_di.di_size = rg * sizeof(struct gfs_rindex);
-			gfs_dinode_out(&sdp->riinode->i_di, BH_DATA(dibh));
-			write_buf(sdp, dibh, 0);
-			grow_problems = fix_grow_problems = 0;
-			relse_buf(sdp, dibh);
-		}
-		if (!error) { /* if no problems encountered with the rgs */
-			log_info("(passed)\n");
-			break;  /* no reason to distrust what we saw. Otherwise, we
-					   reiterate and become a little less trusting. */
-		}
-		else {
-			if (trust_lvl < distrust)
-				log_info("(failed--trying again at level 2)\n");
-			else
-				log_info("(failed--recovery impossible)\n");
-		}
-		ri_cleanup(&sdp->rglist);
-	} /* for trust_lvl */
-	return 0;
-
- fail:
-	ri_cleanup(&sdp->rglist);
-	return -1;
-}
-
-int write_sb(struct fsck_sb *sbp)
-{
-	int error = 0;
-	osi_buf_t *bh;
-
-	error = get_and_read_buf(sbp, GFS_SB_ADDR >> sbp->fsb2bb_shift, &bh, 0);
-	if (error){
-		log_crit("Unable to read superblock\n");
-		goto out;
-	}
-
-	gfs_sb_out(&sbp->sb, BH_DATA(bh));
-
-	if((error = write_buf(sbp, bh, BW_WAIT))) {
-		stack;
-		goto out;
-	}
-
-	relse_buf(sbp, bh);
-out:
-	return error;
-
-}
-
diff --git a/gfs/gfs_fsck/super.h b/gfs/gfs_fsck/super.h
deleted file mode 100644
index 702c804..0000000
--- a/gfs/gfs_fsck/super.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _SUPER_H
-#define _SUPER_H
-
-#include "fsck_incore.h"
-
-int read_sb(struct fsck_sb *sdp);
-int ji_update(struct fsck_sb *sdp);
-int ri_update(struct fsck_sb *sdp);
-int write_sb(struct fsck_sb *sdp);
-
-#endif /* _SUPER_H */
diff --git a/gfs/gfs_fsck/test_bitmap.c b/gfs/gfs_fsck/test_bitmap.c
deleted file mode 100644
index 18e23bd..0000000
--- a/gfs/gfs_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/gfs/gfs_fsck/test_block_list.c b/gfs/gfs_fsck/test_block_list.c
deleted file mode 100644
index cd25f05..0000000
--- a/gfs/gfs_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/gfs/gfs_fsck/util.c b/gfs/gfs_fsck/util.c
deleted file mode 100644
index 7a3a515..0000000
--- a/gfs/gfs_fsck/util.c
+++ /dev/null
@@ -1,333 +0,0 @@
-#include "bio.h"
-#include "fs_bits.h"
-
-#include "util.h"
-#include "log.h"
-
-/**
- * compute_height
- * @sdp:
- * @sz:
- *
- */
-int compute_height(struct fsck_sb *sdp, uint64 sz)
-{
-  unsigned int height;
-  uint64 space, old_space;
-  unsigned int bsize = sdp->sb.sb_bsize;
-
-  if (sz <= (bsize - sizeof(struct gfs_dinode)))
-    return 0;
-
-  height = 1;
-  space = sdp->diptrs * bsize;
-
-  while (sz > space)
-  {
-    old_space = space;
-
-    height++;
-    space *= sdp->inptrs;
-
-    if (space / sdp->inptrs != old_space ||
-        space % sdp->inptrs != 0)
-      break;
-  }
-
-  return height;
-}
-
-
-/*
- * 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 check_range(struct fsck_sb *sdp, uint64 blkno){
-	if((blkno > sdp->last_fs_block) ||
-	   (blkno < sdp->first_data_block))
-		return -1;
-	return 0;
-}
-
-
-/*
- * set_meta - set the meta header of a buffer
- * @bh
- * @type
- *
- * Returns: 0 if ok, -1 on error
- */
-int set_meta(osi_buf_t *bh, int type, int format){
-  struct gfs_meta_header header;
-
-  if(!check_meta(bh, 0)){
-	  log_debug("Setting metadata\n");
-    ((struct gfs_meta_header *)BH_DATA(bh))->mh_type = cpu_to_gfs32(type);
-    ((struct gfs_meta_header *)BH_DATA(bh))->mh_format = cpu_to_gfs32(format);
-  } else {
-    memset(&header, 0, sizeof(struct gfs_meta_header));
-    header.mh_magic = GFS_MAGIC;
-    header.mh_type = type;
-    header.mh_format = format;
-
-    gfs_meta_header_out(&header, BH_DATA(bh));
-  }
-  return 0;
-}
-
-
-
-
-/*
- * check_meta - check the meta header of a buffer
- * @bh: buffer to check
- * @type: meta type (or 0 if don't care)
- *
- * Returns: 0 if ok, -1 on error
- */
-int check_meta(osi_buf_t *bh, int type){
-  uint32 check_magic = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_magic;
-  uint32 check_type = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
- 
-  check_magic = gfs32_to_cpu(check_magic);
-  check_type = gfs32_to_cpu(check_type);
-  if((check_magic != GFS_MAGIC) || (type && (check_type != type))){
-	  log_debug("For %"PRIu64" Expected %X:%X - got %X:%X\n", BH_BLKNO(bh), GFS_MAGIC, type,
-		    check_magic, check_type);
-    return -1;
-  }
-  return 0;
-}
-
-/*
- * check_type - check the meta type of a buffer
- * @bh: buffer to check
- * @type: meta type
- *
- * Returns: 0 if ok, -1 on error
- */
-int check_type(osi_buf_t *bh, int type){
-  uint32 check_magic = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_magic;
-  uint32 check_type = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
- 
-  check_magic = gfs32_to_cpu(check_magic);
-  check_type = gfs32_to_cpu(check_type);
-  if((check_magic != GFS_MAGIC) || (check_type != type)){
-    return -1;
-  }
-  return 0;
-}
-
-/**
- * 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 next_rg_meta(struct fsck_rgrp *rgd, uint64 *block, int first)
-{
-  fs_bitmap_t *bits = NULL;
-  uint32 length = rgd->rd_ri.ri_length;
-  uint32 blk = (first)? 0: (uint32)((*block+1)-rgd->rd_ri.ri_data1);
-  int i;
-
-  if(!first && (*block < rgd->rd_ri.ri_data1)){
-    log_err("next_rg_meta:  Start block is outside rgrp bounds.\n");
-    exit(1);
-  }
-
-  for(i=0; i < length; i++){
-    bits = &rgd->rd_bits[i];
-    if(blk < bits->bi_len*GFS_NBBY){
-      break;
-    }
-    blk -= bits->bi_len*GFS_NBBY;
-  }
-
-
-  for(; i < length; i++){
-    bits = &rgd->rd_bits[i];
-
-    blk = fs_bitfit((unsigned char *)BH_DATA(rgd->rd_bh[i]) + bits->bi_offset,
-                    bits->bi_len, blk, GFS_BLKST_USEDMETA);
-
-    if(blk != BFITNOENT){
-	    *block = blk + (bits->bi_start * GFS_NBBY) + rgd->rd_ri.ri_data1;
-	    break;
-    }
-
-    blk=0;
-  }
-
-  if(i == length){
-    return -1;
-  }
-  return 0;
-}
-
-/**
- * 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 next_rg_meta_free(struct fsck_rgrp *rgd, uint64 *block, int first, int *mfree)
-{
-  fs_bitmap_t *bits = NULL;
-  uint32 length = rgd->rd_ri.ri_length;
-  uint32 blk = (first)? 0: (uint32)((*block+1)-rgd->rd_ri.ri_data1);
-  uint32 ublk, fblk;
-  int i;
-
-  if(!first && (*block < rgd->rd_ri.ri_data1)){
-    log_err("next_rg_meta:  Start block is outside rgrp bounds.\n");
-    exit(1);
-  }
-
-  for(i=0; i < length; i++){
-    bits = &rgd->rd_bits[i];
-    if(blk < bits->bi_len*GFS_NBBY){
-      break;
-    }
-    blk -= bits->bi_len*GFS_NBBY;
-  }
-
-
-  for(; i < length; i++){
-    bits = &rgd->rd_bits[i];
-
-    ublk = fs_bitfit((unsigned char *)BH_DATA(rgd->rd_bh[i]) + bits->bi_offset,
-                    bits->bi_len, blk, GFS_BLKST_USEDMETA);
-
-    fblk = fs_bitfit((unsigned char *)BH_DATA(rgd->rd_bh[i]) + bits->bi_offset,
-			     bits->bi_len, blk, GFS_BLKST_FREEMETA);
-    if(ublk < fblk) {
-	    blk = ublk;
-	    *mfree = 0;
-    } else {
-	    blk = fblk;
-	    *mfree = 1;
-    }
-    if(blk != BFITNOENT){
-	    *block = blk + (bits->bi_start * GFS_NBBY) + rgd->rd_ri.ri_data1;
-	    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 next_rg_metatype(struct fsck_rgrp *rgd, uint64 *block, uint32 type, int first)
-{
-  struct fsck_sb *sdp = rgd->rd_sbd;
-  osi_buf_t *bh=NULL;
-
-  do{
-    relse_buf(sdp, bh);
-    if(next_rg_meta(rgd, block, first))
-      return -1;
-
-    if(get_and_read_buf(sdp, *block, &bh, 0)){
-      log_err("next_rg_metatype:  Unable to read meta block "
-	      "#%"PRIu64" from disk\n", *block);
-      exit(1);
-    }
-
-    if(check_meta(bh,0)){
-      log_err("next_rg_metatype:  next_rg_meta returned block #%"PRIu64",\n"
-	      "                   which is not a valid meta block.\n", *block);
-      exit(1);
-    }
-
-    first = 0;
-  } while(check_meta(bh, type));
-  relse_buf(sdp, bh);
-
-  return 0;
-}
-
-
-
-#if 0
-/**
- * search_list
- * @list
- * @addr
- *
- * Returns: di_info_t ptr if found, NULL otherwise
- */
-struct di_info *search_list(osi_list_t *list, uint64 addr)
-{
-  osi_list_t *tmp;
-  struct di_info *dinfo;
-
-  for (tmp = list->next; tmp != list; tmp = tmp->next)
-  {
-    dinfo = osi_list_entry(tmp, struct di_info, din_list);
-
-    if (dinfo->din_addr == addr)
-      return(dinfo);
-  }
-
-  return NULL;
-}
-#endif
-
-/* 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)
-{
-	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);
-			}
-		}
-	}
-}
diff --git a/gfs/gfs_fsck/util.h b/gfs/gfs_fsck/util.h
deleted file mode 100644
index 7a4a041..0000000
--- a/gfs/gfs_fsck/util.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef __UTIL_H__
-#define __UTIL_H__
-
-#include "fsck_incore.h"
-
-#define do_lseek(fd, off) \
-  ((lseek((fd), (off), SEEK_SET) == (off)) ? 0 : -1)
-
-#define do_read(fd, buff, len) \
-  ((read((fd), (buff), (len)) == (len)) ? 0 : -1)
-
-#define do_write(fd, buff, len) \
-  ((write((fd), (buff), (len)) == (len)) ? 0 : -1)
-
-
-int compute_height(struct fsck_sb *sdp, uint64 sz);
-int check_range(struct fsck_sb *sdp, uint64 blkno);
-int set_meta(osi_buf_t *bh, int type, int format);
-int check_type(osi_buf_t *bh, int type);
-int check_meta(osi_buf_t *bh, int type);
-int next_rg_meta(struct fsck_rgrp *rgd, uint64 *block, int first);
-int next_rg_meta_free(struct fsck_rgrp *rgd, uint64 *block, int first, int *free);
-int next_rg_metatype(struct fsck_rgrp *rgd, uint64 *block, uint32 type, int first);
-struct di_info *search_list(osi_list_t *list, uint64 addr);
-void warm_fuzzy_stuff(uint64_t block);
-
-#endif /* __UTIL_H__ */
diff --git a/gfs/gfs_grow/Makefile b/gfs/gfs_grow/Makefile
deleted file mode 100644
index 9c54b12..0000000
--- a/gfs/gfs_grow/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-TARGET= gfs_grow
-
-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 \
-      ondisk.o
-
-CFLAGS += -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64
-CFLAGS += -I${gfskincdir}
-CFLAGS += -I$(S)/../include -I$(S)/../libgfs
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L../libgfs -lgfs
-LDFLAGS += -L${libdir}
-
-LDDEPS += ../libgfs/libgfs.a
-
-${TARGET}: ${OBJS} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-depends:
-	$(MAKE) -C ../libgfs all
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/gfs/gfs_grow/main.c b/gfs/gfs_grow/main.c
deleted file mode 100644
index eb30e21..0000000
--- a/gfs/gfs_grow/main.c
+++ /dev/null
@@ -1,915 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <sys/ioctl.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <stdint.h>
-#include <inttypes.h>
-
-#include "gfs_ondisk.h"
-#define __user
-#include "gfs_ioctl.h"
-#include "osi_list.h"
-#include "libgfs.h"
-
-#include "copyright.cf"
-
-struct rglist_entry {
-	osi_list_t list;
-	struct gfs_rindex ri;
-	struct gfs_rgrp rg;
-};
-
-struct jilist_entry {
-	osi_list_t list;
-	struct gfs_jindex ji;
-};
-
-/*
- * verbose: 0 = no messages, 1 = normal, 2 = everything
- * test: 0 = normal, 1 = don't actually write data, but do everything else
- * fspath: path to root of mounted GFS filesystem
- * device: the device upon which the GFS filesystem is mounted
- * fsoptions: the mount options used
- * devsize: the size of the device (in filesystem blocks, rounded down)
- * fssize: the size of the filesystem (in filesystem blocks, rounded down)
- * override_device_size: if non-zero, this is used for the device size
- */
-static int verbose = 1;
-static int test = 0;
-static char fspath[4096];
-static char device[1024];
-static char fsoptions[4096];
-static uint64_t devsize;
-static uint64_t fssize;
-static uint64_t override_device_size = 0;
-
-/*
- * fs_sb: the superblock read from the mounted filesystem
- * rglist_current: list of resource groups currently making up the filesystem
- * rglist_new: where we put the new resource groups to be written
- * jilist_current: list of current journals in the filesystem
- */
-static struct gfs_sb fs_sb;
-static osi_list_decl(rglist_current);
-static osi_list_decl(rglist_new);
-static osi_list_decl(jilist_current);
-
-/**
- * device_geometry - Find out the size of a block device
- * @device: The name of the device
- *
- * Returns: The size of the device in FS blocks
- */
-
-static uint64_t
-device_geometry(char *device)
-{
-	int fd;
-	uint64_t bytes;
-	int error;
-
-	if (override_device_size)
-		bytes = override_device_size;
-	else {
-		fd = open(device, O_RDONLY);
-		if (fd < 0) {
-			fprintf(stderr, "gfs_grow: can't open %s: %s\n",
-				device, strerror(errno));
-			exit(EXIT_FAILURE);
-		}
-
-		error = device_size(fd, &bytes);
-		if (error) {
-			fprintf(stderr,
-				"gfs_grow: can't determine size of %s: %s\n",
-				device, strerror(errno));
-			exit(EXIT_FAILURE);
-		}
-
-		close(fd);
-	}
-
-	return bytes >> fs_sb.sb_bsize_shift;
-}
-
-/**
- * jread - Read from journaled file using ioctl()
- * @fd: The fd to read from
- * @file: The file to read
- * @buf: The buffer to fill
- * @size: The amount of data to read
- * @offset: The offset to read from
- *
- * Returns: Error code, or amount of data read
- */
-
-int
-jread(int fd, char *file, void *buf, uint64_t size, uint64_t *offset)
-{
-	struct gfs_ioctl gi;
-	char *argv[] = { "do_hfile_read", file };
-	int error;
-
-	gi.gi_argc = 2;
-	gi.gi_argv = argv;
-	gi.gi_data = buf;
-	gi.gi_size = size;
-	gi.gi_offset = *offset;
-
-	error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-	if (error > 0)
-		*offset += error;
-
-	return error;
-}
-
-/**
- * jwrite - Write to journaled file using ioctl()
- * @fd: The fd to write to
- * @file: The file to write
- * @buf: The buffer to write
- * @size: The amount of data to write
- * @offset: The offset at which to write the data
- *
- * Returns: Error code, or the amount of data written
- */
-
-int
-jwrite(int fd, char *file, void *buf, uint64_t size, uint64_t *offset)
-{
-	struct gfs_ioctl gi;
-	char *argv[] = { "do_hfile_write", file };
-	int error;
-
-	gi.gi_argc = 2;
-	gi.gi_argv = argv;
-	gi.gi_data = buf;
-	gi.gi_size = size;
-	gi.gi_offset = *offset;
-
-	error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-	if (error > 0)
-		*offset += error;
-
-	return error;
-}
-
-/**
- * filesystem_size - Calculate the size of the filesystem
- *
- * Reads the lists of journals and resource groups in order to
- * work out where the last block of the filesystem is located.
- *
- * Returns: The calculated size
- */
-
-static uint64_t
-filesystem_size(void)
-{
-	osi_list_t *tmp, *head;
-	struct rglist_entry *rgl;
-	struct jilist_entry *jil;
-	uint64_t size = 0;
-	uint64_t extent;
-
-	tmp = head = &rglist_current;
-	for (;;) {
-		tmp = tmp->next;
-		if (tmp == head)
-			break;
-		rgl = osi_list_entry(tmp, struct rglist_entry, list);
-		extent = rgl->ri.ri_addr + rgl->ri.ri_length + rgl->ri.ri_data;
-		if (extent > size)
-			size = extent;
-	}
-
-	tmp = head = &jilist_current;
-	for (;;) {
-		tmp = tmp->next;
-		if (tmp == head)
-			break;
-		jil = osi_list_entry(tmp, struct jilist_entry, list);
-		extent = jil->ji.ji_addr + jil->ji.ji_nsegment * fs_sb.sb_seg_size;
-		if (extent > size)
-			size = extent;
-	}
-
-	return size;
-}
-
-/**
- * gfs_jientry - Get journal index entry
- * @fd: The fd of the journal index
- * @offset: The offset at which the journal entry appears
- *
- * Reads a single entry from the journal index file and
- * adds it to the list of current journal entries.
- *
- * Returns: 1 on EOF, 0 otherwise
- */
-
-static int
-get_jientry(int fd, uint64_t *offset)
-{
-	char buffer[sizeof(struct gfs_jindex)];
-	int len = jread(fd, "jindex", buffer,
-			sizeof(struct gfs_jindex), offset);
-	struct jilist_entry *jil;
-
-	if (len != sizeof(struct gfs_jindex)) {
-		if (len == 0)
-			return 1;
-		fprintf(stderr, "Erk! Read odd size from jindex (%d)\n", len);
-		exit(EXIT_FAILURE);
-	}
-	if ((jil = malloc(sizeof(struct jilist_entry))) == NULL) {
-		perror("jilist_entry");
-		exit(EXIT_FAILURE);
-	}
-	memset(jil, 0, sizeof(struct jilist_entry));
-	gfs_jindex_in(&jil->ji, buffer);
-	osi_list_add(&jil->list, &jilist_current);
-	return 0;
-}
-
-/**
- * read_journals - Read the whole journal index
- * @fs_fd: An fd for some file or directory within the mounted GFS filesystem
- *
- */
-
-static void
-read_journals(int fs_fd)
-{
-	uint64_t offset = 0;
-	while (get_jientry(fs_fd, &offset) == 0)
-		/* do nothing */;
-}
-
-/**
- * get_rgrp - Read a single rindex entry
- * @fd: The fd for the rindex file
- * @offset: The offset at which to read the rindex entry
- *
- * Reads a single rindex entry and adds it to the list of current
- * resource group entries.
- *
- * Returns: 1 on EOF, 0 otherwise
- */
-
-static int
-get_rgrp(int fd, uint64_t *offset)
-{
-	char buffer[sizeof(struct gfs_rindex)];
-	int len = jread(fd, "rindex", buffer,
-			sizeof(struct gfs_rindex), offset);
-	struct rglist_entry *rgl;
-
-	if (len != sizeof(struct gfs_rindex)) {
-		if (len == 0)
-			return 1;
-		fprintf(stderr, "Erk! Read odd size from rindex (%d)\n", len);
-		exit(EXIT_FAILURE);
-	}
-	if ((rgl = malloc(sizeof(struct rglist_entry))) == NULL) {
-		perror("rglist_entry");
-		exit(EXIT_FAILURE);
-	}
-	memset(rgl, 0, sizeof(struct rglist_entry));
-	gfs_rindex_in(&rgl->ri, buffer);
-	osi_list_add(&rgl->list, &rglist_current);
-	return 0;
-}
-
-/**
- * read_rgrps - Reads the contents of the rindex file
- * @fs_fd: An fd for any file or directory within the mounted GFS filesytem
- *
- */
-
-static void
-read_rgrps(int fs_fd)
-{
-	uint64_t offset = 0;
-	while (get_rgrp(fs_fd, &offset) == 0)
-		/* do nothing */;
-}
-
-/**
- * write_a_block - Write a block to the current device
- * @where: The position to write the block (in filesystem blocks)
- * @rg: The (optional) resource group to write
- *
- * Writes a single disk block to the device. It has a safety check which
- * prevents it writing to the device at a position within the control of
- * the active filesystem. If @rg is NULL, it writes a single block of
- * zeros with a meta_header, otherwise the resource group is copied 
- * into the start of the block.
- */
-
-static void
-write_a_block(uint64_t where, struct gfs_rgrp *rg)
-{
-	char buffer[4096];
-	uint64_t fsoffset = where * (uint64_t) fs_sb.sb_bsize;
-	int fd = open(device, O_RDWR);
-	struct gfs_meta_header mh;
-	mh.mh_magic = GFS_MAGIC;
-	mh.mh_type = GFS_METATYPE_RB;
-	mh.mh_format = GFS_FORMAT_RB;
-
-	if (fd < 0) {
-		perror(device);
-		exit(EXIT_FAILURE);
-	}
-	if (where < fssize) {
-		fprintf(stderr,
-			"Sanity check failed: Caught trying to write to live filesystem!\n");
-		exit(EXIT_FAILURE);
-	}
-	memset(buffer, 0, 4096);
-	if (rg)
-		gfs_rgrp_out(rg, buffer);
-	else
-		gfs_meta_header_out(&mh, buffer);
-	if (lseek(fd, fsoffset, SEEK_SET) != fsoffset) {
-		perror(device);
-		exit(EXIT_FAILURE);
-	}
-	if (write(fd, buffer, fs_sb.sb_bsize) != fs_sb.sb_bsize) {
-		perror("write_zero_block");
-		exit(EXIT_FAILURE);
-	}
-	close(fd);
-}
-
-/**
- * write_whole_rgrp - Write a complete rgrp, including bitmaps
- * @rgl: The information about the resource group
- *
- * Writes a complete rgrp, including any bitmap blocks required
- * by calling write_a_block() a number of times. Calls sync() to
- * ensure data really reached disk.
- */
-
-static void
-write_whole_rgrp(struct rglist_entry *rgl)
-{
-	uint32_t l;
-	uint32_t nzb = rgl->ri.ri_length;
-	uint64_t addr = rgl->ri.ri_addr;
-
-	write_a_block(addr++, &rgl->rg);
-	for (l = 1; l < nzb; l++)
-		write_a_block(addr++, NULL);
-	sync();
-}
-
-/**
- * get_length - Use stat() to get the length of a file
- * @fd: The fd of the file whose length we wish to know
- *
- * Returns: The length
- */
-
-static uint64_t
-get_length(int fd, char *file)
-{
-	struct gfs_ioctl gi;
-	char *argv[] = { "get_hfile_stat", file };
-	struct gfs_dinode di;
-	int error;
-
-	gi.gi_argc = 2;
-	gi.gi_argv = argv;
-	gi.gi_data = (char *)&di;
-	gi.gi_size = sizeof(struct gfs_dinode);
-
-	error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-	if (error != gi.gi_size) {
-		perror("stat");
-		fprintf(stderr, "Failed to get size of file. Aborting.\n");
-		exit(EXIT_FAILURE);
-	}
-
-	return di.di_size;
-}
-
-/**
- * write_rindex - Writes new records to the end of the rindex file
- * @fs_fd: A fd of any file or directory withint the GFS filesystem
- *
- * This is the critical function in expanding a filesystem. It does the
- * actual write to the rindex which causes the GFS filesystem to see the
- * new resource groups which were previously added.
- */
-
-static void
-write_rindex(int fs_fd)
-{
-	osi_list_t *tmp, *head;
-	struct rglist_entry *rgl;
-	char buffer[sizeof(struct gfs_rindex)];
-	uint64_t offset;
-
-	offset = get_length(fs_fd, "rindex");
-
-	/*
-	 * This is the critical section.
-	 * If things mess up here, it could be very difficult to put right
-	 */
-	tmp = head = &rglist_new;
-	for (;;) {
-		tmp = tmp->next;
-		if (tmp == head)
-			break;
-		rgl = osi_list_entry(tmp, struct rglist_entry, list);
-		gfs_rindex_out(&rgl->ri, buffer);
-		if (jwrite(fs_fd, "rindex", buffer,
-			   sizeof(struct gfs_rindex), &offset) !=
-		    sizeof(struct gfs_rindex)) {
-			perror("write: rindex");
-			fprintf(stderr, "Aborting...\n");
-			exit(EXIT_FAILURE);
-		}
-	}
-	/*
-	 * This is the end of the critical section
-	 */
-}
-
-/**
- * write_rgrps - Write the new resource groups to disk
- * @fs_fd: An fd from any file or directory on the GFS mounted filesystem
- *
- * This first writes out the new resource group information to the
- * area of the disk beyond the area the filesystem is currently
- * using and then calls write_rindex() to make the filesystem see
- * the newly written resource groups.
- */
-
-static void
-write_rgrps(int fs_fd)
-{
-	osi_list_t *tmp, *head;
-	struct rglist_entry *rgl;
-
-	tmp = head = &rglist_new;
-	for (;;) {
-		tmp = tmp->next;
-		if (tmp == head)
-			break;
-		rgl = osi_list_entry(tmp, struct rglist_entry, list);
-		write_whole_rgrp(rgl);
-	}
-
-	sync();
-	sync();
-	sync();
-
-	write_rindex(fs_fd);
-
-	sync();
-	sync();
-	sync();
-}
-
-/**
- * gather_info - Gathers all the information about the existing filesystem
- *
- */
-
-static void
-gather_info(void)
-{
-	int fd;
-	struct gfs_ioctl gi;
-	char *argv[] = { "get_super" };
-	int error;
-
-	fd = open(fspath, O_RDONLY);
-	if (fd < 0) {
-		perror(fspath);
-		exit(EXIT_FAILURE);
-	}
-
-	gi.gi_argc = 1;
-	gi.gi_argv = argv;
-	gi.gi_data = (char *)&fs_sb;
-	gi.gi_size = sizeof(struct gfs_sb);
-
-	error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-	if (error != gi.gi_size) {
-		perror("ioctl: GFS_GET_SUPER");
-		exit(EXIT_FAILURE);
-	}
-
-	read_rgrps(fd);
-	read_journals(fd);
-	close(fd);
-	devsize = device_geometry(device);
-	fssize = filesystem_size();
-}
-
-/**
- * print_rgrps - Print information about resource groups
- * @lh: The list of resource groups to print
- *
- */
-
-static void
-print_rgrps(osi_list_t *lh)
-{
-	osi_list_t *tmp, *head;
-	struct rglist_entry *rgl;
-	int n = 0;
-
-	tmp = head = lh;
-	for (;;) {
-		tmp = tmp->next;
-		if (tmp == head)
-			break;
-		rgl = osi_list_entry(tmp, struct rglist_entry, list);
-		n++;
-		printf("RI: Addr %"PRIu64", RgLen %u, Start %"PRIu64", DataLen %u, BmapLen %u\n",
-		       rgl->ri.ri_addr, rgl->ri.ri_length,
-		       rgl->ri.ri_data1, rgl->ri.ri_data, rgl->ri.ri_bitbytes);
-	}
-	printf("RGRP: %d Resource groups in total\n", n);
-}
-
-/**
- * print_journals - Print a list of journals
- *
- */
-
-static void
-print_journals(osi_list_t *lh)
-{
-	osi_list_t *tmp, *head;
-	struct jilist_entry *jil;
-	int n = 0;
-
-	tmp = head = lh;
-	for (;;) {
-		tmp = tmp->next;
-		if (tmp == head)
-			break;
-		jil = osi_list_entry(tmp, struct jilist_entry, list);
-		n++;
-		printf("JI: Addr %"PRIu64" NumSeg %u SegSize %u\n",
-		       jil->ji.ji_addr, jil->ji.ji_nsegment, fs_sb.sb_seg_size);
-	}
-	printf("JRNL: %d Journals in total\n", n);
-}
-
-/**
- * print_info - Print out various bits of (interesting?) information
- *
- */
-
-static void
-print_info(void)
-{
-	printf("FS: Mount Point: %s\n", fspath);
-	printf("FS: Device: %s\n", device);
-	printf("FS: Options: %s\n", fsoptions);
-	printf("FS: Size: %"PRIu64"\n", fssize);
-	if (verbose > 1) {
-		printf("RGRP: Current Resource Group List:\n");
-		print_rgrps(&rglist_current);
-		printf("JRNL: Current Journal List:\n");
-		print_journals(&jilist_current);
-	}
-	printf("DEV: Size: %"PRIu64"\n", devsize);
-	if (verbose > 1) {
-		printf("RGRP: New Resource Group List:\n");
-		print_rgrps(&rglist_new);
-	}
-}
-
-#define RGRP_STUFFED_BLKS(sb) (((sb)->sb_bsize - sizeof(struct gfs_rgrp)) * GFS_NBBY)
-#define RGRP_BITMAP_BLKS(sb) (((sb)->sb_bsize - sizeof(struct gfs_meta_header)) * GFS_NBBY)
-
-/**
- * rgrp_length - Calculate the length of a resource group
- * @size: The total size of the resource group
- *
- */
-
-uint64_t
-rgrp_length(uint64_t size)
-{
-	uint64_t bitbytes = RGRP_BITMAP_BLKS(&fs_sb) + 1;
-	uint64_t stuff = RGRP_STUFFED_BLKS(&fs_sb) + 1;
-	uint64_t blocks = 1;
-
-	if (size < stuff)
-		goto out;
-	size -= stuff;
-	while (size > bitbytes) {
-		blocks++;
-		size -= bitbytes;
-	}
-	if (size)
-		blocks++;
- out:
-	return blocks;
-}
-
-/**
- * make_rgrp - Make a new rglist_entry
- * @offset: The offset at which the new rgrp will go
- * @size: The size of the new rgrp
- *
- * Returns: The end of the new resource group
- */
-
-uint64_t
-make_rgrp(uint64_t offset, uint64_t size)
-{
-	struct rglist_entry *rgl = malloc(sizeof(struct rglist_entry));
-	if (rgl == NULL)
-		exit(EXIT_FAILURE);
-	memset(rgl, 0, sizeof(struct rglist_entry));
-
-	rgl->ri.ri_addr = offset;
-	rgl->ri.ri_length = rgrp_length(size);
-	rgl->ri.ri_data1 = offset + rgl->ri.ri_length;
-	rgl->ri.ri_data = size - rgl->ri.ri_length;
-
-	/* Round down to nearest multiple of GFS_NBBY */
-	while (rgl->ri.ri_data & 0x03)
-		rgl->ri.ri_data--;
-
-	rgl->ri.ri_bitbytes = rgl->ri.ri_data / GFS_NBBY;
-
-	rgl->rg.rg_header.mh_magic = GFS_MAGIC;
-	rgl->rg.rg_header.mh_type = GFS_METATYPE_RG;
-	rgl->rg.rg_header.mh_format = GFS_FORMAT_RG;
-	rgl->rg.rg_free = rgl->ri.ri_data;
-
-	osi_list_add_prev(&rgl->list, &rglist_new);
-	return offset + size;
-}
-
-/**
- * create_rgrps - Create a list of the new rgrps
- * 
- */
-
-static void
-create_rgrps(void)
-{
-	uint64_t space = devsize - fssize;
-	uint64_t optimal_rgrp_size = RGRP_STUFFED_BLKS(&fs_sb) +
-		14 * RGRP_BITMAP_BLKS(&fs_sb) + 15;
-	uint64_t rgrps = space / optimal_rgrp_size;
-	uint64_t offset = fssize;
-	uint64_t rgsize;
-	uint64_t n;
-
-	if (space % optimal_rgrp_size)
-		rgrps++;
-	rgsize = optimal_rgrp_size;
-
-	for (n = 0; n < rgrps; n++)
-		offset = make_rgrp(offset, (n != 0) ? rgsize :
-				   (space - ((rgrps - 1) * rgsize)));
-
-	if (offset > devsize) {
-		fprintf(stderr, "Calculation error: Out of bounds\n");
-		exit(EXIT_FAILURE);
-	}
-}
-
-/**
- * update_fs - Actually perform the filesystem update
- *
- */
-
-static void
-update_fs(void)
-{
-	int fd = open(fspath, O_RDONLY);
-	if (fd < 0) {
-		perror(fspath);
-		exit(EXIT_FAILURE);
-	}
-	if (verbose)
-		printf("Preparing to write new FS information...\n");
-	write_rgrps(fd);
-	if (verbose)
-		printf("Done.\n");
-	close(fd);
-}
-
-/**
- * find_fs - Find the filesystem which the user specified
- * @name: The name of a device or mount point
- *
- * Returns: 0 if the filesystem is located, 1 otherwise
- */
-
-static int
-find_fs(const char *name)
-{
-	FILE *fp = fopen("/proc/mounts", "r");
-	char buffer[4096];
-	char fstype[80];
-	int fsdump, fspass;
-	char *realname;
-
-	realname = realpath(name, NULL);
-	if (!realname) {
-		perror(name);
-		return -1;
-	}
-	if (fp == NULL) {
-		perror("open: /proc/mounts");
-		exit(EXIT_FAILURE);
-	}
-	while ((fgets(buffer, 4095, fp)) != NULL) {
-		buffer[4095] = 0;
-		if (strstr(buffer, realname) == 0)
-			continue;
-		if (sscanf(buffer, "%s %s %s %s %d %d", device, fspath, fstype,
-			   fsoptions, &fsdump, &fspass) != 6)
-			continue;
-		if (strcmp(fstype, "gfs") != 0)
-			continue;
-		if ((strcmp(device, realname) != 0) &&
-		    (strcmp(fspath, realname) != 0))
-			continue;
-		fclose(fp);
-		free(realname);
-		return 0;
-	}
-	fprintf(stderr, "GFS Filesystem %s not found\n", name);
-	fclose(fp);
-	free(realname);
-	return 1;
-}
-
-/**
- * delete_rgrp_list - Delete a list of rgrps
- * @list: The list to delete
- *
- */
-
-static void
-delete_rgrp_list(osi_list_t *list)
-{
-	struct rglist_entry *rg;
-
-	while (!osi_list_empty(list)) {
-		rg = osi_list_entry(list->next, struct rglist_entry, list);
-		osi_list_del(&rg->list);
-		free(rg);
-	}
-}
-
-/**
- * delete_jrnl_list - Delete a list of journals
- * @list: the list to delete
- *
- */
-
-static void
-delete_jrnl_list(osi_list_t *list)
-{
-	struct jilist_entry *ji;
-
-	while (!osi_list_empty(list)) {
-		ji = osi_list_entry(list->next, struct jilist_entry, list);
-		osi_list_del(&ji->list);
-		free(ji);
-	}
-}
-
-/**
- * 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"
-		"gfs_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");
-}
-
-/**
- * main - Tha main function
- * @argc: The argument count
- * @argv: The argument vector
- *
- * Runs through the filesystem expansion code for each of the specified
- * filesystems. Each filesystem specified on the command line has the
- * same options applied to it. You'll need to run the program multiple times
- * if you want to use it on several different filesystems with different
- * options for each. If you forget to specify a filesystem, then it is
- * assumed that the program has run successfully, since its done everything
- * asked of it, and it exits without printing a message.
- *
- * Returns: 0 on success, -1 otherwise
- */
-
-int
-main(int argc, char *argv[])
-{
-	int opt;
-	int error = 0;
-
-	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':
-			if (verbose)
-				verbose--;
-			break;
-		case 'T':
-			test = 1;
-			break;
-		case 'v':
-			verbose++;
-			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);
-	}
-
-	while ((argc - optind) > 0) {
-		if (find_fs(argv[optind++])) {
-			error = 1;
-			continue;
-		}
-		gather_info();
-		if (fssize > devsize) {
-			error = 1;
-			fprintf(stderr,
-				"Filesystem thinks device is bigger than it really is.... skipping\n");
-			continue;
-		}
-		if ((devsize - fssize) < 100) {
-			error = 1;
-			fprintf(stderr,
-				"Device has grown by less than 100 blocks.... skipping\n");
-			continue;
-		}
-		create_rgrps();
-		if (verbose)
-			print_info();
-		if (!test)
-			update_fs();
-		delete_rgrp_list(&rglist_current);
-		delete_rgrp_list(&rglist_new);
-		delete_jrnl_list(&jilist_current);
-	}
-
-	return error;
-}
diff --git a/gfs/gfs_grow/ondisk.c b/gfs/gfs_grow/ondisk.c
deleted file mode 100644
index 191c688..0000000
--- a/gfs/gfs_grow/ondisk.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-
-#include "linux_endian.h"
-#include "gfs_ondisk.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/gfs/gfs_jadd/Makefile b/gfs/gfs_jadd/Makefile
deleted file mode 100644
index 0d41942..0000000
--- a/gfs/gfs_jadd/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-TARGET= gfs_jadd
-
-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 \
-      ondisk.o
-
-CFLAGS += -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64
-CFLAGS += -I${gfskincdir}
-CFLAGS += -I$(S)/../include -I$(S)/../libgfs
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L../libgfs -lgfs
-LDFLAGS += -L${libdir}
-
-LDDEPS += ../libgfs/libgfs.a
-
-${TARGET}: ${OBJS} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-depends:
-	$(MAKE) -C ../libgfs all
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/gfs/gfs_jadd/main.c b/gfs/gfs_jadd/main.c
deleted file mode 100644
index e4e4a9b..0000000
--- a/gfs/gfs_jadd/main.c
+++ /dev/null
@@ -1,908 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <sys/ioctl.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <stdint.h>
-#include <inttypes.h>
-
-#include "gfs_ondisk.h"
-#define __user
-#include "gfs_ioctl.h"
-#include "osi_list.h"
-#include "libgfs.h"
-
-#include "copyright.cf"
-
-#define BLOCK_END(buffer, type) ((buffer) + GFS_BASIC_BLOCK - sizeof(type))
-
-struct rglist_entry {
-	osi_list_t list;
-	struct gfs_rindex ri;
-	struct gfs_rgrp rg;
-};
-
-struct jilist_entry {
-	osi_list_t list;
-	struct gfs_jindex ji;
-};
-
-/*
- * verbose: 0 = no messages, 1 = normal, 2 = everything
- * test: 0 = normal, 1 = don't actually write data, but do everything else
- * fspath: path to root of mounted GFS filesystem
- * device: the device upon which the GFS filesystem is mounted
- * fsoptions: the mount options used
- * devsize: the size of the device (in filesystem blocks, rounded down)
- * fssize: the size of the filesystem (in filesystem blocks, rounded down)
- * override_device_size: if non-zero, this is used for the device size
- * number_of_journals: Number of journals to add to each fs
- * journal_size: The size of each journal, in MB
- * journal_size_blocks: The size of each journal in fs blocks
- */
-static int verbose = 1;
-static int test = 0;
-static char fspath[4096];
-static char device[1024];
-static char fsoptions[4096];
-static uint64_t devsize;
-static uint64_t fssize;
-static uint64_t override_device_size = 0;
-static unsigned int number_of_journals = 1;
-static uint64_t journal_size = 128;
-static uint64_t journal_size_blocks;
-
-/*
- * fs_sb: the superblock read from the mounted filesystem
- * rglist_current: list of resource groups currently making up the filesystem
- * jilist_current: list of current journals in the filesystem
- * jilist_new: where we put the new resource groups to be written
- */
-static struct gfs_sb fs_sb;
-static osi_list_decl(rglist_current);
-static osi_list_decl(jilist_current);
-static osi_list_decl(jilist_new);
-
-/**
- * device_geometry - Find out the size of a block device
- * @device: The name of the device
- *
- * Returns: The size of the device in FS blocks
- */
-
-static uint64_t
-device_geometry(char *device)
-{
-	int fd;
-	uint64_t bytes;
-	int error;
-
-	if (override_device_size)
-		bytes = override_device_size;
-	else {
-		fd = open(device, O_RDONLY);
-		if (fd < 0) {
-			fprintf(stderr, "gfs_jadd: can't open %s: %s\n",
-				device, strerror(errno));
-			exit(EXIT_FAILURE);
-		}
-
-		error = device_size(fd, &bytes);
-		if (error) {
-			fprintf(stderr,
-				"gfs_grow: can't determine size of %s: %s\n",
-				device, strerror(errno));
-			exit(EXIT_FAILURE);
-		}
-
-		close(fd);
-	}
-
-	return bytes >> fs_sb.sb_bsize_shift;
-}
-
-/**
- * jread - Read from journaled file using ioctl()
- * @fd: The fd to read from
- * @file: The file to read
- * @buf: The buffer to fill
- * @size: The amount of data to read
- * @offset: The offset to read from
- *
- * Returns: Error code, or amount of data read
- */
-
-int
-jread(int fd, char *file, void *buf, uint64_t size, uint64_t *offset)
-{
-	struct gfs_ioctl gi;
-	char *argv[] = { "do_hfile_read", file };
-	int error;
-
-	gi.gi_argc = 2;
-	gi.gi_argv = argv;
-	gi.gi_data = buf;
-	gi.gi_size = size;
-	gi.gi_offset = *offset;
-
-	error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-	if (error > 0)
-		*offset += error;
-
-	return error;
-}
-
-/**
- * jwrite - Write to journaled file using ioctl()
- * @fd: The fd to write to
- * @file: The file to write
- * @buf: The buffer to write
- * @size: The amount of data to write
- * @offset: The offset at which to write the data
- *
- * Returns: Error code, or the amount of data written
- */
-
-int
-jwrite(int fd, char *file, void *buf, uint64_t size, uint64_t *offset)
-{
-	struct gfs_ioctl gi;
-	char *argv[] = { "do_hfile_write", file };
-	int error;
-
-	gi.gi_argc = 2;
-	gi.gi_argv = argv;
-	gi.gi_data = buf;
-	gi.gi_size = size;
-	gi.gi_offset = *offset;
-
-	error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-	if (error > 0)
-		*offset += error;
-
-	return error;
-}
-
-/**
- * filesystem_size - Calculate the size of the filesystem
- *
- * Reads the lists of journals and resource groups in order to
- * work out where the last block of the filesystem is located.
- *
- * Returns: The calculated size
- */
-
-static uint64_t
-filesystem_size(void)
-{
-	osi_list_t *tmp, *head;
-	struct rglist_entry *rgl;
-	struct jilist_entry *jil;
-	uint64_t size = 0;
-	uint64_t extent;
-
-	tmp = head = &rglist_current;
-	for (;;) {
-		tmp = tmp->next;
-		if (tmp == head)
-			break;
-		rgl = osi_list_entry(tmp, struct rglist_entry, list);
-		extent = rgl->ri.ri_addr + rgl->ri.ri_length + rgl->ri.ri_data;
-		if (extent > size)
-			size = extent;
-	}
-
-	tmp = head = &jilist_current;
-	for (;;) {
-		tmp = tmp->next;
-		if (tmp == head)
-			break;
-		jil = osi_list_entry(tmp, struct jilist_entry, list);
-		extent = jil->ji.ji_addr + jil->ji.ji_nsegment * fs_sb.sb_seg_size;
-		if (extent > size)
-			size = extent;
-	}
-
-	return size;
-}
-
-/**
- * gfs_jientry - Get journal index entry
- * @fd: The fd of the journal index
- * @offset: The offset at which the journal entry appears
- *
- * Reads a single entry from the journal index file and
- * adds it to the list of current journal entries.
- *
- * Returns: 1 on EOF, 0 otherwise
- */
-
-static int
-get_jientry(int fd, uint64_t *offset)
-{
-	char buffer[sizeof(struct gfs_jindex)];
-	int len = jread(fd, "jindex", buffer,
-			sizeof(struct gfs_jindex), offset);
-	struct jilist_entry *jil;
-
-	if (len != sizeof(struct gfs_jindex)) {
-		if (len == 0)
-			return 1;
-		fprintf(stderr, "Erk! Read odd size from jindex (%d)\n", len);
-		exit(EXIT_FAILURE);
-	}
-	if ((jil = malloc(sizeof(struct jilist_entry))) == NULL) {
-		perror("jilist_entry");
-		exit(EXIT_FAILURE);
-	}
-	memset(jil, 0, sizeof(struct jilist_entry));
-	gfs_jindex_in(&jil->ji, buffer);
-	osi_list_add(&jil->list, &jilist_current);
-	return 0;
-}
-
-/**
- * read_journals - Read the whole journal index
- * @fs_fd: An fd for some file or directory within the mounted GFS filesystem
- *
- */
-
-static void
-read_journals(int fs_fd)
-{
-	uint64_t offset = 0;
-	while (get_jientry(fs_fd, &offset) == 0)
-		/* do nothing */;
-}
-
-/**
- * get_rgrp - Read a single rindex entry
- * @fd: The fd for the rindex file
- * @offset: The offset at which to read the rindex entry
- *
- * Reads a single rindex entry and adds it to the list of current
- * resource group entries.
- *
- * Returns: 1 on EOF, 0 otherwise
- */
-
-static int
-get_rgrp(int fd, uint64_t *offset)
-{
-	char buffer[sizeof(struct gfs_rindex)];
-	int len = jread(fd, "rindex", buffer,
-			sizeof(struct gfs_rindex), offset);
-	struct rglist_entry *rgl;
-
-	if (len != sizeof(struct gfs_rindex)) {
-		if (len == 0)
-			return 1;
-		fprintf(stderr, "Erk! Read odd size from rindex (%d)\n", len);
-		exit(EXIT_FAILURE);
-	}
-	if ((rgl = malloc(sizeof(struct rglist_entry))) == NULL) {
-		perror("rglist_entry");
-		exit(EXIT_FAILURE);
-	}
-	memset(rgl, 0, sizeof(struct rglist_entry));
-	gfs_rindex_in(&rgl->ri, buffer);
-	osi_list_add(&rgl->list, &rglist_current);
-	return 0;
-}
-
-/**
- * read_rgrps - Reads the contents of the rindex file
- * @fs_fd: An fd for any file or directory within the mounted GFS filesytem
- *
- */
-
-static void
-read_rgrps(int fs_fd)
-{
-	uint64_t offset = 0;
-	while (get_rgrp(fs_fd, &offset) == 0)
-		/* do nothing */;
-}
-
-/**
- * write_a_block - Write a block to the current device
- * @where: The position to write the block (in filesystem blocks)
- *
- * Writes a single disk block to the device. It has a safety check which
- * prevents it writing to the device at a position within the control of
- * the active filesystem. 
- */
-
-static void
-write_a_block(uint64_t where, uint64_t seq)
-{
-	char buffer[4096];
-	uint64_t fsoffset = where * (uint64_t) fs_sb.sb_bsize;
-	int fd = open(device, O_RDWR);
-	struct gfs_log_header lh;
-
-	memset(&lh, 0, sizeof(struct gfs_log_header));
-
-	lh.lh_header.mh_magic = GFS_MAGIC;
-	lh.lh_header.mh_type = GFS_METATYPE_LH;
-	lh.lh_header.mh_format = GFS_FORMAT_LH;
-	lh.lh_flags = GFS_LOG_HEAD_UNMOUNT;
-	lh.lh_first = where;
-	lh.lh_sequence = seq;
-
-	if (fd < 0) {
-		perror(device);
-		exit(EXIT_FAILURE);
-	}
-	if (where < fssize) {
-		fprintf(stderr,
-			"Sanity check failed: Caught trying to write to live filesystem!\n");
-		exit(EXIT_FAILURE);
-	}
-
-	memset(buffer, 0, 4096);
-	gfs_log_header_out(&lh, buffer);
-	gfs_log_header_out(&lh, BLOCK_END(buffer, struct gfs_log_header));
-
-	if (lseek(fd, fsoffset, SEEK_SET) != fsoffset) {
-		perror(device);
-		exit(EXIT_FAILURE);
-	}
-	if (write(fd, buffer, fs_sb.sb_bsize) != fs_sb.sb_bsize) {
-		perror("write_a_block");
-		exit(EXIT_FAILURE);
-	}
-	close(fd);
-}
-
-/**
- * write_whole_journal - Write a complete journal to the disk
- * @jil: The information about the journal
- *
- * Write a complete new journal on disk.
- */
-
-static void
-write_whole_journal(struct jilist_entry *jil)
-{
-	uint64_t seg;
-	uint64_t offset;
-
-	for (seg = 0; seg < jil->ji.ji_nsegment; seg++) {
-		offset = seg * fs_sb.sb_seg_size;
-		write_a_block(jil->ji.ji_addr + offset, offset);
-	}
-
-	sync();
-}
-
-/**
- * get_length - Use stat() to get the length of a file
- * @fd: The fd of the file whose length we wish to know
- *
- * Returns: The length
- */
-
-static uint64_t
-get_length(int fd, char *file)
-{
-	struct gfs_ioctl gi;
-	char *argv[] = { "get_hfile_stat", file };
-	struct gfs_dinode di;
-	int error;
-
-	gi.gi_argc = 2;
-	gi.gi_argv = argv;
-	gi.gi_data = (char *)&di;
-	gi.gi_size = sizeof(struct gfs_dinode);
-
-	error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-	if (error != gi.gi_size) {
-		perror("stat");
-		fprintf(stderr, "Failed to get size of file. Aborting.\n");
-		exit(EXIT_FAILURE);
-	}
-
-	return di.di_size;
-}
-
-/**
- * write_jindex - Writes new records to the end of the jindex file
- * @fs_fd: A fd of any file or directory withint the GFS filesystem
- *
- * This is the critical function in adding journals. It does the
- * actual write to the jindex which causes the GFS filesystem to see the
- * new journals which were previously added.
- */
-
-static void
-write_jindex(int fs_fd)
-{
-	osi_list_t *tmp, *head;
-	struct jilist_entry *jil;
-	char buffer[sizeof(struct gfs_jindex)];
-	uint64_t offset;
-
-	offset = get_length(fs_fd, "jindex");
-
-	/*
-	 * This is the critical section.
-	 * If things mess up here, it could be very difficult to put right
-	 */
-	tmp = head = &jilist_new;
-	for (;;) {
-		tmp = tmp->next;
-		if (tmp == head)
-			break;
-		jil = osi_list_entry(tmp, struct jilist_entry, list);
-		gfs_jindex_out(&jil->ji, buffer);
-		if (jwrite(fs_fd, "jindex", buffer,
-			   sizeof(struct gfs_jindex), &offset) !=
-		    sizeof(struct gfs_jindex)) {
-			perror("write: jindex");
-			fprintf(stderr, "Aborting...\n");
-			exit(EXIT_FAILURE);
-		}
-	}
-	/*
-	 * This is the end of the critical section
-	 */
-}
-
-/**
- * write_journals - Write the new journals to disk
- * @fs_fd: An fd from any file or directory on the GFS mounted filesystem
- *
- * This first writes out the new journal information to the
- * area of the disk beyond the area the filesystem is currently
- * using and then calls write_jindex() to make the filesystem see
- * the newly written journal.
- */
-
-static void
-write_journals(int fs_fd)
-{
-	osi_list_t *tmp, *head;
-	struct jilist_entry *jil;
-
-	tmp = head = &jilist_new;
-	for (;;) {
-		tmp = tmp->next;
-		if (tmp == head)
-			break;
-		jil = osi_list_entry(tmp, struct jilist_entry, list);
-		write_whole_journal(jil);
-	}
-
-	sync();
-	sync();
-	sync();
-
-	write_jindex(fs_fd);
-
-	sync();
-	sync();
-	sync();
-}
-
-/**
- * gather_info - Gathers all the information about the existing filesystem
- *
- */
-
-static void
-gather_info(void)
-{
-	int fd;
-	struct gfs_ioctl gi;
-	char *argv[] = { "get_super" };
-	int error;
-
-	fd = open(fspath, O_RDONLY);
-	if (fd < 0) {
-		perror(fspath);
-		exit(EXIT_FAILURE);
-	}
-
-	gi.gi_argc = 1;
-	gi.gi_argv = argv;
-	gi.gi_data = (char *)&fs_sb;
-	gi.gi_size = sizeof(struct gfs_sb);
-
-	error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-	if (error != gi.gi_size) {
-		perror("ioctl: GFS_GET_SUPER");
-		exit(EXIT_FAILURE);
-	}
-
-	read_rgrps(fd);
-	read_journals(fd);
-	close(fd);
-	devsize = device_geometry(device);
-	fssize = filesystem_size();
-
-	journal_size_blocks = journal_size << (20 - fs_sb.sb_bsize_shift);
-	/*
-	 * Round size down to integer number of segments
-	 */
-	while (journal_size_blocks % fs_sb.sb_seg_size) {
-		journal_size_blocks--;
-		journal_size -= fs_sb.sb_bsize;
-	}
-}
-
-/**
- * print_rgrps - Print information about resource groups
- * @lh: The list of resource groups to print
- *
- */
-
-static void
-print_rgrps(osi_list_t *lh)
-{
-	osi_list_t *tmp, *head;
-	struct rglist_entry *rgl;
-	int n = 0;
-
-	tmp = head = lh;
-	for (;;) {
-		tmp = tmp->next;
-		if (tmp == head)
-			break;
-		rgl = osi_list_entry(tmp, struct rglist_entry, list);
-		n++;
-		printf("RI: Addr %"PRIu64", RgLen %u, Start %"PRIu64", DataLen %u, BmapLen %u\n",
-		       rgl->ri.ri_addr, rgl->ri.ri_length,
-		       rgl->ri.ri_data1, rgl->ri.ri_data, rgl->ri.ri_bitbytes);
-	}
-	printf("RGRP: %d Resource groups in total\n", n);
-}
-
-/**
- * print_journals - Print a list of journals
- *
- */
-
-static void
-print_journals(osi_list_t *lh)
-{
-	osi_list_t *tmp, *head;
-	struct jilist_entry *jil;
-	int n = 0;
-
-	tmp = head = lh;
-	for (;;) {
-		tmp = tmp->next;
-		if (tmp == head)
-			break;
-		jil = osi_list_entry(tmp, struct jilist_entry, list);
-		n++;
-		printf("JI: Addr %"PRIu64" NumSeg %u SegSize %u\n",
-		       jil->ji.ji_addr, jil->ji.ji_nsegment, fs_sb.sb_seg_size);
-	}
-	printf("JRNL: %d Journals in total\n", n);
-}
-
-/**
- * print_info - Print out various bits of (interesting?) information
- *
- */
-
-static void
-print_info(void)
-{
-	printf("FS: Mount Point: %s\n", fspath);
-	printf("FS: Device: %s\n", device);
-	printf("FS: Options: %s\n", fsoptions);
-	printf("FS: Size: %"PRIu64"\n", fssize);
-	if (verbose > 1) {
-		printf("RGRP: Current Resource Group List:\n");
-		print_rgrps(&rglist_current);
-		printf("JRNL: Current Journal List:\n");
-		print_journals(&jilist_current);
-	}
-	printf("DEV: Size: %"PRIu64"\n", devsize);
-	if (verbose > 1) {
-		printf("JRNL: New Journal List:\n");
-		print_journals(&jilist_new);
-	}
-}
-
-/**
- * make_journal - Make a new jilist_entry
- * @offset: The offset at which the new journal will go
- * @size: The size of the new journal in fs blocks
- *
- */
-
-uint64_t
-make_journal(uint64_t offset, uint64_t size)
-{
-	struct jilist_entry *jil = malloc(sizeof(struct jilist_entry));
-	if (jil == NULL) {
-		perror("jilist_entry");
-		exit(EXIT_FAILURE);
-	}
-	memset(jil, 0, sizeof(struct jilist_entry));
-
-	if (offset % fs_sb.sb_seg_size) {
-		size -= fs_sb.sb_seg_size - (offset % fs_sb.sb_seg_size);
-		offset += fs_sb.sb_seg_size - (offset % fs_sb.sb_seg_size);
-	}
-
-	jil->ji.ji_addr = offset;
-	jil->ji.ji_nsegment = size / fs_sb.sb_seg_size;
-
-	osi_list_add(&jil->list, &jilist_new);
-	return offset + size;
-}
-
-/**
- * create_journals - Create a list of the new journals
- * 
- */
-
-static int
-create_journals(void)
-{
-	uint64_t offset = fssize;
-	int n;
-
-	if ((journal_size_blocks * number_of_journals) > (devsize - fssize)) {
-		fprintf(stderr,
-			"Requested size (%" PRIu64
-			" blocks) greater than available space (%" PRIu64
-			" blocks)\n", journal_size_blocks * number_of_journals,
-			devsize - fssize);
-		return -1;
-	}
-
-	for (n = 0; n < number_of_journals; n++)
-		offset = make_journal(offset, journal_size_blocks);
-
-	if (offset > devsize) {
-		fprintf(stderr, "Calculation error: Out of bounds\n");
-		exit(EXIT_FAILURE);
-	}
-
-	return 0;
-}
-
-/**
- * update_fs - Actually perform the filesystem update
- *
- */
-
-static void
-update_fs(void)
-{
-	int fd = open(fspath, O_RDONLY);
-	if (fd < 0) {
-		perror(fspath);
-		exit(EXIT_FAILURE);
-	}
-	if (verbose)
-		printf("Preparing to write new FS information...\n");
-	write_journals(fd);
-	if (verbose)
-		printf("Done.\n");
-	close(fd);
-}
-
-/**
- * find_fs - Find the filesystem which the user specified
- * @name: The name of a device or mount point
- *
- * Returns: 0 if the filesystem is located, 1 otherwise
- */
-
-static int
-find_fs(char *name)
-{
-	FILE *fp = fopen("/proc/mounts", "r");
-	char buffer[4096];
-	char fstype[80];
-	int fsdump, fspass;
-
-	if (fp == NULL) {
-		perror("open: /proc/mounts");
-		exit(EXIT_FAILURE);
-	}
-	while ((fgets(buffer, 4095, fp)) != NULL) {
-		buffer[4095] = 0;
-		if (strstr(buffer, name) == 0)
-			continue;
-		if (sscanf(buffer, "%s %s %s %s %d %d", device, fspath, fstype,
-			   fsoptions, &fsdump, &fspass) != 6)
-			continue;
-		if (strcmp(fstype, "gfs") != 0)
-			continue;
-		if ((strcmp(device, name) != 0) && (strcmp(fspath, name) != 0))
-			continue;
-		fclose(fp);
-		return 0;
-	}
-	fprintf(stderr, "GFS Filesystem %s not found\n", name);
-	fclose(fp);
-	return 1;
-}
-
-/**
- * delete_rgrp_list - Delete a list of rgrps
- * @list: The list to delete
- *
- */
-
-static void
-delete_rgrp_list(osi_list_t *list)
-{
-	struct rglist_entry *rg;
-
-	while (!osi_list_empty(list)) {
-		rg = osi_list_entry(list->next, struct rglist_entry, list);
-		osi_list_del(&rg->list);
-		free(rg);
-	}
-}
-
-/**
- * delete_jrnl_list - Delete a list of journals
- * @list: The list to delete
- *
- */
-
-static void
-delete_jrnl_list(osi_list_t *list)
-{
-	struct jilist_entry *ji;
-
-	while (!osi_list_empty(list)) {
-		ji = osi_list_entry(list->next, struct jilist_entry, list);
-		osi_list_del(&ji->list);
-		free(ji);
-	}
-}
-
-/**
- * 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"
-		"gfs_jadd [options] /path/to/filesystem\n"
-		"\n"
-		"Options:\n"
-		"  -h               Print this usage information.\n"
-		"  -J <MB>          Size of journals in MB (minimum 32, default 128)\n"
-		"  -j <num>         Number of journals to add (default 1)\n"
-		"  -q               Quiet, reduce verbosity\n"
-		"  -T               Test, do everything except update FS\n"
-		"  -V               Version information\n"
-		"  -v               Verbose, increase verbosity\n");
-}
-
-/**
- * main - Tha main function
- * @argc: The argument count
- * @argv: The argument vector
- *
- * Runs through the filesystem expansion code for each of the specified
- * filesystems. Each filesystem specified on the command line has the
- * same options applied to it. You'll need to run the program multiple times
- * if you want to use it on several different filesystems with different
- * options for each. If you forget to specify a filesystem, then it is
- * assumed that the program has run successfully, since its done everything
- * asked of it, and it exits without printing a message.
- *
- * Returns: 0 on success, -1 otherwise
- */
-
-int
-main(int argc, char *argv[])
-{
-	int opt;
-	int error = 0;
-
-	while ((opt = getopt(argc, argv, "D:Vhj:J:vqT?")) != 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 'j':
-			number_of_journals = atoi(optarg);
-			if (number_of_journals < 1) {
-				fprintf(stderr,
-					"Erk! Number of journals must be 1 or greater.\n");
-				usage();
-				exit(EXIT_FAILURE);
-			}
-			break;
-		case 'J':
-			journal_size = atoi(optarg);
-			if (journal_size < 32) {
-				fprintf(stderr,
-					"Erk! Specified journal size of %"
-					PRIu64 " is too small.\n",
-					journal_size);
-				usage();
-				exit(EXIT_FAILURE);
-			}
-			break;
-		case 'q':
-			if (verbose)
-				verbose--;
-			break;
-		case 'T':
-			test = 1;
-			break;
-		case 'v':
-			verbose++;
-			break;
-		case ':':
-		case '?':
-			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);
-	}
-
-	while ((argc - optind) > 0) {
-		if (find_fs(argv[optind++])) {
-			error = 1;
-			continue;
-		}
-		gather_info();
-		if (fssize > devsize) {
-			fprintf(stderr,
-				"Filesystem thinks device is bigger than it really is.... skipping\n");
-			error = 1;
-			continue;
-		}
-		if (create_journals()) {
-			error = 1;
-			continue;
-		}
-		if (verbose)
-			print_info();
-		if (!test)
-			update_fs();
-		delete_rgrp_list(&rglist_current);
-		delete_jrnl_list(&jilist_current);
-		delete_jrnl_list(&jilist_new);
-	}
-
-	return error;
-}
diff --git a/gfs/gfs_jadd/ondisk.c b/gfs/gfs_jadd/ondisk.c
deleted file mode 100644
index 191c688..0000000
--- a/gfs/gfs_jadd/ondisk.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-
-#include "linux_endian.h"
-#include "gfs_ondisk.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/gfs/gfs_mkfs/Makefile b/gfs/gfs_mkfs/Makefile
deleted file mode 100644
index 9174217..0000000
--- a/gfs/gfs_mkfs/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-TARGET1= gfs_mkfs
-TARGET2= mkfs.gfs
-
-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=	device_geometry.o \
-	fs_geometry.o \
-	locking.o \
-	main.o \
-	ondisk.o \
-	structures.o
-
-CFLAGS += -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64
-CFLAGS += -I${gfskincdir} -I${volidincdir}
-CFLAGS += -I$(S)/../include -I$(S)/../libgfs
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${volidlibdir} -lvolume_id
-LDFLAGS += -L../libgfs -lgfs
-LDFLAGS += -L${libdir}
-
-LDDEPS += ../libgfs/libgfs.a
-
-${TARGET1}: ${OBJS} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-${TARGET2}: ${TARGET1}
-	ln -sf ${TARGET1} ${TARGET2}
-
-depends:
-	$(MAKE) -C ../libgfs all
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/gfs/gfs_mkfs/device_geometry.c b/gfs/gfs_mkfs/device_geometry.c
deleted file mode 100644
index a3b5259..0000000
--- a/gfs/gfs_mkfs/device_geometry.c
+++ /dev/null
@@ -1,153 +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 <assert.h>
-#include <time.h>
-#include <sys/param.h>
-
-#include "global.h"
-#include "gfs_ondisk.h"
-#include "osi_list.h"
-#include "mkfs_gfs.h"
-#include "libgfs.h"
-
-/**
- * device_geometry - Get the size of a device
- * @comline: the command line
- * @device: the structure the geometry is returned in
- *
- */
-
-void device_geometry(commandline_t *comline, mkfs_device_t *device)
-{
-	int fd;
-	uint64 bytes;
-	int error;
-
-	fd = open(comline->device, O_RDONLY);
-	if (fd < 0)
-		die("can't open %s: %s\n", comline->device, strerror(errno));
-
-	error = device_size(fd, &bytes);
-	if (error)
-		die("can't determine size of %s: %s\n", comline->device, strerror(errno));
-
-	close(fd);
-
-	if (comline->debug)
-		printf("\nPartition size = %"PRIu64"\n", bytes >> 9);
-
-	device->nsubdev = 1;
-
-	type_zalloc(device->subdev, mkfs_subdevice_t, 1);
-
-	device->subdev->start = 0;
-	device->subdev->length = bytes >> 9;
-}
-
-/**
- * add_journals_to_device - carve space out of a mkfs_device_t to add journals
- * @comline: the command line arguments
- * @device: the mkfs_device_t
- *
- */
-
-void add_journals_to_device(commandline_t *comline, mkfs_device_t *device)
-{
-	mkfs_subdevice_t *old;
-	uint64 jsize;
-	unsigned int x;
-
-	MKFS_ASSERT(device->nsubdev == 1 &&
-				!device->subdev->is_journal, );
-
-	if (!comline->journals)
-		die("No journals specified (use -j)\n");
-
-	if (!comline->jsize)
-		die("journal size is zero (use -J)\n");
-
-	jsize = comline->jsize * (1 << 20) / GFS_BASIC_BLOCK;
-
-	if (comline->journals * jsize > device->subdev->length)
-		die("Partition too small for number/size of journals\n");
-
-	old = device->subdev;
-
-	device->nsubdev = comline->journals + 2;
-	type_zalloc(device->subdev, mkfs_subdevice_t, device->nsubdev);
-	
-	device->subdev[0].start = old->start;
-	device->subdev[0].length = (old->length - comline->journals * jsize) / 2;
-
-	for (x = 1; x <= comline->journals; x++) {
-		device->subdev[x].start = device->subdev[x - 1].start + device->subdev[x - 1].length;
-		device->subdev[x].length = jsize;
-		device->subdev[x].is_journal = TRUE;
-	}
-
-	device->subdev[x].start = device->subdev[x - 1].start + device->subdev[x - 1].length;
-	device->subdev[x].length = device->subdev[0].length;
-
-	free(old);
-}
-
-/**
- * fix_device_geometry - round off address and lengths and convert to FS blocks
- * @comline: the command line
- * @device: the description of the underlying device
- *
- */
-
-void fix_device_geometry(commandline_t *comline, mkfs_device_t *device)
-{
-	unsigned int x;
-	uint64 offset, len;
-	uint32 bbsize = comline->bsize >> 9;
-	
-	if (comline->debug) {
-		printf("\nDevice Geometry:  (in basic blocks)\n");
-		for (x = 0; x < device->nsubdev; x++)
-			printf("  SubDevice #%d:  %s:  start = %"PRIu64", len = %"PRIu64"\n",
-				   x,
-				   (device->subdev[x].is_journal) ? "journal" : "data",
-				   device->subdev[x].start,
-				   device->subdev[x].length);
-	}
-
-	/*  Make sure all the subdevices are aligned  */
-
-	for (x = 0; x < device->nsubdev; x++) {
-		offset = device->subdev[x].start;
-		len = device->subdev[x].length;
-
-		if (len < 100 * bbsize)
-			die("subdevice %d is way too small (%"PRIu64" bytes)\n", x, len * GFS_BASIC_BLOCK); 
-
-		if (offset % bbsize) {
-			len -= bbsize - (offset % bbsize);
-			offset += bbsize - (offset % bbsize);
-		}
-
-		device->subdev[x].start = offset / bbsize;
-		device->subdev[x].length = len / bbsize;
-	}
-
-	if (comline->debug) {
-		printf("\nDevice Geometry:  (in FS blocks)\n");
-		for (x = 0; x < device->nsubdev; x++)
-			printf("  SubDevice #%d:  %s:  start = %"PRIu64", len = %"PRIu64"\n",
-				   x,
-				   (device->subdev[x].is_journal) ? "journal" : "data",
-				   device->subdev[x].start,
-				   device->subdev[x].length);
-
-		printf("\njournals = %u\n", comline->journals);
-	}
-}
diff --git a/gfs/gfs_mkfs/fs_geometry.c b/gfs/gfs_mkfs/fs_geometry.c
deleted file mode 100644
index dc9857a..0000000
--- a/gfs/gfs_mkfs/fs_geometry.c
+++ /dev/null
@@ -1,180 +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 <assert.h>
-#include <time.h>
-
-#include "global.h"
-#include "gfs_ondisk.h"
-#include "osi_list.h"
-
-#include "mkfs_gfs.h"
-
-/**
- * how_many_rgrps - figure out how many RG to put in a subdevice
- * @comline: the command line
- * @sdev: the subdevice
- *
- * Returns: the number of RGs
- */
-
-static uint64 how_many_rgrps(commandline_t *comline, mkfs_subdevice_t *sdev)
-{
-	uint64 nrgrp;
-	unsigned int min = (comline->expert) ? 1 : 4;
-
-	while (TRUE) {
-		nrgrp = DIV_RU(sdev->length, (comline->rgsize << 20) / comline->bsize);
-
-		if (nrgrp < min)
-			nrgrp = min;
-
-		if (comline->rgsize_specified || /* If user specified an rg size or */
-			nrgrp <= MKFS_EXCESSIVE_RGS || /* not an excessive # of rgs or  */
-			comline->rgsize >= 2048)     /* we've reached the max rg size */
-			break;
-
-		comline->rgsize += MKFS_DEFAULT_RGSIZE; /* Try again w/bigger rgs */
-	}
-
-	if (comline->debug)
-		printf("  rg sz = %"PRIu32"\n  nrgrp = %"PRIu64"\n", comline->rgsize,
-			   nrgrp);
-
-	return nrgrp;
-}
-
-/**
- * compute_rgrp_layout - figure out where the RG in a FS are
- * @comline: the command line
- * @device: the device layout
- * @rlist: the list of resource groups
- *
- * Returns: a list of rgrp_list_t structures
- */
-
-void compute_rgrp_layout(commandline_t *comline, mkfs_device_t *device, osi_list_t *rlist)
-{
-	mkfs_subdevice_t *sdev;
-	rgrp_list_t *rl, *rlast = NULL;
-	osi_list_t *tmp;
-	uint64 rgrp, nrgrp;
-	unsigned int x;
-	int first_sdev = TRUE;
-
-	for (x = 0; x < device->nsubdev; x++) {
-		sdev = &device->subdev[x];
-
-		if (!sdev->is_journal) {
-			/* If this is the 1st subdevice reserve space for the superblock */
-
-			if (first_sdev)
-				sdev->length -= comline->sb_addr + 1;
-
-			if (comline->debug)
-				printf("\nData Subdevice %u\n", x);
-
-			nrgrp = how_many_rgrps(comline, sdev);
-
-			for (rgrp = 0; rgrp < nrgrp; rgrp++) {
-				type_zalloc(rl, rgrp_list_t, 1);
-
-				rl->subdevice = x;
-
-				if (rgrp) {
-					rl->rg_offset = rlast->rg_offset + rlast->rg_length;
-					rl->rg_length = sdev->length / nrgrp;
-				}
-				else {
-					rl->rg_offset = sdev->start;
-					rl->rg_length = sdev->length - (nrgrp - 1) * (sdev->length / nrgrp);
-
-					if (first_sdev)
-						rl->rg_offset += comline->sb_addr + 1;
-				}
-
-				osi_list_add_prev(&rl->list, rlist);
-
-				rlast = rl;
-			}
-
-			first_sdev = FALSE;
-
-			comline->rgrps += nrgrp;
-		}
-	}
-
-	if (comline->debug) {
-		printf("\n");
-
-		for (tmp = rlist->next; tmp != rlist; tmp = tmp->next) {
-			rl = osi_list_entry(tmp, rgrp_list_t, list);
-			printf("subdevice %u:  rg_o = %"PRIu64", rg_l = %"PRIu64" blocks (%"PRIu64"MB)\n",
-				   rl->subdevice, rl->rg_offset, rl->rg_length, 
-				   rl->rg_length * comline->bsize / (1024 * 1024));
-		}
-	}
-}
-
-/**
- * compute_journal_layout - figure out where the journals in a FS are
- * @comline: the command line
- * @device: the device layout
- * @jlist: the list of journals
- *
- * Returns: a list of journal_list_t structures
- */
-
-void compute_journal_layout(commandline_t *comline, mkfs_device_t *device, osi_list_t *jlist)
-{
-	mkfs_subdevice_t *sdev;
-	journal_list_t *jl;
-	osi_list_t *tmp;
-	unsigned int x, j = 0;
-	uint64 boffset, bcount;
-	unsigned int min_jsize = (comline->expert) ? 1 : 32;
-
-	for (x = 0; x < device->nsubdev; x++) {
-		sdev = &device->subdev[x];
-
-		if (sdev->is_journal) {
-			type_zalloc(jl, journal_list_t, 1);
-
-			/*  Align the journals on seg_size boundries  */
-
-			boffset = sdev->start;
-			bcount = sdev->length;
-
-			if ((bcount + comline->seg_size) * comline->bsize < min_jsize << 20)
-				die("journal %d is too small (minimum size is %u MB)\n", j, min_jsize);
-
-			if (boffset % comline->seg_size) {
-				bcount -= comline->seg_size - (boffset % comline->seg_size);
-				boffset += comline->seg_size - (boffset % comline->seg_size);
-			}
-
-			jl->start = boffset;
-			jl->segments = bcount / comline->seg_size;
-			
-			osi_list_add_prev(&jl->list, jlist);
-
-			j++;
-		}
-	}
-
-	if (comline->debug) {
-		printf("\n");
-		
-		for (tmp = jlist->next, j = 0; tmp != jlist; tmp = tmp->next, j++) {
-			jl = osi_list_entry(tmp, journal_list_t, list);
-			printf("journal %u:  start = %"PRIu64", segments = %u\n",
-				   j, jl->start, jl->segments);
-		}
-	}
-}
diff --git a/gfs/gfs_mkfs/locking.c b/gfs/gfs_mkfs/locking.c
deleted file mode 100644
index 4f66836..0000000
--- a/gfs/gfs_mkfs/locking.c
+++ /dev/null
@@ -1,102 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "global.h"
-#include "gfs_ondisk.h"
-#include "osi_list.h"
-
-#include "mkfs_gfs.h"
-
-
-
-
-
-/**
- * test_locking - Make sure the GFS is set up to use the right lock protocol
- * @lockproto: the lock protocol to mount
- * @locktable: the locktable name
- * @estr: returns the a string describing the error
- * @elen: the length of @estr
- *
- * Returns: 0 if things are ok, -1 on error (with estr set)
- */
-
-int test_locking(char *lockproto, char *locktable, char *estr, unsigned int elen)
-{
-  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))
-      {
-	snprintf(estr, elen, "locktable error: contains space characters");
-	return -1;
-      }
-      if (!isprint(*c))
-      {
-	snprintf(estr, elen, "locktable error: contains unprintable characters");
-	return -1;
-      }
-    }
-
-    c = strstr(locktable, ":");
-    if (!c)
-    {
-      snprintf(estr, elen, "locktable error: missing colon in the locktable");
-      return -1;
-    }
-
-    if (c == locktable)
-    {
-      snprintf(estr, elen, "locktable error: missing cluster name");
-      return -1;
-    }
-
-    if (c - locktable > 16)
-    {
-      snprintf(estr, elen, "locktable error: cluster name too long");
-      return -1;
-    }
-
-    c++;
-    if (!c)
-    {
-      snprintf(estr, elen, "locktable error: missing filesystem name");
-      return -1;
-    }
-
-    if (strstr(c, ":"))
-    {
-      snprintf(estr, elen, "locktable error: more than one colon present");
-      return -1;
-    }
-
-    if (!strlen(c))
-    {
-      snprintf(estr, elen, "locktable error: missing filesystem name");
-      return -1;
-    }
-
-    if (strlen(c) > 16)
-    {
-      snprintf(estr, elen, "locktable error: filesystem name too long");
-      return -1;
-    }
-  }
-  else
-  {
-    snprintf(estr, elen, "lockproto error: %s unknown", lockproto);
-    return -1;
-  }
-
-  return 0;
-}
diff --git a/gfs/gfs_mkfs/main.c b/gfs/gfs_mkfs/main.c
deleted file mode 100644
index f216b5c..0000000
--- a/gfs/gfs_mkfs/main.c
+++ /dev/null
@@ -1,426 +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 <assert.h>
-#include <time.h>
-#include <mntent.h>
-
-#include "global.h"
-#include "gfs_ondisk.h"
-#include "osi_list.h"
-#include "libvolume_id.h"
-#include "libgfs.h"
-#include "copyright.cf"
-
-#define EXTERN
-#include "mkfs_gfs.h"
-
-
-
-#define OPTION_STRING               ("b:DhJ:j:Op:qr:s:t:VX")
-
-
-
-
-
-/**
- * print_usage - print out usage information
- *
- */
-
-static void print_usage()
-{
-  printf("Usage:\n");
-  printf("\n");
-  printf("%s [options] <device>\n", prog_name);
-  printf("\n");
-  printf("Options:\n");
-  printf("\n");
-  printf("  -b <bytes>       Filesystem block size\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("  -s <blocks>      Journal segment size\n");
-  printf("  -t <name>        Name of the lock table\n");
-  printf("  -V               Print program version information, then exit\n");
-}
-
-
-/**
- * decode_arguments - decode command line arguments and fill in the commandline_t
- * @argc:
- * @argv:
- * @comline: the decoded command line arguments
- *
- */
-
-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 'b':
-      comline->bsize = atoi(optarg);
-      break;
-
-
-    case 'D':
-      comline->debug = TRUE;
-      break;
-
-
-    case 'h':
-      print_usage();
-      exit(EXIT_SUCCESS);
-      break;
-
-
-    case 'J':
-      comline->jsize = atoi(optarg);
-      break;
-
-
-    case 'j':
-      comline->journals = atoi(optarg);
-      break;
-
-
-    case 'O':
-      comline->override = TRUE;
-      break;
-
-
-    case 'p':
-      if (strlen(optarg) >= GFS_LOCKNAME_LEN)
-	die("lock protocol name %s is too long\n", optarg);
-      strcpy(comline->lockproto, optarg);
-      break;
-
-
-    case 'q':
-      comline->quiet = TRUE;
-      break;
-
-
-    case 'r':
-      comline->rgsize_specified = TRUE;
-      comline->rgsize = atoi(optarg);
-      break;
-
-
-    case 's':
-      comline->seg_size = atoi(optarg);
-      break;
-
-
-    case 't':
-      if (strlen(optarg) >= GFS_LOCKNAME_LEN)
-	die("lock table name %s is too long\n", optarg);
-      strcpy(comline->locktable, optarg);
-      break;
-
-
-    case 'V':
-      printf("gfs_mkfs %s (built %s %s)\n", RELEASE_VERSION, __DATE__, __TIME__);
-      printf("%s\n", REDHAT_COPYRIGHT);
-      exit(EXIT_SUCCESS);
-      break;
-
-
-    case 'X':
-      comline->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)
-  {
-    comline->device = argv[optind];
-    optind++;
-  }
-  else
-    die("no device specified (try -h for help)\n");
-
-
-
-  if (optind < argc) 
-    die("Unrecognized option: %s\n", argv[optind]);
-
-
-  if (comline->debug)
-  {
-    printf("Command Line Arguments:\n");
-    printf("  proto = %s\n", comline->lockproto);
-    printf("  table = %s\n", comline->locktable);
-    printf("  bsize = %u\n", comline->bsize);
-    printf("  seg_size = %u\n", comline->seg_size);
-    printf("  journals = %u\n", comline->journals);
-    printf("  jsize = %u\n", comline->jsize);
-    printf("  rgsize = %u\n", comline->rgsize);
-    printf("  debug = %d\n", comline->debug);
-    printf("  device = %s\n", comline->device);
-  }
-}
-
-
-/**
- * are_you_sure - protect lusers from themselves
- * @comline: the command line
- *
- */
-
-void are_you_sure(commandline_t *comline)
-{
-	char input[32];
-	struct volume_id *vid = NULL;
-	int fd;
-
-	fd = open(comline->device, O_RDONLY);
-	if (fd < 0)
-		die("Error: device %s not found.\n", comline->device);
-	vid = volume_id_open_fd(fd);
-	if (vid == NULL) {
-		close(fd);
-		die("error identifying the contents of %s: %s\n",
-		    comline->device, strerror(errno));
-	}
-	printf("This will destroy any data on %s.\n",
-	       comline->device);
-	if (volume_id_probe_all(vid, 0, MKFS_DEFAULT_BSIZE) == 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) == NULL || input[0] != 'y')
-		die("aborted\n");
-	else
-		printf("\n");
-}
-
-
-/**
- * check_mount - check to see if device is mounted/busy
- * @
- *
- */
-
-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
- * @comline: the command line
- *
- */
-
-void print_results(commandline_t *comline)
-{
-  if (comline->quiet)
-    return;
-
-  if (comline->expert)
-    printf("Expert mode:               on\n");
-
-  printf("Device:                    %s\n", comline->device);
-
-  printf("Blocksize:                 %u\n", comline->bsize);
-  printf("Filesystem Size:           %"PRIu64"\n", comline->fssize);
-
-  printf("Journals:                  %u\n", comline->journals);
-  printf("Resource Groups:           %"PRIu64"\n", comline->rgrps);
-
-  printf("Locking Protocol:          %s\n", comline->lockproto);
-  printf("Lock Table:                %s\n", comline->locktable);
-
-  printf("\nSyncing...\n");
-
-  sync();
-
-  printf("All Done\n");
-}
-
-
-/**
- * main - do everything
- * @argc:
- * @argv:
- *
- * Returns: 0 on success, non-0 on failure
- */
-
-int main(int argc, char *argv[])
-{
-	commandline_t comline;
-	mkfs_device_t device;
-	osi_list_t rlist;
-	osi_list_t jlist;
-	unsigned int x;
-
-	prog_name = argv[0];
-
-	osi_list_init(&rlist);
-	osi_list_init(&jlist);
-
-	/*  Process the command line arguments  */
-
-	memset(&comline, 0, sizeof(commandline_t));
-	comline.bsize = MKFS_DEFAULT_BSIZE;
-	comline.seg_size = MKFS_DEFAULT_SEG_SIZE;
-	comline.jsize = MKFS_DEFAULT_JSIZE;
-	comline.rgsize = MKFS_DEFAULT_RGSIZE;
-	comline.rgsize_specified = FALSE;
-	strcpy(comline.lockproto, MKFS_DEFAULT_LOCKPROTO);
-
-	decode_arguments(argc, argv, &comline);
-
-	check_mount(comline.device);
-
-	if (!comline.expert) {
-		char buf[256];
-		if (test_locking(comline.lockproto, comline.locktable, buf, 256))
-			die("%s\n", buf);
-	}
-
-	/*  Block sizes must be a power of two from 512 to 65536  */
-
-	for (x = 512; x; x <<= 1)
-		if (x == comline.bsize)
-			break;
-
-	if (!x || comline.bsize > 65536)
-		die("block size must be a power of two between 512 and 65536\n");
-
-	comline.sb_addr = GFS_SB_ADDR * GFS_BASIC_BLOCK / comline.bsize;
-
-	if (comline.seg_size < 2)
-		die("segment size too small\n");
-
-	if (!comline.expert && (uint64)comline.seg_size * comline.bsize > 4194304)
-		die("segment size too large\n");
-
-	if (comline.expert) {
-		if (1 > comline.rgsize || comline.rgsize > 2048)
-			die("bad resource group size\n");
-	}
-	else {
-		if (32 > comline.rgsize || comline.rgsize > 2048)
-			die("bad resource group size\n");
-	}
-
-	/*  Get the device geometry  */
-
-	memset(&device, 0, sizeof(mkfs_device_t));
-
-	device_geometry(&comline, &device);
-	add_journals_to_device(&comline, &device);
-
-	fix_device_geometry(&comline, &device);
-
-	/*  Compute the resource group layouts  */
-
-	compute_rgrp_layout(&comline, &device, &rlist);
-
-	compute_journal_layout(&comline, &device, &jlist);
-
-	/*  Start writing stuff out  */
-
-	comline.fd = open(comline.device, O_RDWR);
-	if (comline.fd < 0)
-		die("can't open device %s\n", comline.device);
-
-	if (!comline.override)
-		are_you_sure(&comline);
-
-	write_mkfs_sb(&comline, &rlist);
-
-	/*  Figure out where we start allocating in rgrp 0  */
-	comline.rgrp0_next = comline.sbd->sd_sb.sb_root_di.no_addr + 1;
-
-	write_jindex(&comline, &jlist);
-
-	write_rindex(&comline, &rlist);
-
-	write_root(&comline);
-
-	write_quota(&comline);
-
-	write_license(&comline);
-
-	write_rgrps(&comline, &rlist);
-
-	write_journals(&comline, &jlist);
-
-	close(comline.fd);
-	free(comline.sbd);
-	print_results(&comline);
-
-	exit(EXIT_SUCCESS);
-}
diff --git a/gfs/gfs_mkfs/mkfs_gfs.h b/gfs/gfs_mkfs/mkfs_gfs.h
deleted file mode 100644
index cb00342..0000000
--- a/gfs/gfs_mkfs/mkfs_gfs.h
+++ /dev/null
@@ -1,181 +0,0 @@
-#ifndef __MKFS_GFS_DOT_H__
-#define __MKFS_GFS_DOT_H__
-
-
-/*  Extern Macro  */
-
-#ifndef EXTERN
-#define EXTERN extern
-#define INIT(X)
-#else
-#undef EXTERN
-#define EXTERN
-#define INIT(X) =X 
-#endif
-
-
-#define die(fmt, args...) \
-do \
-{ \
-  fprintf(stderr, "%s: ", prog_name); \
-  fprintf(stderr, fmt, ##args); \
-  exit(EXIT_FAILURE); \
-} \
-while (0)
-
-#define MKFS_ASSERT(x, todo) \
-do \
-{ \
-  if (!(x)) \
-  { \
-    {todo} \
-    die("assertion failed on line %d of file %s\n", __LINE__, __FILE__); \
-  } \
-} \
-while (0)
-
-#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 DIV_RU(x, y) (((x) + (y) - 1) / (y))
-
-
-
-
-
-struct mkfs_subdevice
-{
-  uint64 start;
-  uint64 length;
-  int is_journal;
-};
-typedef struct mkfs_subdevice mkfs_subdevice_t;
-
-
-struct mkfs_device
-{
-  unsigned int nsubdev;
-  mkfs_subdevice_t *subdev; 
-};
-typedef struct mkfs_device mkfs_device_t;
-
-
-struct commandline
-{
-  char lockproto[GFS_LOCKNAME_LEN];
-  char locktable[GFS_LOCKNAME_LEN];
-
-  uint32 bsize;             /*  The block size of the FS  */
-  uint32 seg_size;          /*  The journal segment size  */
-  uint32 journals;          /*  Number of journals  */
-  uint32 jsize;             /*  Size of journals  */
-  uint32 rgsize;            /*  The Resource Group size  */
-  int rgsize_specified;     /*  Did the user specify a rg size? */
-
-  int debug;                /*  Print out debugging information?  */
-  int quiet;                /*  No messages  */
-  int expert;
-  int override;
-
-  char *device;             /*  device  */
-
-
-  /*  Not specified on the command line, but...  */
-
-  uint64 rgrps;             /*  Number of rgrps  */
-  int fd;                   /*  fd of the device  */
-  struct gfs_sbd *sbd;      /*  A copy of the superblock */
-  uint64 fssize;            /*  size of the filesystem  */
-
-  uint64 sb_addr;
-
-  uint64 rgrp0_next;        /*  The address of the next available block in rgrp 0  */
-};
-typedef struct commandline commandline_t;
-
-
-struct rgrp_list
-{
-  osi_list_t list;
-
-  uint32 subdevice;         /*  The subdevice who holds this resource group  */
-
-  uint64 rg_offset;         /*  The offset of the beginning of this resource group  */
-  uint64 rg_length;         /*  The length of this resource group  */
-
-  struct gfs_rindex *ri;
-};
-typedef struct rgrp_list rgrp_list_t;
-
-
-struct journal_list
-{
-  osi_list_t list;
-
-  uint64 start;
-  uint32 segments;
-};
-typedef struct journal_list journal_list_t;
-
-
-EXTERN char *prog_name;
-
-
-#define MKFS_DEFAULT_BSIZE          (4096)
-#define MKFS_DEFAULT_SEG_SIZE       (16)
-#define MKFS_DEFAULT_JSIZE          (128)
-#define MKFS_DEFAULT_RGSIZE         (256)
-#define MKFS_DEFAULT_LOCKPROTO      "lock_dlm"
-#define MKFS_EXCESSIVE_RGS          (10000)
-
-/*  device_geometry.c  */
-
-void device_geometry(commandline_t *comline, mkfs_device_t *device);
-void add_journals_to_device(commandline_t *comline, mkfs_device_t *device);
-void fix_device_geometry(commandline_t *comline, mkfs_device_t *device);
-
-
-/*  fs_geometry.c  */
-
-void compute_rgrp_layout(commandline_t *comline, mkfs_device_t *device, osi_list_t *rlist);
-void compute_journal_layout(commandline_t *comline, mkfs_device_t *device, osi_list_t *jlist);
-
-
-/*  locking.c  */
-
-int test_locking(char *lockproto, char *locktable, char *estr, unsigned int elen);
-
-
-/*  structures.c  */
-
-void write_mkfs_sb(commandline_t *comline, osi_list_t *rlist);
-void write_jindex(commandline_t *comline, osi_list_t *jlist);
-void write_rindex(commandline_t *comline, osi_list_t *rlist);
-void write_root(commandline_t *comline);
-void write_quota(commandline_t *comline);
-void write_license(commandline_t *comline);
-void write_rgrps(commandline_t *comline, osi_list_t *rlist);
-void write_journals(commandline_t *comline, osi_list_t *jlist);
-
-
-#endif  /*  __MKFS_GFS_DOT_H__  */
-
diff --git a/gfs/gfs_mkfs/ondisk.c b/gfs/gfs_mkfs/ondisk.c
deleted file mode 100644
index f0955a5..0000000
--- a/gfs/gfs_mkfs/ondisk.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-
-#include "global.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/gfs/gfs_mkfs/structures.c b/gfs/gfs_mkfs/structures.c
deleted file mode 100644
index 9a33d70..0000000
--- a/gfs/gfs_mkfs/structures.c
+++ /dev/null
@@ -1,845 +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 <assert.h>
-#include <time.h>
-
-#include "global.h"
-#include "gfs_ondisk.h"
-#include "osi_list.h"
-#include "linux_endian.h"
-#include "libgfs.h"
-#include "mkfs_gfs.h"
-
-
-#define MKFS_ROOT_MODE              (0755)
-#define MKFS_HIDDEN_MODE            (0600)
-
-/**
- * rgblocks2bitblocks - blerg
- * @bsize: the FS block size
- * @rgblocks: The total number of the blocks in the RG
- *            Also, returns the number of allocateable blocks
- * @bitblocks: Returns the number of bitmap blocks
- *
- * Give a number of blocks in a RG, figure out the number of blocks
- * needed for bitmaps.
- *
- */
-
-static 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 gfs_rgrp);
-
-	for (;;) {
-	        bitbytes_needed = (*rgblocks - *bitblocks) / GFS_NBBY;
-
-		if (bitbytes_provided >= bitbytes_needed) {
-			if (last >= bitbytes_needed)
-				(*bitblocks)--;
-			break;
-		}
-
-		last = bitbytes_provided;
-		(*bitblocks)++;
-		bitbytes_provided += bsize - sizeof(struct gfs_meta_header);
-	}
-
-	*rgblocks = bitbytes_needed * GFS_NBBY;
-}
-
-
-/**
- * write_mkfs_sb - write the superblock
- * @comline: the command line
- * @rlist: the list of RGs
- *
- */
-
-void write_mkfs_sb(commandline_t *comline, osi_list_t *rlist)
-{
-	struct gfs_sbd *sbd;
-	uint64 jindex_dinode;
-	char buf[comline->bsize];
-	int x;
-
-	memset(buf, 0, comline->bsize);
-
-	for (x = 0; x < comline->sb_addr; x++) {
-		do_lseek(comline->fd, x * comline->bsize);
-		do_write(comline->fd, buf, comline->bsize);
-	}
-
-	/*  Figure out the location of the journal index inode  */
-	{
-		rgrp_list_t *rl = osi_list_entry(rlist->next, rgrp_list_t, list);
-		uint32_t rgblocks, bitblocks;
-		
-		rgblocks = rl->rg_length;
-		rgblocks2bitblocks(comline->bsize, &rgblocks, &bitblocks);
-		
-		jindex_dinode = rl->rg_offset + bitblocks;
-	}
-
-	/*  Now, fill in the superblock  */
-
-	type_zalloc(sbd, struct gfs_sbd, 1);
-	comline->sbd = sbd;
-
-	sbd->sd_sb.sb_header.mh_magic = GFS_MAGIC;
-	sbd->sd_sb.sb_header.mh_type = GFS_METATYPE_SB;
-	sbd->sd_sb.sb_header.mh_format = GFS_FORMAT_SB;
-
-	sbd->sd_sb.sb_fs_format = GFS_FORMAT_FS;
-	sbd->sd_sb.sb_multihost_format = GFS_FORMAT_MULTI;
-
-	sbd->sd_sb.sb_bsize = comline->bsize;
-	sbd->sd_sb.sb_bsize_shift = ffs(comline->bsize) - 1;
-	sbd->sd_sb.sb_seg_size = comline->seg_size;
-	
-	compute_constants(sbd);
-
-	sbd->sd_sb.sb_jindex_di.no_formal_ino = jindex_dinode;
-	sbd->sd_sb.sb_jindex_di.no_addr = jindex_dinode;
-	sbd->sd_sb.sb_rindex_di.no_formal_ino = jindex_dinode + 1;
-	sbd->sd_sb.sb_rindex_di.no_addr = jindex_dinode + 1;
-	sbd->sd_sb.sb_root_di.no_formal_ino = jindex_dinode + 4;
-	sbd->sd_sb.sb_root_di.no_addr = jindex_dinode + 4;
-
-	strcpy(sbd->sd_sb.sb_lockproto, comline->lockproto);
-	strcpy(sbd->sd_sb.sb_locktable, comline->locktable);
-
-	sbd->sd_sb.sb_quota_di.no_formal_ino = jindex_dinode + 2;
-	sbd->sd_sb.sb_quota_di.no_addr = jindex_dinode + 2;
-	sbd->sd_sb.sb_license_di.no_formal_ino = jindex_dinode + 3;
-	sbd->sd_sb.sb_license_di.no_addr = jindex_dinode + 3;
-	sbd->sd_fsb2bb_shift = sbd->sd_sb.sb_bsize_shift - GFS_BASIC_BLOCK_SHIFT;
-
-	write_sb(comline->fd, sbd);
-	if (comline->debug) {
-		printf("\nSuperblock:\n");
-		gfs_sb_print(&sbd->sd_sb);
-	}
-}
-
-/**
- * build_tree - build the pointers and indirect blocks for a file
- * @comline: the command line
- * @di: the dinode
- * @addr: the start of the file
- * @blocks: the number of blocks in the file
- *
- */
-
-static void build_tree(commandline_t *comline, struct gfs_dinode *di, uint64 addr, unsigned int blocks)
-{
-	struct gfs_indirect ind;
-	char *buf;
-	unsigned int x, offset;
-	unsigned int height;
-	unsigned int indblocks;
-	uint64 tmp_addr;
-	unsigned int tmp_blocks;
-  
-	di->di_height = compute_height(comline->sbd, di->di_size);
-
-	if (di->di_height == 1) {
-		type_zalloc(buf, char, comline->bsize);
-
-		for (x = 0; x < blocks; x++)
-			((uint64 *)(buf + sizeof(struct gfs_dinode)))[x] = cpu_to_gfs64(addr + x);
-
-		gfs_dinode_out(di, buf);
-
-		do_lseek(comline->fd, di->di_num.no_addr * comline->bsize);
-		do_write(comline->fd, buf, comline->bsize);
-
-		free(buf);
-	}
-	else {
-		tmp_addr = addr;
-		tmp_blocks = blocks;
-
-		for (height = di->di_height; height > 1; height--) {
-			memset(&ind, 0, sizeof(struct gfs_indirect));
-			ind.in_header.mh_magic = GFS_MAGIC;
-			ind.in_header.mh_type = GFS_METATYPE_IN;
-			ind.in_header.mh_format = GFS_FORMAT_IN;
-
-			indblocks = DIV_RU((tmp_blocks * sizeof(uint64)),
-							   (comline->bsize - sizeof(struct gfs_indirect)));
-
-			type_zalloc(buf, char, indblocks * comline->bsize);
-
-			offset = 0;
-			for (x = 0; x < tmp_blocks; x++) {
-				if (!(offset % comline->bsize)) {
-					gfs_indirect_out(&ind, buf + offset);
-					offset += sizeof(struct gfs_indirect);
-				}
-				
-				*((uint64 *)(buf + offset)) = cpu_to_gfs64(tmp_addr + x);
-				offset += sizeof(uint64);
-			}
-
-			do_lseek(comline->fd, comline->rgrp0_next * comline->bsize);
-			do_write(comline->fd, buf, indblocks * comline->bsize);
-
-			free(buf);
-
-			tmp_addr = comline->rgrp0_next;
-			tmp_blocks = indblocks;
-
-			di->di_blocks += indblocks;
-			
-			comline->rgrp0_next += indblocks;
-		}
-		type_zalloc(buf, char, comline->bsize);
-
-		for (x = 0; x < tmp_blocks; x++)
-			((uint64 *)(buf + sizeof(struct gfs_dinode)))[x] = cpu_to_gfs64(tmp_addr + x);
-
-		gfs_dinode_out(di, buf);
-
-		do_lseek(comline->fd, di->di_num.no_addr * comline->bsize);
-		do_write(comline->fd, buf, comline->bsize);    
-
-		free(buf);
-	}
-}
-
-
-/**
- * fill_jindex - create the journal index data
- * @comline: the command line
- * @jlist: the list of journals
- *
- * Returns: a pointer data for the jindex
- */
-
-static char *fill_jindex(commandline_t *comline, osi_list_t *jlist)
-{
-	journal_list_t *jl;
-	struct gfs_jindex ji;
-	osi_list_t *tmp;
-	char *buf;
-	unsigned int j = 0;
-	
-	type_alloc(buf, char, comline->journals * sizeof(struct gfs_jindex));
-
-	for (tmp = jlist->next; tmp != jlist; tmp = tmp->next) {
-		jl = osi_list_entry(tmp, journal_list_t, list);
-
-		memset(&ji, 0, sizeof(struct gfs_jindex));
-
-		ji.ji_addr = jl->start;
-		ji.ji_nsegment = jl->segments;
-
-		gfs_jindex_out(&ji, buf + j * sizeof(struct gfs_jindex));
-
-		j++;
-	}
-
-	if (comline->debug) {
-		printf("\nJournal Index data:\n");
-
-		for (j = 0; j < comline->journals; j++) {
-			gfs_jindex_in(&ji, buf + j * sizeof(struct gfs_jindex));
-			
-			printf("\n  Journal %d\n", j);
-			gfs_jindex_print(&ji);
-		}
-	}
-
-	return buf;
-}
-
-/**
- * write_jindex - write out the journal index
- * @comline: the command line
- * @jlist: the list of journals
- *
- */
-
-void write_jindex(commandline_t *comline, osi_list_t *jlist)
-{
-	struct gfs_dinode di;
-	struct gfs_meta_header jd;
-	char *buf, *data;
-	uint64 addr;
-	unsigned int blocks;
-	unsigned int x, left, jbsize = comline->bsize - sizeof(struct gfs_meta_header);
-
-	memset(&di, 0, sizeof(struct gfs_dinode));
- 
-	di.di_header.mh_magic = GFS_MAGIC;
-	di.di_header.mh_type = GFS_METATYPE_DI;
-	di.di_header.mh_format = GFS_FORMAT_DI;
-
-	di.di_num = comline->sbd->sd_sb.sb_jindex_di;
-
-	di.di_mode = MKFS_HIDDEN_MODE;
-	di.di_nlink = 1;
-	di.di_size = comline->journals * sizeof(struct gfs_jindex);
-	di.di_blocks = 1;
-	di.di_atime = di.di_mtime = di.di_ctime = time(NULL);
-
-	di.di_flags = GFS_DIF_JDATA;
-	di.di_payload_format = GFS_FORMAT_JI;
-	di.di_type = GFS_FILE_REG;
-
-	data = fill_jindex(comline, jlist);
-
-	if (di.di_size < comline->bsize - sizeof(struct gfs_dinode)) {
-		type_zalloc(buf, char, comline->bsize);
-
-		gfs_dinode_out(&di, buf);
-
-		memcpy(buf + sizeof(struct gfs_dinode), data, comline->journals * sizeof(struct gfs_jindex));
-
-		do_lseek(comline->fd, di.di_num.no_addr * comline->bsize);
-		do_write(comline->fd, buf, comline->bsize);
-
-		free(buf);
-	}
-	else {
-		blocks = DIV_RU(di.di_size, (comline->bsize - sizeof(struct gfs_meta_header)));
-		di.di_blocks += blocks;
-
-		addr = comline->rgrp0_next;
-		memset(&jd, 0, sizeof(struct gfs_meta_header));
-		jd.mh_magic = GFS_MAGIC;
-		jd.mh_type = GFS_METATYPE_JD;
-		jd.mh_format = GFS_FORMAT_JD;
-
-		type_zalloc(buf, char, blocks * comline->bsize);
-
-		left = comline->journals * sizeof(struct gfs_jindex);
-		for (x = 0; x < blocks; x++) {
-			gfs_meta_header_out(&jd, buf + x * comline->bsize);
-			memcpy(buf + x * comline->bsize + sizeof(struct gfs_meta_header),
-				   data + x * jbsize,
-				   (left > jbsize) ? jbsize : left);
-			left -= jbsize;
-		}
-
-		do_lseek(comline->fd, addr * comline->bsize);
-		do_write(comline->fd, buf, blocks * comline->bsize);
-
-		free(buf);
-
-		comline->rgrp0_next += blocks;
-
-		build_tree(comline, &di, addr, blocks);
-	}
-
-	free(data);
-
-	if (comline->debug) {
-		printf("\nJournal index dinode:\n");
-		gfs_dinode_print(&di);
-	}
-}
-
-
-/**
- * fill_rindex - create the resource group index data
- * @comline: the command line
- * @rlist: the list of RGs
- *
- * Returns: a pointer data for the rindex
- */
-
-static char *fill_rindex(commandline_t *comline, osi_list_t *rlist)
-{
-	struct gfs_rindex *ri, rindex;
-	rgrp_list_t *rl;
-	osi_list_t *tmp;
-	char *buf;
-	unsigned int r = 0;
-	uint32 rgblocks, bitblocks;
-
-	type_alloc(buf, char, comline->rgrps * sizeof(struct gfs_rindex));
-
-	for (tmp = rlist->next; tmp != rlist; tmp = tmp->next) {
-		rl = osi_list_entry(tmp, rgrp_list_t, list);
-	
-		rgblocks = rl->rg_length;
-		rgblocks2bitblocks(comline->bsize, &rgblocks, &bitblocks);
-
-		type_zalloc(ri, struct gfs_rindex, 1);
-		rl->ri = ri;
-		
-		ri->ri_addr = rl->rg_offset;
-		ri->ri_length = bitblocks;
-
-		ri->ri_data1 = rl->rg_offset + bitblocks;
-		ri->ri_data = rgblocks;
-
-		ri->ri_bitbytes = rgblocks / GFS_NBBY;
-
-		gfs_rindex_out(ri, buf + r * sizeof(struct gfs_rindex));
-		
-		comline->fssize += rgblocks;
-
-		r++;
-	}
-
-	if (comline->debug) {
-		printf("\nResource Index data:\n");
-
-		for (r = 0; r < comline->rgrps; r++) {
-			gfs_rindex_in(&rindex, buf + r * sizeof(struct gfs_rindex));
-
-			printf("\n  Resource index %d\n", r);
-			gfs_rindex_print(&rindex);
-		}
-	}
-	return buf;
-}
-
-/**
- * write_rindex - write out the resource group index
- * @comline: the command line
- * @jlist: the list of RGs
- *
- */
-
-void write_rindex(commandline_t *comline, osi_list_t *rlist)
-{
-	struct gfs_dinode di;
-	struct gfs_meta_header jd;
-	char *buf, *data;
-	uint64 addr;
-	unsigned int blocks;
-	unsigned int x, left, jbsize = comline->bsize - sizeof(struct gfs_meta_header);
-
-	memset(&di, 0, sizeof(struct gfs_dinode));
-
-	di.di_header.mh_magic = GFS_MAGIC;
-	di.di_header.mh_type = GFS_METATYPE_DI;
-	di.di_header.mh_format = GFS_FORMAT_DI;
-
-	di.di_num = comline->sbd->sd_sb.sb_rindex_di;
-
-	di.di_mode = MKFS_HIDDEN_MODE;
-	di.di_nlink = 1;
-	di.di_size = comline->rgrps * sizeof(struct gfs_rindex);
-	di.di_blocks = 1;
-	di.di_atime = di.di_mtime = di.di_ctime = time(NULL);
-
-	di.di_flags = GFS_DIF_JDATA;
-	di.di_payload_format = GFS_FORMAT_RI;
-	di.di_type = GFS_FILE_REG;
-
-	data = fill_rindex(comline, rlist);
-
-	if (di.di_size < comline->bsize - sizeof(struct gfs_dinode)) {
-		type_zalloc(buf, char, comline->bsize);
-
-		gfs_dinode_out(&di, buf);
-    
-		memcpy(buf + sizeof(struct gfs_dinode), data, comline->rgrps * sizeof(struct gfs_rindex));
-
-		do_lseek(comline->fd, di.di_num.no_addr * comline->bsize);
-		do_write(comline->fd, buf, comline->bsize);
-
-		free(buf);
-	}
-	else {
-		blocks = DIV_RU(di.di_size, (comline->bsize - sizeof(struct gfs_meta_header)));
-		di.di_blocks += blocks;
-
-		addr = comline->rgrp0_next;
-
-		memset(&jd, 0, sizeof(struct gfs_meta_header));
-		jd.mh_magic = GFS_MAGIC;
-		jd.mh_type = GFS_METATYPE_JD;
-		jd.mh_format = GFS_FORMAT_JD;
-
-		type_zalloc(buf, char, blocks * comline->bsize);
-
-		left = comline->rgrps * sizeof(struct gfs_rindex);
-		for (x = 0; x < blocks; x++) {
-			gfs_meta_header_out(&jd, buf + x * comline->bsize);
-			memcpy(buf + x * comline->bsize + sizeof(struct gfs_meta_header),
-				   data + x * jbsize,
-				   (left > jbsize) ? jbsize : left);
-			left -= jbsize;
-		}
-
-		do_lseek(comline->fd, addr * comline->bsize);
-		do_write(comline->fd, buf, blocks * comline->bsize);
-
-		free(buf);
-
-		comline->rgrp0_next += blocks;
-
-		build_tree(comline, &di, addr, blocks);
-	}
-
-	free(data);
-
-	if (comline->debug) {
-		printf("\nResource index dinode:\n");
-		gfs_dinode_print(&di);
-	}
-}
-
-
-/**
- * write_root - write out the root dinode
- * @comline: the command line
- *
- */
-
-void write_root(commandline_t *comline)
-{
-	struct gfs_dinode di;
-	struct gfs_dirent de;
-	char buf[comline->bsize];
-
-	memset(&di, 0, sizeof(struct gfs_dinode));
-	memset(buf, 0, comline->bsize);
-
-	di.di_header.mh_magic = GFS_MAGIC;
-	di.di_header.mh_type = GFS_METATYPE_DI;
-	di.di_header.mh_format = GFS_FORMAT_DI;
-
-	di.di_num = comline->sbd->sd_sb.sb_root_di;
-
-	di.di_mode = MKFS_ROOT_MODE;
-	di.di_nlink = 2;
-	di.di_size = comline->bsize - sizeof(struct gfs_dinode);
-	di.di_blocks = 1;
-	di.di_atime = di.di_mtime = di.di_ctime = time(NULL);
-
-	di.di_flags = GFS_DIF_JDATA;
-	di.di_payload_format = GFS_FORMAT_DE;
-	di.di_type = GFS_FILE_DIR;
-
-	di.di_entries = 2;
-
-	gfs_dinode_out(&di, buf);
-
-	/*  Fill in .  */
-
-	memset(&de, 0, sizeof(struct gfs_dirent));
-
-	de.de_inum = comline->sbd->sd_sb.sb_root_di;
-	de.de_hash = gfs_dir_hash(".", 1);
-	de.de_rec_len = GFS_DIRENT_SIZE(1);
-	de.de_name_len = 1;
-	de.de_type = GFS_FILE_DIR;
-
-	gfs_dirent_out(&de, buf + sizeof(struct gfs_dinode));
-	memcpy(buf + sizeof(struct gfs_dinode) + sizeof(struct gfs_dirent), ".", 1);
-
-	if (comline->debug) {
-		printf("\nRoot Dinode dirent:\n");
-		gfs_dirent_print(&de, ".");
-	}
-
-	/*  Fill in ..  */
-
-	memset(&de, 0, sizeof(struct gfs_dirent));
-
-	de.de_inum = comline->sbd->sd_sb.sb_root_di;
-	de.de_hash = gfs_dir_hash("..", 2);
-	de.de_rec_len = comline->bsize - GFS_DIRENT_SIZE(1) - sizeof(struct gfs_dinode);
-	de.de_name_len = 2;
-	de.de_type = GFS_FILE_DIR;
-
-	gfs_dirent_out(&de, buf + sizeof(struct gfs_dinode) + GFS_DIRENT_SIZE(1));
-	memcpy(buf + sizeof(struct gfs_dinode) + GFS_DIRENT_SIZE(1) + sizeof(struct gfs_dirent), "..", 2);
-
-	if (comline->debug) {
-		printf("\nRoot Dinode dirent:\n");
-		gfs_dirent_print(&de, "..");
-	}
-
-	do_lseek(comline->fd, di.di_num.no_addr * comline->bsize);
-	do_write(comline->fd, buf, comline->bsize);
-
-	if (comline->debug) {
-		printf("\nRoot dinode:\n");
-		gfs_dinode_print(&di);
-	}
-}
-
-/**
- * write_quota - write out the quota dinode
- * @comline: the command line
- *
- */
-
-void write_quota(commandline_t *comline)
-{
-	struct gfs_dinode di;
-	struct gfs_quota qu;
-
-	char buf[comline->bsize];
-
-	memset(&di, 0, sizeof(struct gfs_dinode));
-	memset(buf, 0, comline->bsize);
-
-	di.di_header.mh_magic = GFS_MAGIC;
-	di.di_header.mh_type = GFS_METATYPE_DI;
-	di.di_header.mh_format = GFS_FORMAT_DI;
-
-	di.di_num = comline->sbd->sd_sb.sb_quota_di;
-
-	di.di_mode = MKFS_HIDDEN_MODE;
-	di.di_nlink = 1;
-	di.di_size = 2 * sizeof(struct gfs_quota);
-	di.di_blocks = 1;
-	di.di_atime = di.di_mtime = di.di_ctime = time(NULL);
-
-	di.di_flags = GFS_DIF_JDATA;
-	di.di_payload_format = GFS_FORMAT_QU;
-	di.di_type = GFS_FILE_REG;
-
-	gfs_dinode_out(&di, buf);
-
-	/*  Fill in the root user quota  */
-
-	memset(&qu, 0, sizeof(struct gfs_quota));
-	qu.qu_value = comline->rgrp0_next - comline->sbd->sd_sb.sb_jindex_di.no_addr;
-
-	gfs_quota_out(&qu, buf + sizeof(struct gfs_dinode));
-
-	if (comline->debug) {
-		printf("\nRoot user quota:\n");
-		gfs_quota_print(&qu);
-	}
-
-	/*  Fill in the root group quota  */
-
-	memset(&qu, 0, sizeof(struct gfs_quota));
-	qu.qu_value = comline->rgrp0_next - comline->sbd->sd_sb.sb_jindex_di.no_addr;
-
-	gfs_quota_out(&qu, buf + sizeof(struct gfs_dinode) + sizeof(struct gfs_quota));
-
-	if (comline->debug) {
-		printf("\nRoot group quota:\n");
-		gfs_quota_print(&qu);
-	}
-
-	do_lseek(comline->fd, di.di_num.no_addr * comline->bsize);
-	do_write(comline->fd, buf, comline->bsize);
-
-	if (comline->debug) {
-		printf("\nQuota dinode:\n");
-		gfs_dinode_print(&di);
-	}
-}
-
-/**
- * write_license - write out the quota dinode
- * @comline: the command line
- *
- */
-
-void write_license(commandline_t *comline)
-{
-	struct gfs_dinode di;
-
-	char buf[comline->bsize];
-
-	memset(&di, 0, sizeof(struct gfs_dinode));
-	memset(buf, 0, comline->bsize);
-
-	di.di_header.mh_magic = GFS_MAGIC;
-	di.di_header.mh_type = GFS_METATYPE_DI;
-	di.di_header.mh_format = GFS_FORMAT_DI;
-
-	di.di_num = comline->sbd->sd_sb.sb_license_di;
-
-	di.di_mode = MKFS_HIDDEN_MODE;
-	di.di_nlink = 1;
-	di.di_size = 0;
-	di.di_blocks = 1;
-	di.di_atime = di.di_mtime = di.di_ctime = time(NULL);
-
-	di.di_flags = GFS_DIF_JDATA;
-	di.di_payload_format = GFS_FORMAT_QU;
-	di.di_type = GFS_FILE_REG;
-
-	gfs_dinode_out(&di, buf);
-
-	do_lseek(comline->fd, di.di_num.no_addr * comline->bsize);
-	do_write(comline->fd, buf, comline->bsize);
-
-
-	if (comline->debug) {
-		printf("\nLicense dinode:\n");
-		gfs_dinode_print(&di);
-	}
-}
-
-/**
- * write_rgrps - write out the resource group headers
- * @comline: the command line
- * @rlist: the RG list
- *
- */
-
-void write_rgrps(commandline_t *comline, osi_list_t *rlist)
-{
-	struct gfs_rgrp rg;
-	struct gfs_meta_header rb;
-	rgrp_list_t *rl;
-	osi_list_t *tmp;
-	char *buf, *data;
-	unsigned int x, offset;
-	unsigned int byte, bit;
-	unsigned int blk_count;
-	unsigned int r = 0;
-
-	memset(&rb, 0, sizeof(struct gfs_meta_header));
-	rb.mh_magic = GFS_MAGIC;
-	rb.mh_type = GFS_METATYPE_RB;
-	rb.mh_format = GFS_FORMAT_RB;
-
-	for (tmp = rlist->next; tmp != rlist; tmp = tmp->next) {
-		rl = osi_list_entry(tmp, rgrp_list_t, list);
-		
-		memset(&rg, 0, sizeof(struct gfs_rgrp));
-		rg.rg_header.mh_magic = GFS_MAGIC;
-		rg.rg_header.mh_type = GFS_METATYPE_RG;
-		rg.rg_header.mh_format = GFS_FORMAT_RG;
-		rg.rg_free = rl->ri->ri_data;
-
-		type_zalloc(data, char, rl->ri->ri_bitbytes);
-		type_zalloc(buf, char, rl->ri->ri_length * comline->bsize);
-
-		/*  Deal with the special case of the first dinode  */
-
-		if (!r) {
-			if (comline->rgrp0_next > rl->ri->ri_data1 + rl->ri->ri_data)
-				die("RG 0 is full.\n");
-			
-			/*  Compensate for the hidden dinodes  */
-
-			*data = (GFS_BLKST_USEDMETA << 3 * GFS_BIT_SIZE) |
-				(GFS_BLKST_USEDMETA << 2 * GFS_BIT_SIZE) |
-				(GFS_BLKST_USEDMETA << GFS_BIT_SIZE) |
-				GFS_BLKST_USEDMETA;
-			*(data + 1) = GFS_BLKST_USEDMETA;
-			rg.rg_free -= 5;
-			rg.rg_useddi = 5;
-
-			/*  Compensate for the data the hidden dinodes point to  */
-
-			for (x = rl->ri->ri_data1 + 5; x < comline->rgrp0_next; x++) {
-				byte = (x - rl->ri->ri_data1) / GFS_NBBY;
-				bit = (x - rl->ri->ri_data1) % GFS_NBBY;
-				
-				data[byte] |= GFS_BLKST_USEDMETA << (bit * GFS_BIT_SIZE);
-				
-				rg.rg_free--;
-				rg.rg_usedmeta++;
-			}
-		}
-
-		gfs_rgrp_out(&rg, buf);
-		offset = sizeof(struct gfs_rgrp);
-		blk_count = 1;
-
-		for (x = 0; x < rl->ri->ri_bitbytes; x++) {
-			if (!(offset % comline->bsize)) {
-				gfs_meta_header_out(&rb, buf + offset);
-				offset += sizeof(struct gfs_meta_header);
-				blk_count++;
-			}
-
-			buf[offset] = data[x];
-			offset++;
-		}
-
-		if (blk_count != rl->ri->ri_length)
-			die("RG underflow (rg = %u, blk_count = %u, rl->ri->ri_length = %u)\n",
-				r, blk_count, rl->ri->ri_length);
-		
-		do_lseek(comline->fd, rl->ri->ri_addr * comline->bsize);
-		do_write(comline->fd, buf, rl->ri->ri_length * comline->bsize);
-
-		free(buf);
-		free(data);
-
-		if (comline->debug) {
-			printf("\nResource group header %d\n", r);
-			gfs_rgrp_print(&rg);
-		}
-
-		r++;
-	}
-}
-
-/**
- * write_journals - write out the journal log headers
- * @comline: the command line
- * @rlist: the RG list
- *
- */
-
-void write_journals(commandline_t *comline, osi_list_t *jlist)
-{
-	struct gfs_log_header lh;
-	journal_list_t *jl;
-	osi_list_t *tmp;
-	char buf[comline->bsize];
-	uint32 seg, sequence;
-	int x = 0;
-
-	srandom(time(NULL));
-
-	for (tmp = jlist->next; tmp != jlist; tmp = tmp->next) {
-		jl = osi_list_entry(tmp, journal_list_t, list);
-
-		if (comline->debug)
-			printf("Starting journal %d\n", x++);
-
-		sequence = jl->segments / (RAND_MAX + 1.0) * random();
-
-		for (seg = 0; seg < jl->segments; seg++) {
-			memset(buf, 0, comline->bsize);
-			memset(&lh, 0, sizeof(struct gfs_log_header));
-
-			lh.lh_header.mh_magic = GFS_MAGIC;
-			lh.lh_header.mh_type = GFS_METATYPE_LH;
-			lh.lh_header.mh_format = GFS_FORMAT_LH;
-			lh.lh_flags = GFS_LOG_HEAD_UNMOUNT;
-			lh.lh_first = jl->start + seg * comline->seg_size;
-			lh.lh_sequence = sequence;
-			/*  Don't care about tail  */
-			/*  Don't care about log dump  */
-
-			gfs_log_header_out(&lh, buf);
-			gfs_log_header_out(&lh, buf + GFS_BASIC_BLOCK - sizeof(struct gfs_log_header));
-
-			do_lseek(comline->fd, lh.lh_first * comline->bsize);
-			do_write(comline->fd, buf, comline->bsize);
-
-			if (++sequence == jl->segments)
-				sequence = 0;
-
-			if (!(seg % 100))
-				if (comline->debug)
-					printf("seg #%u\n", seg);
-		}
-	}
-}
diff --git a/gfs/gfs_quota/Makefile b/gfs/gfs_quota/Makefile
deleted file mode 100644
index 3a4e114..0000000
--- a/gfs/gfs_quota/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-TARGET= gfs_quota
-
-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=	check.o \
-	main.o \
-	names.o \
-	ondisk.o \
-	layout.o
-
-CFLAGS += -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64
-CFLAGS += -I${gfskincdir}
-CFLAGS += -I$(S)/../include
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${libdir}
-
-${TARGET}: ${OBJS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/gfs/gfs_quota/check.c b/gfs/gfs_quota/check.c
deleted file mode 100644
index 5645263..0000000
--- a/gfs/gfs_quota/check.c
+++ /dev/null
@@ -1,633 +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>
-
-#include "linux_endian.h"
-#include "gfs_ondisk.h"
-#define __user
-#include "gfs_ioctl.h"
-#include "osi_list.h"
-
-#include "gfs_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(commandline_t *comline, osi_list_t *uid, osi_list_t *gid)
-{
-	int fd;
-	struct gfs_sb sb;
-	uint64_t hidden_blocks;
-	struct gfs_ioctl gi;
-	char buf[sizeof(struct gfs_quota)];
-	struct gfs_quota q;
-	uint64_t offset = 0;
-	uint32_t id;
-	int error;
-
-	fd = open(comline->filesystem, O_RDONLY);
-	if (fd < 0)
-		die("can't open file %s: %s\n", comline->filesystem,
-		    strerror(errno));
-
-	check_for_gfs(fd, comline->filesystem);
-
-	do_get_super(fd, &sb);
-
-	hidden_blocks = compute_hidden_blocks(comline, fd);
-
-	do {
-		char *argv[] = { "do_hfile_read", "quota" };
-
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;
-		gi.gi_data = buf;
-		gi.gi_size = sizeof(struct gfs_quota);
-		gi.gi_offset = offset;
-
-		memset(buf, 0, sizeof(struct gfs_quota));
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error < 0)
-			die("can't read quota file (%d): %s\n",
-			    error, strerror(errno));
-
-		gfs_quota_in(&q, buf);
-
-		id = (offset / sizeof(struct gfs_quota)) >> 1;
-		if (!id)
-			q.qu_value -= hidden_blocks;
-		q.qu_value <<= sb.sb_bsize_shift - 9;
-
-		if (q.qu_value) {
-			if (id * sizeof(struct gfs_quota) * 2 == offset)
-				add_value(uid, id, q.qu_value);
-			else
-				add_value(gid, id, q.qu_value);
-		}
-
-		offset += sizeof(struct gfs_quota);
-	} while (error == sizeof(struct gfs_quota));
-
-	close(fd);
-}
-
-/**
- * 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(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(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(commandline_t *comline, int user, osi_list_t *list, int64_t multiplier)
-{
-	int fd;
-	struct gfs_sb sb;
-	osi_list_t *tmp;
-	values_t *v;
-	uint64_t offset;
-	int64_t value;
-	struct gfs_ioctl gi;
-	char buf[256];
-	int error;
-
-	fd = open(comline->filesystem, O_RDONLY);
-	if (fd < 0)
-		die("can't open file %s: %s\n", comline->filesystem,
-		    strerror(errno));
-
-	check_for_gfs(fd, comline->filesystem);
-	do_get_super(fd, &sb);
-
-	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 gfs_quota);
-		offset += (unsigned long)(&((struct gfs_quota *)NULL)->qu_value);
-
-		value = v->v_blocks * multiplier;
-		value >>= sb.sb_bsize_shift - 9;
-		value = cpu_to_gfs64(value);
-
-		{
-			char *argv[] = { "do_hfile_write", "quota"};
-
-			gi.gi_argc = 2;
-			gi.gi_argv = argv;
-			gi.gi_data = (char *)&value;
-			gi.gi_size = sizeof(int64_t);
-			gi.gi_offset = offset;
-
-			error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-			if (error != sizeof(int64_t))
-				die("can't write quota file (%d): %s\n",
-				    error, strerror(errno));
-		}
-
-		sprintf(buf, "%s:%u",
-			(user) ? "u" : "g",
-			v->v_id);
-
-		{
-			char *argv[] = { "do_quota_refresh", buf };
-
-			gi.gi_argc = 2;
-			gi.gi_argv = argv;
-
-			error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-			if (error)
-				die("can't refresh the quota LVB 1: %s\n",
-				    strerror(errno));
-		}
-	}
-
-	close(fd);
-}
-
-/**
- * add_hidden - add in the hidden file block count into the root UID and GID
- * @comline: the command line arguments
- *
- */
-
-static void
-add_hidden(commandline_t *comline)
-{
-	int fd;
-	uint64_t hidden_blocks;
-	uint64_t offset = (unsigned long)(&((struct gfs_quota *)NULL)->qu_value);
-	struct gfs_ioctl gi;
-	int64_t value;
-	unsigned int pass = 0;
-	char buf[256];
-	int error;
-
-	fd = open(comline->filesystem, O_RDONLY);
-	if (fd < 0)
-		die("can't open file %s: %s\n", comline->filesystem,
-		    strerror(errno));
-
-	check_for_gfs(fd, comline->filesystem);
-
-	hidden_blocks = compute_hidden_blocks(comline, fd);
-
-	for (;;) {
-		{
-			char *argv[] = { "do_hfile_read", "quota" };
-
-			gi.gi_argc = 2;
-			gi.gi_argv = argv;
-			gi.gi_data = (char *)&value;
-			gi.gi_size = sizeof(int64_t);
-			gi.gi_offset = offset;
-
-			error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-			if (error != sizeof(int64_t))
-				die("can't read quota file (%d): %s\n",
-				    error, strerror(errno));
-		}
-
-		value = gfs64_to_cpu(value);
-		value += hidden_blocks;
-		value = cpu_to_gfs64(value);
-
-		{
-			char *argv[] = { "do_hfile_write", "quota" };
-
-			gi.gi_argc = 2;
-			gi.gi_argv = argv;
-			gi.gi_data = (char *)&value;
-			gi.gi_size = sizeof(int64_t);
-			gi.gi_offset = offset;
-
-			error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-			if (error != sizeof(int64_t))
-				die("can't write quota file (%d): %s\n",
-				    error, strerror(errno));
-		}
-
-		sprintf(buf, "%s:%u",
-			(pass) ? "g" : "u",
-			0);
-
-		{
-			char *argv[] = { "do_quota_refresh", buf };
-
-			gi.gi_argc = 2;
-			gi.gi_argv = argv;
-
-			error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-			if (error)
-				die("can't refresh the quota LVB 2: %s\n",
-				    strerror(errno));
-		}
-
-		if (!pass) {
-			offset += sizeof(struct gfs_quota);
-			pass = 1;
-		} else
-			break;
-	}
-
-	close(fd);
-}
-
-/**
- * do_init - initialize the quota file
- * @comline: the command line arguments
- *
- */
-
-void
-do_init(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(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);
-
-	/* Yes, do the set_list() calls twice.  Gotta get around
-	   the fact that writing to the quota file causes
-	   quota changes  */
-
-	set_list(comline, TRUE, &qf_uid, 0);
-	set_list(comline, FALSE, &qf_gid, 0);
-	set_list(comline, TRUE, &fs_uid, 1);
-	set_list(comline, FALSE, &fs_gid, 1);
-
-	do_sync(comline);
-	do_sync(comline);
-
-	set_list(comline, TRUE, &qf_uid, 0);
-	set_list(comline, FALSE, &qf_gid, 0);
-	set_list(comline, TRUE, &fs_uid, 1);
-	set_list(comline, FALSE, &fs_gid, 1);
-
-	do_sync(comline);
-
-	add_hidden(comline);
-
-	do_sync(comline);
-
-	do_check(comline);
-}
diff --git a/gfs/gfs_quota/gfs_quota.h b/gfs/gfs_quota/gfs_quota.h
deleted file mode 100644
index a7a7670..0000000
--- a/gfs/gfs_quota/gfs_quota.h
+++ /dev/null
@@ -1,94 +0,0 @@
-#ifndef __GFS_QUOTA_DOT_H__
-#define __GFS_QUOTA_DOT_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 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_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)
-
-struct commandline {
-	unsigned int operation;
-
-	uint64_t new_value;
-	int new_value_set;
-
-	unsigned int id_type;
-	uint32_t id;
-
-	unsigned int units;
-
-	int no_hidden_file_blocks;
-	int numbers;
-
-	char filesystem[PATH_MAX];
-};
-typedef struct commandline commandline_t;
-
-extern char *prog_name;
-
-/*  main.c  */
-
-void check_for_gfs(int fd, char *path);
-void do_get_super(int fd, struct gfs_sb *sb);
-void do_sync(commandline_t *comline);
-uint64_t compute_hidden_blocks(commandline_t *comline, int fd);
-
-/*  check.c  */
-
-void do_check(commandline_t *comline);
-void do_init(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);
-
-/* layout.c */
-
-void print_quota_file(commandline_t *comline);
-#endif /* __GFS_QUOTA_DOT_H__ */
diff --git a/gfs/gfs_quota/layout.c b/gfs/gfs_quota/layout.c
deleted file mode 100644
index 015a5a5..0000000
--- a/gfs/gfs_quota/layout.c
+++ /dev/null
@@ -1,600 +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>
-
-#define __user
-#include "gfs_ioctl.h"
-#include "gfs_ondisk.h"
-
-#include "osi_list.h"
-#include "linux_endian.h"
-
-#include "gfs_quota.h"
-
-#define LAYOUT_DATA_QUANTUM (4194304)
-
-extern void
-print_quota(commandline_t *comline,
-            int user, uint32_t id,
-            struct gfs_quota *q,
-            struct gfs_sb *sb);
-
-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 lblk_range {
-        osi_list_t list;
-        
-        uint64_t start;
-        unsigned int len;
-};
-typedef struct lblk_range lblk_range_t;
-
-struct world {
-        char *buf_data;
-        unsigned int buf_size;
-        int buf_count;
-        osi_list_t blist;
-        osi_list_t elist;
-
-        struct gfs_sb sb;
-        unsigned int diptrs;
-        unsigned int inptrs;
-        unsigned int jbsize;
-        unsigned int hash_bsize;
-        unsigned int hash_ptrs;
-
-        buffer_t *dibh;
-        struct gfs_dinode di;
-};
-typedef struct world world_t;
-
-typedef void (*pointer_call_t) (world_t *w,
-                                unsigned int height, uint64_t bn, void *data);
-
-static lblk_range_t *lblk_range_list;
-static unsigned int j_blk_size;
-
-/**
- * add_lblk_range - Add a range of logical block numbers to lblk_list
- * @lblk_list: the list to add to
- * @start: the starting block number of the range
- * @len: the length of the range
- *
- */
-
-static void 
-add_lblk_range(lblk_range_t *lblk_list, uint64_t start, unsigned int len)
-{
-        lblk_range_t *tmp;
-
-        tmp = malloc(sizeof(lblk_range_t));
-        if (!tmp)
-                die("out of memory\n");
-        
-        tmp->start = start;
-        tmp->len = len;
-        
-        osi_list_add_prev(&tmp->list, &lblk_list->list);
-}
-
-/**
- * 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 gfs_meta_header mh;
-        char *type;
-
-        for (tmp = w->blist.next; tmp != &w->blist; tmp = tmp->next) {
-                b = osi_list_entry(tmp, buffer_t, list);
-
-                gfs_meta_header_in(&mh, b->data);
-
-                if (mh.mh_magic != GFS_MAGIC)
-                        die("bad magic number on block\n");
-
-                switch (mh.mh_type) {
-                case GFS_METATYPE_DI:
-                        type = "GFS_METATYPE_DI";
-
-                        if (w->dibh)
-                                die("more than one dinode in file\n");
-                        else {
-                                w->dibh = b;
-                                gfs_dinode_in(&w->di, b->data);
-
-                                b->touched = TRUE;
-                        }
-                        break;
-                case GFS_METATYPE_IN:
-                        type = "GFS_METATYPE_IN";
-                        break;
-                case GFS_METATYPE_LF:
-                        type = "GFS_METATYPE_LF";
-                        break;
-                case GFS_METATYPE_JD:
-                        type = "GFS_METATYPE_JD";
-                        break;
-                case GFS_METATYPE_EA:
-                        type = "GFS_METATYPE_EA";
-                        break;
-                case GFS_METATYPE_ED:
-                        die("GFS_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 gfs_dinode));
-                bottom =
-                    (uint64_t *) (b->data + sizeof(struct gfs_dinode)) +
-                    w->diptrs;
-        } else {
-                b = getbuf(w, block);
-
-                top = (uint64_t *) (b->data + sizeof(struct gfs_indirect));
-                bottom =
-                    (uint64_t *) (b->data + sizeof(struct gfs_indirect)) +
-                    w->inptrs;
-        }
-
-        for (; top < bottom; top++) {
-                bn = gfs64_to_cpu(*top);
-
-                pc(w, height, bn, data);
-
-                if (bn && height < w->di.di_height - 1)
-                        recursive_scan(w, height + 1, bn, pc, data);
-        }
-}
-
-/**
- * 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) {
-                                if (pf->height == w->di.di_height) {
-                                        add_extent(w, pf->offset, pf->start,
-                                                   pf->len);
-                                        add_lblk_range(lblk_range_list, 
-                                                       pf->offset, pf->len);
-                                }
-                        }
-
-                        pf->offset += pf->skip;
-                        pf->start = bn;
-                        pf->len = 1;
-                        pf->skip = 1;
-                }
-        }
-}
-
-/**
- * get_dblk_ranges - Run through the file and add valid data block ranges to 
- *                   lblk_range_list
- * @w: the world
- *
- */
-
-static void
-get_dblk_ranges(world_t *w)
-{
-        do_pf_t pf;
-        unsigned int h;
-
-        for (h = 1; h <= w->di.di_height; h++) {
-
-                memset(&pf, 0, sizeof(do_pf_t));
-                pf.height = h;
-
-                recursive_scan(w, 0, 0, do_pf, &pf);
-
-                if (pf.start) {
-                        if (h == w->di.di_height) {
-                                add_extent(w, pf.offset, pf.start, pf.len);
-                                add_lblk_range(lblk_range_list, pf.offset, 
-                                               pf.len);
-                        }
-                }
-        }
-}
-
-/**
- * compute_layout - Computes the layout and store the valid data page ranges 
- *                  in lblk_range_list
- * @argc:
- * @argv:
- *
- */
-
-void
-compute_layout(char *path)
-{
-        world_t w;
-        int fd;
-        int retry = TRUE;
-        struct gfs_ioctl gi;
-        int error;
-
-        memset(&w, 0, sizeof(world_t));
-        w.buf_size = LAYOUT_DATA_QUANTUM;
-        osi_list_init(&w.blist);
-        osi_list_init(&w.elist);
-
-
-        fd = open(path, O_RDONLY);
-        if (fd < 0)
-                die("can't open %s: %s\n", path, strerror(errno));
-
-        check_for_gfs(fd, path);
-
-        {
-                char *argv[] = { "get_super" };
-
-                gi.gi_argc = 1;
-                gi.gi_argv = argv;
-                gi.gi_data = (char *)&w.sb;
-                gi.gi_size = sizeof(struct gfs_sb);
-
-                error = ioctl(fd, GFS_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 gfs_dinode)) /
-                sizeof(uint64_t);
-        w.inptrs = (w.sb.sb_bsize - sizeof(struct gfs_indirect)) /
-                sizeof(uint64_t);
-        w.jbsize = w.sb.sb_bsize - sizeof(struct gfs_meta_header);
-        j_blk_size = w.jbsize;
-        w.hash_bsize = w.sb.sb_bsize / 2;
-        w.hash_ptrs = w.hash_bsize / sizeof(uint64_t);
-
-        for (;;) {
-                char *argv[] = { "get_file_meta_quota" };
-
-                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(fd, GFS_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);
-
-        get_dblk_ranges(&w);
-
-        close(fd);
-}
-
-/**
- * print_quota_range - print the quota information in the given sequence of 
- *                     blocks
- * @argc:
- * @argv:
- *
- */
-void 
-print_quota_range(commandline_t *comline, int type, uint64_t start, 
-                  unsigned int len)
-{
-        uint64_t blk_offt, blk_end_offt, offset;
-        uint64_t quo;
-        unsigned int rem;
-        int fd;
-        struct gfs_sb sb;
-        struct gfs_ioctl gi;
-        char buf[sizeof(struct gfs_quota)];
-        struct gfs_quota q;
-        uint64_t hidden_blocks = 0;
-        uint32_t id;
-        int error;
-
-        blk_offt = start * (uint64_t)j_blk_size;
-        blk_end_offt = blk_offt + (uint64_t)(len * j_blk_size);
-
-        quo = blk_offt / (uint64_t)(2 * sizeof(struct gfs_quota));
-        rem = blk_offt % (uint64_t)(2 * sizeof(struct gfs_quota));
-        
-        offset = type == GQ_ID_USER ? blk_offt : 
-                blk_offt + sizeof(struct gfs_quota);
-        
-        if (rem && type == GQ_ID_USER)
-                offset = (quo + 1) * (uint64_t)(2 * sizeof(struct gfs_quota));
-        
-        if (rem && type == GQ_ID_GROUP) {
-                if (rem <= sizeof(struct gfs_quota))
-                        offset = quo * (uint64_t)(2 * sizeof(struct gfs_quota))
-                                + sizeof(struct gfs_quota);
-                else
-                        offset = (quo + 1) * 
-                                (uint64_t)(2 * sizeof(struct gfs_quota)) + 
-                                sizeof(struct gfs_quota);
-        }
-
-        fd = open(comline->filesystem, O_RDONLY);
-        if (fd < 0)
-                die("can't open file %s: %s\n", comline->filesystem, 
-                    strerror(errno));
-
-        check_for_gfs(fd, comline->filesystem);
-        do_get_super(fd, &sb);
-        
-        if (comline->no_hidden_file_blocks)
-                hidden_blocks = compute_hidden_blocks(comline, fd);
-
-        do {
-                char *argv[] = { "do_hfile_read", "quota" };
-
-                gi.gi_argc = 2;
-                gi.gi_argv = argv;
-                gi.gi_data = buf;
-                gi.gi_size = sizeof(struct gfs_quota);
-                gi.gi_offset = offset;
-                
-                memset(buf, 0, sizeof(struct gfs_quota));
-                
-                error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-                if (error < 0)
-                        die("can't read quota file: %s\n",
-                            strerror(errno));
-                
-                gfs_quota_in(&q, buf);
-                
-                id = (offset / sizeof(struct gfs_quota)) >> 1;
-                if (!id && comline->no_hidden_file_blocks)
-                        q.qu_value -= hidden_blocks;
-                
-                if (q.qu_limit || q.qu_warn || q.qu_value)
-                        print_quota(comline, type == GQ_ID_GROUP ? FALSE : TRUE,
-                                    id, &q, &sb);
-
-                offset += 2 * sizeof(struct gfs_quota);
-        } while ((error == sizeof(struct gfs_quota)) && 
-                 (offset < blk_end_offt));
-        
-        close(fd);
-}
-
-void 
-print_quota_file(commandline_t *comline)
-{
-        lblk_range_t lblk_range, *bar;
-        osi_list_t *t, *x;
-
-        lblk_range_list = &lblk_range;
-
-        osi_list_init(&lblk_range_list->list);
-        
-        compute_layout(comline->filesystem);
-        
-        if (osi_list_empty(&lblk_range_list->list)) {
-                /* stuffed quota inode */
-                print_quota_range(comline, GQ_ID_USER, 0, 1);
-                print_quota_range(comline, GQ_ID_GROUP, 0, 1);
-        } else {
-                /* print the user quotas */
-                osi_list_foreach(t, &lblk_range_list->list) {
-                        bar = osi_list_entry(t, lblk_range_t, list);
-                        print_quota_range(comline, GQ_ID_USER, bar->start, 
-                                          bar->len);
-                }
-                /* print the group quotas */
-                osi_list_foreach(t, &lblk_range_list->list) {
-                        bar = osi_list_entry(t, lblk_range_t, list);
-                        print_quota_range(comline, GQ_ID_GROUP, bar->start, 
-                                          bar->len);
-                }
-                /* free the list */
-                osi_list_foreach_safe(t, &lblk_range_list->list, x) {
-                        bar = osi_list_entry(t, lblk_range_t, list);
-                        osi_list_del(&bar->list);
-                        free(bar);
-                }
-        }
-}
diff --git a/gfs/gfs_quota/main.c b/gfs/gfs_quota/main.c
deleted file mode 100644
index abdbeaf..0000000
--- a/gfs/gfs_quota/main.c
+++ /dev/null
@@ -1,734 +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 <limits.h>
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <stdint.h>
-#include <inttypes.h>
-
-#include "linux_endian.h"
-#include "gfs_ondisk.h"
-#define __user
-#include "gfs_ioctl.h"
-
-#include "copyright.cf"
-
-#include "gfs_quota.h"
-
-/*  Constants  */
-
-#define OPTION_STRING ("bdf:g:hkl:mnsu:V")
-
-char *prog_name;
-
-/**
- * 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("\n");
-	printf("Options:\n");
-	printf("  -b               sizes are in FS blocks\n");
-	printf("  -d               don't include hidden inode 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");
-}
-
-/**
- * check_for_gfs - Check to see if a descriptor is a file on a GFS filesystem
- * @fd: the file descriptor
- * @path: the path used to open the descriptor
- *
- */
-
-void
-check_for_gfs(int fd, char *path)
-{
-	unsigned int magic = 0;
-	int error;
-
-	error = ioctl(fd, GFS_IOCTL_IDENTIFY, &magic);
-	if (error || magic != GFS_MAGIC)
-		die("%s is not a GFS file/filesystem\n", path);
-}
-
-/**
- * do_get_super
- * fd:
- * sb:
- *
- */
-
-void
-do_get_super(int fd, struct gfs_sb *sb)
-{
-	struct gfs_ioctl gi;
-	char *argv[] = { "get_super" };
-	int error;
-
-	gi.gi_argc = 1;
-	gi.gi_argv = argv;
-	gi.gi_data = (char *)sb;
-	gi.gi_size = sizeof(struct gfs_sb);
-
-	error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-	if (error != gi.gi_size)
-		die("can't read the superblock (%d): %s\n",
-		    error, strerror(errno));
-}
-
-/**
- * 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 'd':
-			comline->no_hidden_file_blocks = TRUE;
-			break;
-
-		case 'n':
-			comline->numbers = TRUE;
-			break;
-
-		case 'V':
-			printf("gfs_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
-			die("unknown option %s\n", argv[optind]);
-
-		optind++;
-	}
-}
-
-/**
- * compute_hidden_blocks - figure out how much space the hidden inodes use
- * @comline: the struct containing the parsed command line arguments
- * @fd: the filedescriptor to the filesystem
- *
- * Returns: the number of hidden blocks
- */
-
-uint64_t
-compute_hidden_blocks(commandline_t *comline, int fd)
-{
-	struct gfs_dinode di;
-	struct gfs_ioctl gi;
-	uint64_t hidden_blocks = 0;
-	int error;
-
-	{
-		char *argv[] = { "get_hfile_stat", "jindex" };
-
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;	
-		gi.gi_data = (char *)&di;
-		gi.gi_size = sizeof(struct gfs_dinode);
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error != gi.gi_size)
-			die("can't stat jindex (%d): %s\n",
-			    error, strerror(errno));
-		hidden_blocks += di.di_blocks;
-	}
-
-	{
-		char *argv[] = { "get_hfile_stat", "rindex" };
-
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;	
-		gi.gi_data = (char *)&di;
-		gi.gi_size = sizeof(struct gfs_dinode);
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error != gi.gi_size)
-			die("can't stat rindex (%d): %s\n",
-			    error, strerror(errno));
-		hidden_blocks += di.di_blocks;
-	}
-
-	{
-		char *argv[] = { "get_hfile_stat", "quota" };
-
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;	
-		gi.gi_data = (char *)&di;
-		gi.gi_size = sizeof(struct gfs_dinode);
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error != gi.gi_size)
-			die("can't stat quota file (%d): %s\n",
-			    error, strerror(errno));
-		hidden_blocks += di.di_blocks;
-	}
-
-	{
-		char *argv[] = { "get_hfile_stat", "license" };
-
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;	
-		gi.gi_data = (char *)&di;
-		gi.gi_size = sizeof(struct gfs_dinode);
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error != gi.gi_size)
-			die("can't stat license file (%d): %s\n",
-			    error, strerror(errno));
-		hidden_blocks += di.di_blocks;
-	}
-
-	return hidden_blocks;
-}
-
-/**
- * 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
- *
- */
-
-void
-print_quota(commandline_t *comline,
-	    int user, uint32_t id,
-	    struct gfs_quota *q,
-	    struct gfs_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: %-10"PRIu64" warn: %-10"PRIu64"value: %-10"PRId64"\n",
-			       q->qu_limit / 2,
-			       q->qu_warn / 2,
-			       q->qu_value / 2);
-		else
-			printf("limit: %-10"PRIu64" warn: %-10"PRIu64"value: %-10"PRId64"\n",
-			       q->qu_limit << (sb->sb_bsize_shift - 10),
-			       q->qu_warn << (sb->sb_bsize_shift - 10),
-			       q->qu_value << (sb->sb_bsize_shift - 10));
-		break;
-
-	case GQ_UNITS_FSBLOCK:
-		printf("limit: %-10"PRIu64" warn: %-10"PRIu64" value: %-10"PRId64"\n",
-		       q->qu_limit, q->qu_warn, q->qu_value);
-		break;
-
-	case GQ_UNITS_BASICBLOCK:
-		printf("limit: %-10"PRIu64" warn: %-10"PRIu64" value: %-10"PRId64"\n",
-		       q->qu_limit << (sb->sb_bsize_shift - 9),
-		       q->qu_warn << (sb->sb_bsize_shift - 9),
-		       q->qu_value << (sb->sb_bsize_shift - 9));
-		break;
-
-	default:
-		die("bad units\n");
-		break;
-	}
-}
-
-/**
- * do_list - List all the quota data for a filesystem
- * @comline: the struct containing the parsed command line arguments
- *
- */
-
-static void
-do_list(commandline_t *comline)
-{
-	print_quota_file(comline);
-}
-
-/**
- * do_sync_one - sync the quotas on one GFS filesystem
- * @path: a file/directory in the filesystem
- *
- */
-
-static void
-do_sync_one(char *filesystem)
-{
-	int fd;
-	char *argv[] = { "do_quota_sync" };
-	struct gfs_ioctl gi;
-	int error;
-
-	fd = open(filesystem, O_RDONLY);
-	if (fd < 0)
-		die("can't open file %s: %s\n", filesystem, strerror(errno));
-
-	check_for_gfs(fd, filesystem);
-
-	gi.gi_argc = 1;
-	gi.gi_argv = argv;
-
-	error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-	if (error)
-		die("can't sync quotas: %s\n", strerror(errno));
-
-	close(fd);
-}
-
-/**
- * do_sync - sync out unsyned quotas
- * @comline: the struct containing the parsed command line arguments
- *
- */
-
-void
-do_sync(commandline_t *comline)
-{
-	sync();
-
-	if (*comline->filesystem)
-		do_sync_one(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, "gfs") != 0)
-				continue;
-
-			do_sync_one(path);
-		}
-
-		fclose(file);
-	}
-}
-
-/**
- * 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(commandline_t *comline, char *filesystem)
-{
-	int fd;
-	char buf[256];
-	struct gfs_ioctl gi;
-	struct gfs_quota q;
-	struct gfs_sb sb;
-	int error;
-
-	fd = open(filesystem, O_RDONLY);
-	if (fd < 0)
-		die("can't open file %s: %s\n", comline->filesystem,
-		    strerror(errno));
-
-	check_for_gfs(fd, filesystem);
-
-	sprintf(buf, "%s:%u",
-		(comline->id_type == GQ_ID_USER) ? "u" : "g",
-		comline->id);
-
-	{
-		char *argv[] = { "do_quota_read", buf };
-
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;
-		gi.gi_data = (char *)&q;
-		gi.gi_size = sizeof(struct gfs_quota);
-
-		memset(&q, 0, sizeof(struct gfs_quota));
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error < 0)
-			die("can't get quota info (%d): %s\n",
-			    error, strerror(errno));
-	}
-
-	if (comline->no_hidden_file_blocks && !comline->id)
-		q.qu_value -= compute_hidden_blocks(comline, fd);
-
-	do_get_super(fd, &sb);
-
-	print_quota(comline,
-		    (comline->id_type == GQ_ID_USER), comline->id,
-		    &q, &sb);
-
-	close(fd);
-}
-
-/**
- * do_get - Get a quota value
- * @comline: the struct containing the parsed command line arguments
- *
- */
-
-static void
-do_get(commandline_t *comline)
-{
-	int first = TRUE;
-
-	if (*comline->filesystem)
-		do_get_one(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, "gfs") != 0)
-				continue;
-
-			if (first)
-				first = FALSE;
-			else
-				printf("\n");
-
-			printf("%s:\n", path);
-			do_get_one(comline, path);
-		}
-
-		fclose(file);
-	}
-}
-
-/**
- * do_set - Set a quota value
- * @comline: the struct containing the parsed command line arguments
- *
- */
-
-static void
-do_set(commandline_t *comline)
-{
-	int fd;
-	uint64_t offset;
-	struct gfs_ioctl gi;
-	struct gfs_sb sb;
-	uint64_t new_value;
-	char buf[256];
-	int error;
-
-	if (!*comline->filesystem)
-		die("need a filesystem to work on\n");
-	if (!comline->new_value_set)
-		die("need a new value\n");
-
-	fd = open(comline->filesystem, O_RDONLY);
-	if (fd < 0)
-		die("can't open file %s: %s\n", comline->filesystem,
-		    strerror(errno));
-
-	check_for_gfs(fd, comline->filesystem);
-
-	switch (comline->id_type) {
-	case GQ_ID_USER:
-		offset = (2 * (uint64_t)comline->id) * sizeof(struct gfs_quota);
-		break;
-
-	case GQ_ID_GROUP:
-		offset = (2 * (uint64_t)comline->id + 1) * sizeof(struct gfs_quota);
-		break;
-
-	default:
-		die("invalid user/group ID\n");
-		break;
-	}
-
-	switch (comline->operation) {
-	case GQ_OP_LIMIT:
-		offset += (unsigned long)(&((struct gfs_quota *) NULL)->qu_limit);
-		break;
-
-	case GQ_OP_WARN:
-		offset += (unsigned long)(&((struct gfs_quota *) NULL)->qu_warn);
-		break;
-
-	default:
-		die("invalid operation\n");
-		break;
-	};
-
-	do_get_super(fd, &sb);
-
-	switch (comline->units) {
-	case GQ_UNITS_MEGABYTE:
-		new_value = comline->new_value << (20 - sb.sb_bsize_shift);
-		break;
-
-	case GQ_UNITS_KILOBYTE:
-		if (sb.sb_bsize == 512)
-			new_value = comline->new_value * 2;
-		else
-			new_value = comline->new_value >> (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 >> (sb.sb_bsize_shift - 9);
-		break;
-
-	default:
-		die("bad units\n");
-		break;
-	}
-
-	new_value = cpu_to_gfs64(new_value);
-
-	{
-		char *argv[] = { "do_hfile_write", "quota" };
-
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;
-		gi.gi_data = (char *)&new_value;
-		gi.gi_size = sizeof(uint64_t);
-		gi.gi_offset = offset;
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error != gi.gi_size)
-			die("can't write quota file (%d): %s\n",
-			    error, strerror(errno));
-	}
-
-	sprintf(buf, "%s:%u",
-		(comline->id_type == GQ_ID_USER) ? "u" : "g",
-		comline->id);
-
-	{
-		char *argv[] = { "do_quota_refresh", buf };
-
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error)
-			die("can't refresh the quota LVB: %s\n",
-			    strerror(errno));
-	}
-
-	close(fd);
-}
-
-/**
- * main - Do everything
- * @argc: well, it's argc...
- * @argv: well, it's argv...
- *
- * Returns: exit status
- */
-
-int
-main(int argc, char *argv[])
-{
-	commandline_t comline;
-
-	prog_name = argv[0];
-
-	memset(&comline, 0, sizeof(commandline_t));
-
-	decode_arguments(argc, argv, &comline);
-
-	switch (comline.operation) {
-	case GQ_OP_LIST:
-		do_list(&comline);
-		break;
-
-	case GQ_OP_SYNC:
-		do_sync(&comline);
-		break;
-
-	case GQ_OP_GET:
-		do_get(&comline);
-		break;
-
-	case GQ_OP_LIMIT:
-	case GQ_OP_WARN:
-		do_set(&comline);
-		break;
-
-	case GQ_OP_CHECK:
-		do_sync(&comline);
-		do_sync(&comline);
-		do_check(&comline);
-		break;
-
-	case GQ_OP_INIT:
-		do_sync(&comline);
-		do_sync(&comline);
-		do_init(&comline);
-		break;
-
-	default:
-		if (!comline.id_type) {
-			comline.id_type = GQ_ID_USER;
-			comline.id = geteuid();
-		}
-		do_get(&comline);
-		break;
-	}
-
-	exit(EXIT_SUCCESS);
-}
diff --git a/gfs/gfs_quota/names.c b/gfs/gfs_quota/names.c
deleted file mode 100644
index fd4ade8..0000000
--- a/gfs/gfs_quota/names.c
+++ /dev/null
@@ -1,84 +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 "gfs_ondisk.h"
-
-#include "gfs_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/gfs/gfs_quota/ondisk.c b/gfs/gfs_quota/ondisk.c
deleted file mode 100644
index 191c688..0000000
--- a/gfs/gfs_quota/ondisk.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-
-#include "linux_endian.h"
-#include "gfs_ondisk.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/gfs/gfs_tool/Makefile b/gfs/gfs_tool/Makefile
deleted file mode 100644
index 31a8cf8..0000000
--- a/gfs/gfs_tool/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-TARGET= gfs_tool
-
-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=	counters.o \
-	df.o \
-	layout.o \
-	main.o \
-	misc.o \
-	ondisk.o \
-	sb.o \
-	tune.o \
-	util.o
-
-CFLAGS += -D_FILE_OFFSET_BITS=64
-CFLAGS += -I${gfskincdir}
-CFLAGS += -I$(S)/../include
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${libdir}
-
-${TARGET}: ${OBJS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/gfs/gfs_tool/counters.c b/gfs/gfs_tool/counters.c
deleted file mode 100644
index 641428a..0000000
--- a/gfs/gfs_tool/counters.c
+++ /dev/null
@@ -1,202 +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>
-
-#define __user
-#include "gfs_ioctl.h"
-#include "osi_list.h"
-
-#include "gfs_tool.h"
-
-#define SIZE (4096)
-
-struct token_list {
-	osi_list_t list;
-	char *token;
-	unsigned int last;
-};
-
-static osi_list_decl(token_list);
-
-/**
- * find_update_last - find and update the last value of a token
- * @token: the token to look for
- * @this: the current value of the token
- *
- * Returns: the last value of the token
- */
-
-static unsigned int
-find_update_last(char *token, unsigned int this)
-{
-	osi_list_t *tmp, *head;
-	struct token_list *tl;
-	unsigned int last;
-
-	for (head = &token_list, tmp = head->next; tmp != head; tmp = tmp->next) {
-		tl = osi_list_entry(tmp, struct token_list, list);
-		if (strcmp(tl->token, token))
-			continue;
-
-		last = tl->last;
-		tl->last = this;
-		return last;
-	}
-
-	tl = malloc(sizeof (struct token_list) + strlen(token) + 1);
-	if (!tl)
-		die("out of memory\n");
-	tl->token = (char *) (tl + 1);
-	strcpy(tl->token, token);
-	tl->last = this;
-	osi_list_add(&tl->list, &token_list);
-
-	return 0;
-}
-
-/**
- * print_line - print out a counter
- * @token: the name of the counter
- * @description: the text description of the counter
- * @option: an optional modifier
- * @value: the value of the counter
- *
- */
-
-static void
-print_line(char *token, char *description, char *option, char *value)
-{
-	static unsigned int sd_log_seg_free;
-	unsigned int this, last;
-
-	if (!strcmp(token, "sd_log_seg_free"))
-		sscanf(value, "%u", &sd_log_seg_free);
-
-	else if (!strcmp(token, "ji_nsegment")) {
-		sscanf(value, "%u", &this);
-		printf("%39s %.2f%%\n",
-		       "log space used",
-		       100.0 * (this - sd_log_seg_free) / this);
-
-	} else if (continuous && !strcmp(option, "diff")) {
-		sscanf(value, "%u", &this);
-		last = find_update_last(token, this);
-		printf("%39s %-10s %d/s\n",
-		       description, value,
-		       (this - last + interval - 1) / interval);
-
-	} else
-		printf("%39s %s\n", description, value);
-}
-
-/**
- * parse_line: break up a chunk of data into counter fields
- * @buf: the data
- * @count: the number of bytes of data
- *
- */
-
-static void
-parse_lines(char *buf, unsigned int count)
-{
-	char line[SIZE];
-	char part1[SIZE], part2[SIZE], part3[SIZE], part4[SIZE];
-	char *c, *c2;
-	unsigned int x;
-
-	printf("\n");
-
-	while (count) {
-		for (c = line; count; c++) {
-			*c = *buf;
-			buf++;
-			count--;
-			if (*c == '\n')
-				break;
-		}
-		*c = 0;
-
-		*part1 = *part2 = *part3 = *part4 = 0;
-
-		for (c = line, x = 0; (c2 = strsep(&c, ":")); x++) {
-			if (!*c2)
-				continue;
-
-			if (x == 0)
-				strcpy(part1, c2);
-			else if (x == 1)
-				strcpy(part2, c2);
-			else if (x == 2)
-				strcpy(part3, c2);
-			else
-				strcpy(part4, c2);
-		}
-
-		if (x == 4)
-			print_line(part1, part2, part3, part4);
-	}
-}
-
-/**
- * print_counters - print out the current countersable parameters for a filesystem
- * @argc:
- * @argv:
- *
- */
-
-void
-print_counters(int argc, char **argv)
-{
-	char *fs;
-	int fd;
-
-	if (optind < argc)
-		fs = argv[optind++];
-	else
-		die("Usage: gfs_tool counters <mountpoint>\n");
-
-	fd = open(fs, O_RDONLY);
-	if (fd < 0)
-		die("can't open file %s: %s\n", fs, strerror(errno));
-
-	check_for_gfs(fd, fs);
-
-	for (;;) {
-		struct gfs_ioctl gi;
-		char *argv[] = { "get_counters" };
-		char data[SIZE];
-		int error;
-
-		gi.gi_argc = 1;
-		gi.gi_argv = argv;
-		gi.gi_data = data;
-		gi.gi_size = SIZE;
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error < 0)
-			die("can't get counters: %s\n", strerror(errno));
-
-		if (debug)
-			error = write(STDOUT_FILENO, data, error);
-
-		parse_lines(data, error);
-
-		if (!continuous)
-			break;
-
-		fflush(stdout);
-
-		sleep(interval);
-	}
-
-	close(fd);
-}
diff --git a/gfs/gfs_tool/decipher_lockstate_dump b/gfs/gfs_tool/decipher_lockstate_dump
deleted file mode 100644
index 10080a5..0000000
--- a/gfs/gfs_tool/decipher_lockstate_dump
+++ /dev/null
@@ -1,172 +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/)
-	{
-	    $locks[$ln++] .= "\n" if (!$nosort && $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/\(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] /;
-	}
-	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)/none[$1]/;
-	    $line =~ s/(1)/regular[$1]/;
-	    $line =~ s/(2)/directory[$1]/;
-	    $line =~ s/(5)/symbolic link[$1]/;
-	    $line =~ s/(7)/block device[$1]/;
-	    $line =~ s/(8)/character device[$1]/;
-	    $line =~ s/(101)/fifo[$1]/;
-	    $line =~ s/(102)/socket[$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;
-	$ln++ if ($nosort);
-    }
-
-    close(FILE);
-}
-
-
-@locks = sort funky @locks unless ($nosort);
-
-
-foreach $lock (@locks)
-{
-    print $lock;
-}
-
-
-
-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/gfs/gfs_tool/df.c b/gfs/gfs_tool/df.c
deleted file mode 100644
index 26aa65a..0000000
--- a/gfs/gfs_tool/df.c
+++ /dev/null
@@ -1,257 +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>
-
-#define __user
-#include "gfs_ioctl.h"
-#include "gfs_ondisk.h"
-
-#include "gfs_tool.h"
-
-#define SIZE (4096)
-
-/**
- * do_df_one - print out information about one filesystem
- * @path: the path to the filesystem
- *
- */
-
-static void
-do_df_one(char *path)
-{
-	int fd;
-	struct gfs_ioctl gi;
-	char stat_gfs[SIZE], args[SIZE], lockstruct[SIZE];
-	struct gfs_sb sb;
-	struct gfs_dinode ji, ri;
-	uint64_t journals, rgrps;
-	uint64_t used_data;
-	unsigned int flags;
-	unsigned int percentage;
- 	int error;
-
-
-	fd = open(path, O_RDONLY);
-	if (fd < 0)
-		die("can't open %s: %s\n", path, strerror(errno));
-
-	check_for_gfs(fd, path);
-
-
-	{
-		char *argv[] = { "get_stat_gfs" };
-
-		gi.gi_argc = 1;
-		gi.gi_argv = argv;
-		gi.gi_data = stat_gfs;
-		gi.gi_size = SIZE;
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error < 0)
-			die("error doing get_stat_gfs (%d): %s\n",
-			    error, strerror(errno));
-	}
-	{
-		char *argv[] = { "get_super" };
-
-		gi.gi_argc = 1;
-		gi.gi_argv = argv;
-		gi.gi_data = (char *)&sb;
-		gi.gi_size = sizeof(struct gfs_sb);
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error != gi.gi_size)
-			die("error doing get_super (%d): %s\n",
-			    error, strerror(errno));
-	}
-	{
-		char *argv[] = { "get_args" };
-
-		gi.gi_argc = 1;
-		gi.gi_argv = argv;
-		gi.gi_data = args;
-		gi.gi_size = SIZE;
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error < 0)
-			die("error doing get_args (%d): %s\n",
-			    error, strerror(errno));
-	}
-	{
-		char *argv[] = { "get_lockstruct" };
-
-		gi.gi_argc = 1;
-		gi.gi_argv = argv;
-		gi.gi_data = lockstruct;
-		gi.gi_size = SIZE;
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error < 0)
-			die("error doing get_lockstruct (%d): %s\n",
-			    error, strerror(errno));
-	}
-	{
-		char *argv[] = { "get_hfile_stat",
-				 "jindex" };
-
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;
-		gi.gi_data = (char *)&ji;
-		gi.gi_size = sizeof(struct gfs_dinode);
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error != gi.gi_size)
-			die("error doing get_hfile_stat for jindex (%d): %s\n",
-			    error, strerror(errno));
-	}
-	{
-		char *argv[] = { "get_hfile_stat",
-				 "rindex" };
-
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;
-		gi.gi_data = (char *)&ri;
-		gi.gi_size = sizeof(struct gfs_dinode);
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error != gi.gi_size)
-			die("error doing get_hfile_stat for rindex (%d): %s\n",
-			    error, strerror(errno));
-	}
-
-
-	close(fd);
-
-
-	journals = ji.di_size;
-	if (journals % sizeof(struct gfs_jindex))
-		die("bad jindex size\n");
-	journals /= sizeof(struct gfs_jindex);
-
-	rgrps = ri.di_size;
-	if (rgrps % sizeof(struct gfs_rindex))
-		die("bad rindex size\n");
-	rgrps /= sizeof(struct gfs_rindex);
-
-
-	used_data = name2u64(stat_gfs, "total_blocks") -
-		name2u64(stat_gfs, "free") -
-		(name2u64(stat_gfs, "used_dinode") + name2u64(stat_gfs, "free_dinode")) -
-		(name2u64(stat_gfs, "used_meta") + name2u64(stat_gfs, "free_meta"));
-
-
-	printf("%s:\n", path);
-	printf("  SB lock proto = \"%s\"\n", sb.sb_lockproto);
-	printf("  SB lock table = \"%s\"\n", sb.sb_locktable);
-	printf("  SB ondisk format = %u\n", sb.sb_fs_format);
-	printf("  SB multihost format = %u\n", sb.sb_multihost_format);
-	printf("  Block size = %u\n", name2u32(stat_gfs, "bsize"));
-	printf("  Journals = %"PRIu64"\n", journals);
-	printf("  Resource Groups = %"PRIu64"\n", rgrps);
-	printf("  Mounted lock proto = \"%s\"\n",
-	       (name2value(args, "lockproto")[0]) ?
-	       name2value(args, "lockproto") : sb.sb_lockproto);
-	printf("  Mounted lock table = \"%s\"\n",
-	       (name2value(args, "locktable")[0]) ?
-	       name2value(args, "locktable") : sb.sb_locktable);
-	printf("  Mounted host data = \"%s\"\n", name2value(args, "hostdata"));
-	printf("  Journal number = %u\n", name2u32(lockstruct, "jid"));
-	flags = name2u32(lockstruct, "flags");
-	printf("  Lock module flags = %x", flags);
-	printf("\n");
-	printf("  Local flocks = %s\n", (name2u32(args, "localflocks")) ? "TRUE" : "FALSE");
-	printf("  Local caching = %s\n", (name2u32(args, "localcaching")) ? "TRUE" : "FALSE");
-	printf("  Oopses OK = %s\n", (name2u32(args, "oopses_ok")) ? "TRUE" : "FALSE");
-	printf("\n");
-	printf("  %-15s%-15s%-15s%-15s%-15s\n", "Type", "Total", "Used", "Free", "use%");
-	printf("  ------------------------------------------------------------------------\n");
-
-	percentage = (name2u64(stat_gfs, "used_dinode") + name2u64(stat_gfs, "free_dinode")) ?
-		(100.0 * name2u64(stat_gfs, "used_dinode") / (name2u64(stat_gfs, "used_dinode") +
-							      name2u64(stat_gfs, "free_dinode")) + 0.5) : 0;
-	printf("  %-15s%-15"PRIu64"%-15"PRIu64"%-15"PRIu64"%u%%\n",
-	       "inodes",
-	       name2u64(stat_gfs, "used_dinode") + name2u64(stat_gfs, "free_dinode"),
-	       name2u64(stat_gfs, "used_dinode"),
-	       name2u64(stat_gfs, "free_dinode"),
-	       percentage);
-
-	percentage = (name2u64(stat_gfs, "used_meta") + name2u64(stat_gfs, "free_meta")) ?
-		(100.0 * name2u64(stat_gfs, "used_meta") / (name2u64(stat_gfs, "used_meta") +
-							    name2u64(stat_gfs, "free_meta")) + 0.5) : 0;
-	printf("  %-15s%-15"PRIu64"%-15"PRIu64"%-15"PRIu64"%u%%\n",
-	       "metadata",
-	       name2u64(stat_gfs, "used_meta") + name2u64(stat_gfs, "free_meta"),
-	       name2u64(stat_gfs, "used_meta"),
-	       name2u64(stat_gfs, "free_meta"),
-	       percentage);
-
-	percentage = (used_data + name2u64(stat_gfs, "free")) ?
-		(100.0 * used_data / (used_data + name2u64(stat_gfs, "free")) + 0.5) : 0;
-	printf("  %-15s%-15"PRIu64"%-15"PRIu64"%-15"PRIu64"%u%%\n",
-	       "data",
-	       used_data + name2u64(stat_gfs, "free"),
-	       used_data,
-	       name2u64(stat_gfs, "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, "gfs") != 0)
-				continue;
-
-			if (first)
-				first = FALSE;
-			else
-				printf("\n");
-
-			do_df_one(path);
-		}
-
-		fclose(file);
-	}
-}
-
-
diff --git a/gfs/gfs_tool/gfs_tool.h b/gfs/gfs_tool/gfs_tool.h
deleted file mode 100644
index 1e45d43..0000000
--- a/gfs/gfs_tool/gfs_tool.h
+++ /dev/null
@@ -1,90 +0,0 @@
-#ifndef __GFS_TOOL_DOT_H__
-#define __GFS_TOOL_DOT_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)
-
-
-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_jindex(int argc, char **argv);
-void print_rindex(int argc, char **argv);
-void print_quota(int argc, char **argv);
-void print_list(void);
-void reclaim_metadata(int argc, char **argv);
-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);
-
-
-/* From util.c */
-
-void check_for_gfs(int fd, char *path);
-char *get_list(void);
-char **str2lines(char *str);
-char *mp2cookie(char *mp, int ioctl_ok);
-char *name2value(char *str, char *name);
-uint32_t name2u32(char *str, char *name);
-uint64_t name2u64(char *str, char *name);
-
-
-#endif /* __GFS_TOOL_DOT_H__ */
diff --git a/gfs/gfs_tool/layout.c b/gfs/gfs_tool/layout.c
deleted file mode 100644
index e86e8f8..0000000
--- a/gfs/gfs_tool/layout.c
+++ /dev/null
@@ -1,842 +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>
-
-#define __user
-#include "gfs_ioctl.h"
-#include "gfs_ondisk.h"
-
-#include "osi_list.h"
-#include "linux_endian.h"
-
-#include "gfs_tool.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 gfs_sb sb;
-	unsigned int diptrs;
-	unsigned int inptrs;
-	unsigned int jbsize;
-	unsigned int hash_bsize;
-	unsigned int hash_ptrs;
-
-	buffer_t *dibh;
-	struct gfs_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);
-
-/**
- * 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 gfs_meta_header mh;
-	char *type;
-
-	for (tmp = w->blist.next; tmp != &w->blist; tmp = tmp->next) {
-		b = osi_list_entry(tmp, buffer_t, list);
-
-		gfs_meta_header_in(&mh, b->data);
-
-		if (mh.mh_magic != GFS_MAGIC)
-			die("bad magic number on block\n");
-
-		switch (mh.mh_type) {
-		case GFS_METATYPE_DI:
-			type = "GFS_METATYPE_DI";
-
-			if (w->dibh)
-				die("more than one dinode in file\n");
-			else {
-				w->dibh = b;
-				gfs_dinode_in(&w->di, b->data);
-
-				b->touched = TRUE;
-			}
-
-			break;
-		case GFS_METATYPE_IN:
-			type = "GFS_METATYPE_IN";
-			break;
-		case GFS_METATYPE_LF:
-			type = "GFS_METATYPE_LF";
-			break;
-		case GFS_METATYPE_JD:
-			type = "GFS_METATYPE_JD";
-			break;
-		case GFS_METATYPE_EA:
-			type = "GFS_METATYPE_EA";
-			break;
-		case GFS_METATYPE_ED:
-			die("GFS_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 gfs_dinode));
-		bottom =
-		    (uint64_t *) (b->data + sizeof(struct gfs_dinode)) +
-		    w->diptrs;
-	} else {
-		b = getbuf(w, block);
-
-		top = (uint64_t *) (b->data + sizeof(struct gfs_indirect));
-		bottom =
-		    (uint64_t *) (b->data + sizeof(struct gfs_indirect)) +
-		    w->inptrs;
-	}
-
-	for (; top < bottom; top++) {
-		bn = gfs64_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 & GFS_DIF_JDATA))
-		die("not a journaled file\n");
-
-	if (!w->di.di_height) {
-		if (offset >= w->sb.sb_bsize - sizeof(struct gfs_dinode))
-			memset(buf, 0, size);
-		else {
-			chunk =
-			    w->sb.sb_bsize - sizeof(struct gfs_dinode) -
-			    offset;
-			if (chunk > size)
-				chunk = size;
-			memcpy(buf,
-			       w->dibh->data + sizeof(struct gfs_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 gfs_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 gfs_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 = gfs64_to_cpu(lp[lp_offset]);
-		if (!leaf_no)
-			die("NULL leaf pointer\n");
-
-		b = getbuf(w, leaf_no);
-		gfs_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_type) {
-	case GFS_FILE_REG:
-		type = "File";
-		break;
-	case GFS_FILE_DIR:
-		type = "Directory";
-		break;
-	case GFS_FILE_LNK:
-		type = "Symbolic Link";
-		break;
-	case GFS_FILE_BLK:
-		type = "Block Device";
-		break;
-	case GFS_FILE_CHR:
-		type = "Character Device";
-		break;
-	case GFS_FILE_FIFO:
-		type = "FIFO";
-		break;
-	case GFS_FILE_SOCK:
-		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 (w->di.di_type == GFS_FILE_DIR) {
-			if (w->di.di_flags & GFS_DIF_EXHASH)
-				printf("\nStuffed hash table\n");
-		} else
-			printf("\nStuffed file data\n");
-
-		return;
-	}
-
-	for (h = 1; h <= w->di.di_height; h++) {
-		if (w->di.di_type == GFS_FILE_DIR)
-			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 gfs_leaf leaf;
-	uint64_t blk;
-
-	for (blk = leaf_no; blk; blk = leaf.lf_next) {
-		b = getbuf(w, blk);
-		gfs_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 & GFS_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 GFS_EA_REC_LEN(ea) gfs32_to_cpu((ea)->ea_rec_len)
-#define GFS_EA_IS_STUFFED(ea) (!(ea)->ea_num_ptrs)
-#define GFS_EA_IS_LAST(ea) ((ea)->ea_flags & GFS_EAFLAG_LAST)
-#define GFS_EA2NAME(ea) ((char *)((struct gfs_ea_header *)(ea) + 1))
-#define GFS_EA2DATAPTRS(ea) \
-((uint64_t *)(GFS_EA2NAME(ea) + MAKE_MULT8((ea)->ea_name_len)))
-#define GFS_EA2NEXT(ea) \
-((struct gfs_ea_header *)((char *)(ea) + GFS_EA_REC_LEN(ea)))
-#define GFS_EA_BH2FIRST(b) \
-((struct gfs_ea_header *)((b)->data + \
-			  sizeof(struct gfs_meta_header)))
-
-static void
-print_eattr_data(world_t *w, uint64_t blkno, int *first)
-{
-	buffer_t *b = getbuf(w, blkno);
-	struct gfs_ea_header *ea;
-
-	ea = GFS_EA_BH2FIRST(b);
-	for (;;) {
-		if (!GFS_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 == GFS_EATYPE_UNUSED)
-				strcpy(name, "unused");
-			else {
-				unsigned int x;
-				switch (ea->ea_type) {
-				case GFS_EATYPE_USR:
-					strcpy(name, "user.");
-					break;
-				case GFS_EATYPE_SYS:
-					strcpy(name, "system.");
-					break;
-				default:
-					strcpy(name, "unknown.");
-					break;
-				}
-				x = strlen(name);
-				memcpy(name + x,
-				       GFS_EA2NAME(ea), ea->ea_name_len);
-				name[x + ea->ea_name_len] = 0;
-			}
-
-			b = 0;
-			l = 0;
-			c = FALSE;
-
-			p = GFS_EA2DATAPTRS(ea);
-			for (x = 0; x < ea->ea_num_ptrs; x++) {
-				blkno = gfs64_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 (GFS_EA_IS_LAST(ea))
-			break;
-		ea = GFS_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 & GFS_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 gfs_indirect));
-		for (x = 0; x < w->inptrs; x++) {
-			if (!*blkno)
-				break;
-			printf("  %" PRIu64 "\n", gfs64_to_cpu(*blkno));
-			blkno++;
-		}
-
-		blkno = (uint64_t *) (b->data + sizeof(struct gfs_indirect));
-		for (x = 0; x < w->inptrs; x++) {
-			if (!*blkno)
-				break;
-			print_eattr_data(w, gfs64_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;
-	char *path;
-	int fd;
-	int retry = TRUE;
-	struct gfs_ioctl gi;
-	int error;
-
-	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: gfs_tool layout <filename> [buffersize]\n");
-
-	path = argv[optind++];
-	if (optind < argc ) {
-		w.buf_size = atoi(argv[3]);
-		retry = FALSE;
-	}
-
-	fd = open(path, O_RDONLY);
-	if (fd < 0)
-		die("can't open %s: %s\n", path, strerror(errno));
-
-	check_for_gfs(fd, path);
-
-	{
-		char *argv[] = { "get_super" };
-
-		gi.gi_argc = 1;
-		gi.gi_argv = argv;
-		gi.gi_data = (char *)&w.sb;
-		gi.gi_size = sizeof(struct gfs_sb);
-
-		error = ioctl(fd, GFS_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 gfs_dinode)) /
-		sizeof(uint64_t);
-	w.inptrs = (w.sb.sb_bsize - sizeof(struct gfs_indirect)) /
-		sizeof(uint64_t);
-	w.jbsize = w.sb.sb_bsize - sizeof(struct gfs_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(fd, GFS_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 (w.di.di_type == GFS_FILE_DIR)
-		print_leaves(&w);
-
-	if (w.di.di_eattr)
-		print_eattr(&w);
-
-	check_for_untouched_buffers(&w);
-
-	close(fd);
-}
diff --git a/gfs/gfs_tool/main.c b/gfs/gfs_tool/main.c
deleted file mode 100644
index 3de8580..0000000
--- a/gfs/gfs_tool/main.c
+++ /dev/null
@@ -1,264 +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 "copyright.cf"
-
-#include "gfs_tool.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",
-	"  gfs_tool clearflag flag <filenames>\n",
-	"\n",
-	"Print the counters for a filesystem\n",
-	"  gfs_tool counters <mountpoint>\n",
-	"\n",
-	"Do a GFS specific \"df\"\n",
-	"  gfs_tool df <mountpoint>\n",
-	"\n",
-	"Force files from a machine's cache\n",
-	"  gfs_tool flush <filenames>\n",
-	"\n",
-	"Freeze a GFS cluster:\n",
-	"  gfs_tool freeze <mountpoint>\n",
-	"\n",
-	"Print the superblock of a mounted filesystem:\n",
-	"  gfs_tool getsb <mountpoint>\n",
-	"\n",
-	"Get tuneable parameters for a filesystem\n",
-	"  gfs_tool gettune <mountpoint>\n",
-	"\n",
-	"Print the journal index of a mounted filesystem:\n",
-	"  gfs_tool jindex <mountpoint>\n",
-	"\n",
-	"Print out the ondisk layout for a file:\n",
-	"  gfs_tool layout <filename> [buffersize]\n",
-	"\n",
-	"List filesystems:\n",
-	"  gfs_tool list\n",
-	"\n",
-	"Have GFS dump its lock state:\n",
-	"  gfs_tool lockdump <mountpoint> [buffersize]\n",
-	"\n",
-	"Provide arguments for next mount:\n",
-	"  gfs_tool margs <mountarguments>\n",
-	"\n",
-	"Print the quota file of a mounted filesystem:\n",
-	"  gfs_tool quota <mountpoint>\n",
-	"\n",
-	"Free unused disk inodes:\n",
-	"  gfs_tool reclaim <mountpoint>\n",
-	"\n",
-	"Print the resource group index of a mounted filesystem:\n",
-	"  gfs_tool rindex <mountpoint>\n",
-	"\n",
-	"Tune a GFS superblock\n",
-	"  gfs_tool sb <device> proto [newval]\n",
-	"  gfs_tool sb <device> table [newval]\n",
-	"  gfs_tool sb <device> ondisk [newval]\n",
-	"  gfs_tool sb <device> multihost [newval]\n",
-	"  gfs_tool sb <device> all\n",
-	"\n",
-	"Set a flag on a inode\n",
-	"  gfs_tool setflag flag <filenames>\n",
-	"\n",
-	"Tune a running filesystem\n",
-	"  gfs_tool settune <mountpoint> <parameter> <value>\n",
-	"\n",
-	"Shrink a filesystem's inode cache:\n",
-	"  gfs_tool shrink <mountpoint>\n",
-	"\n",
-	"Print file stat data:\n",
-	"  gfs_tool stat <filename>\n",
-	"\n",
-	"Unfreeze a GFS cluster:\n",
-	"  gfs_tool unfreeze <mountpoint>\n",
-	"\n",
-	"Print tool version information\n",
-	"  gfs_tool version\n",
-	"\n",
-	"Withdraw this machine from participating in a filesystem:\n",
-	"  gfs_tool withdraw <mountpoint>\n",
-	"",
-};
-
-/**
- * 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("gfs_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 (FALSE) {
-		/* Do Nothing */
-	} else if (strcmp(action, "clearflag") == 0)
-		set_flag(argc, argv);
-	else if (strcmp(action, "counters") == 0)
-		print_counters(argc, argv);
-	else if (strcmp(action, "df") == 0)
-		print_df(argc, argv);
-	else if (strcmp(action, "flush") == 0)
-		do_file_flush(argc, argv);
-	else if (strcmp(action, "freeze") == 0)
-		do_freeze(argc, argv);
-	else if (strcmp(action, "getsb") == 0)
-		print_sb(argc, argv);
-	else if (strcmp(action, "gettune") == 0)
-		get_tune(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, "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, "quota") == 0)
-		print_quota(argc, argv);
-	else if (strcmp(action, "reclaim") == 0)
-		reclaim_metadata(argc, argv);
-	else if (strcmp(action, "rindex") == 0)
-		print_rindex(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, "stat") == 0)
-		print_stat(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);
-	else
-		die("unknown action: %s\n",
-		    action);
-
-	exit(EXIT_SUCCESS);
-}
diff --git a/gfs/gfs_tool/misc.c b/gfs/gfs_tool/misc.c
deleted file mode 100644
index bd699f2..0000000
--- a/gfs/gfs_tool/misc.c
+++ /dev/null
@@ -1,731 +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>
-
-#define __user
-#include "gfs_ioctl.h"
-#include "gfs_ondisk.h"
-
-#include "gfs_tool.h"
-
-/**
- * do_file_flush - 
- * @argc:
- * @argv:
- *
- */
-
-void
-do_file_flush(int argc, char **argv)
-{
-	char *gi_argv[] = { "do_file_flush" };
-	struct gfs_ioctl gi;
-	int fd;
-	int error;
-
-	if (optind == argc)
-		die("Usage: gfs_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));
-
-		check_for_gfs(fd, argv[optind]);
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error)
-			die("error doing do_file_flush (%d): %s\n",
-			    error, strerror(errno));
-
-		close(fd);
-	}
-}
-
-/**
- * do_freeze - freeze a GFS filesystem
- * @argc:
- * @argv:
- *
- */
-
-void
-do_freeze(int argc, char **argv)
-{
-	char *command = argv[optind - 1];
-	char *cookie;
-	int fd;
-	char buf[256];
-	int x;
-
-	if (optind == argc)
-		die("Usage: gfs_tool %s <mountpoint>\n",
-		    command);
-
-	cookie = mp2cookie(argv[optind], FALSE);
-	x = sprintf(buf, "%s %s\n", command, cookie);
-
-	fd = open("/proc/fs/gfs", O_RDWR);
-	if (fd < 0)
-		die("can't open /proc/fs/gfs: %s\n",
-		    strerror(errno));
-
-	if (write(fd, buf, x) != x)
-		die("can't write %s command: %s\n",
-		    command, strerror(errno));
-	if (read(fd, buf, 256))
-		die("can't %s %s: %s\n",
-		    command, argv[optind], strerror(errno));
-
-	close(fd);
-	sync();
-}
-
-/**
- * print_lockdump -
- * @argc:
- * @argv:
- *
- */
-
-void
-print_lockdump(int argc, char **argv)
-{
-	int fd;
-	char *mp, *cookie;
-	unsigned int size = 4194304;
-	char *data;
-	char command[256];
-	int retry = TRUE;
-	int x, count;
-
-
-	if (optind < argc)
-		mp = argv[optind++];
-	else
-		die("Usage: gfs_tool lockdump <mountpoint> [buffersize]\n");
-
-	if (optind < argc) {
-		sscanf(argv[optind++], "%u", &size);
-		retry = FALSE;
-	}
-
-	cookie = mp2cookie(mp, FALSE);
-	x = sprintf(command, "lockdump %s\n", cookie);
-
-
-	fd = open("/proc/fs/gfs", O_RDWR);
-	if (fd < 0)
-		die("can't open /proc/fs/gfs: %s\n",
-		    strerror(errno));
-
-	for (;;) {
-		data = malloc(size);
-		if (!data)
-			die("out of memory\n");
-
-		if (write(fd, command, x) != x)
-			die("can't write lockdump command: %s\n",
-			    strerror(errno));
-		count = read(fd, data, size);
-		if (count >= 0)
-			break;
-
-		if (errno == ENOMEM) {
-			if (retry) {
-				free(data);
-				size += 4194304;
-				continue;
-			} else
-				die("%u bytes isn't enough memory\n", size);
-		}
-		die("error doing lockdump: %s\n",
-		    strerror(errno));
-	}
-
-	close(fd);
-
-
-	x = write(STDOUT_FILENO, data, count);
-
-	free(data);
-}
-
-/**
- * margs -
- * @argc:
- * @argv:
- *
- */
-
-void
-margs(int argc, char **argv)
-{
-	int fd;
-	char *buf;
-	unsigned int x;
-
-	if (optind == argc)
-		die("Usage: gfs_tool margs <mountarguments>\n");
-
-	x = strlen(argv[optind]) + 7;
-	buf = malloc(x + 1);
-	if (!buf)
-		die("out of memory\n");
-	sprintf(buf, "margs %s\n", argv[optind]);
-
-	fd = open("/proc/fs/gfs", O_RDWR);
-	if (fd < 0)
-		die("can't open /proc/fs/gfs: %s\n",
-		    strerror(errno));
- 
-	if (write(fd, buf, x) != x)
-		die("can't write margs command: %s\n",
-		    strerror(errno));
-	if (read(fd, buf, x))
-		die("can't set mount args: %s\n",
-		    strerror(errno));
-
-	close(fd);
-}
-
-/**
- * print_flags - print the flags in a dinode's di_flags field
- * @di: the dinode structure
- *
- */
-
-static void
-print_flags(struct gfs_dinode *di)
-{
-	if (di->di_flags) {
-		printf("Flags:\n");
-		if (di->di_flags & GFS_DIF_JDATA)
-			printf("  jdata\n");
-		if (di->di_flags & GFS_DIF_EXHASH)
-			printf("  exhash\n");
-		if (di->di_flags & GFS_DIF_UNUSED)
-			printf("  unused\n");
-		if (di->di_flags & GFS_DIF_EA_INDIRECT)
-			printf("  ea_indirect\n");
-		if (di->di_flags & GFS_DIF_DIRECTIO)
-			printf("  directio\n");
-		if (di->di_flags & GFS_DIF_IMMUTABLE)
-			printf("  immutable\n");
-		if (di->di_flags & GFS_DIF_APPENDONLY)
-			printf("  appendonly\n");
-#if 0
-		if (di->di_flags & GFS_DIF_NOATIME)
-			printf("  noatime\n");
-		if (di->di_flags & GFS_DIF_SYNC)
-			printf("  sync\n");
-#endif
-		if (di->di_flags & GFS_DIF_INHERIT_DIRECTIO)
-			printf("  inherit_directio\n");
-		if (di->di_flags & GFS_DIF_INHERIT_JDATA)
-			printf("  inherit_jdata\n");
-	}
-}
-
-/**
- * set_flag - set or clear flags in some dinodes
- * @argc:
- * @argv:
- *
- */
-
-void
-set_flag(int argc, char **argv)
-{
-	struct gfs_dinode di;
-	char *set;
-	char *flag;
-	struct gfs_ioctl gi;
-	int fd;
-	int error;
-
-	if (optind == argc) {
-		di.di_flags = 0xFFFFFFFF;
-		print_flags(&di);
-		return;
-	}
-
-	set = (strcmp(argv[optind - 1], "setflag") == 0) ? "set" : "clear";
-	flag = argv[optind++];
-
-	for (; optind < argc; optind++) {
-		fd = open(argv[optind], O_RDONLY);
-		if (fd < 0)
-			die("can't open %s: %s\n", argv[optind], strerror(errno));
-
-		check_for_gfs(fd, argv[optind]);
-
-		{
-			char *gi_argv[] = { "set_file_flag",
-					    set,
-					    flag };
-			gi.gi_argc = 3;
-			gi.gi_argv = gi_argv;
-
-			error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-			if (error)
-				die("can't change flag on %s: %s\n", argv[optind], strerror(errno));
-		}
-
-		close(fd);
-	}
-}
-
-/**
- * print_stat - print out the struct gfs_dinode for a file
- * @argc:
- * @argv:
- *
- */
-
-void
-print_stat(int argc, char **argv)
-{
-	int fd;
-	char *gi_argv[] = { "get_file_stat" };
-	struct gfs_ioctl gi;
-	struct gfs_dinode di;
-	int error;
-
-	if (optind == argc)
-		die("Usage: gfs_tool stat <filename>\n");
-
-	fd = open(argv[optind], O_RDONLY);
-	if (fd < 0)
-		die("can't open %s: %s\n", argv[optind], strerror(errno));
-
-	check_for_gfs(fd, argv[optind]);
-
-	gi.gi_argc = 1;
-	gi.gi_argv = gi_argv;
-	gi.gi_data = (char *)&di;
-	gi.gi_size = sizeof(struct gfs_dinode);
-
-	error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-	if (error != gi.gi_size)
-		die("error doing get_file_stat (%d): %s\n",
-		    error, strerror(errno));
-
-	close(fd);
-
-	gfs_dinode_print(&di);
-	printf("\n");
-	print_flags(&di);
-}
-
-/**
- * print_sb - the superblock
- * @argc:
- * @argv:
- *
- */
-
-void
-print_sb(int argc, char **argv)
-{
-	int fd;
-	char *gi_argv[] = { "get_super" };
-	struct gfs_ioctl gi;
-	struct gfs_sb sb;
-	int error;
-
-	if (optind == argc)
-		die("Usage: gfs_tool getsb <mountpoint>\n");
-
-	fd = open(argv[optind], O_RDONLY);
-	if (fd < 0)
-		die("can't open %s: %s\n", argv[optind], strerror(errno));
-	
-	check_for_gfs(fd, argv[optind]);
-
-	gi.gi_argc = 1;
-	gi.gi_argv = gi_argv;
-	gi.gi_data = (char *)&sb;
-	gi.gi_size = sizeof(struct gfs_sb);
-
-	error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-	if (error != gi.gi_size)
-		die("error doing get_super (%d): %s\n",
-		    error, strerror(errno));
-
-	close(fd);
-
-	gfs_sb_print(&sb);
-}
-
-/**
- * print_jindex - print out the journal index
- * @argc:
- * @argv:
- *
- */
-
-void
-print_jindex(int argc, char **argv)
-{
-	int fd;
-	struct gfs_ioctl gi;
-	uint64_t offset;
-	unsigned int x;
-	int error;
-
-
-	if (optind == argc)
-		die("Usage: gfs_tool jindex <mountpoint>\n");
-
-	fd = open(argv[optind], O_RDONLY);
-	if (fd < 0)
-		die("can't open %s: %s\n", argv[optind], strerror(errno));
-
-	check_for_gfs(fd, argv[optind]);
-
-
-	{
-		char *argv[] = { "get_hfile_stat",
-				 "jindex" };
-		struct gfs_dinode di;
-
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;
-		gi.gi_data = (char *)&di;
-		gi.gi_size = sizeof(struct gfs_dinode);
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error != gi.gi_size)
-			die("error doing get_hfile_stat (%d): %s\n",
-			    error, strerror(errno));
-
-		gfs_dinode_print(&di);
-	}
-
-
-	for (offset = 0, x = 0; ; offset += sizeof(struct gfs_jindex), x++) {
-		char *argv[] = { "do_hfile_read",
-				 "jindex" };
-		char buf[sizeof(struct gfs_jindex)];
-		struct gfs_jindex ji;
-		
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;
-		gi.gi_data = buf;
-		gi.gi_size = sizeof(struct gfs_jindex);
-		gi.gi_offset = offset;
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (!error)
-			break;
-		if (error != sizeof(struct gfs_jindex))
-			die("error doing do_hfile_read (%d): %s\n",
-			    error, strerror(errno));
-
-		gfs_jindex_in(&ji, buf);
-
-		printf("\nJournal %u:\n\n", x);
-		gfs_jindex_print(&ji);
-	}
-
-
-	close(fd);
-}
-
-/**
- * print_rindex - print out the journal index
- * @argc:
- * @argv:
- *
- */
-
-void
-print_rindex(int argc, char **argv)
-{
-	int fd;
-	struct gfs_ioctl gi;
-	uint64_t offset;
-	unsigned int x;
-	int error;
-
-
-	if (optind == argc)
-		die("Usage: gfs_tool rindex <mountpoint>\n");
-
-	fd = open(argv[optind], O_RDONLY);
-	if (fd < 0)
-		die("can't open %s: %s\n", argv[optind], strerror(errno));
-
-	check_for_gfs(fd, argv[optind]);
-
-
-	{
-		char *argv[] = { "get_hfile_stat",
-				 "rindex" };
-		struct gfs_dinode di;
-
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;
-		gi.gi_data = (char *)&di;
-		gi.gi_size = sizeof(struct gfs_dinode);
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error != gi.gi_size)
-			die("error doing get_hfile_stat (%d): %s\n",
-			    error, strerror(errno));
-
-		gfs_dinode_print(&di);
-	}
-
-
-	for (offset = 0, x = 0; ; offset += sizeof(struct gfs_rindex), x++) {
-		char *argv[] = { "do_hfile_read",
-				 "rindex" };
-		char buf[sizeof(struct gfs_rindex)];
-		struct gfs_rindex ri;
-		
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;
-		gi.gi_data = buf;
-		gi.gi_size = sizeof(struct gfs_rindex);
-		gi.gi_offset = offset;
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (!error)
-			break;
-		if (error != sizeof(struct gfs_rindex))
-			die("error doing do_hfile_read (%d): %s\n",
-			    error, strerror(errno));
-
-		gfs_rindex_in(&ri, buf);
-
-		printf("\nRG %u:\n\n", x);
-		gfs_rindex_print(&ri);
-	}
-
-
-	close(fd);
-}
-
-/**
- * print_quota - print out the journal index
- * @argc:
- * @argv:
- *
- */
-
-void
-print_quota(int argc, char **argv)
-{
-	int fd;
-	struct gfs_ioctl gi;
-	uint64_t offset;
-	unsigned int x;
-	int error;
-
-
-	if (optind == argc)
-		die("Usage: gfs_tool quota <mountpoint>\n");
-
-	fd = open(argv[optind], O_RDONLY);
-	if (fd < 0)
-		die("can't open %s: %s\n", argv[optind], strerror(errno));
-
-	check_for_gfs(fd, argv[optind]);
-
-
-	{
-		char *argv[] = { "get_hfile_stat",
-				 "quota" };
-		struct gfs_dinode di;
-
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;
-		gi.gi_data = (char *)&di;
-		gi.gi_size = sizeof(struct gfs_dinode);
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (error != gi.gi_size)
-			die("error doing get_hfile_stat (%d): %s\n",
-			    error, strerror(errno));
-
-		gfs_dinode_print(&di);
-	}
-
-
-	for (offset = 0, x = 0; ; offset += sizeof(struct gfs_quota), x++) {
-		char *argv[] = { "do_hfile_read",
-				 "quota" };
-		char buf[sizeof(struct gfs_quota)];
-		struct gfs_quota q;
-		
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;
-		gi.gi_data = buf;
-		gi.gi_size = sizeof(struct gfs_quota);
-		gi.gi_offset = offset;
-
-		error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-		if (!error)
-			break;
-		if (error != sizeof(struct gfs_quota))
-			die("error doing do_hfile_read (%d): %s\n",
-			    error, strerror(errno));
-
-		gfs_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);
-			gfs_quota_print(&q);
-		}
-	}
-
-
-	close(fd);
-}
-
-/**
- * print_list - print the list of mounted filesystems
- *
- */
-
-void
-print_list(void)
-{
-	char *list = get_list();
-	printf("%s", list);
-}
-
-/**
- * reclaim_metadata - reclaim unused metadata blocks
- * @argc:
- * @argv:
- *
- * This routine uses an ioctl command to quiesce the cluster and then
- * hunt down and free all disk inodes that have been freed.  This will
- * gain back meta data blocks to be used for data (or metadata) again.
- *
- */
-
-void
-reclaim_metadata(int argc, char **argv)
-{
-	int fd;
-	char *gi_argv[] = { "do_reclaim" };
-	struct gfs_ioctl gi;
-	char buf[256];
-
-	if (optind == argc)
-		die("Usage: gfs_tool reclaim <mountpoint>\n");
-
-	fd = open(argv[optind], O_RDONLY);
-	if (fd < 0)
-		die("can't open %s: %s\n", argv[optind], strerror(errno));
-
-	check_for_gfs(fd, argv[optind]);
-
-	if (!override) {
-		printf("Don't do this if this file system is being exported by NFS (on any machine).\n");
-		printf("\nAre you sure you want to proceed? [y/n] ");
-		if (fgets(buf, 255, stdin) == NULL || buf[0] != 'y')
-			die("aborted\n");
-
-		printf("\n");
-	}
-
-	gi.gi_argc = 1;
-	gi.gi_argv = gi_argv;
-	gi.gi_data = buf;
-	gi.gi_size = 256;
-
-	if (ioctl(fd, GFS_IOCTL_SUPER, &gi) < 0)
-		die("error doing do_reclaim: %s\n", strerror(errno));
-
-	close(fd);
-
-	printf("Reclaimed:\n");
-	printf("%s", buf);
-}
-
-/**
- * do_shrink - shrink the inode cache for a filesystem
- * @argc:
- * @argv:
- *
- */
-
-void
-do_shrink(int argc, char **argv)
-{
-	int fd;
-	char *gi_argv[] = { "do_shrink" };
-	struct gfs_ioctl gi;
-
-	if (optind == argc)
-		die("Usage: gfs_tool shrink <mountpoint>\n");
-
-	fd = open(argv[optind], O_RDONLY);
-	if (fd < 0)
-		die("can't open %s: %s\n",
-		    argv[optind], strerror(errno));
-
-	check_for_gfs(fd, argv[optind]);
-
-	gi.gi_argc = 1;
-	gi.gi_argv = gi_argv;
-
-	if (ioctl(fd, GFS_IOCTL_SUPER, &gi))
-		die("error doing ioctl: %s\n",
-		    strerror(errno));
-
-	close(fd);
-}
-
-/**
- * do_withdraw - freeze a GFS filesystem
- * @argc:
- * @argv:
- *
- */
-
-void
-do_withdraw(int argc, char **argv)
-{
-	char *cookie;
-	int fd;
-	char buf[256];
-	int x;
-
-	if (optind == argc)
-		die("Usage: gfs_tool withdraw <mountpoint>\n");
-
-	cookie = mp2cookie(argv[optind], FALSE);
-	x = sprintf(buf, "withdraw %s\n", cookie);
-
-	fd = open("/proc/fs/gfs", O_RDWR);
-	if (fd < 0)
-		die("can't open /proc/fs/gfs: %s\n",
-		    strerror(errno));
-
-	if (write(fd, buf, x) != x)
-		die("can't write withdraw command: %s\n",
-		    strerror(errno));
-	if (read(fd, buf, 256))
-		die("can't withdraw %s: %s\n",
-		    argv[optind], strerror(errno));
-
-	close(fd);
-}
diff --git a/gfs/gfs_tool/ondisk.c b/gfs/gfs_tool/ondisk.c
deleted file mode 100644
index eeda916..0000000
--- a/gfs/gfs_tool/ondisk.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-
-#include "linux_endian.h"
-#include "gfs_ondisk.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/gfs/gfs_tool/parse_lockdump b/gfs/gfs_tool/parse_lockdump
deleted file mode 100644
index 9e77599..0000000
--- a/gfs/gfs_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/gfs/gfs_tool/sb.c b/gfs/gfs_tool/sb.c
deleted file mode 100644
index 130e039..0000000
--- a/gfs/gfs_tool/sb.c
+++ /dev/null
@@ -1,152 +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 "gfs_ondisk.h"
-
-#include "gfs_tool.h"
-
-#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)
-
-#define do_write(fd, buff, len) \
-do { \
-	if (write((fd), (buff), (len)) != (len)) \
-		die("bad write: %s on line %d of file %s\n", \
-		    strerror(errno), __LINE__, __FILE__); \
-} while (0)
-
-/**
- * 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[GFS_BASIC_BLOCK];
-	char input[256];
-	struct gfs_sb sb;
-
-	if (optind == argc)
-		die("Usage: gfs_tool sb <device> <field> [newval]\n");
-
-	device = argv[optind++];
-
-	if (optind == argc)
-		die("Usage: gfs_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(input, 255, stdin) == NULL || input[0] != 'y')
-			die("aborted\n");
-
-		printf("\n");
-	}
-
-	do_lseek(fd, GFS_SB_ADDR * GFS_BASIC_BLOCK);
-	do_read(fd, buf, GFS_BASIC_BLOCK);
-
-	gfs_sb_in(&sb, (char *)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 (strcmp(field, "proto") == 0) {
-		printf("current lock protocol name = \"%s\"\n",
-		       sb.sb_lockproto);
-
-		if (newval) {
-			if (strlen(newval) >= GFS_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) >= GFS_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) {
-		gfs_sb_print(&sb);
-		newval = FALSE;
-	} else
-		die("unknown field %s\n", field);
-
-	if (newval) {
-		gfs_sb_out(&sb, (char *)buf);
-
-		do_lseek(fd, GFS_SB_ADDR * GFS_BASIC_BLOCK);
-		do_write(fd, buf, GFS_BASIC_BLOCK);
-
-		fsync(fd);
-
-		printf("Done\n");
-	}
-
-	close(fd);
-}
diff --git a/gfs/gfs_tool/tune.c b/gfs/gfs_tool/tune.c
deleted file mode 100644
index 85be170..0000000
--- a/gfs/gfs_tool/tune.c
+++ /dev/null
@@ -1,135 +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>
-
-#define __user
-#include "gfs_ioctl.h"
-
-#include "gfs_tool.h"
-
-#define SIZE (4096)
-
-/**
- * get_tune - print out the current tuneable parameters for a filesystem
- * @argc:
- * @argv:
- *
- */
-
-void
-get_tune(int argc, char **argv)
-{
-	int fd;
-	char *gi_argv[] = { "get_tune" };
-	struct gfs_ioctl gi;
-	char str[SIZE], str2[SIZE];
-	char **lines, **l;
-
-	if (optind == argc)
-		die("Usage: gfs_tool gettune <mountpoint>\n");
-
-	fd = open(argv[optind], O_RDONLY);
-	if (fd < 0)
-		die("can't open file %s: %s\n",
-		    argv[optind], strerror(errno));
-
-	check_for_gfs(fd, argv[optind]);
-
-	gi.gi_argc = 1;
-	gi.gi_argv = gi_argv;
-	gi.gi_data = str;
-	gi.gi_size = SIZE;
-
-	if (ioctl(fd, GFS_IOCTL_SUPER, &gi) < 0)
-		die("error doing get_tune: %s\n",
-		    strerror(errno));
-
-	close(fd);
-
-	strcpy(str2, str);
-	lines = str2lines(str2);
-
-	for (l = lines; **l; l++) {
-		char *p;
-		for (p = *l; *p; p++)
-			if (*p == ' ') {
-				*p++ = 0;
-				break;
-			}
-
-		if (strcmp(*l, "version") == 0)
-			continue;
-		if (strcmp(*l, "quota_scale_num") == 0) {
-			printf("quota_scale = %.4f   (%u, %u)\n",
-			       (double)name2u32(str, "quota_scale_num") / name2u32(str, "quota_scale_den"),
-			       name2u32(str, "quota_scale_num"), name2u32(str, "quota_scale_den"));
-			continue;
-		}
-		if (strcmp(*l, "quota_scale_den") == 0)
-			continue;
-
-		printf("%s = %s\n", *l, p);
-	}
-}
-
-/**
- * set_tune - set a tuneable parameter
- * @argc:
- * @argv:
- *
- */
-
-void
-set_tune(int argc, char **argv)
-{
-	char *mp, *param, *value;
-	int fd;
-	struct gfs_ioctl gi;
-	char buf[256];
-
-	if (optind == argc)
-		die("Usage: gfs_tool settune <mountpoint> <parameter> <value>\n");
-	mp = argv[optind++];
-	if (optind == argc)
-		die("Usage: gfs_tool settune <mountpoint> <parameter> <value>\n");
-	param = argv[optind++];
-	if (optind == argc)
-		die("Usage: gfs_tool settune <mountpoint> <parameter> <value>\n");
-	value = argv[optind++];
-
-	fd = open(mp, O_RDONLY);
-	if (fd < 0)
-		die("can't open file %s: %s\n",
-		    mp, strerror(errno));
-
-	check_for_gfs(fd, mp);
-
-	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;
-	}
-
-	{
-		char *argv[] = { "set_tune", param, value };
-
-		gi.gi_argc = 3;
-		gi.gi_argv = argv;
-
-		if (ioctl(fd, GFS_IOCTL_SUPER, &gi))
-			die("can't change tunable parameter %s: %s\n",
-			    param, strerror(errno));
-	}
-
-	close(fd);
-}
diff --git a/gfs/gfs_tool/util.c b/gfs/gfs_tool/util.c
deleted file mode 100644
index 653e258..0000000
--- a/gfs/gfs_tool/util.c
+++ /dev/null
@@ -1,270 +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 <libgen.h>
-
-#define __user
-#include "gfs_ioctl.h"
-#include "gfs_ondisk.h"
-
-#include "gfs_tool.h"
-
-/**
- * check_for_gfs - Check to see if a descriptor is a file on a GFS filesystem
- * @fd: the file descriptor
- * @path: the path used to open the descriptor
- *
- */
-
-void
-check_for_gfs(int fd, char *path)
-{
-	unsigned int magic = 0;
-	int error;
-
-	error = ioctl(fd, GFS_IOCTL_IDENTIFY, &magic);
-	if (error || magic != GFS_MAGIC)
-		die("%s is not a GFS file/filesystem\n",
-		    path);
-}
-
-/**
- * get_list - Get the list of GFS filesystems
- *
- * Returns: a NULL terminated string
- */
-
-#define LIST_SIZE (1048576)
-
-char *
-get_list(void)
-{
-	char *list;
-	int fd;
-	int x;
-
-	list = malloc(LIST_SIZE);
-	if (!list)
-		die("out of memory\n");
-
-	fd = open("/proc/fs/gfs", O_RDWR);
-	if (fd < 0)
-		die("can't open /proc/fs/gfs: %s\n",
-		    strerror(errno));
-
-	if (write(fd, "list", 4) != 4)
-		die("can't write list command: %s\n",
-		    strerror(errno));
-	x = read(fd, list, LIST_SIZE - 1);
-	if (x < 0)
-		die("can't get list of filesystems: %s\n",
-		    strerror(errno));
-
-	close(fd);
-
-	list[x] = 0;
-
-	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;
-}
-
-/**
- * mp2cookie - Find the cookie for a filesystem given its mountpoint
- * @mp:
- * @ioctl_ok: If this is FALSE, it's not acceptable to open() the mountpoint
- *
- * Returns: the cookie
- */
-
-char *
-mp2cookie(char *mp, int ioctl_ok)
-{
-	char *cookie;
-	char *list, **lines;
-	FILE *file;
-	char line[256], device[256], dev_id[256];
-	unsigned int x;
-	struct stat st;
-
-	cookie = malloc(256);
-	if (!cookie)
-		die("out of memory\n");
-	list = get_list();
-	lines = str2lines(list);
-
-	file = fopen("/proc/mounts", "r");
-	if (!file)
-		die("can't open /proc/mounts: %s\n",
-		    strerror(errno));
-
-	memset(dev_id, 0, sizeof(dev_id));
-	while (fgets(line, 256, file)) {
-		char path[256], type[256];
-
-		if (sscanf(line, "%s %s %s", device, path, type) != 3)
-			continue;
-		if (strcmp(path, mp))
-			continue;
-		if (strcmp(type, "gfs"))
-			die("%s is not a GFS filesystem\n", mp);
-
-		if (stat(device, &st))
-			continue;
-		sprintf(dev_id, "%u:%u", major(st.st_rdev),minor(st.st_rdev));
-		break;
-	}
-
-	fclose(file);
-
-	for (x = 0; *lines[x]; x++) {
-		char device_id[256];
-		sscanf(lines[x], "%s %s", cookie, device_id);
-		if (dev_id[0]) {
-			if (strcmp(device_id, dev_id) == 0)
-				return cookie;
-		} else {
-			if (strcmp(cookie, mp) == 0)
-				return cookie;
-		}
-	}
-
-	if (ioctl_ok) {
-		struct gfs_ioctl gi;
-		char *argv[] = { "get_cookie" };
-		int fd;
-
-		gi.gi_argc = 1;
-		gi.gi_argv = argv;
-		gi.gi_data = cookie;
-		gi.gi_size = 256;
-
-		fd = open(mp, O_RDONLY);
-		if (fd < 0)
-			die("can't open %s: %s\n",
-			    mp, strerror(errno));
-
-		check_for_gfs(fd, mp);
-
-		if (ioctl(fd, GFS_IOCTL_SUPER, &gi) < 0)
-			die("can't get cookie for %s: %s\n",
-			    mp, strerror(errno));
-
-		close(fd);
-
-		return cookie;
-	}
-
-	die("unknown mountpoint %s\n", mp);
-}
-
-/**
- * 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[256];
-	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/gfs/include/global.h b/gfs/include/global.h
deleted file mode 100644
index 02c3eff..0000000
--- a/gfs/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/gfs/include/linux_endian.h b/gfs/include/linux_endian.h
deleted file mode 100644
index 43089d2..0000000
--- a/gfs/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/gfs/include/list.h b/gfs/include/list.h
deleted file mode 100644
index 566b377..0000000
--- a/gfs/include/list.h
+++ /dev/null
@@ -1,325 +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_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/gfs/include/osi_list.h b/gfs/include/osi_list.h
deleted file mode 100644
index 3b1483b..0000000
--- a/gfs/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/gfs/include/osi_user.h b/gfs/include/osi_user.h
deleted file mode 100644
index 34964ed..0000000
--- a/gfs/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/gfs/init.d/Makefile b/gfs/init.d/Makefile
deleted file mode 100644
index 2ad74ac..0000000
--- a/gfs/init.d/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-TARGET= gfs
-
-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/gfs/init.d/gfs.in b/gfs/init.d/gfs.in
deleted file mode 100644
index c3bf59a..0000000
--- a/gfs/init.d/gfs.in
+++ /dev/null
@@ -1,149 +0,0 @@
-#!/bin/bash
-#
-# gfs mount/unmount helper 
-#
-# chkconfig: - 26 74
-# description: mount/unmount gfs filesystems configured in /etc/fstab
-
-### BEGIN INIT INFO
-# Provides:		gfs
-# Required-Start:	$network cman
-# Required-Stop:	$network cman
-# Default-Start:
-# Default-Stop:
-# Short-Description:	mount/unmount gfs filesystems configured in /etc/fstab
-# Description:		mount/unmount gfs 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/gfs ] && . /etc/sysconfig/gfs
-	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/subsys/gfs"
-	success=success
-	failure=failure
-fi
-
-# deb based distros
-if [ -d /etc/default ]; then
-	[ -f /etc/default/cluster ] && . /etc/default/cluster
-	[ -f /etc/default/gfs ] && . /etc/default/gfs
-	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/gfs"
-	success=local_success
-	failure=local_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.  
-#
-GFSFSTAB=$(LC_ALL=C awk '!/^#/ && $3 == "gfs" && $4 !~ /noauto/ { print $2 }' /etc/fstab)
-GFSMTAB=$(LC_ALL=C awk '!/^#/ && $3 == "gfs" && $2 != "/" { print $2 }' /proc/mounts)
-
-# See how we were called.
-case "$1" in
-  start)
-        if [ -n "$GFSFSTAB" ] 
-	then
-		echo -n "Mounting GFS filesystems: "
-		mount -a -t gfs
-		rtrn=$?
-		if [ $rtrn = 0 ]; then
-			touch $LOCK_FILE
-			$success
-			echo
-		else
-			$failure
-			echo
-		fi
-	fi
-	;;
-
-  stop)
-  	if [ -n "$GFSMTAB" ] 
-	then
-		sig=
-		retry=6
-		remaining=`LC_ALL=C awk '!/^#/ && $3 == "gfs" && $2 != "/" {print $2}' /proc/mounts`
-		while [ -n "$remaining" -a "$retry" -gt 0 ]
-		do
-			echo -n "Unmounting GFS filesystems: "
-			umount -a -t gfs
-			rtrn=$?
-			if [ $rtrn = 0 ]; then
-				$success
-				echo
-			else
-				$failure
-				echo
-			fi
-
-			if [ $retry -eq 0 ] 
-			then
-				echo -n "Unmounting GFS filesystems (lazy): "
-				umount -l -a -t gfs
-				rtrn=$?
-				if [ $rtrn = 0 ]; then
-					$success
-					echo
-				else
-					$failure
-					echo
-				fi
-				break
-			fi
-
-			sleep 2
-			remaining=`LC_ALL=C awk '!/^#/ && $3 == "gfs" && $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 gfs
-	rm -f $LOCK_FILE
-	;;
-
-  status)
-	if [ -f /proc/mounts ]
-	then
-	        [ -n "$GFSFSTAB" ] && {
-		     echo "Configured GFS mountpoints: "
-		     for fs in $GFSFSTAB; do echo $fs ; done
-		}
-		[ -n "$GFSMTAB" ] && {
-                      echo "Active GFS mountpoints: "
-		      for fs in $GFSMTAB; 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/gfs/libgfs/Makefile b/gfs/libgfs/Makefile
deleted file mode 100644
index bae9954..0000000
--- a/gfs/libgfs/Makefile
+++ /dev/null
@@ -1,33 +0,0 @@
-TARGET=libgfs
-
-MAKESTATICLIB = 1
-
-OBJS=	bio.o \
-	bitmap.o \
-	block_list.o \
-	file.o \
-	fs_bits.o \
-	fs_bmap.o \
-	fs_dir.o \
-	fs_inode.o \
-	inode.o \
-	log.o \
-	ondisk.o \
-	rgrp.o \
-	size.o \
-	super.o \
-	util.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
-CFLAGS += -D_GNU_SOURCE -DHELPER_PROGRAM
-CFLAGS += -c
-CFLAGS += -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/
-CFLAGS += -I${gfskincdir} -I$(S)/../include
-CFLAGS += -I${incdir}
diff --git a/gfs/libgfs/bio.c b/gfs/libgfs/bio.c
deleted file mode 100644
index 673fc1a..0000000
--- a/gfs/libgfs/bio.c
+++ /dev/null
@@ -1,167 +0,0 @@
-#include <stdint.h>
-#include "list.h"
-#include "gfs_ondisk.h"
-#include "libgfs.h"
-
-/*
- * get_buf - get a buffer
- * @sdp: the super block
- * @blkno: blk # that this buffer will be associated with
- * @bhp: the location where the buffer is returned
- *
- * This function allocates space for a buffer head structure
- * and the corresponding data.  It does not fill in the
- * actual data - that is done by read_buf.
- *
- * Returns: 0 on success, -1 on error
- */
-int get_buf(uint32_t sb_bsize, uint64 blkno, osi_buf_t **bhp)
-{
-	osi_buf_t *bh = NULL;
-
-	*bhp = NULL;
-	bh = (osi_buf_t *)malloc(sizeof(osi_buf_t));
-	if(!bh){
-		log_err("Unable to allocate memory for new buffer head.\n");
-		return -1;
-	}
-	if(!memset(bh, 0, sizeof(osi_buf_t))) {
-		log_err("Unable to zero buffer head\n");
-		return -1;
-	}
-
-	/* FIXME: Not sure how this will work on all
-	 * architectures without the casts */
-	bh->b_blocknr = blkno;
-	bh->b_size = sb_bsize;
-	bh->b_state = 0;
-	if(!(bh->b_data = malloc(BH_SIZE(bh)))) {
-		free(bh);
-		log_err("Unable to allocate memory for new buffer "
-			"blkno = %"PRIu64", size = %u\n", blkno, BH_SIZE(bh));
-		return -1;
-	}
-	if(!memset(BH_DATA(bh), 0, BH_SIZE(bh))) {
-		free(bh);
-		log_err("Unable to zero memory for new buffer "
-			"blkno = %"PRIu64", size = %u\n", blkno, BH_SIZE(bh));
-	}
-
-	*bhp = bh;
-
-	return 0;
-}
-
-
-/*
- * relse_buf - release a buffer
- * @sdp: the super block
- * @bh: the buffer to release
- *
- * This function will release the memory of the buffer
- * and associated buffer head.
- *
- * Returns: nothing
- */
-void relse_buf(osi_buf_t *bh){
-	if(bh){
-		if(BH_DATA(bh)) {
-			free(BH_DATA(bh));
-			bh->b_data = NULL;
-		}
-		free(bh);
-		bh = NULL;
-	}
-}
-
-
-/*
- * read_buf - read a buffer
- * @sdp: the super block
- * @blkno: block number
- * @bhp: place where buffer is returned
- * @flags:
- *
- * Returns 0 on success, -1 on error
- */
-int read_buf(int disk_fd, osi_buf_t *bh, int flags){
-
-	if(do_lseek(disk_fd, (uint64)(BH_BLKNO(bh)*BH_SIZE(bh)))){
-		log_err("Unable to seek to position %"PRIu64" "
-			"(%"PRIu64" * %u) on storage device.\n",
-			(uint64)(BH_BLKNO(bh) * BH_SIZE(bh)),
-			BH_BLKNO(bh), BH_SIZE(bh));
-		return -1;
-	}
-
-	if(do_read(disk_fd, BH_DATA(bh), BH_SIZE(bh))){
-		log_err("Unable to read %u bytes from position %"PRIu64"\n",
-			BH_SIZE(bh), (uint64)(BH_BLKNO(bh) * BH_SIZE(bh)));
-		return -1;
-	}
-
-	return 0;
-}
-
-
-/*
- * write_buf - write a buffer
- * @sdp: the super block
- * @bh: buffer head that describes buffer to write
- * @flags: flags that determine usage
- *
- * Returns: 0 on success, -1 on failure
- */
-int write_buf(int disk_fd, osi_buf_t *bh, int flags){
-
-	if(do_lseek(disk_fd, (uint64)(BH_BLKNO(bh) * BH_SIZE(bh)))) {
-		log_err("Unable to seek to position %"PRIu64
-			"(%"PRIu64" * %u) on storage device.\n",
-			(uint64)(BH_BLKNO(bh) * BH_SIZE(bh)),
-			BH_BLKNO(bh), BH_SIZE(bh));
-		return -1;
-	}
-
-	log_debug("Writing to %"PRIu64" - %"PRIu64" %u\n",
-		  (uint64)(BH_BLKNO(bh) * BH_SIZE(bh)),
-		  BH_BLKNO(bh), BH_SIZE(bh));
-	if(do_write(disk_fd, BH_DATA(bh), BH_SIZE(bh))) {
-		log_err("Unable to write %u bytes to position %"PRIu64"\n",
-			BH_SIZE(bh), (uint64)(BH_BLKNO(bh) * BH_SIZE(bh)));
-		return -1;
-	}
-
-	if(flags & BW_WAIT){
-		fsync(disk_fd);
-	}
-
-	return 0;
-}
-
-
-/*
- * get_and_read_buf - combines get_buf and read_buf functions
- * @sdp
- * @blkno
- * @bhp
- * @flags
- *
- * Returns: 0 on success, -1 on error
- */
-int get_and_read_buf(int disk_fd, uint32_t sb_bsize, uint64 blkno,
-					 osi_buf_t **bhp, int flags)
-{
-	if(get_buf(sb_bsize, blkno, bhp)) {
-		stack;
-		return -1;
-	}
-
-	if(read_buf(disk_fd, *bhp, flags)){
-		stack;
-		relse_buf(*bhp);
-		*bhp = NULL;  /* guarantee that ptr is NULL in failure cases */
-		return -1;
-	}
-
-	return 0;
-}
diff --git a/gfs/libgfs/bitmap.c b/gfs/libgfs/bitmap.c
deleted file mode 100644
index 4d983a3..0000000
--- a/gfs/libgfs/bitmap.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Basic bitmap manipulation */
-#include <stdint.h>
-#include <stdio.h>
-#include <errno.h>
-#include "osi_user.h"
-#include "libgfs.h"
-#include "incore.h"
-
-
-#define BITMAP_SIZE(size, cpb) (size / cpb)
-
-#define BITMAP_BYTE_OFFSET(x, map) ((x % map->chunks_per_byte) \
-                                    * map->chunksize )
-
-#define BITMAP_MASK(chunksize) ((2 << (chunksize - 1)) - 1)
-
-uint64_t bitmap_size(struct bmap *bmap) {
-	return bmap->size;
-}
-
-int bitmap_create(struct bmap *bmap, uint64_t size, uint8_t chunksize)
-{
-	if((((chunksize >> 1) << 1) != chunksize) && chunksize != 1) {
-		log_err("chunksize must be a power of 2\n");
-		return -1;
-	}
-	if(chunksize > 8) {
-		log_err("chunksize must be <= 8\n");
-		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))) {
-		log_err("Unable to allocate bitmap of size %"PRIu64"\n",
-			bmap->mapsize);
-		return ENOMEM;
-	}
-	if(!memset(bmap->map, 0, sizeof(char) * bmap->mapsize)) {
-		log_err("Unable to zero bitmap of size %"PRIu64"\n",
-			bmap->mapsize);
-		free(bmap->map);
-		bmap->map = NULL;
-		return ENOMEM;
-	}
-	log_debug("Allocated bitmap of size %"PRIu64
-		  " with %d chunks per byte\n",
-		  bmap->mapsize, bmap->chunks_per_byte);
-	return 0;
-}
-
-int bitmap_set(struct bmap *bmap, uint64_t offset, uint8_t val)
-{
-	char *byte = NULL;
-	uint64_t b = offset;
-
-	if(offset < bmap->size) {
-		byte = bmap->map + BITMAP_SIZE(offset, bmap->chunks_per_byte);
-		b = BITMAP_BYTE_OFFSET(offset, bmap);
-
-		*byte |= (val & BITMAP_MASK(bmap->chunksize)) << b;
-		return 0;
-	}
-	log_debug("offset %d out of bounds\n", offset);
-	return -1;
-}
-
-int bitmap_get(struct bmap *bmap, uint64_t bit, uint8_t *val)
-{
-	char *byte = NULL;
-	uint64_t b = bit;
-
-	if(bit < bmap->size) {
-		byte = bmap->map + BITMAP_SIZE(bit, bmap->chunks_per_byte);
-		b = BITMAP_BYTE_OFFSET(bit, bmap);
-
-		*val = (*byte & (BITMAP_MASK(bmap->chunksize) << b )) >> b;
-		return 0;
-	}
-	log_debug("offset %d out of bounds\n", bit);
-	return -1;
-}
-
-
-int bitmap_clear(struct bmap *bmap, uint64_t offset)
-{
-	char *byte = NULL;
-	uint64_t b = offset;
-
-	if(offset < bmap->size) {
-		byte = bmap->map + BITMAP_SIZE(offset, bmap->chunks_per_byte);
-		b = BITMAP_BYTE_OFFSET(offset, bmap);
-
-		*byte &= ~(BITMAP_MASK(bmap->chunksize) << b);
-		return 0;
-	}
-	log_debug("offset %d out of bounds\n", offset);
-	return -1;
-
-}
-
-void bitmap_destroy(struct 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/gfs/libgfs/block_list.c b/gfs/libgfs/block_list.c
deleted file mode 100644
index 28047a6..0000000
--- a/gfs/libgfs/block_list.c
+++ /dev/null
@@ -1,267 +0,0 @@
-#include <unistd.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <inttypes.h>
-#include "libgfs.h"
-#include "gfs_ondisk.h"
-
-#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 FREE_META	(0xD)  /*   1101 */
-#define EATTR_META	(0xE)  /*   1110 */
-
-#define INVALID_META	(0xF)  /*   1111 */
-
-
-/* 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, FREE_META,
-	EATTR_META, INVALID_META
-};
-
-struct block_list *block_list_create(uint64_t size, enum block_list_type type)
-{
-	struct block_list *il;
-	log_info("Creating a block list of size %"PRIu64"...\n", size);
-
-	if ((il = malloc(sizeof(*il)))) {
-		if(!memset(il, 0, sizeof(*il))) {
-			log_err("Cannot set block list to zero\n");
-			return NULL;
-		}
-		il->type = type;
-
-		switch(type) {
-		case gbmap:
-			if(bitmap_create(&il->list.gbmap.group_map, size, 4)) {
-				stack;
-				free(il);
-				il = NULL;
-			}
-			if(bitmap_create(&il->list.gbmap.bad_map, size, 1)) {
-				stack;
-				free(il);
-				il = NULL;
-			}
-			if(bitmap_create(&il->list.gbmap.dup_map, size, 1)) {
-				stack;
-				free(il);
-				il = NULL;
-			}
-			if(bitmap_create(&il->list.gbmap.eattr_map, size, 1)) {
-				stack;
-				free(il);
-				il = NULL;
-			}
-			break;
-		default:
-			log_crit("Block list type %d not implemented\n",
-				type);
-			break;
-		}
-	}
-
-	return il;
-}
-
-int block_mark(struct block_list *il, uint64_t block, enum mark_block mark)
-{
-	int err = 0;
-
-	switch(il->type) {
-	case gbmap:
-		if(mark == bad_block) {
-			err = bitmap_set(&il->list.gbmap.bad_map, block, 1);
-		}
-		else if(mark == dup_block) {
-			err = bitmap_set(&il->list.gbmap.dup_map, block, 1);
-		}
-		else if(mark == eattr_block) {
-			err = bitmap_set(&il->list.gbmap.eattr_map, block, 1);
-		}
-		else {
-			err = bitmap_set(&il->list.gbmap.group_map, block,
-					 mark_to_gbmap[mark]);
-		}
-
-		break;
-	default:
-		log_err("block list type %d not implemented\n",
-			il->type);
-		err = -1;
-		break;
-	}
-	return err;
-}
-
-int block_set(struct block_list *il, uint64_t block, enum mark_block mark)
-{
-	int err = 0;
-	err = block_clear(il, block, mark);
-	if(!err)
-		err = block_mark(il, block, mark);
-	return err;
-}
-
-int block_clear(struct block_list *il, uint64_t block, enum mark_block m)
-{
-	int err = 0;
-
-	switch(il->type) {
-	case gbmap:
-		switch (m) {
-		case dup_block:
-			err = bitmap_clear(&il->list.gbmap.dup_map, block);
-			break;
-		case bad_block:
-			err = bitmap_clear(&il->list.gbmap.bad_map, block);
-			break;
-		case eattr_block:
-			err = bitmap_clear(&il->list.gbmap.eattr_map, block);
-			break;
-		default:
-			/* FIXME: check types */
-			err = bitmap_clear(&il->list.gbmap.group_map, block);
-			break;
-		}
-
-		break;
-	default:
-		log_err("block list type %d not implemented\n",
-			il->type);
-		err = -1;
-		break;
-	}
-	return err;
-}
-
-int block_check(struct block_list *il, uint64_t block, struct block_query *val)
-{
-	int err = 0;
-	val->block_type = 0;
-	val->bad_block = 0;
-	val->dup_block = 0;
-	switch(il->type) {
-	case gbmap:
-		if((err = bitmap_get(&il->list.gbmap.group_map, block,
-				     &val->block_type))) {
-			log_err("Unable to get block type for block %"
-				PRIu64"\n", block);
-			break;
-		}
-		if((err = bitmap_get(&il->list.gbmap.bad_map, block,
-				     &val->bad_block))) {
-			log_err("Unable to get bad block status for block %"
-				PRIu64"\n", block);
-			break;
-		}
-		if((err = bitmap_get(&il->list.gbmap.dup_map, block,
-				     &val->dup_block))) {
-			log_err("Unable to get duplicate status for block %"
-				PRIu64"\n", block);
-			break;
-		}
-		if((err = bitmap_get(&il->list.gbmap.eattr_map, block,
-				     &val->eattr_block))) {
-			log_err("Unable to get eattr status for block %"
-				PRIu64"\n", block);
-			break;
-		}
-		break;
-	default:
-		log_err("block list type %d not implemented\n",
-			il->type);
-		err = -1;
-		break;
-	}
-
-	return err;
-}
-
-void *block_list_destroy(struct block_list *il)
-{
-	if(il) {
-		switch(il->type) {
-		case gbmap:
-			bitmap_destroy(&il->list.gbmap.group_map);
-			bitmap_destroy(&il->list.gbmap.bad_map);
-			bitmap_destroy(&il->list.gbmap.dup_map);
-			bitmap_destroy(&il->list.gbmap.eattr_map);
-			break;
-		default:
-			break;
-		}
-		free(il);
-		il = NULL;
-	}
-	return il;
-}
-
-
-int find_next_block_type(struct block_list *il, enum mark_block m, uint64_t *b)
-{
-	uint64_t i;
-	uint8_t val;
-	int found = 0;
-	for(i = *b; ; i++) {
-		switch(il->type) {
-		case gbmap:
-			if(i >= bitmap_size(&il->list.gbmap.dup_map))
-				return -1;
-
-			switch(m) {
-			case dup_block:
-				if(bitmap_get(&il->list.gbmap.dup_map, i,
-					      &val)) {
-					stack;
-					return -1;
-				}
-
-				if(val)
-					found = 1;
-				break;
-			case eattr_block:
-				if(bitmap_get(&il->list.gbmap.eattr_map, i,
-					      &val)) {
-					stack;
-					return -1;
-				}
-
-				if(val)
-					found = 1;
-				break;
-			default:
-				/* FIXME: add support for getting
-				 * other types */
-				log_err("Unhandled block type\n");
-			}
-			break;
-		default:
-			log_err("Unhandled block list type\n");
-			break;
-		}
-		if(found) {
-			*b = i;
-			return 0;
-		}
-	}
-	return -1;
-}
diff --git a/gfs/libgfs/file.c b/gfs/libgfs/file.c
deleted file mode 100644
index ff1dd2a..0000000
--- a/gfs/libgfs/file.c
+++ /dev/null
@@ -1,231 +0,0 @@
-#include <stdint.h>
-#include "gfs_ondisk.h"
-#include "libgfs.h"
-
-/**
- * readi - Read a file
- * @ip: The GFS Inode
- * @buf: The buffer to place result into
- * @offset: File offset to begin reading from
- * @size: Amount of data to transfer
- *
- * Returns: The amount of data actually copied or the error
- */
-int readi(int disk_fd, struct gfs_inode *ip, void *buf, uint64 offset,
-		  unsigned int size)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	osi_buf_t *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;
-	int error = 0;
-
-	if (offset >= ip->i_di.di_size){
-		log_debug("readi:  Offset (%"PRIu64") is >= "
-			"the file size (%"PRIu64").\n",
-			offset, ip->i_di.di_size);
-		goto out;
-	}
-
-	if ((offset + size) > ip->i_di.di_size)
-		size = ip->i_di.di_size - offset;
-
-	if (!size){
-		log_err("readi:  Nothing to be read.\n");
-		goto out;
-	}
-
-	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 (fs_is_stuffed(ip))
-		offset += sizeof(struct gfs_dinode);
-	else if (journaled)
-		offset += sizeof(struct gfs_meta_header);
-
-
-	while (copied < size){
-		amount = size - copied;
-		if (amount > sdp->sd_sb.sb_bsize - offset)
-			amount = sdp->sd_sb.sb_bsize - offset;
-
-		if (!extlen){
-			error = fs_block_map(disk_fd, ip, lblock, &not_new, &dblock, &extlen);
-			if (error){
-				log_err("readi:  The call to fs_block_map() failed.\n");
-				goto out;
-			}
-		}
-
-		if (dblock){
-			error = get_and_read_buf(disk_fd, ip->i_sbd->sd_sb.sb_bsize,
-									 dblock, &bh, 0);
-			if (error){
-				log_err("readi:  Unable to perform get_and_read_buf()\n");
-				goto out;
-			}
-
-			dblock++;
-			extlen--;
-		}
-		else
-			bh = NULL;
-
-		if (bh){
-			memcpy(buf+copied, BH_DATA(bh)+offset, amount);
-			relse_buf(bh);
-		} else {
-			memset(buf+copied, 0, amount);
-		}
-		copied += amount;
-		lblock++;
-
-		offset = (journaled) ? sizeof(struct gfs_meta_header) : 0;
-	}
-
- out:
-
-	return (error < 0) ? error : copied;
-}
-
-
-
-/**
- * writei - Write bytes to a file
- * @ip: The GFS inode
- * @buf: The buffer containing information to be written
- * @offset: The file offset to start writing at
- * @size: The amount of data to write
- *
- * Returns: The number of bytes correctly written or error code
- */
-int writei(int disk_fd, struct gfs_inode *ip, void *buf, uint64_t offset,
-		   unsigned int size)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	osi_buf_t *dibh, *bh;
-	uint64_t lblock, dblock;
-	uint32_t extlen = 0;
-	unsigned int amount;
-	int new;
-	int journaled = fs_is_jdata(ip);
-	const uint64_t start = offset;
-	int copied = 0;
-	int error = 0;
-
-	/*  Bomb out on writing nothing.
-	    Posix says we can't change the time here.  */
-
-	if (!size)
-		goto fail;  /*  Not really an error  */
-
-
-	if (fs_is_stuffed(ip) &&
-	    ((start + size) > (sdp->sd_sb.sb_bsize - sizeof(struct gfs_dinode)))){
-		error = fs_unstuff_dinode(disk_fd, ip);
-		if (error)
-			goto fail;
-	}
-
-
-	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 (fs_is_stuffed(ip))
-		offset += sizeof(struct gfs_dinode);
-	else if (journaled)
-		offset += sizeof(struct gfs_meta_header);
-
-
-	while (copied < size){
-		amount = size - copied;
-		if (amount > sdp->sd_sb.sb_bsize - offset)
-			amount = sdp->sd_sb.sb_bsize - offset;
-
-		if (!extlen){
-			new = TRUE;
-			error = fs_block_map(disk_fd, ip, lblock, &new, &dblock, &extlen);
-			if (error)
-				goto fail;
-			if(!dblock){
-				log_crit("fs_writei:  "
-					"Unable to map logical block to real block.\n");
-				log_crit("Uncircumventable error.\n");
-				exit(EXIT_FAILURE);
-			}
-		}
-
-		error = get_and_read_buf(disk_fd, ip->i_sbd->sd_sb.sb_bsize, dblock,
-								 &bh, 0);
-		if (error)
-			goto fail;
-
-		if(journaled && dblock != ip->i_di.di_num.no_addr ) {
-			set_meta(bh, GFS_METATYPE_JD, GFS_FORMAT_JD);
-		}
-
-		memcpy(BH_DATA(bh)+offset, buf+copied, amount);
-		write_buf(disk_fd, bh, 0);
-		relse_buf(bh);
-
-		copied += amount;
-		lblock++;
-		dblock++;
-		extlen--;
-
-		offset = (journaled) ? sizeof(struct gfs_meta_header) : 0;
-	}
-
-
- out:
-	error = get_and_read_buf(disk_fd, ip->i_sbd->sd_sb.sb_bsize,
-							 ip->i_num.no_addr, &dibh, 0);
-	if (error){
-		log_err("fs_writei:  "
-			"Unable to get inode buffer.\n");
-		return -1;
-	}
-
-	error = check_meta(dibh, GFS_METATYPE_DI);
-	if(error){
-		log_err("fs_writei:  "
-			"Buffer is not a valid inode.\n");
-		relse_buf(dibh);
-		return -1;
-	}
-
-	if (ip->i_di.di_size < start + copied)
-		ip->i_di.di_size = start + copied;
-	ip->i_di.di_mtime = ip->i_di.di_ctime = osi_current_time();
-
-	gfs_dinode_out(&ip->i_di, (char *)BH_DATA(dibh));
-	write_buf(disk_fd, dibh, 0);
-	relse_buf(dibh);
-
-	return copied;
-
-
-
- fail:
-	if (copied)
-		goto out;
-
-	return error;
-}
-
diff --git a/gfs/libgfs/fs_bits.c b/gfs/libgfs/fs_bits.c
deleted file mode 100644
index 3509763..0000000
--- a/gfs/libgfs/fs_bits.c
+++ /dev/null
@@ -1,348 +0,0 @@
-#include "incore.h"
-#include "libgfs.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 fs_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 / GFS_NBBY);
-	bit = (block % GFS_NBBY) * GFS_BIT_SIZE;
-	end = buffer + buflen;
-
-	if(byte >= end){
-		log_err("fs_setbit:  byte >= end\n");
-		exit(1);
-	}
-	cur_state = (*byte >> bit) & GFS_BIT_MASK;
-
-	*byte ^= cur_state << bit;
-	*byte |= new_state << bit;
-}
-
-uint32_t fs_bitfit_core(struct gfs_sbd *sbp, uint64_t goal, uint64_t start,
-						uint64_t len, unsigned char old_state)
-{
-	uint64_t block;
-	struct block_query q;
-
-	log_debug("Goal: %"PRIu64", Start: %"PRIu64" len: %"PRIu64"\n",
-		  goal, start, len);
-	for(block = start+goal; block < start+len; block++) {
-		block_check(sbp->bl, block, &q);
-		switch(old_state) {
-		case GFS_BLKST_FREE:
-			switch(q.block_type) {
-			case block_free:
-				return block - start;
-			}
-			break;
-		case GFS_BLKST_FREEMETA:
-			switch(q.block_type) {
-			case meta_free:
-				return block - start;
-			}
-			break;
-		case GFS_BLKST_USEDMETA:
-			switch(q.block_type) {
-			case inode_dir:
-			case inode_file:
-			case inode_lnk:
-			case inode_blk:
-			case inode_chr:
-			case inode_fifo:
-			case inode_sock:
-			case indir_blk:
-			case leaf_blk:
-			case journal_blk:
-			case meta_other:
-			case meta_eattr:
-				return block - start;
-			}
-			break;
-		case GFS_BLKST_USED:
-			switch(q.block_type) {
-			case block_used:
-				return block - start;
-			}
-			break;
-		default:
-			log_err("Invalid type");
-			break;
-		}
-	}
-	return BFITNOENT;
-}
-/**
- * fs_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 fs_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 / GFS_NBBY);
-	bit = (goal % GFS_NBBY) * GFS_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) & GFS_BIT_MASK) == old_state){
-			return blk;
-		}
-
-		bit += GFS_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 fs_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) & GFS_BIT_MASK) == state)
-			count++;
-
-		bit += GFS_BIT_SIZE;
-		if (bit >= 8){
-			bit = 0;
-			byte++;
-		}
-	}
-	return count;
-}
-
-
-/**
- * fs_blkalloc_internal - allocate a single block
- * @rgd: the resource group descriptor
- * @goal: the goal block in the RG
- * @old_state: the type of block to find
- * @new_state: the resulting block type
- * @do_it: if FALSE, we just find the block we would allocate
- *
- *
- * Returns:  returns the block allocated, or BFITNOENT on failure
- */
-uint32_t fs_blkalloc_internal(struct gfs_rgrpd *rgd, uint32_t goal,
-			      unsigned char old_state,
-			      unsigned char new_state, int do_it)
-{
-	struct gfs_sbd *sdp = rgd->rd_sbd;
-	uint32_t block = 0;
-	log_debug("fs_blkalloc_internal got %u as goal\n", goal);
-	goal = ((int)(goal - rgd->rd_ri.ri_data1) < 0)
-		? 0
-		: goal - rgd->rd_ri.ri_data1;
-
-
-	block = fs_bitfit_core(sdp, goal, rgd->rd_ri.ri_data1,
-			       rgd->rd_ri.ri_data, old_state);
-
-
-	if(block == BFITNOENT) {
-		log_debug("No bits left in old_state?\n"
-			  "\told_state   = %u\n"
-			  "\tnew_state   = %u\n"
-			  "\trg_free     = %u\n"
-			  "\trg_freemeta = %u\n",
-			old_state, new_state,
-			rgd->rd_rg.rg_free,
-			rgd->rd_rg.rg_freemeta);
-		return BFITNOENT;
-	}
-
-	log_debug("fs_blkalloc_internal found block %u\n", block);
-	switch(new_state) {
-	case GFS_BLKST_FREE:
-		block_set(sdp->bl, block + rgd->rd_ri.ri_data1, block_free);
-		break;
-	case GFS_BLKST_USED:
-		block_set(sdp->bl, block + rgd->rd_ri.ri_data1, block_used);
-		break;
-	case GFS_BLKST_USEDMETA:
-		block_set(sdp->bl, block + rgd->rd_ri.ri_data1, meta_other);
-		break;
-	case GFS_BLKST_FREEMETA:
-		block_set(sdp->bl, block + rgd->rd_ri.ri_data1, meta_free);
-		break;
-	}
-	return  block;
-}
-
-
-/*
- * 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_FREEMETA (2)
- *  GFS_BLKST_USEDMETA (3)
- *
- * Returns: state on success, -1 on error
- */
-int fs_get_bitmap(int disk_fd, struct gfs_sbd *sdp, uint64 blkno, struct gfs_rgrpd *rgd){
-	int           buf, val;
-	uint32_t        rgrp_block;
-/*  struct gfs_rgrpd	*rgd;*/
-	struct gfs_bitmap	*bits = NULL;
-	unsigned int  bit;
-	unsigned char *byte;
-	int local_rgd = 0;
-
-	if(check_range(sdp, blkno)){
-		log_warn("Block #%"PRIu64" is out of range.\n", blkno);
-		return -1;
-	}
-	if(rgd == NULL) {
-		local_rgd = 1;
-		rgd = fs_blk2rgrpd(sdp, blkno);
-	}
-	if(rgd == NULL){
-		log_err( "Unable to get rgrp for block #%"PRIu64"\n", blkno);
-		return -1;
-	}
-	if(fs_rgrp_read(disk_fd, rgd, FALSE)){ /* FALSE:don't try to fix (done elsewhere) */
-		log_err( "Unable to read rgrp.\n");
-		return -1;
-	}
-
-	rgrp_block = (uint32_t)(blkno - rgd->rd_ri.ri_data1);
-
-	for(buf= 0; buf < rgd->rd_ri.ri_length; buf++){
-		bits = &(rgd->rd_bits[buf]);
-		if(rgrp_block < ((bits->bi_start + bits->bi_len)*GFS_NBBY)){
-			break;
-		}
-	}
-
-	if(buf >= rgd->rd_ri.ri_length){
-		log_err( "Unable to locate bitmap entry for block #%"PRIu64"\n",
-			blkno);
-		fs_rgrp_relse(rgd);
-		return -1;
-	}
-
-	byte = (unsigned char *)((BH_DATA(rgd->rd_bh[buf]) + bits->bi_offset) +
-				 (rgrp_block/GFS_NBBY - bits->bi_start));
-	bit = (rgrp_block % GFS_NBBY) * GFS_BIT_SIZE;
-
-	val = ((*byte >> bit) & GFS_BIT_MASK);
-	if(local_rgd) {
-		fs_rgrp_relse(rgd);
-	}
-
-	return val;
-}
-
-
-/*
- * fs_set_bitmap
- * @sdp: super block
- * @blkno: block number relative to file system
- * @state: one of 4 possible states
- *
- * This function sets the value of a bit of the
- * file system bitmap.
- *
- * Returns: 0 on success, -1 on error
- */
-int fs_set_bitmap(int disk_fd, struct gfs_sbd *sdp, uint64 blkno, int state)
-{
-	int           buf;
-	uint32_t        rgrp_block;
-	struct gfs_bitmap	*bits = NULL;
-	struct gfs_rgrpd	*rgd;
-
-	if((state != GFS_BLKST_FREE) && (state != GFS_BLKST_USED) &&
-	   (state != GFS_BLKST_FREEMETA) && (state != GFS_BLKST_USEDMETA)){
-		return -1;
-	}
-
-	rgd = fs_blk2rgrpd(sdp, blkno);
-
-	if(!rgd) {
-		log_err("Unable to get resource group for blkno %"PRIu64"\n",
-			blkno);
-		return -1;
-	}
-
-	if(fs_rgrp_read(disk_fd, rgd, FALSE)) {
-		stack;
-		return -1;
-	}
-	rgrp_block = (uint32_t)(blkno - rgd->rd_ri.ri_data1);
-	for(buf= 0; buf < rgd->rd_ri.ri_length; buf++){
-		bits = &(rgd->rd_bits[buf]);
-		if(rgrp_block < ((bits->bi_start + bits->bi_len)*GFS_NBBY)){
-			break;
-		}
-	}
-
-	fs_setbit((unsigned char *)BH_DATA(rgd->rd_bh[buf]) + bits->bi_offset,
-		  bits->bi_len,
-		  (rgrp_block - (bits->bi_start*GFS_NBBY)),
-		  state);
-
-
-	if(write_buf(disk_fd, rgd->rd_bh[buf], 0)){
-		fs_rgrp_relse(rgd);
-		return -1;
-	}
-
-	fs_rgrp_relse(rgd);
-	return 0;
-}
diff --git a/gfs/libgfs/fs_bmap.c b/gfs/libgfs/fs_bmap.c
deleted file mode 100644
index a75f774..0000000
--- a/gfs/libgfs/fs_bmap.c
+++ /dev/null
@@ -1,522 +0,0 @@
-#include "libgfs.h"
-
-typedef struct metapath
-{
-	uint64              mp_list[GFS_MAX_META_HEIGHT];
-}metapath_t;
-
-
-/**
- * fs_unstuff_dinode - Unstuff a dinode when the data has grown too big
- * @ip: The GFS inode to unstuff
- * * This routine unstuffs a dinode and returns it to a "normal" state such
- * that the height can be grown in the traditional way.
- *
- * Returns: 0 on success, -EXXXX on failure
- */
-int fs_unstuff_dinode(int disk_fd, struct gfs_inode *ip)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	osi_buf_t *bh = NULL;
-	osi_buf_t *dibh = NULL;
-	int journaled = fs_is_jdata(ip);
-	uint64 block = 0;
-	int error;
-
-	log_debug("Unstuffing inode %"PRIu64" - %u\n", ip->i_di.di_num.no_addr,
-		  journaled);
-
-	if(!fs_is_stuffed(ip)){
-		log_err("Trying to unstuff a dinode that is already unstuffed.\n");
-		return -1;
-	}
-	error = get_and_read_buf(disk_fd, sdp->sd_sb.sb_bsize, ip->i_num.no_addr,
-							 &dibh, 0);
-	if (error) {
-		stack;
-		goto fail;
-	}
-
-	error = check_meta(dibh, GFS_METATYPE_DI);
-	if(error) {
-		stack;
-		goto fail;
-	}
-
-	if (ip->i_di.di_size){
-		log_err("Allocating new block for unstuffed dinode\n");
-		if(journaled){
-			error = fs_metaalloc(disk_fd, ip, &block);
-			if (error) {
-				stack;
-				goto fail;
-			}
-			log_err("Got block %"PRIu64"\n", block);
-			error = get_buf(sdp->sd_sb.sb_bsize, block, &bh);
-			if (error) {
-				stack;
-				goto fail;
-			}
-
-			set_meta(bh, GFS_METATYPE_JD, GFS_FORMAT_JD);
-
-			memcpy(BH_DATA(bh)+sizeof(struct gfs_meta_header),
-			       BH_DATA(dibh)+sizeof(struct gfs_dinode),
-			       BH_SIZE(dibh)-sizeof(struct gfs_dinode));
-
-			error = write_buf(disk_fd, bh, 0);
-			if(error) {
-				stack;
-				goto fail;
-			}
-			relse_buf(bh);
-			block_set(sdp->bl, block, journal_blk);
-		}
-		else{
-			error = fs_blkalloc(disk_fd, ip, &block);
-
-			if(error) {
-				stack;
-				goto fail;
-			}
-
-			error = get_buf(sdp->sd_sb.sb_bsize, block, &bh);
-			if (error) {
-				stack;
-				goto fail;
-			}
-
-			memcpy(BH_DATA(bh)+sizeof(struct gfs_meta_header),
-			       BH_DATA(dibh)+sizeof(struct gfs_dinode),
-			       BH_SIZE(dibh)-sizeof(struct gfs_dinode));
-
-			error = write_buf(disk_fd, bh, 0);
-			if(error) {
-				stack;
-				goto fail;
-			}
-			relse_buf(bh);
-			block_set(sdp->bl, block, block_used);
-		}
-	}
-
-	bh = NULL;
-	/*  Set up the pointer to the new block  */
-
-	memset(BH_DATA(dibh)+sizeof(struct gfs_dinode), 0,
-	       BH_SIZE(dibh)-sizeof(struct gfs_dinode));
-
-	if (ip->i_di.di_size){
-		((uint64 *)(BH_DATA(dibh) + sizeof(struct gfs_dinode)))[0] = cpu_to_gfs64(block);
-		ip->i_di.di_blocks++;
-	}
-
-	ip->i_di.di_height = 1;
-
-	gfs_dinode_out(&ip->i_di, BH_DATA(dibh));
-	if(write_buf(disk_fd, dibh, 0)){
-		log_err("Dinode unstuffed, but unable to write back dinode.\n");
-		goto fail;
-	}
-	relse_buf(dibh);
-
-	return 0;
-
-
-
- fail:
-	if(bh) relse_buf(bh);
-	if(dibh) relse_buf(dibh);
-
-	return error;
-}
-
-
-/**
- * calc_tree_height - Calculate the height of a metadata tree
- * @ip: The GFS inode
- * @size: The proposed size of the file
- *
- * Work out how tall a metadata tree needs to be in order to accommodate a
- * file of a particular size. If size is less than the current size of
- * the inode, then the current size of the inode is used instead of the
- * supplied one.
- *
- * Returns: the height the tree should be
- */
-
-static unsigned int calc_tree_height(struct gfs_inode *ip, uint64 size)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	uint64 *arr;
-	unsigned int max, height;
-
-	if (ip->i_di.di_size > size)
-		size = ip->i_di.di_size;
-
-	if (fs_is_jdata(ip)){
-		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;
-}
-
-
-/**
- * build_height - Build a metadata tree of the requested height
- * @ip: The GFS inode
- * @height: The height to build to
- *
- *
- * Returns: 0 on success, -EXXXX on failure
- */
-static int build_height(int disk_fd, struct gfs_inode *ip, int height)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	osi_buf_t *bh, *dibh;
-	uint64 block, *bp;
-	unsigned int x;
-	int new_block;
-	int error;
-
-	while (ip->i_di.di_height < height){
-		error = get_and_read_buf(disk_fd, ip->i_sbd->sd_sb.sb_bsize,
-								 ip->i_num.no_addr, &dibh, 0);
-		if (error)
-			goto fail;
-
-		new_block = FALSE;
-		bp = (uint64 *)(BH_DATA(dibh) + sizeof(struct gfs_dinode));
-		for (x = 0; x < sdp->sd_diptrs; x++, bp++)
-			if (*bp){
-				new_block = TRUE;
-				break;
-			}
-
-
-		if (new_block){
-			/*  Get a new block, fill it with the old direct pointers and write it out  */
-			error = fs_metaalloc(disk_fd, ip, &block);
-			if (error)
-				goto fail_drelse;
-
-			error = get_and_read_buf(disk_fd, sdp->sd_sb.sb_bsize, block, &bh, 0);
-			if (error)
-				goto fail_drelse;
-
-			set_meta(bh, GFS_METATYPE_IN, GFS_FORMAT_IN);
-			/*
-			  gfs_buffer_copy_tail(bh, sizeof(struct gfs_indirect),
-			  dibh, sizeof(struct gfs_dinode));
-			*/
-			log_err("ATTENTION -- Not doing copy_tail...\n");
-			exit(1);
-			error = -1;
-			goto fail_drelse;
-			if((error = write_buf(disk_fd, bh, 0))){
-				log_err( "Unable to write new buffer #%"PRIu64".\n",
-					BH_BLKNO(bh));
-				goto fail_drelse;
-			}
-			relse_buf(bh);
-		}
-
-
-		/*  Set up the new direct pointer and write it out to disk  */
-
-		memset(BH_DATA(dibh)+sizeof(struct gfs_dinode), 0,
-		       BH_SIZE(dibh)-sizeof(struct gfs_dinode));
-
-		if (new_block){
-			((uint64 *)(BH_DATA(dibh) + sizeof(struct gfs_dinode)))[0] = cpu_to_gfs64(block);
-			ip->i_di.di_blocks++;
-		}
-
-		ip->i_di.di_height++;
-
-		gfs_dinode_out(&ip->i_di, BH_DATA(dibh));
-		write_buf(disk_fd, dibh, 0);
-		relse_buf(dibh);
-	}
-
-	return 0;
-
-
-
- fail_drelse:
-	relse_buf(dibh);
-
- fail:
-	return error;
-}
-
-
-static void find_metapath(struct gfs_inode *ip, metapath_t *mp, uint64 block)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	unsigned int i;
-
-	for (i = ip->i_di.di_height; i--; ){
-		mp->mp_list[i] = block % sdp->sd_inptrs;
-		block /= sdp->sd_inptrs;
-	}
-}
-
-
-/**
- * metapointer - Return pointer to start of metadata in a buffer
- * @bh: The buffer
- * @level: The metadata level (0 = dinode)
- * @mp: The metapath
- *
- * Return a pointer to the block number of the next level of the metadata
- * tree given a buffer containing the pointer to the current level of the
- * metadata tree.
- */
-
-static uint64 *metapointer(osi_buf_t *bh, unsigned int level, metapath_t *mp)
-{
-	int head_size = (level > 0) ? sizeof(struct gfs_indirect) : sizeof(struct gfs_dinode);
-	return ((uint64 *)(BH_DATA(bh) + head_size)) + mp->mp_list[level];
-}
-
-
-/**
- * get_metablock - Get the next metadata block in metadata tree
- * @ip: The GFS inode
- * @bh: Buffer containing the pointers to metadata blocks
- * @level: The level of the tree (0 = dinode)
- * @mp: The metapath
- * @create: Non-zero if we may create a new meatdata block
- * @new: Used to indicate if we did create a new metadata block
- * @block: the returned disk block number
- *
- * Given a metatree, complete to a particular level, checks to see if the next
- * level of the tree exists. If not the next level of the tree is created.
- * The block number of the next level of the metadata tree is returned.
- *
- * Returns: 0 on success, -EXXX on failure
- */
-
-static int get_metablock(int disk_fd, struct gfs_inode *ip,
-			 osi_buf_t *bh, unsigned int level, metapath_t *mp,
-			 int create, int *new, uint64 *block)
-{
-	uint64 *ptr = metapointer(bh, level, mp);
-	int error = 0;
-
-	*new = 0;
-	*block = 0;
-
-	if (*ptr){
-		*block = gfs64_to_cpu(*ptr);
-		goto out;
-	}
-
-	if (!create)
-		goto out;
-
-	error = fs_metaalloc(disk_fd, ip, block);
-	if (error)
-		goto out;
-
-	*ptr = cpu_to_gfs64(*block);
-	ip->i_di.di_blocks++;
-	write_buf(disk_fd, bh, 0);
-
-	*new = 1;
-
- out:
-	return error;
-}
-
-
-/**
- * get_datablock - Get datablock number from metadata block
- * @rgd: rgrp to allocate from if necessary
- * @ip: The GFS inode
- * @bh: The buffer containing pointers to datablocks
- * @mp: The metapath
- * @create: Non-zero if we may create a new data block
- * @new: Used to indicate if we created a new data block
- * @block: the returned disk block number
- *
- * Given a fully built metadata tree, checks to see if a particular data
- * block exists. It is created if it does not exist and the block number
- * on disk is returned.
- *
- * Returns: 0 on success, -EXXX on failure
- */
-
-static int get_datablock(int disk_fd, struct gfs_inode *ip,
-			 osi_buf_t *bh, metapath_t *mp,
-			 int create, int *new, uint64 *block)
-{
-	uint64 *ptr = metapointer(bh, ip->i_di.di_height - 1, mp);
-	int error = 0;
-
-	*new = 0;
-	*block = 0;
-
-	if (*ptr){
-		*block = gfs64_to_cpu(*ptr);
-		goto out;
-	}
-
-	if (!create)
-		goto out;
-
-	if (fs_is_jdata(ip)){
-		error = fs_metaalloc(disk_fd, ip, block);
-		if (error)
-			goto out;
-	}
-	else {
-		error = fs_blkalloc(disk_fd, ip, block);
-		if (error)
-			goto out;
-	}
-
-	*ptr = cpu_to_gfs64(*block);
-	ip->i_di.di_blocks++;
-	write_buf(disk_fd, bh, 0);
-
-	*new = 1;
-
- out:
-	return error;
-}
-
-
-/**
- * fs_block_map - Map a block from an inode to a disk block
- * @ip: The GFS inode
- * @lblock: The logical block number
- * @new: Value/Result argument (1 = may create/did create new blocks)
- * @dblock: the disk block number of the start of an extent
- * @extlen: the size of the extent
- *
- * Find the block number on the current device which corresponds to an
- * inode's block. If the block had to be created, "new" will be set.
- *
- * Returns: 0 on success, -EXXX on failure
- */
-int fs_block_map(int disk_fd, struct gfs_inode *ip, uint64 lblock, int *new,
-				 uint64 *dblock, uint32 *extlen)
-{
-	struct gfs_sbd *sdp = ip->i_sbd;
-	osi_buf_t *bh = NULL;
-	metapath_t mp;
-	int create = *new;
-	unsigned int bsize;
-	unsigned int height;
-	unsigned int x, end_of_metadata;
-	unsigned int nptrs;
-	uint64 tmp_dblock;
-	int tmp_new;
-	int error = 0;
-
-	*new = 0;
-	*dblock = 0;
-	if (extlen)
-		*extlen = 0;
-
-	if (fs_is_stuffed(ip)){
-		*dblock = ip->i_num.no_addr;
-		if (extlen)
-			*extlen = 1;
-		goto out;
-	}
-	bsize = (fs_is_jdata(ip)) ? sdp->sd_jbsize : sdp->sd_sb.sb_bsize;
-
-	height = calc_tree_height(ip, (lblock + 1) * bsize);
-	if (ip->i_di.di_height < height){
-		if (!create){
-			error = 0;
-			goto fail;
-		}
-
-		error = build_height(disk_fd, ip, height);
-		if (error)
-			goto fail;
-	}
-
-	error = get_and_read_buf(disk_fd, ip->i_sbd->sd_sb.sb_bsize,
-							 ip->i_num.no_addr, &bh, 0);
-	if (error)
-		goto fail;
-
-	find_metapath(ip, &mp, lblock);
-	end_of_metadata = ip->i_di.di_height - 1;
-
-	for (x = 0; x < end_of_metadata; x++){
-		error = get_metablock(disk_fd, ip, bh, x, &mp, create, new, dblock);
-		relse_buf(bh); bh = NULL;
-		if (error)
-			goto fail;
-		if (!*dblock)
-			goto out;
-
-		error = get_and_read_buf(disk_fd, ip->i_sbd->sd_sb.sb_bsize,
-								 *dblock, &bh, 0);
-		if (error)
-			goto fail;
-	}
-
-	error = get_datablock(disk_fd, ip, bh, &mp, create, new, dblock);
-	if (error)
-		goto fail_drelse;
-
-	if (extlen && *dblock){
-		*extlen = 1;
-
-		if (!*new){
-			nptrs = (end_of_metadata) ? sdp->sd_inptrs : sdp->sd_diptrs;
-			while (++mp.mp_list[end_of_metadata] < nptrs){
-				error = get_datablock(disk_fd, ip, bh, &mp, 0, &tmp_new,
-						      &tmp_dblock);
-				if(error){
-					log_err( "Unable to perform get_datablock.\n");
-					goto fail;
-				}
-
-				if (*dblock + *extlen != tmp_dblock)
-					break;
-
-				(*extlen)++;
-			}
-		}
-	}
-
-	relse_buf(bh);
-
-
- out:
-	if (*new){
-		error = get_and_read_buf(disk_fd, sdp->sd_sb.sb_bsize, ip->i_num.no_addr,
-								 &bh, 0);
-		if (error)
-			goto fail;
-		gfs_dinode_out(&ip->i_di, BH_DATA(bh));
-		write_buf(disk_fd, bh, 0);
-		relse_buf(bh);
-	}
-	return 0;
-
-
-
- fail_drelse:
-	if(bh)
-		relse_buf(bh);
-
- fail:
-	return error;
-}
diff --git a/gfs/libgfs/fs_dir.c b/gfs/libgfs/fs_dir.c
deleted file mode 100644
index fe34b8a..0000000
--- a/gfs/libgfs/fs_dir.c
+++ /dev/null
@@ -1,1683 +0,0 @@
-#include "incore.h"
-#include "link.h"
-#include "libgfs.h"
-
-#define dir_hash(qstr) (gfs_dir_hash((char *)(qstr)->name, (qstr)->len))
-
-/* Detect directory is a stuffed inode */
-int gfs_inode_is_stuffed(struct gfs_inode *ip)
-{
-	return !ip->i_di.di_height;
-}
-
-/**
- * dirent_first - Return the first dirent
- * @bh: The buffer
- * @dent: Pointer to list of dirents
- *
- * return first dirent whether bh points to leaf or stuffed dinode
- *
- * Returns: IS_LEAF or IS_DINODE
- */
-int dirent_first(osi_buf_t *bh, struct gfs_dirent **dent)
-{
-	struct gfs_leaf *leaf;
-	struct gfs_dinode *dinode;
-
-	leaf = (struct gfs_leaf *)BH_DATA(bh);
-
-	if (gfs32_to_cpu(leaf->lf_header.mh_type) == GFS_METATYPE_LF)
-	{
-		*dent = (struct gfs_dirent *)(BH_DATA(bh) + sizeof(struct gfs_leaf));
-
-		return IS_LEAF;
-	}
-	else
-	{
-		dinode = (struct gfs_dinode *)BH_DATA(bh);
-		if(gfs32_to_cpu(dinode->di_header.mh_type) != GFS_METATYPE_DI){
-			log_err("buffer is not GFS_METATYPE_[DI | LF]\n");
-			return -1;
-		}
-
-		*dent = (struct gfs_dirent *)(BH_DATA(bh) + sizeof(struct gfs_dinode));
-
-		return IS_DINODE;
-	}
-}
-
-
-/**
- * dirent_next - Next dirent
- * @bh: The buffer
- * @dent: Pointer to list of dirents
- *
- * Returns: 0 on success, error code otherwise
- */
-int dirent_next(osi_buf_t *bh, struct gfs_dirent **dent)
-{
-	struct gfs_dirent *tmp, *cur;
-	char *bh_end;
-	uint32 cur_rec_len;
-
-	cur = *dent;
-	bh_end = BH_DATA(bh) + BH_SIZE(bh);
-
-	cur_rec_len = gfs16_to_cpu(cur->de_rec_len);
-
-	if ((char *)cur + cur_rec_len >= bh_end){
-		if((char *)cur + cur_rec_len != bh_end){
-			log_err("Bad record length causing failure in dirent_next()\n");
-			return -1;
-		}
-		return -ENOENT;
-	}
-
-	tmp = (struct gfs_dirent *)((char *)cur + cur_rec_len);
-
-	if((char *)tmp + gfs16_to_cpu(tmp->de_rec_len) > bh_end){
-		log_err("Bad record length causing failure in dirent_next\n");
-		return -1;
-	}
-
-	/*  only the first dent could ever have de_ino == 0  */
-	if(!tmp->de_inum.no_formal_ino){
-		char tmp_name[256];
-
-		memcpy(tmp_name, cur+sizeof(struct gfs_dirent), gfs16_to_cpu(cur->de_name_len));
-		tmp_name[gfs16_to_cpu(cur->de_name_len)] = '\0';
-		log_err("dirent_next:  "
-			"A non-first dir entry has zero formal inode.\n");
-		log_err("\tFaulty dirent after (%s) in block #%"PRIu64".\n",
-			tmp_name, BH_BLKNO(bh));
-
-		return -1;
-	}
-
-	*dent = tmp;
-
-	return 0;
-}
-
-
-/**
- * dirent_del - Delete a dirent
- * @dip: The GFS inode
- * @bh: The buffer
- * @prev: The previous dirent
- * @cur: The current dirent
- *
- * Returns: 0 on success, error code otherwise
- */
-
-int dirent_del(int disk_fd, struct gfs_inode *dip, osi_buf_t *bh,
-	       struct gfs_dirent *prev, struct gfs_dirent *cur){
-	uint32 cur_rec_len, prev_rec_len;
-
-	dip->i_di.di_entries--;
-	if(!cur->de_inum.no_formal_ino){
-		log_err("dirent_del:  "
-			"Can not delete dirent with !no_formal_ino.\n");
-		return -1;
-	}
-
-	/*  If there is no prev entry, this is the first entry in the block.
-	    The de_rec_len is already as big as it needs to be.  Just zero
-	    out the inode number and return.  */
-
-	if (!prev){
-		cur->de_inum.no_formal_ino = 0;  /*  No endianess worries  */
-		if (write_buf(disk_fd, bh, 0)){
-			log_err("dirent_del: Bad write_buf.\n");
-			return -EIO;
-		}
-		return 0;
-	}
-
-	/*  Combine this dentry with the previous one.  */
-
-	prev_rec_len = gfs16_to_cpu(prev->de_rec_len);
-	cur_rec_len = gfs16_to_cpu(cur->de_rec_len);
-
-	if((char *)prev + prev_rec_len != (char *)cur){
-		log_err("dirent_del: Bad bounds for directory entries.\n");
-		return -1;
-	}
-
-	if((char *)(cur) + cur_rec_len > BH_DATA(bh) + BH_SIZE(bh)){
-		log_err("dirent_del: Directory entry has record length"
-			" longer than buffer.\n");
-		return -1;
-	}
-
-	log_debug("Updating previous record from %u to %u\n",
-		  prev_rec_len, prev_rec_len+cur_rec_len);
-	prev_rec_len += cur_rec_len;
-	prev->de_rec_len = cpu_to_gfs16(prev_rec_len);
-
-	if(write_buf(disk_fd, bh, 0)){
-		log_err("dirent_del: Bad write_buf.\n");
-		return -EIO;
-	}
-
-	return 0;
-}
-
-
-/**
- * get_leaf - Get leaf
- * @dip:
- * @leaf_no:
- * @bh_out:
- *
- * Returns: 0 on success, error code otherwise
- */
-
-int get_leaf(int disk_fd, struct gfs_inode *dip, uint64 leaf_no,
-			 osi_buf_t **bhp)
-{
-	int error;
-
-	error = get_and_read_buf(disk_fd, dip->i_sbd->sd_sb.sb_bsize, leaf_no,
-							 bhp, 0);
-	if (error) {
-		log_err("Unable to read leaf buffer #%"PRIu64"\n", leaf_no);
-		return error;
-	}
-
-	error = check_meta(*bhp, GFS_METATYPE_LF);
-
-	if(error) {
-		log_err("Metatype for block #%"PRIu64" is not type 'leaf'\n",
-			leaf_no);
-		relse_buf(*bhp);
-	}
-	return error;
-}
-
-
-/**
- * get_first_leaf - Get first leaf
- * @dip: The GFS inode
- * @index:
- * @bh_out:
- *
- * Returns: 0 on success, error code otherwise
- */
-
-int get_first_leaf(int disk_fd, struct gfs_inode *dip, uint32 index,
-				   osi_buf_t **bh_out)
-{
-	uint64 leaf_no;
-	int error;
-
-	error = get_leaf_nr(disk_fd, dip, index, &leaf_no);
-	if (!error)
-		error = get_leaf(disk_fd, dip, leaf_no, bh_out);
-
-	return error;
-}
-
-
-/**
- * get_next_leaf - Get next leaf
- * @dip: The GFS inode
- * @bh_in: The buffer
- * @bh_out:
- *
- * Returns: 0 on success, error code otherwise
- */
-
-int get_next_leaf(int disk_fd, struct gfs_inode *dip,osi_buf_t *bh_in,osi_buf_t **bh_out)
-{
-	struct gfs_leaf *leaf;
-	int error;
-
-	leaf = (struct gfs_leaf *)BH_DATA(bh_in);
-
-	if (!leaf->lf_next)
-		error = -ENOENT;
-	else
-		error = get_leaf(disk_fd, dip, gfs64_to_cpu(leaf->lf_next), bh_out);
-	return error;
-}
-
-/**
- * leaf_search
- * @bh:
- * @id:
- * @dent_out:
- * @dent_prev:
- *
- * Returns:
- */
-static int leaf_search(osi_buf_t *bh, identifier_t *id,
-                       struct gfs_dirent **dent_out,
-		       struct gfs_dirent **dent_prev)
-{
-	uint32 hash;
-	struct gfs_dirent *dent, *prev = NULL;
-	unsigned int entries = 0, x = 0;
-	int type;
-
-	type = dirent_first(bh, &dent);
-
-	if (type == IS_LEAF){
-		struct gfs_leaf *leaf = (struct gfs_leaf *)BH_DATA(bh);
-		entries = gfs16_to_cpu(leaf->lf_entries);
-	} else if (type == IS_DINODE) {
-		struct gfs_dinode *dinode = (struct gfs_dinode *)(BH_DATA(bh));
-		entries = gfs32_to_cpu(dinode->di_entries);
-	} else {
-		log_err("type != IS_LEAF && type != IS_DINODE\n");
-		return -1;
-	}
-
-	if(id->type == ID_FILENAME){
-		hash = dir_hash(id->filename);
-
-		do{
-			if (!dent->de_inum.no_formal_ino){
-				prev = dent;
-				continue;
-			}
-
-			if (gfs32_to_cpu(dent->de_hash) == hash &&
-			    fs_filecmp(id->filename, (char *)(dent + 1),
-				       gfs16_to_cpu(dent->de_name_len))){
-				*dent_out = dent;
-				if (dent_prev)
-					*dent_prev = prev;
-				return 0;
-			}
-
-			if(x >= entries){
-				log_err("x >= entries (%u >= %u)\n", x, entries);
-				return -1;
-			}
-			x++;
-			prev = dent;
-		} while (dirent_next(bh, &dent) == 0);
-	} else if(id->type == ID_INUM){
-		struct gfs_inum inum;
-
-		do{
-			if (!dent->de_inum.no_formal_ino){
-				prev = dent;
-				continue;
-			}
-
-			gfs_inum_in(&inum, (char *)&dent->de_inum);
-
-			if(inum.no_addr == id->inum->no_addr){
-				*dent_out = dent;
-				if(dent_prev)
-					*dent_prev = prev;
-				return 0;
-			}
-
-			if(x >= entries){
-				log_err("x >= entries (%u >= %u)\n", x, entries);
-				return -1;
-			}
-			x++;
-			prev = dent;
-		} while (dirent_next(bh, &dent) == 0);
-	} else {
-		log_err("leaf_search:  Invalid type for identifier.\n");
-		exit(1);
-	}
-
-	return -ENOENT;
-}
-
-
-/**
- * linked_leaf_search - Linked leaf search
- * @dip: The GFS inode
- * @id:
- * @dent_out:
- * @dent_prev:
- * @bh_out:
- *
- * Returns: 0 on sucess, error code otherwise
- */
-
-static int linked_leaf_search(int disk_fd, struct gfs_inode *dip,
-							  identifier_t *id, struct gfs_dirent **dent_out,
-			      struct gfs_dirent **dent_prev, osi_buf_t **bh_out)
-{
-	osi_buf_t *bh = NULL, *bh_next;
-	uint32 hsize, index;
-	uint32 hash;
-	int error = 0;
-
-	hsize = 1 << dip->i_di.di_depth;
-	if(hsize * sizeof(uint64) != dip->i_di.di_size){
-		log_err("hsize * sizeof(uint64) != dip->i_di.di_size\n");
-		return -1;
-	}
-
-	/*  Figure out the address of the leaf node.  */
-
-	if(id->type == ID_FILENAME){
-		hash = dir_hash(id->filename);
-		index = hash >> (32 - dip->i_di.di_depth);
-
-		error = get_first_leaf(disk_fd, dip, index, &bh_next);
-		if (error){
-			return error;
-		}
-
-		/*  Find the entry  */
-		do{
-			if (bh)
-				relse_buf(bh);
-
-			bh = bh_next;
-
-			error = leaf_search(bh, id, dent_out, dent_prev);
-			switch (error){
-			case 0:
-				*bh_out = bh;
-				return 0;
-
-			case -ENOENT:
-				break;
-
-			default:
-				relse_buf(bh);
-				return error;
-			}
-
-			error = get_next_leaf(disk_fd, dip, bh, &bh_next);
-		}while (!error);
-
-		relse_buf(bh);
-	} else if(id->type == ID_INUM){
-		for(index=0; index < (1 << dip->i_di.di_depth); index++){
-			error = get_first_leaf(disk_fd, dip, index, &bh_next);
-			if (error){
-				return error;
-			}
-
-			/*  Find the entry  */
-			do{
-				if (bh)
-					relse_buf(bh);
-
-				bh = bh_next;
-
-				error = leaf_search(bh, id, dent_out, dent_prev);
-				switch (error){
-				case 0:
-					*bh_out = bh;
-					return 0;
-
-				case -ENOENT:
-					break;
-
-				default:
-					relse_buf(bh);
-					return error;
-				}
-
-				error = get_next_leaf(disk_fd, dip, bh, &bh_next);
-			}while (!error);
-		}
-	} else {
-		log_err("linked_leaf_search:  Invalid type for identifier.\n");
-		exit(1);
-	}
-	return error;
-}
-
-
-/**
- * dir_e_search -
- * @dip: The GFS inode
- * @id:
- * @inode:
- *
- * Returns:
- */
-static int dir_e_search(int disk_fd, struct gfs_inode *dip,
-						identifier_t *id, unsigned int *type)
-{
-	osi_buf_t *bh = NULL;
-	struct gfs_dirent *dent;
-	int error;
-
-	error = linked_leaf_search(disk_fd, dip, id, &dent, NULL, &bh);
-	if (error){
-		return error;
-	}
-
-	if(id->type == ID_FILENAME){
-		if(id->inum){
-			log_err("dir_e_search:  Illegal parameter.  inum must be NULL.\n");
-			exit(1);
-		}
-		if(!(id->inum = (struct gfs_inum *)malloc(sizeof(struct gfs_inum)))) {
-			log_err("Unable to allocate inum structure\n");
-			return -1;
-		}
-		if(!memset(id->inum, 0, sizeof(struct gfs_inum))) {
-			log_err("Unable to zero inum structure\n");
-			return -1;
-		}
-
-		gfs_inum_in(id->inum, (char *)&dent->de_inum);
-	} else {
-		if(id->filename){
-			log_err("dir_e_search:  Illegal parameter.  name must be NULL.\n");
-			exit(1);
-		}
-		if(!(id->filename = (osi_filename_t *)malloc(sizeof(osi_filename_t)))) {
-			log_err("Unable to allocate osi_filename structure\n");
-			return -1;
-		}
-		if(!(memset(id->filename, 0, sizeof(osi_filename_t)))) {
-			log_err("Unable to zero osi_filename structure\n");
-			return -1;
-		}
-
-		id->filename->len = gfs16_to_cpu(dent->de_name_len);
-		if(!(id->filename->name = malloc(id->filename->len))) {
-			log_err("Unable to allocate name in osi_filename structure\n");
-			free(id->filename);
-			return -1;
-		}
-		if(!(memset(id->filename->name, 0, id->filename->len))) {
-			log_err("Unable to zero name in osi_filename structure\n");
-			free(id->inum);
-			free(id->filename);
-			return -1;
-		}
-
-		memcpy(id->filename->name, (char *)dent+sizeof(struct gfs_dirent),
-		       id->filename->len);
-	}
-	if (type)
-		*type = gfs16_to_cpu(dent->de_type);
-
-	relse_buf(bh);
-
-	return 0;
-}
-
-
-/**
- * dir_l_search -
- * @dip: The GFS inode
- * @id:
- * @inode:
- *
- * Returns:
- */
-static int dir_l_search(int disk_fd, struct gfs_inode *dip, identifier_t *id,
-						unsigned int *type)
-{
-	osi_buf_t *dibh;
-	struct gfs_dirent *dent;
-	int error;
-
-	if(!fs_is_stuffed(dip)){
-		log_err("A linear search was attempted on a directory "
-			"that is not stuffed.\n");
-		return -1;
-	}
-
-	error = get_and_read_buf(disk_fd, dip->i_sbd->sd_sb.sb_bsize,
-							 dip->i_num.no_addr, &dibh, 0);
-	if (error)
-		goto out;
-
-
-	error = leaf_search(dibh, id, &dent, NULL);
-	if (error)
-		goto out_drelse;
-
-	if(id->type == ID_FILENAME){
-		if(id->inum){
-			log_err("dir_l_search:  Illegal parameter.  inum must be NULL.\n");
-			exit(1);
-		}
-		id->inum = (struct gfs_inum *)malloc(sizeof(struct gfs_inum));
-		// FIXME: handle failed malloc
-		memset(id->inum, 0, sizeof(struct gfs_inum));
-
-		gfs_inum_in(id->inum, (char *)&dent->de_inum);
-	} else {
-		if(id->filename){
-			log_err("dir_l_search:  Illegal parameter.  name must be NULL.\n");
-			exit(1);
-		}
-		id->filename = (osi_filename_t *)malloc(sizeof(osi_filename_t));
-		// FIXME: handle failed malloc
-		memset(id->filename, 0, sizeof(osi_filename_t));
-
-		id->filename->len = gfs16_to_cpu(dent->de_name_len);
-		id->filename->name = malloc(id->filename->len);
-		// FIXME: handle failed malloc
-		memset(id->filename->name, 0, id->filename->len);
-
-		memcpy(id->filename->name, (char *)dent+sizeof(struct gfs_dirent),
-		       id->filename->len);
-	}
-	if(type)
-		*type = gfs16_to_cpu(dent->de_type);
-
-
- out_drelse:
-	relse_buf(dibh);
-
- out:
-	return error;
-}
-
-
-/**
- * dir_make_exhash - Convet a stuffed directory into an ExHash directory
- * @dip: The GFS inode
- *
- * Returns: 0 on success, error code otherwise
- */
-
-static int dir_make_exhash(int disk_fd, struct gfs_inode *dip)
-{
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct gfs_dirent *dent;
-	osi_buf_t *bh = NULL, *dibh = NULL;
-	struct gfs_leaf *leaf;
-	int y;
-	uint32 x;
-	uint64 *lp, bn;
-	int error;
-
-	/*  Sanity checks  */
-
-	if(sizeof(struct gfs_leaf) > sizeof(struct gfs_dinode)){
-		log_err(
-			"dir_make_exhash:  on-disk leaf is larger than on-disk dinode.\n"
-			"                  Unable to expand directory.\n");
-		return -1;
-	}
-
-	error = get_and_read_buf(disk_fd, dip->i_sbd->sd_sb.sb_bsize,
-							 dip->i_num.no_addr, &dibh, 0);
-	if (error)
-		goto fail;
-
-
-	error = fs_metaalloc(disk_fd, dip, &bn);
-
-	if (error)
-		goto fail_drelse;
-
-
-	/*  Turn over a new leaf  */
-
-	error = get_and_read_buf(disk_fd, sdp->sd_sb.sb_bsize, bn, &bh, 0);
-	if (error)
-		goto fail_drelse;
-
-	if(check_meta(bh, 0)){
-		log_err("dir_make_exhash:  Buffer has bad meta header.\n");
-		goto fail_drelse;
-	}
-
-	set_meta(bh, GFS_METATYPE_LF, GFS_FORMAT_LF);
-	memset(BH_DATA(bh) + sizeof(struct gfs_meta_header), 0,
-	       BH_SIZE(bh) - sizeof(struct gfs_meta_header));
-
-	/*  Fill in the leaf structure  */
-
-	leaf = (struct gfs_leaf *)BH_DATA(bh);
-
-	if(dip->i_di.di_entries >= (1 << 16)){
-		log_err(
-			"dir_make_exhash:  Too many directory entries.\n"
-			"                  Unable to expand directory.\n");
-		goto fail_drelse;
-	}
-	leaf->lf_dirent_format = cpu_to_gfs32(GFS_FORMAT_DE);
-	leaf->lf_entries = cpu_to_gfs16(dip->i_di.di_entries);
-
-
-	/*  Copy dirents  */
-	memset(BH_DATA(bh)+sizeof(struct gfs_leaf), 0, BH_SIZE(bh)-sizeof(struct gfs_leaf));
-	memcpy(BH_DATA(bh)+sizeof(struct gfs_leaf),
-	       BH_DATA(dibh)+sizeof(struct gfs_dinode),
-	       BH_SIZE(dibh)-sizeof(struct gfs_dinode));
-
-	/*  Find last entry  */
-
-	x = 0;
-	dirent_first(bh, &dent);
-
-	do
-	{
-		if (!dent->de_inum.no_formal_ino)
-			continue;
-
-		if (++x == dip->i_di.di_entries)
-			break;
-	}
-	while (dirent_next(bh, &dent) == 0);
-
-
-	/*  Adjust the last dirent's record length
-	    (Remember that dent still points to the last entry.)  */
-
-	dent->de_rec_len = gfs16_to_cpu(dent->de_rec_len) +
-		sizeof(struct gfs_dinode) - sizeof(struct gfs_leaf);
-	dent->de_rec_len = cpu_to_gfs16(dent->de_rec_len);
-
-	if(write_buf(disk_fd, bh, 0)){
-		log_err("dir_make_exhash:  bad write_buf()\n");
-		goto fail_drelse;
-	}
-	relse_buf(bh); bh=NULL;
-
-	log_debug("Created a new leaf block at %"PRIu64"\n", bn);
-
-	block_set(dip->i_sbd->bl, bn, leaf_blk);
-	/*  We're done with the new leaf block, now setup the new
-	    hash table.  */
-
-	memset(BH_DATA(dibh) + sizeof(struct gfs_dinode), 0,
-	       BH_SIZE(dibh) - sizeof(struct gfs_dinode));
-
-	lp = (uint64 *)(BH_DATA(dibh) + sizeof(struct gfs_dinode));
-
-	for (x = sdp->sd_hash_ptrs; x--; lp++)
-		*lp = cpu_to_gfs64(bn);
-
-	dip->i_di.di_size = sdp->sd_sb.sb_bsize / 2;
-	dip->i_di.di_blocks++;
-	dip->i_di.di_flags |= GFS_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;
-
-	gfs_dinode_out(&dip->i_di, BH_DATA(dibh));
-
-	if(write_buf(disk_fd, dibh, 0)){
-		log_err("dir_make_exhash: bad write_buf()\n");
-		goto fail_drelse;
-	}
-	relse_buf(dibh); dibh = NULL;
-
-	return 0;
-
-
-
- fail_drelse:
-	if(bh)
-		relse_buf(bh);
-	if(dibh)
-		relse_buf(dibh);
-
- fail:
-	return error;
-}
-
-
-/**
- * dir_split_leaf - Split a leaf block into two
- * @dip: The GFS inode
- * @index:
- * @leaf_no:
- *
- * Returns: 0 on success, error code on failure
- */
-static int dir_split_leaf(int disk_fd, struct gfs_inode *dip, uint32 index,
-						  uint64 leaf_no)
-{
-	struct gfs_sbd *sdp = dip->i_sbd;
-	osi_buf_t *nbh, *obh, *dibh;
-	struct gfs_leaf *nleaf, *oleaf;
-	struct gfs_dirent *dent, *prev = NULL, *next = NULL, *new;
-	uint32 start, len, half_len, divider;
-	uint64 bn, *lp;
-	uint32 name_len;
-	int x, moved = FALSE;
-	int error;
-
-	/*  Allocate the new leaf block  */
-
-	error = fs_metaalloc(disk_fd, dip, &bn);
-	if (error)
-		goto fail;
-
-
-	/*  Get the new leaf block  */
-	error = get_and_read_buf(disk_fd, sdp->sd_sb.sb_bsize, bn, &nbh, 0);
-	if (error)
-		goto fail;
-
-	if(check_meta(nbh, 0)){
-		log_err("dir_split_leaf:  Buffer is not a meta buffer.\n");
-		relse_buf(nbh);
-		return -1;
-	}
-
-	set_meta(nbh, GFS_METATYPE_LF, GFS_FORMAT_LF);
-
-	memset(BH_DATA(nbh)+sizeof(struct gfs_meta_header), 0,
-	       BH_SIZE(nbh)-sizeof(struct gfs_meta_header));
-
-	nleaf = (struct gfs_leaf *)BH_DATA(nbh);
-
-	nleaf->lf_dirent_format = cpu_to_gfs32(GFS_FORMAT_DE);
-
-
-	/*  Get the old leaf block  */
-
-	error = get_leaf(disk_fd, dip, leaf_no, &obh);
-	if (error)
-		goto fail_nrelse;
-
-	oleaf = (struct gfs_leaf *)BH_DATA(obh);
-
-
-	/*  Compute the start and len of leaf pointers in the hash table.  */
-
-	len = 1 << (dip->i_di.di_depth - gfs16_to_cpu(oleaf->lf_depth));
-	if(len == 1){
-		log_err("dir_split_leaf:  Corrupted leaf block encountered.\n");
-		goto fail_orelse;
-	}
-	half_len = len >> 1;
-
-	start = (index & ~(len - 1));
-
-	log_debug("Splitting leaf: len = %u, half_len = %u\n", len, half_len);
-
-	/*  Change the pointers.
-	    Don't bother distinguishing stuffed from non-stuffed.
-	    This code is complicated enough already.  */
-
-	lp = (uint64 *)malloc(half_len * sizeof(uint64));
-	// FIXME: handle failed malloc
-	memset(lp, 0, half_len * sizeof(uint64));
-
-	error = readi(disk_fd, dip, (char *)lp, start * sizeof(uint64),
-		      half_len * sizeof(uint64));
-	if (error != half_len * sizeof(uint64)){
-		if (error >= 0)
-			error = -EIO;
-		goto fail_lpfree;
-	}
-
-	/*  Change the pointers  */
-
-	for (x = 0; x < half_len; x++)
-		lp[x] = cpu_to_gfs64(bn);
-
-	error = writei(disk_fd, dip, (char *)lp, start * sizeof(uint64),
-		       half_len * sizeof(uint64));
-
-	if (error != half_len * sizeof(uint64)){
-		if (error >= 0)
-			error = -EIO;
-		goto fail_lpfree;
-	}
-
-	free(lp); lp = NULL;  /* need to set lp for failure cases */
-
-
-	/*  Compute the divider  */
-
-	divider = (start + half_len) << (32 - dip->i_di.di_depth);
-
-	/*  Copy the entries  */
-
-	dirent_first(obh, &dent);
-
-	do{
-		next = dent;
-		if (dirent_next(obh, &next))
-			next = NULL;
-
-		if (dent->de_inum.no_formal_ino &&
-		    (gfs32_to_cpu(dent->de_hash) < divider)){
-			name_len = gfs16_to_cpu(dent->de_name_len);
-
-			error = fs_dirent_alloc(disk_fd, dip, nbh, name_len, &new);
-			if(error){
-				log_err("dir_split_leaf:  fs_dirent_alloc failed.\n");
-				goto fail_orelse;
-			}
-
-			new->de_inum = dent->de_inum;  /*  No endianness worries  */
-			new->de_hash = dent->de_hash;  /*  No endianness worries  */
-			new->de_type = dent->de_type;  /*  No endianness worries  */
-			memcpy((char *)(new + 1), (char *)(dent + 1), name_len);
-
-			nleaf->lf_entries = gfs16_to_cpu(nleaf->lf_entries) + 1;
-			nleaf->lf_entries = cpu_to_gfs16(nleaf->lf_entries);
-
-			dirent_del(disk_fd, dip, obh, prev, dent);
-			/* Dirent del decrements entries, but we're
-			 * just shifting entries around, so increment
-			 * it again */
-			dip->i_di.di_entries++;
-
-			if(!gfs16_to_cpu(oleaf->lf_entries)){
-				log_err("dir_split_leaf:  old leaf contains no entries.\n");
-				goto fail_orelse;
-			}
-			oleaf->lf_entries = gfs16_to_cpu(oleaf->lf_entries) - 1;
-			oleaf->lf_entries = cpu_to_gfs16(oleaf->lf_entries);
-
-			if (!prev)
-				prev = dent;
-
-			moved = TRUE;
-		}
-		else
-			prev = dent;
-
-		dent = next;
-	}
-	while (dent);
-
-
-	/*  If none of the entries got moved into the new leaf,
-	    artificially fill in the first entry.  */
-
-	if (!moved){
-		error = fs_dirent_alloc(disk_fd, dip, nbh, 0, &new);
-		if(error){
-			log_err("dir_split_leaf:  fs_dirent_alloc failed..\n");
-			goto fail_orelse;
-		}
-		new->de_inum.no_formal_ino = 0;
-	}
-
-
-	oleaf->lf_depth = gfs16_to_cpu(oleaf->lf_depth) + 1;
-	oleaf->lf_depth = cpu_to_gfs16(oleaf->lf_depth);
-	nleaf->lf_depth = oleaf->lf_depth;
-
-
-	error = get_and_read_buf(disk_fd, dip->i_sbd->sd_sb.sb_bsize,
-							 dip->i_num.no_addr, &dibh, 0);
-	if(error){
-		log_err("dir_split_leaf:  Unable to get inode buffer.\n");
-		goto fail_orelse;
-	}
-
-	error = check_meta(dibh, GFS_METATYPE_DI);
-	if(error){
-		log_err("dir_split_leaf:  Buffer #%"PRIu64" is not a directory "
-			"inode.\n", BH_BLKNO(dibh));
-		goto fail_drelse;
-	}
-
-	dip->i_di.di_blocks++;
-
-	gfs_dinode_out(&dip->i_di, BH_DATA(dibh));
-	if(write_buf(disk_fd, dibh, 0)){
-		log_err("dir_split_leaf:  Failed to write new directory inode.\n");
-		goto fail_drelse;
-	}
-	relse_buf(dibh);
-
-
-	if(write_buf(disk_fd, obh, 0)){
-		log_err("dir_split_leaf:  Failed to write back old leaf block.\n");
-		goto fail_orelse;
-	}
-	relse_buf(obh);
-	if(write_buf(disk_fd, nbh, 0)){
-		log_err("dir_split_leaf:  Failed to write new leaf block.\n");
-		goto fail_nrelse;
-	}
-
-	log_debug("Created a new leaf block at %"PRIu64"\n", BH_BLKNO(nbh));
-
-	block_set(dip->i_sbd->bl, BH_BLKNO(nbh), leaf_blk);
-
-	relse_buf(nbh);
-
-	return 0;
-
-
-
- fail_drelse:
-	relse_buf(dibh);
-
- fail_lpfree:
-	if(lp) free(lp);
-
- fail_orelse:
-	relse_buf(obh);
-
- fail_nrelse:
-	relse_buf(nbh);
-
- fail:
-	return -1;
-}
-
-
-/**
- * dir_double_exhash - Double size of ExHash table
- * @dip: The GFS dinode
- *
- * Returns: 0 on success, -1 on failure
- */
-static int dir_double_exhash(int disk_fd, struct gfs_inode *dip)
-{
-	struct gfs_sbd *sdp = dip->i_sbd;
-	osi_buf_t *dibh;
-	uint32 hsize;
-	uint64 *buf;
-	uint64 *from, *to;
-	uint64 block;
-	int x;
-	int error = 0;
-
-	/*  Sanity Checks  */
-
-	hsize = 1 << dip->i_di.di_depth;
-	if(hsize * sizeof(uint64) != dip->i_di.di_size){
-		log_err("dir_double_exhash:  "
-			"hash size does not correspond to di_size.\n");
-		return -1;
-	}
-
-
-	/*  Allocate both the "from" and "to" buffers in one big chunk  */
-
-	buf = (uint64 *)malloc(3 * sdp->sd_hash_bsize);
-	if(!buf){
-		log_err("dir_double_exhash:  "
-			"Unable to allocate memory for blk ptr list.\n");
-		return -1;
-	}
-	memset(buf, 0, 3 * sdp->sd_hash_bsize);
-
-	for (block = dip->i_di.di_size / sdp->sd_hash_bsize; block--;){
-		error = readi(disk_fd, dip, (char *)buf, block * sdp->sd_hash_bsize,
-			      sdp->sd_hash_bsize);
-		if (error != sdp->sd_hash_bsize){
-			if (error >= 0)
-				error = -EIO;
-			goto out;
-		}
-
-		from = buf;
-		to = (uint64 *)((char *)buf + sdp->sd_hash_bsize);
-
-		for (x = sdp->sd_hash_ptrs; x--; from++){
-			*to++ = *from;  /*  No endianess worries  */
-			*to++ = *from;
-		}
-
-		error = writei(disk_fd, dip, (char *)buf + sdp->sd_hash_bsize,
-			       block * sdp->sd_sb.sb_bsize, sdp->sd_sb.sb_bsize);
-		if (error != sdp->sd_sb.sb_bsize){
-			if (error >= 0)
-				error = -EIO;
-			goto out;
-		}
-	}
-
-	free(buf); buf=NULL;
-
-
-	error = get_and_read_buf(disk_fd, sdp->sd_sb.sb_bsize,
-							 dip->i_num.no_addr, &dibh, 0);
-	if(error){
-		log_err("dir_double_exhash:  "
-			"Unable to get inode buffer.\n");
-		return -1;
-	}
-
-	error = check_meta(dibh, GFS_METATYPE_DI);
-	if(error){
-		log_err("dir_double_exhash:  "
-			"Buffer does not contain directory inode.\n");
-		relse_buf(dibh);
-		return -1;
-	}
-
-	dip->i_di.di_depth++;
-
-	gfs_dinode_out(&dip->i_di, BH_DATA(dibh));
-	if(write_buf(disk_fd, dibh, 0)){
-		log_err("dir_double_exhash:  "
-			"Unable to write out directory inode.\n");
-		relse_buf(dibh);
-		return -1;
-	}
-
-	relse_buf(dibh);
-
-	return 0;
-
-
- out:
-	if(buf) free(buf);
-
-	return error;
-}
-
-
-static int dir_e_del(int disk_fd, struct gfs_inode *dip, osi_filename_t *filename){
-	int index;
-	int error;
-	int found = 0;
-	uint64 leaf_no;
-	osi_buf_t *bh;
-	identifier_t id;
-	struct gfs_dirent *cur, *prev;
-
-	id.type = ID_FILENAME;
-	id.filename = filename;
-	id.inum = NULL;
-
-	index = (1 << (dip->i_di.di_depth))-1;
-
-	for(; (index >= 0) && !found; index--){
-		error = get_leaf_nr(disk_fd, dip, index, &leaf_no);
-		if (error){
-			log_err("dir_e_del:  Unable to get leaf number.\n");
-			return error;
-		}
-
-		while(leaf_no && !found){
-			if(get_leaf(disk_fd, dip, leaf_no, &bh)){
-				stack;
-				return -1;
-			}
-
-			error = leaf_search(bh, &id, &cur, &prev);
-			if(id.inum) free(id.inum);
-
-			if(error){
-				if(error != -ENOENT){
-					log_err("dir_e_del:  leaf_search failed.\n");
-					relse_buf(bh);
-					return -1;
-				}
-				leaf_no = gfs64_to_cpu(((struct gfs_leaf *)BH_DATA(bh))->lf_next);
-				relse_buf(bh);
-			} else {
-				found = 1;
-			}
-		}
-	}
-
-	if(!found)
-		return 1;
-
-	if(dirent_del(disk_fd, dip, bh, prev, cur)){
-		log_err("dir_e_del:  dirent_del failed.\n");
-		relse_buf(bh);
-		return -1;
-	}
-
-	relse_buf(bh);
-	return 0;
-}
-
-
-static int dir_l_del(int disk_fd, struct gfs_inode *dip, osi_buf_t *dibh,
-		     osi_filename_t *filename){
-	int error=0;
-	int got_buf = 0;
-	struct gfs_dirent *cur, *prev;
-	identifier_t id;
-
-	id.type = ID_FILENAME;
-	id.filename = filename;
-	id.inum = NULL;
-
-	if(!fs_is_stuffed(dip)){
-		log_crit("dir_l_del: Attempting linear delete on unstuffed"
-			 " dinode.\n");
-		return -1;
-	}
-
-	if(!dibh) {
-		error = get_and_read_buf(disk_fd, dip->i_sbd->sd_sb.sb_bsize,
-								 dip->i_num.no_addr, &dibh, 0);
-		if (error){
-			log_err("dir_l_del:  Failed to read in dinode buffer.\n");
-			return -1;
-		}
-		got_buf = 1;
-	}
-
-	error = leaf_search(dibh, &id, &cur, &prev);
-	if(id.inum) free(id.inum);
-
-	if(error){
-		if(error == -ENOENT){
-			log_debug("dir_l_del found no entry\n");
-			if(got_buf)
-				relse_buf(dibh);
-			return 1;
-		} else {
-			log_err("dir_l_del:  leaf_search failed.\n");
-			if(got_buf)
-				relse_buf(dibh);
-			return -1;
-		}
-	}
-
-	if(dirent_del(disk_fd, dip, dibh, prev, cur)){
-		stack;
-		if(got_buf)
-			relse_buf(dibh);
-		return -1;
-	}
-
-	if(got_buf)
-		relse_buf(dibh);
-	return 0;
-}
-
-
-/*
- * fs_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 fs_dirent_del(int disk_fd, struct gfs_inode *dip, osi_buf_t *bh, osi_filename_t *filename){
-	int error;
-
-	if(dip->i_di.di_type != GFS_FILE_DIR){
-		log_err("fs_dirent_del:  parent inode is not a directory.\n");
-		return -1;
-	}
-
-	if (dip->i_di.di_flags & GFS_DIF_EXHASH)
-		error = dir_e_del(disk_fd, dip, filename);
-	else
-		error = dir_l_del(disk_fd, dip, bh, filename);
-
-	return error;
-
-}
-
-
-/**
- * dir_e_add -
- * @dip: The GFS inode
- * @filename:
- * @inode:
- * @type:
- *
- */
-static int dir_e_add(int disk_fd, struct gfs_inode *dip,
-					 osi_filename_t *filename, struct gfs_inum *inum,
-					 unsigned int type)
-{
-	struct gfs_sbd *sdp = dip->i_sbd;
-	osi_buf_t *bh, *nbh, *dibh;
-	struct gfs_leaf *leaf, *nleaf;
-	struct gfs_dirent *dent;
-	uint32 hsize, index;
-	uint32 hash;
-	uint64 leaf_no, bn;
-	int error;
-
- restart:
-
-	/*  Sanity Checks  */
-
-	hsize = 1 << dip->i_di.di_depth;
-	if(hsize * sizeof(uint64) != dip->i_di.di_size){
-		log_err("dir_e_add:  hash size and di_size do not correspond.\n");
-		return -1;
-	}
-
-	/*  Figure out the address of the leaf node.  */
-
-	hash = dir_hash(filename);
-	index = hash >> (32 - dip->i_di.di_depth);
-
-
-	error = get_leaf_nr(disk_fd, dip, index, &leaf_no);
-	if (error){
-		log_err("dir_e_add:  Unable to get leaf number.\n");
-		return error;
-	}
-
-
-	/*  Add entry to the leaf  */
-
-	while (TRUE){
-		error = get_leaf(disk_fd, dip, leaf_no, &bh);
-		if (error){
-			log_err("dir_e_add:  Unable to get leaf #%"PRIu64"\n", leaf_no);
-			return error;
-		}
-
-		leaf = (struct gfs_leaf *)BH_DATA(bh);
-
-
-		if (fs_dirent_alloc(disk_fd, dip, bh, filename->len, &dent)){
-			if (gfs16_to_cpu(leaf->lf_depth) < dip->i_di.di_depth){
-				/*  Can we split the leaf?  */
-				relse_buf(bh);
-
-				error = dir_split_leaf(disk_fd, dip, index, leaf_no);
-				if (error){
-					log_err("dir_e_add:  Unable to split leaf.\n");
-					return error;
-				}
-
-				goto restart;
-			}
-			else if (dip->i_di.di_depth < GFS_DIR_MAX_DEPTH){
-				/*  Can we double the hash table?  */
-				relse_buf(bh);
-
-				error = dir_double_exhash(disk_fd, dip);
-				if (error){
-					log_err("dir_e_add:  Unable to double exhash.\n");
-					return error;
-				}
-
-				goto restart;
-			}
-			else if (leaf->lf_next){
-				/*  Can we try the next leaf in the list?  */
-				leaf_no = gfs64_to_cpu(leaf->lf_next);
-				relse_buf(bh);
-				continue;
-			}
-			else {
-				/*  Create a new leaf and add it to the list.  */
-				error = fs_metaalloc(disk_fd, dip, &bn);
-				if (error){
-					relse_buf(bh);
-					log_err("dir_e_add:  "
-						"Unable to allocate space for meta block.\n");
-					return error;
-				}
-
-				error = get_and_read_buf(disk_fd, sdp->sd_sb.sb_bsize, bn,
-										 &nbh, 0);
-				if (error){
-					relse_buf(bh);
-					return error;
-				}
-
-				/*gfs_trans_add_bh(sdp, dip->i_gl, nbh);*/
-				if(check_meta(nbh, 0)){
-					log_err("dir_e_add:  Buffer is not a meta buffer.\n");
-					relse_buf(bh);
-					relse_buf(nbh);
-					return -1;
-				}
-				set_meta(nbh, GFS_METATYPE_LF, GFS_FORMAT_LF);
-				/* Make sure the bitmap is updated */
-				log_debug("Setting leaf block at %"PRIu64"\n",
-					  bn);
-				block_set(dip->i_sbd->bl, bn, leaf_blk);
-				memset(BH_DATA(nbh)+sizeof(struct gfs_meta_header), 0,
-				       BH_SIZE(nbh)-sizeof(struct gfs_meta_header));
-
-				/*gfs_trans_add_bh(sdp, dip->i_gl, bh);*/
-				leaf->lf_next = cpu_to_gfs64(bn);
-
-				nleaf = (struct gfs_leaf *)BH_DATA(nbh);
-				nleaf->lf_depth = leaf->lf_depth;
-				nleaf->lf_dirent_format = cpu_to_gfs32(GFS_FORMAT_DE);
-
-				if (fs_dirent_alloc(disk_fd, dip, nbh, filename->len, &dent)){
-					log_err("dir_e_add:  Uncircumventible error!\n");
-					exit(EXIT_FAILURE);
-				}
-
-				dip->i_di.di_blocks++;
-
-				/* ATTENTION -- check for errors */
-				write_buf(disk_fd, nbh, BW_WAIT);
-				write_buf(disk_fd, bh, 0);
-				relse_buf(bh);
-
-				bh = nbh;
-				leaf = nleaf;
-			}
-		}
-
-
-		gfs_inum_out(inum, (char *)&dent->de_inum);
-		dent->de_hash = cpu_to_gfs32(hash);
-		dent->de_type = cpu_to_gfs16(type);
-		memcpy((char *)(dent + 1), filename->name, filename->len);
-
-		leaf->lf_entries = gfs16_to_cpu(leaf->lf_entries) + 1;
-		leaf->lf_entries = cpu_to_gfs16(leaf->lf_entries);
-
-		write_buf(disk_fd, bh, 0);
-		relse_buf(bh);
-
-		error = get_and_read_buf(disk_fd, dip->i_sbd->sd_sb.sb_bsize,
-								 dip->i_num.no_addr, &dibh, 0);
-		if(error){
-			log_err("dir_e_add:  Unable to get inode buffer.\n");
-			return error;
-		}
-
-		error = check_meta(dibh, GFS_METATYPE_DI);
-		if(error){
-			log_err("dir_e_add:  Buffer #%"PRIu64" is not a directory "
-				"inode.\n", BH_BLKNO(dibh));
-			relse_buf(dibh);
-			return error;
-		}
-
-		dip->i_di.di_entries++;
-		dip->i_di.di_mtime = dip->i_di.di_ctime = osi_current_time();
-		log_debug("Entries for %"PRIu64" is %u\n", dip->i_di.di_num.no_addr,
-			dip->i_di.di_entries);
-
-		gfs_dinode_out(&dip->i_di, BH_DATA(dibh));
-		write_buf(disk_fd, dibh, 0);
-		relse_buf(dibh);
-
-		return 0;
-	}
-
-	return -ENOENT;
-}
-
-
-/**
- * dir_l_add -
- * @dip: The GFS inode
- * @filename:
- * @inode:
- * @type:
- *
- * Returns:
- */
-
-static int dir_l_add(int disk_fd, struct gfs_inode *dip, osi_filename_t *filename,
-                     struct gfs_inum *inum, unsigned int type)
-{
-	osi_buf_t *dibh;
-	struct gfs_dirent *dent;
-	int error;
-
-	/*  Sanity checks  */
-
-	if(!fs_is_stuffed(dip)){
-		log_err("dir_l_add:  Attempting linear add on unstuffed dinode.\n");
-		return -1;
-	}
-
-	error = get_and_read_buf(disk_fd, dip->i_sbd->sd_sb.sb_bsize,
-							 dip->i_num.no_addr, &dibh, 0);
-	if (error)
-		goto out;
-
-
-	if (fs_dirent_alloc(disk_fd, dip, dibh, filename->len, &dent))
-	{
-		/* no need to write buffer, it hasn't changed. */
-		relse_buf(dibh);
-
-		error = dir_make_exhash(disk_fd, dip);
-		/* DEBUG */
-		log_debug("Changing Linear dir to Exhash dir - %s\n",
-			  (error)? "UNSUCCESSFUL": "SUCCESSFUL");
-		if (!error)
-			error = dir_e_add(disk_fd, dip, filename, inum, type);
-
-		goto out;
-	}
-
-
-	gfs_inum_out(inum, (char *)&dent->de_inum);
-	dent->de_hash = dir_hash(filename);
-	dent->de_hash = cpu_to_gfs32(dent->de_hash);
-	dent->de_type = cpu_to_gfs16(type);
-	memcpy((char *)(dent + 1), filename->name, filename->len);
-
-
-	dip->i_di.di_entries++;
-	dip->i_di.di_mtime = dip->i_di.di_ctime = osi_current_time();
-	log_debug("Entries for %"PRIu64" is %u\n", dip->i_di.di_num.no_addr,
-		dip->i_di.di_entries);
-	gfs_dinode_out(&dip->i_di, BH_DATA(dibh));
-	if(write_buf(disk_fd, dibh, 0)){
-		log_err("dir_l_add:  bad write_buf()\n");
-		error = -EIO;
-	}
-
-	relse_buf(dibh);
-
- out:
-	if(error){
-		char tmp_name[256];
-		memset(tmp_name, 0, sizeof(tmp_name));
-		memcpy(tmp_name, filename->name, filename->len);
-		log_err("Unable to add \"%s\" to directory #%"PRIu64"\n",
-			tmp_name, dip->i_num.no_addr);
-	}
-	return error;
-}
-
-
-
-/**
- * fs_dir_add - Add new filename into directory
- * @dip: The GFS inode
- * @filename: The new name
- * @inode: The inode number of the entry
- * @type: The type of the entry
- *
- * Returns: 0 on success, error code on failure
- */
-int fs_dir_add(int disk_fd, struct gfs_inode *dip, osi_filename_t *filename,
-			   struct gfs_inum *inum, unsigned int type)
-{
-	int error;
-
-	if(dip->i_di.di_type != GFS_FILE_DIR){
-		log_err("fs_dir_add:  parent inode is not a directory.\n");
-		return -1;
-	}
-
-	if (dip->i_di.di_flags & GFS_DIF_EXHASH)
-		error = dir_e_add(disk_fd, dip, filename, inum, type);
-	else
-		error = dir_l_add(disk_fd, dip, filename, inum, type);
-
-	return error;
-}
-
-
-/**
- * fs_dirent_alloc - Allocate a directory entry
- * @dip: The GFS inode
- * @bh: The buffer
- * @name_len: The length of the name
- * @dent_out: Pointer to list of dirents
- *
- * Returns: 0 on success, error code otherwise
- */
-int fs_dirent_alloc(int disk_fd, struct gfs_inode *dip, osi_buf_t *bh,
-		    int name_len, struct gfs_dirent **dent_out)
-{
-	struct gfs_dirent *dent, *new;
-	struct gfs_leaf *leaf;
-	struct gfs_dinode *dinode;
-	unsigned int rec_len = GFS_DIRENT_SIZE(name_len);
-	unsigned int entries = 0, offset = 0, x = 0;
-	int type;
-
-	type = dirent_first(bh, &dent);
-
-	if (type == IS_LEAF){
-		leaf = (struct gfs_leaf *)BH_DATA(bh);
-		entries = gfs16_to_cpu(leaf->lf_entries);
-		offset = sizeof(struct gfs_leaf);
-	}
-	else if (type == IS_DINODE) {
-		dinode = (struct gfs_dinode *)BH_DATA(bh);
-		entries = gfs32_to_cpu(dinode->di_entries);
-		offset = sizeof(struct gfs_dinode);
-	} else {
-		log_err("fs_dirent_alloc:  Buffer has bad metatype.\n");
-		return -1;
-	}
-
-	if (!entries){
-		dent->de_rec_len = BH_SIZE(bh) - offset;
-		dent->de_rec_len = cpu_to_gfs16(dent->de_rec_len);
-		dent->de_name_len = cpu_to_gfs16(name_len);
-
-		*dent_out = dent;
-		write_buf(disk_fd, bh, 0);
-		goto success;
-	}
-
-
-	do{
-		uint32 cur_rec_len, cur_name_len;
-
-		cur_rec_len = gfs16_to_cpu(dent->de_rec_len);
-		cur_name_len = gfs16_to_cpu(dent->de_name_len);
-
-		if ((!dent->de_inum.no_formal_ino && cur_rec_len >= rec_len) ||
-		    (cur_rec_len >= GFS_DIRENT_SIZE(cur_name_len) + rec_len)){
-			if (dent->de_inum.no_formal_ino){
-				new = (struct gfs_dirent *)((char *)dent + GFS_DIRENT_SIZE(cur_name_len));
-				memset(new, 0, sizeof(struct gfs_dirent));
-
-				new->de_rec_len = cpu_to_gfs16(cur_rec_len - GFS_DIRENT_SIZE(cur_name_len));
-				new->de_name_len = cpu_to_gfs16(name_len);
-
-				dent->de_rec_len = cur_rec_len - gfs16_to_cpu(new->de_rec_len);
-				dent->de_rec_len = cpu_to_gfs16(dent->de_rec_len);
-
-				*dent_out = new;
-				write_buf(disk_fd, bh, 0);
-				goto success;
-			}
-
-			dent->de_name_len = cpu_to_gfs16(name_len);
-
-			*dent_out = dent;
-			write_buf(disk_fd, bh, 0);
-			goto success;
-		}
-
-		if(x >= entries){
-			log_err("fs_dirent_alloc:  dirents contain bad length information.\n");
-			return -1;
-		}
-
-		if (dent->de_inum.no_formal_ino)
-			x++;
-	}
-	while(dirent_next(bh, &dent) == 0);
-
-	return -ENOSPC;
-
- success:
-	return 0;
-}
-
-
-/**
- * get_leaf_nr - Get a leaf number associated with the index
- * @dip: The GFS inode
- * @index:
- * @leaf_out:
- *
- * Returns: 0 on success, error code otherwise
- */
-
-int get_leaf_nr(int disk_fd, struct gfs_inode *dip, uint32 index,
-				uint64 *leaf_out)
-{
-	uint64 leaf_no;
-	int error = -1;
-	error = readi(disk_fd, dip, (char *)&leaf_no,
-				  index * sizeof(uint64), sizeof(uint64));
-	if (error != sizeof(uint64)){
-		log_debug("get_leaf_nr:  Bad internal read.  (rtn = %d)\n",
-			  error);
-		return (error < 0) ? error : -EIO;
-	}
-
-	*leaf_out = gfs64_to_cpu(leaf_no);
-
-	return 0;
-}
-
-
-/**
- * fs_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 TRUE if they are equal.
- *
- * Returns: TRUE (!=0) if the files are the same, otherwise FALSE (0).
- */
-int fs_filecmp(osi_filename_t *file1, char *file2, int len_of_file2)
-{
-	if (file1->len != len_of_file2){
-		return FALSE;
-	}
-
-	if (osi_memcmp(file1->name, file2, file1->len)){
-		return FALSE;
-	}
-	return TRUE;
-}
-
-
-/**
- * fs_dir_search - Search a directory
- * @dip: The GFS inode
- * @id
- * @type:
- *
- * This routine searches a directory for a file or another directory
- * given its identifier.  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 fs_dir_search(int disk_fd, struct gfs_inode *dip, identifier_t *id,
-				  unsigned int *type)
-{
-	int error;
-
-	if(dip->i_di.di_type != GFS_FILE_DIR){
-		log_err("An attempt was made to search an inode "
-			"that is not a directory.\n");
-		return -1;
-	}
-
-	if (dip->i_di.di_flags & GFS_DIF_EXHASH)
-		error = dir_e_search(disk_fd, dip, id, type);
-	else
-		error = dir_l_search(disk_fd, dip, id, type);
-
-	return error;
-}
diff --git a/gfs/libgfs/fs_inode.c b/gfs/libgfs/fs_inode.c
deleted file mode 100644
index 51f6e9b..0000000
--- a/gfs/libgfs/fs_inode.c
+++ /dev/null
@@ -1,470 +0,0 @@
-#include "libgfs.h"
-
-#define ST_CREATE 1
-
-/**
- * fs_get_istruct - Get an inode given its number
- * @sdp: The GFS superblock
- * @inum: The inode number
- * @create: Flag to say if we are allowed to create a new struct gfs_inode
- * @ipp: pointer to put the returned inode in
- *
- * Returns: 0 on success, -1 on error
- */
-static int fs_get_istruct(int disk_fd, struct gfs_sbd *sdp,
-						  struct gfs_inum *inum, int create,
-						  struct gfs_inode **ipp)
-{
-	struct gfs_inode *ip = NULL;
-	int error = 0;
-
-	if (!create){
-		/* we are not currently tracking which inodes we already have */
-		error = -1;
-		goto out;
-	}
-
-	if(!(ip = (struct gfs_inode *)malloc(sizeof(struct gfs_inode)))) {
-		log_err("Unable to allocate gfs_inode structure\n");
-		error = -1;
-		goto out;
-	}
-	if(!memset(ip, 0, sizeof(struct gfs_inode))) {
-		log_err("Unable to zero gfs_inode structure\n");
-		error = -1;
-		goto out;
-	}
-
-	ip->i_num = *inum;
-
-	ip->i_sbd = sdp;
-
-	error = fs_copyin_dinode(disk_fd, sdp->sd_sb.sb_bsize, ip, NULL);
-	if (error){
-		free(ip);
-		ip = NULL;
-		goto out;
-	}
-
- out:
-	*ipp = ip;
-
-	return error;
-}
-
-
-/*
- * fs_copyin_dinode - read dinode from disk and store in inode
- * @ip: inode, sdp and inum must be set
- *
- * Returns: 0 on success, -1 on error
- */
-int fs_copyin_dinode(int disk_fd, uint32_t sb_bsize, struct gfs_inode *ip,
-					 osi_buf_t *dibh)
-{
-/*	osi_buf_t *dibh;*/
-	int do_relse = 0;
-	int error = 0;
-
-	if(!dibh) {
-		error = get_and_read_buf(disk_fd, sb_bsize,
-								 ip->i_num.no_addr, &dibh, 0);
-		if (error) {
-			stack;
-			goto out;
-		}
-
-		if(check_meta(dibh, GFS_METATYPE_DI)){
-			log_err("Block #%"PRIu64" is not a dinode.\n",
-				ip->i_num.no_addr);
-			relse_buf(dibh);
-			return -1;
-		}
-		do_relse = 1;
-	}
-	gfs_dinode_in(&ip->i_di, BH_DATA(dibh));
-
-	if(do_relse)
-		relse_buf(dibh);
-
-	
-
- out:
-	return error;
-}
-
-
-/*
- * fs_copyout_dinode - given an inode, copy its dinode data to disk
- * @ip: the inode
- *
- * Returns: 0 on success, -1 on error
- */
-int fs_copyout_dinode(int disk_fd, uint32_t sb_bsize, struct gfs_inode *ip)
-{
-	osi_buf_t *dibh;
-	int error;
-
-	error = get_and_read_buf(disk_fd, sb_bsize, ip->i_num.no_addr, &dibh, 0);
-	if(error){
-		log_err( "Unable to get a buffer to write dinode to disk.\n");
-		return -1;
-	}
-
-	gfs_dinode_out(&ip->i_di, BH_DATA(dibh));
-
-	if(write_buf(disk_fd, dibh, 0)){
-		log_err( "Unable to commit dinode buffer to disk.\n");
-		relse_buf(dibh);
-		return -1;
-	}
-
-	relse_buf(dibh);
-	return 0;
-}
-
-/**
- * fs_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
- * @cred: The caller's credentials
- * @ipp: Used to return the found inode if any
- *
- * Returns: 0 on success, -EXXXX on failure
- */
-static int fs_lookupi(int disk_fd, struct gfs_inode *dip,
-					  osi_filename_t *name, osi_cred_t *cred, 
-					  struct gfs_inode **ipp)
-{
-	struct gfs_sbd *sdp = dip->i_sbd;
-	int error = 0;
-	identifier_t id;
-
-	memset(&id, 0, sizeof(identifier_t));
-	id.filename = name;
-	id.type = ID_FILENAME;
-
-	*ipp = NULL;
-
-	if (!name->len || name->len > GFS_FNAMESIZE)
-	{
-		error = -ENAMETOOLONG;
-		goto out;
-	}
-
-	if (fs_filecmp(name, (char *)".", 1))
-	{
-		*ipp = dip;
-		goto out;
-	}
-
-	error = fs_dir_search(disk_fd, dip, &id, NULL);
-	if (error){
-		if (error == -ENOENT)
-			error = 0;
-		goto out;
-	}
-
-	error = fs_get_istruct(disk_fd, sdp, id.inum, ST_CREATE, ipp);
-
- out:
-
-	if(id.inum) free(id.inum);
-	return error;
-}
-
-int fs_createi(int disk_fd, struct gfs_inode *dip, osi_filename_t *name,
-	       unsigned int type, unsigned int mode, osi_cred_t *cred,
-	       int *new, struct gfs_inode **ipp)
-{
-	osi_list_t *tmp=NULL;
-	struct gfs_sbd *sdp = dip->i_sbd;
-	struct gfs_inum inum;
-	int error;
-	int allocate=0;
-	identifier_t id;
-
-	memset(&id, 0, sizeof(identifier_t));
-
-	if (!name->len || name->len > GFS_FNAMESIZE){
-		error = -ENAMETOOLONG;
-		goto fail;
-	}
-
- restart:
-
-	/*  Don't create entries in an unlinked directory  */
-	if (!dip->i_di.di_nlink){
-		error = -EPERM;
-		goto fail;
-	}
-
-	id.filename = name;
-	id.type = ID_FILENAME;
-
-	error = fs_dir_search(disk_fd, dip, &id, NULL);
-	if(id.inum) free(id.inum);
-	switch (error)
-	{
-	case -ENOENT:
-		break;
-
-	case 0:
-		if (!new){
-			error = -EEXIST;
-			goto fail;
-		} else {
-			error = fs_lookupi(disk_fd, dip, name, cred, ipp);
-			if (error)
-				goto fail;
-
-			if (*ipp){
-				*new = FALSE;
-				return 0;
-			} else
-				goto restart;
-		}
-		break;
-
-	default:
-		goto fail;
-	}
-
-	if (dip->i_di.di_entries == (uint32)-1){
-		error = -EFBIG;
-		goto fail;
-	}
-	if (type == GFS_FILE_DIR && dip->i_di.di_nlink == (uint32)-1){
-		error = -EMLINK;
-		goto fail;
-	}
-
- retry:
-	inum.no_addr = inum.no_formal_ino = 0;
-	for (tmp = (osi_list_t *)sdp->sd_rglist.next;
-		 tmp != (osi_list_t *)&sdp->sd_rglist; tmp = tmp->next){
-		uint64 block;
-		struct gfs_rgrpd *rgd;
-
-		rgd = osi_list_entry(tmp, struct gfs_rgrpd, rd_list);
-		if(fs_rgrp_read(disk_fd, rgd, FALSE))
-			return -1;
-		if(rgd->rd_rg.rg_freemeta){
-			block = fs_blkalloc_internal(rgd, dip->i_num.no_addr,
-						     GFS_BLKST_FREEMETA,
-						     GFS_BLKST_USEDMETA, 1);
-			log_debug("Got block %"PRIu64"\n", block);
-			if(block == BFITNOENT) {
-				fs_rgrp_relse(rgd);
-				continue;
-			}
-			block += rgd->rd_ri.ri_data1;
-			log_debug("Got block #%"PRIu64"\n", block);
-			inum.no_addr = inum.no_formal_ino = block;
-			rgd->rd_rg.rg_freemeta--;
-			rgd->rd_rg.rg_useddi++;
-
-			if(fs_rgrp_recount(disk_fd, rgd)){
-				log_err(  "fs_createi:  Unable to recount rgrp blocks.\n");
-				fs_rgrp_relse(rgd);
-				error = -EIO;
-				goto fail;
-			}
-
-			/* write out the rgrp */
-			gfs_rgrp_out(&rgd->rd_rg, BH_DATA(rgd->rd_bh[0]));
-			write_buf(disk_fd, rgd->rd_bh[0], 0);
-			fs_rgrp_relse(rgd);
-			break;
-		} else {
-			if(allocate){
-				if(!clump_alloc(disk_fd, rgd, 0)){
-					block = fs_blkalloc_internal(rgd, dip->i_num.no_addr,
-								     GFS_BLKST_FREEMETA,
-								     GFS_BLKST_USEDMETA, 1);
-					log_debug("Got block %"PRIu64"\n",
-						  block);
-					if(block == BFITNOENT) {
-						fs_rgrp_relse(rgd);
-						continue;
-					}
-					block += rgd->rd_ri.ri_data1;
-
-					inum.no_addr = inum.no_formal_ino = block;
-					rgd->rd_rg.rg_freemeta--;
-					rgd->rd_rg.rg_useddi++;
-
-					if(fs_rgrp_recount(disk_fd, rgd)){
-						log_err( "fs_createi:  Unable to recount rgrp blocks.\n");
-						fs_rgrp_relse(rgd);
-						error = -EIO;
-						goto fail;
-					}
-
-					/* write out the rgrp */
-					gfs_rgrp_out(&rgd->rd_rg, BH_DATA(rgd->rd_bh[0]));
-					write_buf(disk_fd, rgd->rd_bh[0], 0);
-					fs_rgrp_relse(rgd);
-					break;
-				}
-			}
-			fs_rgrp_relse(rgd);
-		}
-	}
-
-	if(!inum.no_addr){
-		if(allocate){
-			log_err( "No space available for new file or directory.\n");
-			return -1;
-		} else {
-			allocate = 1;
-			goto retry;
-		}
-	}
-
-	error = fs_dir_add(disk_fd, dip, name, &inum, type);
-	if (error)
-		goto fail;
-
-	error = make_dinode(disk_fd, dip, sdp, &inum, type, mode, cred);
-	if (error)
-		goto fail;
-
-
-	error = fs_get_istruct(disk_fd, sdp, &inum, ST_CREATE, ipp);
-	if (error)
-		goto fail;
-
-	if (new)
-		*new = TRUE;
-
-	return 0;
-
- fail:
-	return error;
-}
-
-
-/*
- * fs_mkdir - make a directory
- * @dip - dir inode that is the parent of the new dir
- * @new_dir - name of the new dir
- * @mode - mode of new dir
- * @nip - returned inode ptr to the new directory
- *
- * This function has one main difference from the way a normal mkdir
- * works.  It will not return an error if the directory already
- * exists.  Instead it will return success and nip will point to the
- * inode that exists with the same name as new_dir.
- *
- * Returns: 0 on success, -1 on failure.
- */
-int fs_mkdir(int disk_fd, struct gfs_inode *dip, char *new_dir, 
-			 int mode, struct gfs_inode **nip){
-	int error;
-	osi_cred_t creds;
-	osi_buf_t *dibh;
-	struct gfs_dinode *di;
-	struct gfs_dirent *dent;
-	struct gfs_inode *ip= NULL;
-	struct gfs_sbd *sdp = dip->i_sbd;
-	osi_filename_t name;
-	int new;
-
-	name.name = (unsigned char *)new_dir;
-	name.len = strlen(new_dir);
-	creds.cr_uid = getuid();
-	creds.cr_gid = getgid();
-
-	error = fs_createi(disk_fd, dip, &name, GFS_FILE_DIR, mode, &creds,
-					   &new, &ip);
-
-	if (error)
-		goto fail;
-
-	if(!new){
-		goto out;
-	}
-
-	if(!ip){
-		log_err(  "fs_mkdir:  fs_createi() failed.\n");
-		error = -1;
-		goto fail;
-	}
-
-	ip->i_di.di_nlink = 2;
-	ip->i_di.di_size = sdp->sd_sb.sb_bsize - sizeof(struct gfs_dinode);
-	ip->i_di.di_flags |= GFS_DIF_JDATA;
-	ip->i_di.di_payload_format = GFS_FORMAT_DE;
-	ip->i_di.di_entries = 2;
-
-	error = get_and_read_buf(disk_fd, ip->i_sbd->sd_sb.sb_bsize,
-							 ip->i_num.no_addr, &dibh, 0);
-	if(error){
-		log_err( "fs_mkdir:  Unable to aquire directory buffer.\n");
-		goto fail;
-	}
-
-	di = (struct gfs_dinode *)BH_DATA(dibh);
-
-	error = fs_dirent_alloc(disk_fd, ip, dibh, 1, &dent);
-	if(error){  /*  This should never fail  */
-		log_err( "fs_mkdir:  fs_dirent_alloc() failed for \".\" entry.\n");
-		goto fail;
-	}
-
-	dent->de_inum = di->di_num;  /*  already GFS endian  */
-	dent->de_hash = gfs_dir_hash(".", 1);
-	dent->de_hash = cpu_to_gfs32(dent->de_hash);
-	dent->de_type = cpu_to_gfs16(GFS_FILE_DIR);
-	memcpy((char *)(dent + 1), ".", 1);
-	di->di_entries = cpu_to_gfs32(1);
-
-	error = fs_dirent_alloc(disk_fd, ip, dibh, 2, &dent);
-	if(error){  /*  This should never fail  */
-		log_err( "fs_mkdir:  fs_dirent_alloc() failed for \"..\" entry.\n");
-		goto fail;
-	}
-	gfs_inum_out(&dip->i_num, (char *)&dent->de_inum);
-	dent->de_hash = gfs_dir_hash("..", 2);
-	dent->de_hash = cpu_to_gfs32(dent->de_hash);
-	dent->de_type = cpu_to_gfs16(GFS_FILE_DIR);
-	memcpy((char *)(dent + 1), "..", 2);
-
-	gfs_dinode_out(&ip->i_di, (char *)di);
-	if(write_buf(disk_fd, dibh, 0)){
-		log_err( "fs_mkdir:  Bad write_buf()\n");
-		error = -EIO;
-		goto fail;
-	}
-
-	relse_buf(dibh);
-
-
-	/* FIXME: this may break stuff elsewhere, but since I'm
-	 * keeping track of the linkcount in-core, we shouldn't need
-	 * to do this...
-
-	error = fs_change_nlink(dip, +1);
-	if(error){
-		log_err( "fs_mkdir:  fs_change_nlink() failed.\n");
-		goto fail;
-		} */
-
- out:
-	error=0;
-	if(nip) {
-		*nip = ip;
-	}
-	else if(ip) {
-		free(ip);
-		ip = NULL;
-	}
-	return 0;
- fail:
-	if(ip)
-		free(ip);
-	return error;
-}
-
-
diff --git a/gfs/libgfs/incore.h b/gfs/libgfs/incore.h
deleted file mode 100644
index 5a25076..0000000
--- a/gfs/libgfs/incore.h
+++ /dev/null
@@ -1,1271 +0,0 @@
-/*
- *  In-core (memory/RAM) structures.
- *  These do not appear on-disk.  See gfs_ondisk.h for on-disk structures.
- */
-
-#ifndef __INCORE_DOT_H__
-#define __INCORE_DOT_H__
-
-#ifndef __KERNEL__ /* if called from userland */
-#include <stdint.h>
-#include "list.h"
-#include "gfs_ondisk.h"
-#include "osi_user.h"
-
-#define FSCK_HASH_SHIFT         (13)
-#define FSCK_HASH_SIZE          (1 << FSCK_HASH_SHIFT)
-#define FSCK_HASH_MASK          (FSCK_HASH_SIZE - 1)
-
-struct semaphore {
-	void *nothing;
-};
-struct completion {
-	void *nothing;
-};
-struct lm_lockname {
-	void *nothing;
-};
-struct rw_semaphore {
-	void *nothing;
-};
-struct gfs_quota_lvb {
-	void *nothing;
-};
-struct lm_lockstruct {
-	void *nothing;
-};
-typedef int atomic_t;
-typedef int spinlock_t;
-typedef int lm_lock_t;
-typedef int rwlock_t;
-typedef int wait_queue_head_t;
-#endif
-
-/*  flags used in function call parameters  */
-
-#define DIO_NEW           (0x00000001)  /* Newly allocated metadata */
-#define DIO_FORCE         (0x00000002)  /* Force read of block from disk */
-#define DIO_CLEAN         (0x00000004)  /* Don't write to disk */
-#define DIO_DIRTY         (0x00000008)  /* Data changed, must write to disk */
-#define DIO_START         (0x00000010)  /* Start disk read or write */
-#define DIO_WAIT          (0x00000020)  /* Wait for disk r/w to complete */
-
-#define DIO_METADATA      (0x00000040)  /* Process glock's protected metadata */
-#define DIO_DATA          (0x00000080)  /* Process glock's protected filedata */
-#define DIO_INVISIBLE     (0x00000100)  /* Don't monkey with glock's dirty bit */
-#define DIO_CHECK         (0x00000200)  /* Make sure all metadata has been synced */
-#define DIO_ALL           (0x00000400)  /* Flush all AIL transactions to disk */
-
-/*  Structure prototypes  */
-
-struct gfs_log_operations;
-struct gfs_log_element;
-struct gfs_meta_header_cache;
-struct gfs_depend;
-struct gfs_bitmap;
-struct gfs_rgrpd;
-struct gfs_bufdata;
-struct gfs_glock_operations;
-struct gfs_holder;
-struct gfs_glock;
-struct gfs_alloc;
-struct gfs_inode;
-struct gfs_file;
-struct gfs_unlinked;
-struct gfs_quota_le;
-struct gfs_quota_data;
-struct gfs_log_buf;
-struct gfs_trans;
-struct gfs_gl_hash_bucket;
-struct gfs_sbd;
-
-typedef void (*gfs_glop_bh_t) (struct gfs_glock * gl, unsigned int ret);
-
-/*
- *  Structure of operations that are associated with each
- *  type of element in the log.
- */
-struct gfs_log_operations {
-	/*
-	 * Operations specific to a given log element (LE).
-	 * These are typically executed individually via macros such as LO_ADD.
-	 */
-
-	/* Add new LE to transaction */
-	void (*lo_add) (struct gfs_sbd * sdp, struct gfs_log_element * le);
-
-	/* Do any cleanup, etc., needed just before commit to incore log */
-	void (*lo_trans_end) (struct gfs_sbd * sdp,
-			      struct gfs_log_element * le);
-
-	/* Print LE-specific info via printk() */
-	void (*lo_print) (struct gfs_sbd * sdp, struct gfs_log_element * le,
-			  unsigned int where);
-
-	/* Find any incore transactions that overlap through this LE (e.g.
-	 * share glocks), to determine if any transactions can be combined. */
-	struct gfs_trans *(*lo_overlap_trans) (struct gfs_sbd * sdp,
-					       struct gfs_log_element * le);
-
-	/* Change LE from "new" to "incore" status, before write to log */
-	void (*lo_incore_commit) (struct gfs_sbd * sdp, struct gfs_trans * tr,
-				  struct gfs_log_element * le);
-
-	/* Allow writes to in-place locations, after log is on-disk */
-	void (*lo_add_to_ail) (struct gfs_sbd * sdp,
-			       struct gfs_log_element * le);
-
-	/* Clean up LE after log dump */
-	void (*lo_clean_dump) (struct gfs_sbd * sdp,
-			       struct gfs_log_element * le);
-
-	/*
-	 * Operations specific to a class of log elements.
-	 * These are typically executed over a whole transaction by
-	 * macros such as LO_TRANS_SIZE.  Each LE-type-specific operation
-	 * for each LE contributes its part to the overall result.
-	 */
-
-	/* Determine LE-type-specific quantities of blocks of various types
-	 * required for writing the log */
-	void (*lo_trans_size) (struct gfs_sbd * sdp, struct gfs_trans * tr,
-			       unsigned int *mblks, unsigned int *eblks,
-			       unsigned int *blocks, unsigned int *bmem);
-
-	/* Combine LE-type-specific values in new_tr and tr, result is in tr */
-	void (*lo_trans_combine) (struct gfs_sbd * sdp, struct gfs_trans * tr,
-				  struct gfs_trans * new_tr);
-
-	/* Create control and metadata buffers that will make up the log */
-	void (*lo_build_bhlist) (struct gfs_sbd * sdp, struct gfs_trans * tr);
-
-	/* Calculate log space needed for this LE in a log dump */
-	void (*lo_dump_size) (struct gfs_sbd * sdp, unsigned int *elements,
-			      unsigned int *blocks, unsigned int *bmem);
-
-	/* Add LE to log dump */
-	void (*lo_build_dump) (struct gfs_sbd * sdp, struct gfs_trans * tr);
-
-	/*
-	 * Operations that happen at recovery time
-	 */
-
-	/* Reset/init whatever before doing recovery */
-	void (*lo_before_scan) (struct gfs_sbd * sdp, unsigned int jid,
-				struct gfs_log_header * head,
-				unsigned int pass);
-
-	/* LE-specific recovery procedure */
-	int (*lo_scan_elements) (struct gfs_sbd * sdp,
-				 struct gfs_jindex * jdesc,
-				 struct gfs_glock * gl, uint64_t start,
-				 struct gfs_log_descriptor * desc,
-				 unsigned int pass);
-
-	/* Verify and report recovery results/statistics */
-	void (*lo_after_scan) (struct gfs_sbd * sdp, unsigned int jid,
-			       unsigned int pass);
-
-
-	/* 
-	 * Type of element (glock/buf/unlinked/quota)
-	 */
-	char *lo_name;
-};
-
-/*
- *  Structure that gets added to struct gfs_trans->tr_elements.  They
- *  make up the "stuff" in each transaction.
- */
-struct gfs_log_element {
-	struct gfs_log_operations *le_ops; /* Vector of functions */
-
-	struct gfs_trans *le_trans;     /* We're part of this transaction */
-	osi_list_t le_list;       /* Link to transaction's element list */
-};
-
-/*
- * Meta-header cache structure.
- * One for each metadata block that we've de-allocated.
- * Used to temporarily store gfs_meta_header structs for meta blocks that
- *   have been freshly turned into FREEMETA (alloc'd or de-alloc'd).  Storing
- *   these (small) structures in-core allows us to release the (large) buffers,
- *   and not need to re-read the header from disk if/when we re-allocate the
- *   blocks to USEDMETA, as long as this node holds the EXCLUSIVE lock for the
- *   resource group containing the blocks.  If we release the EX lock, we must
- *   throw away the rgrp's cached meta headers, since another node could change
- *   the blocks' contents.
- * In-core superblock structure hosts the hashed cache, as well as a
- *   linear list of all cached, in most-recently-added order.
- * Also, each resource group keeps a list of cached blocks within its scope.
- */
-struct gfs_meta_header_cache {
-	/* Links to various lists */
-	osi_list_t mc_list_hash;   /* Superblock's hashed list */
-	osi_list_t mc_list_single; /* Superblock's list, MRU order */
-	osi_list_t mc_list_rgd;    /* Resource group's list */
-
-	uint64_t mc_block;               /* Block # (in-place address) */
-	struct gfs_meta_header mc_mh;    /* Payload: the block's meta-header */
-};
-
-/*
- * Dependency cache structure.
- * In-core superblock structure hosts the actual cache.
- * Also, each resource group keeps a list of dependency blocks within its scope.
- */
-struct gfs_depend {
-	/* Links to various lists */
-	osi_list_t gd_list_hash;  /* Superblock's hashed list */
-	osi_list_t gd_list_rgd;   /* Resource group's list */
-
-	struct gfs_rgrpd *gd_rgd;       /* Resource group descriptor */
-	uint64_t gd_formal_ino;         /* Inode ID */
-	unsigned long gd_time;          /* Time (jiffies) when put on list */
-};
-
-/*
- *  Block allocation bitmap descriptor structure.
- *  One of these for each FS block that contains bitmap data
- *    (i.e. the resource group header blocks and their following bitmap blocks).
- *  Each allocatable FS data block is represented by 2 bits (4 alloc states).
- */
-struct gfs_bitmap {
-	uint32_t bi_offset;  /* Byte offset of bitmap within this bit block
-	                        (non-zero only for an rgrp header block) */
-	uint32_t bi_start;   /* Data block (rgrp scope, 32-bit) represented
-	                        by the first bit-pair in this bit block */
-	uint32_t bi_len;     /* The number of bitmap bytes in this bit block */
-};
-
-/*
- *  Resource Group (Rgrp) descriptor structure.
- *  There is one of these for each resource (block) group in the FS.
- *  The filesystem is divided into a number of resource groups to allow
- *    simultaneous block alloc operations by a number of nodes.
- */
-struct gfs_rgrpd {
-	/* Links to superblock lists */
-	osi_list_t rd_list;       /* On-disk-order list of all rgrps */
-	osi_list_t rd_list_mru;   /* Most Recently Used list of all rgs */
-	osi_list_t rd_recent;     /* recently used rgrps */
-	uint32_t rd_try_counter;        /* # of times we fail a try lock */
-
-	struct gfs_glock *rd_gl;        /* Glock for this rgrp */
-
-	struct gfs_rindex rd_ri;        /* Resource Index (on-disk) structure */
-	struct gfs_rgrp rd_rg;          /* Resource Group (on-disk) structure */
-	uint64_t rd_rg_vn;              /* Version #: if != glock's gl_vn,
-	                                   we need to read rgrp fm disk */
-
-	/* Block alloc bitmap cache */
-	struct gfs_bitmap *rd_bits;     /* Array of block bitmap descriptors */
-	struct buffer_head **rd_bh;     /* Array of ptrs to block bitmap bh's */
-
-	/* Block allocation strategy, rgrp scope. Start at these blocks when
-	   searching for next data/meta block to alloc */
-	uint32_t rd_last_alloc_data;    /* Most recent data block allocated */
-	uint32_t rd_last_alloc_meta;    /* Most recent meta block allocated */
-
-	osi_list_t rd_mhc;        /* Cached meta-headers for this rgrp */
-	osi_list_t rd_depend;     /* Dependent inodes (MRU order) */
-
-	struct gfs_sbd *rd_sbd;		/* FS incore superblock (fs instance) */
-#ifndef __KERNEL__
-	int32_t rd_open_count;  /* # of open references on this rgrpd */
-#endif
-};
-
-/*
- *  Per-buffer data
- *  One of these is attached as GFS private data to each FS block's buffer_head.
- *  These keep track of a buffer's progress through the transaction pipeline,
- *    using the "new" embedded log element to attach it to a being-built
- *    transaction, and moving the attachment point to the "incore" LE once
- *    the transaction completes (at which time the buffer becomes a candidate
- *    to be written to the on-disk log).
- *  A buffer may be attached simultaneously to a new and an incore transaction,
- *    but no more than one of each:  Only one new trans may be built at a time
- *    for a given buffer, obviously, since the buffer's contents are protected
- *    by an EXclusive glock when writing.  And, when a transaction is completely
- *    built, GFS combines incore transactions that share glocks (see
- *    incore_commit()), i.e. the glock that protects the buffer, so a buffer
- *    never needs to be attached to more than one (combined) incore trans.
- *  Note that multiple transactions can modify the buffer since its most
- *    recent writes to disk.  This principle applies to both in-place and
- *    journal block locations on-disk, allowing this node to keep modifying the
- *    cached data without writing it to disk, unless/until another node needs
- *    to access the data, or the Linux OS tells us to sync to disk.
- *  If a transaction follows another transaction before the first transaction's
- *    log completes (indicated by the in-place buffer head still being pinned
- *    in RAM), GFS copies the first transaction's results to a "frozen"
- *    image of the buffer, so the first transaction results (an atomic
- *    snapshot) can be logged properly, while the second transaction is
- *    modifying the "real" buffer.  This frozen copy lives only until the new
- *    transaction is complete, at which point one of two things has occurred:
- *    1).  Buffer was logged successfully; frozen copy's job is done.
- *    2).  Buffer was not yet logged; frozen copy no longer needed, newer
- *         buffer becomes the log candidate.
- *
- *  gfs_bufdata structs also link into the Active Items Lists (AIL) (buffers
- *    flushed to on-disk log, but not yet flushed to on-disk in-place locations)
- *    attached to:
- *    1).  The latest transaction to modify and log (on-disk) the buffer, and
- *    2).  The glock that protects the buffer's contents.
- *  The buffer is attached to only the most recent transaction's AIL
- *    list for a couple of reasons.  One is that only the most up-to-date
- *    buffer content needs to be written to the in-place block on-disk.  The
- *    other is that since there is a more recent copy of the block in
- *    the log, we don't need to keep the older copies in the log.  We can
- *    remove them from the AIL and let the log space be reused for new
- *    transactions (GFS advances the log tail when removing buffers from AIL).
- */
-struct gfs_bufdata {
-	struct buffer_head *bd_bh;  /* We belong to this Linux buffer_head */
-	struct gfs_glock *bd_gl;    /* This glock protects buffer's payload */
-
-	/* Log elements map us to a particular set of log operations functions,
-	   and to a particular transaction */
-	struct gfs_log_element bd_new_le;     /* New, incomplete transaction */
-	struct gfs_log_element bd_incore_le;  /* Complete (committed) trans */
-
-	char *bd_frozen;            /* "Frozen" copy of buffer's data */
-	struct semaphore bd_lock;   /* Protects access to this structure */
-
-	/* "Pin" means keep buffer in RAM, don't write to disk (yet) */
-	unsigned int bd_pinned;	         /* Recursive pin count */
-
-	/* Links to Active Items Lists */
-	osi_list_t bd_ail_tr_list; /* This buf's most recent trans' AIL */
-	osi_list_t bd_ail_gl_list; /* This buf's glock's AIL */
-};
-
-/*
- *  Glock operations
- *  One set of operations for each glock, the set selected by type of glock.
- *  These functions get called at various points in a glock's lifetime.
- *  "xmote" = promote or demote (change lock state) a glock at inter-node scope.
- *  "th" = top half, "bh" = bottom half
- *  Some operations/fields are required (GFS assumes they are there):
- *     go_xmote_th
- *     go_drop_th
- *     go_type
- *  Other operations are optional (GFS checks for presence before calling).
- */
-struct gfs_glock_operations {
-
-	/* Acquire lock or change lock state at inter-node scope:
-	     Does type-specific preparation (if any)
-	     Uses gfs_glock_xmote_th to call lock module. */
-	void (*go_xmote_th) (struct gfs_glock * gl, unsigned int state,
-			     int flags);
-
-	/* After acquiring or changing a lock at inter-node scope */
-	void (*go_xmote_bh) (struct gfs_glock * gl);
-
-	/* Release (unlock) a lock at inter-node scope:
-	     Does type-specific preparation (if any)
-	     Uses gfs_glock_drop_th to call lock module. */
-	void (*go_drop_th) (struct gfs_glock * gl);
-
-	/* After releasing a lock at inter-node scope */
-	void (*go_drop_bh) (struct gfs_glock * gl);
-
-	/* Sync dirty data to disk (e.g. before demoting an EX inter-node lock)
-	   (another node needs to read the updated data from disk) */
-	void (*go_sync) (struct gfs_glock * gl, int flags);
-
-	/* Invalidate local cached data just after releasing an inter-node lock
-	   (another node may change the on-disk data, so it's no good to us) */
-	void (*go_inval) (struct gfs_glock * gl, int flags);
-
-	/* Lock-type-specific check to see if it's okay to unlock a glock
-	   at inter-node scope (and remove it from our glock cache) */
-	int (*go_demote_ok) (struct gfs_glock * gl);
-
-	/* After getting lock for first holder (within this node) */
-	int (*go_lock) (struct gfs_glock * gl, int flags);
-
-	/* After last holder (within this node) gives up lock (glock may
-	   remain in glock cache, though) */
-	void (*go_unlock) (struct gfs_glock * gl, int flags);
-
-	/* After receiving a callback: another node needs the lock */
-	void (*go_callback) (struct gfs_glock * gl, unsigned int state);
-
-        /* Called when the glock layer marks a lock as being not greedy
-	   anymore */
-	void (*go_greedy) (struct gfs_glock * gl);
-
-	/* Lock type: locks with same lock # (often an FS block #),
-	   but different types, are different locks */
-	int go_type;
-};
-
-/*
- *  Glock holder structure
- *  One for each holder of a glock.
- *  These coordinate the use, within this node, of an acquired inter-node glock.
- *  Once a node has acquired a glock, it may be shared within that node by
- *    several processes, or even by several recursive requests from the same
- *    process.  Each is a separate "holder".  Different holders may co-exist
- *    having requested different lock states, as long as the node holds the
- *    glock in a state that is compatible.  A hold requestor may select, via
- *    flags, the rules by which sharing within the node is granted:
- *      LM_FLAG_ANY:  Grant if glock state is any other than UNLOCKED.
- *      GL_EXACT:     Grant only if glock state is exactly the requested state.
- *      GL_LOCAL_EXCL:  Grant only one holder at a time within this node.
- *    With no flags, a hold will be granted to a SHARED request even if the
- *    node holds the glock in EXCLUSIVE mode.  See relaxed_state_ok().
- *  When a process needs to manipulate a lock, it requests it via one of
- *    these holder structures.  If the request cannot be satisfied immediately,
- *    the holder structure gets queued on one of these lists in gfs_glock:
- *    1) waiters1, for gaining exclusive access to the (local) glock structure.
- *    2) waiters2, for demoting a lock (unlocking a glock, or changing its state
- *       to be less restrictive) or relenquishing "greedy" status.
- *    3) waiters3, for promoting (locking a new glock, or changing a glock state
- *       to be more restrictive).
- *  When holding a lock, gfs_holder struct stays on glock's holder list.
- *  See gfs-kernel/src/harness/lm_interface.h for gh_state (LM_ST_...)
- *    and gh_flags (LM_FLAG...) fields.
- *  Also see glock.h for gh_flags field (GL_...) flags.
- */
-
-/*  Action requests  */
-#define HIF_MUTEX       (0)  /* Exclusive (local) access to glock struct */
-#define HIF_PROMOTE     (1)  /* Change lock to more restrictive state */
-#define HIF_DEMOTE      (2)  /* Change lock to less restrictive state */
-#define HIF_GREEDY      (3)  /* Wait for the glock to be unlocked */
-
-/*  States  */
-#define HIF_ALLOCED     (4)  /* Holder structure is or was in use */
-#define HIF_DEALLOC     (5)  /* Toss holder struct as soon as queued request
-                              *   is satisfied */
-#define HIF_HOLDER      (6)  /* We have been granted a hold on the lock */
-#define HIF_FIRST       (7)  /* We are first holder to get the lock */
-#define HIF_RECURSE     (8)  /* >1 hold requests on same glock by same process*/
-#define HIF_ABORTED     (9) /* Aborted before being submitted */
-
-struct gfs_holder {
-	osi_list_t gh_list;      /* Link to one of glock's holder lists */
-
-	struct gfs_glock *gh_gl;       /* Glock that we're holding */
-	struct task_struct *gh_owner;  /* Linux process that is the holder */
-
-	/* request to change lock state */
-	unsigned int gh_state;         /* LM_ST_... requested lock state */
-	int gh_flags;                  /* GL_... or LM_FLAG_... req modifiers */
-
-	int gh_error;                  /* GLR_... CANCELLED/TRYFAILED/-errno */
-	unsigned long gh_iflags;       /* HIF_... holder state, see above */
-	struct completion gh_wait;     /* Wait for completion of ... */
-};
-
-/*
- *  Glock Structure
- *  One for each inter-node lock held by this node.
- *  A glock is a local representation/abstraction of an inter-node lock.
- *    Inter-node locks are managed by a "lock module" (LM) which plugs in to
- *    the lock harness / glock interface (see gfs-kernel/harness).  Different
- *    lock modules support different lock protocols (e.g. GULM, GDLM, no_lock).
- *  A glock may have one or more holders within a node.  See gfs_holder above.
- *  Glocks are managed within a hash table hosted by the in-core superblock.
- *  After all holders have released a glock, it will stay in the hash table
- *    cache for a time (depending on lock type), during which the inter-node
- *    lock will not be released unless another node needs the lock (lock
- *    manager requests this via callback to GFS through LM on this node).  This
- *    provides better performance in case this node needs the glock again soon.
- *    See comments for meta_go_demote_ok(), glops.c.
- *  Each glock has an associated vector of lock-type-specific "glops" functions
- *    which are called at important times during the life of a glock, and
- *    which define the type of lock (e.g. dinode, rgrp, non-disk, etc).
- *    See gfs_glock_operations above.
- *  A glock, at inter-node scope, is identified by the following dimensions:
- *    1)  lock number (usually a block # for on-disk protected entities,
- *           or a fixed assigned number for non-disk locks, e.g. MOUNT).
- *    2)  lock type (actually, the type of entity protected by the lock).
- *    3)  lock namespace, to support multiple GFS filesystems simultaneously.
- *           Namespace (usually cluster:filesystem) is specified when mounting.
- *           See man page for gfs_mount.
- *  Glocks require support of Lock Value Blocks (LVBs) by the inter-node lock
- *    manager.  LVBs are small (32-byte) chunks of data associated with a given
- *    lock, that can be quickly shared between cluster nodes.  Used for certain
- *    purposes such as sharing an rgroup's block usage statistics without
- *    requiring the overhead of:
- *      -- sync-to-disk by one node, then a
- *      -- read from disk by another node.
- *  
- */
-
-#define GLF_PLUG                (0)  /* Dummy */
-#define GLF_LOCK                (1)  /* Exclusive (local) access to glock
-                                      *   structure */
-#define GLF_STICKY              (2)  /* Don't release this inter-node lock
-                                      *   unless another node explicitly asks */
-#define GLF_PREFETCH            (3)  /* This lock has been (speculatively)
-                                      *   prefetched, demote if not used soon */
-#define GLF_SYNC                (4)  /* Sync lock's protected data as soon as
-                                      *   there are no more holders */
-#define GLF_DIRTY               (5)  /* There is dirty data for this lock,
-                                      *   sync before releasing inter-node */
-#define GLF_SKIP_WAITERS2       (6)  /* Make run_queue() ignore gl_waiters2
-                                      *   (demote/greedy) holders */
-#define GLF_GREEDY              (7)  /* This lock is ignoring callbacks
-                                      *   (requests from other nodes) for now */
-
-struct gfs_glock {
-	osi_list_t gl_list;    /* Link to hb_list in one of superblock's
-	                              * sd_gl_hash glock hash table buckets */
-	unsigned long gl_flags;      /* GLF_... see above */
-	struct lm_lockname gl_name;  /* Lock number and lock type */
-	atomic_t gl_count;           /* Usage count */
-
-	spinlock_t gl_spin;          /* Protects some members of this struct */
-
-	/* Lock state reflects inter-node manager's lock state */
-	unsigned int gl_state;       /* LM_ST_... see harness/lm_interface.h */
-
-	/* Lists of gfs_holders */
-	osi_list_t gl_holders;  /* all current holders of the glock */
-	osi_list_t gl_waiters1; /* HIF_MUTEX */
-	osi_list_t gl_waiters2; /* HIF_DEMOTE, HIF_GREEDY */
-	osi_list_t gl_waiters3; /* HIF_PROMOTE */
-
-	struct gfs_glock_operations *gl_ops; /* function vector, defines type */
-
-	/* State to remember for async lock requests */
-	struct gfs_holder *gl_req_gh; /* Holder for request being serviced */
-	gfs_glop_bh_t gl_req_bh;  /* The bottom half to execute */
-
-	lm_lock_t *gl_lock;       /* Lock module's private lock data */
-	char *gl_lvb;             /* Lock Value Block */
-	atomic_t gl_lvb_count;    /* LVB recursive usage (hold/unhold) count */
-
-	uint64_t gl_vn;           /* Incremented when protected data changes */
-	unsigned long gl_stamp;   /* Glock cache retention timer */
-	void *gl_object;          /* The protected entity (e.g. a dinode) */
-
-	/* Incore transaction stuff */
-	/* Log elements map us to a particular set of log operations functions,
-	   and to a particular transaction */
-	struct gfs_log_element gl_new_le;     /* New, incomplete transaction */
-	struct gfs_log_element gl_incore_le;  /* Complete (committed) trans */ 
-
-	struct gfs_gl_hash_bucket *gl_bucket; /* Our bucket in sd_gl_hash */
-	osi_list_t gl_reclaim;          /* Link to sd_reclaim_list */
-
-	struct gfs_sbd *gl_sbd;               /* Superblock (FS instance) */
-
-	struct inode *gl_aspace;              /* The buffers protected by this lock */
-	osi_list_t gl_ail_bufs;         /* AIL buffers protected by us */
-};
-
-/*
- *  In-Place Reservation structure
- *  Coordinates allocation of "in-place" (as opposed to journal) FS blocks,
- *     which contain persistent inode/file/directory data and metadata.
- *     These blocks are the allocatable blocks within resource groups (i.e.
- *     not including rgrp header and block alloc bitmap blocks).
- *  gfs_inplace_reserve() calculates a fulfillment plan for allocating blocks,
- *     based on block statistics in the resource group headers.
- *  Then, gfs_blkalloc() or gfs_metaalloc() walks the block alloc bitmaps
- *     to do the actual allocation.
- */
-struct gfs_alloc {
-	/* Up to 4 quotas (including an inode's user and group quotas)
-	   can track changes in block allocation */
-
-	unsigned int al_qd_num;          /* # of quotas tracking changes */
-	struct gfs_quota_data *al_qd[4]; /* Ptrs to quota structures */
-	struct gfs_holder al_qd_ghs[4];  /* Holders for quota glocks */
-
-	/* Request, filled in by the caller to gfs_inplace_reserve() */
-
-	uint32_t al_requested_di;     /* Number of dinodes to reserve */
-	uint32_t al_requested_meta;   /* Number of metadata blocks to reserve */
-	uint32_t al_requested_data;   /* Number of data blocks to reserve */
-
-	/* Fulfillment plan, filled in by gfs_inplace_reserve() */
-
-	char *al_file;                /* Debug info, .c file making request */
-	unsigned int al_line;         /* Debug info, line of code making req */
-	struct gfs_holder al_ri_gh;   /* Glock holder for resource grp index */
-	struct gfs_holder al_rgd_gh;  /* Glock holder for al_rgd rgrp */
-	struct gfs_rgrpd *al_rgd;     /* Resource group from which to alloc */
-	uint32_t al_reserved_meta;    /* Alloc up to this # meta blocks from al_rgd */
-	uint32_t al_reserved_data;    /* Alloc up to this # data blocks from al_rgd */
-
-	/* Actual alloc, filled in by gfs_blkalloc()/gfs_metaalloc(), etc. */
-
-	uint32_t al_alloced_di;       /* # dinode blocks allocated */
-	uint32_t al_alloced_meta;     /* # meta blocks allocated */
-	uint32_t al_alloced_data;     /* # data blocks allocated */
-
-	/* Dinode allocation crap */
-
-	struct gfs_unlinked *al_ul;   /* Unlinked dinode log entry */
-};
-
-/*
- *  Incore inode structure
- */
-
-#define GIF_QD_LOCKED           (0)
-#define GIF_PAGED               (1)
-#define GIF_SW_PAGED            (2)
-
-struct gfs_inode {
-	struct gfs_inum i_num;   /* Formal inode # and block address */
-
-	atomic_t i_count;        /* Usage count */
-	unsigned long i_flags;   /* GIF_...  see above */
-
-	uint64_t i_vn;           /* Version #: if different from glock's vn,
-	                            we need to read inode from disk */
-	struct gfs_dinode i_di;  /* Dinode (on-disk) structure */
-
-	struct gfs_glock *i_gl;  /* This glock protects this inode */
-	struct gfs_sbd *i_sbd;   /* Superblock (fs instance structure) */
-	struct inode *i_vnode;   /* Linux VFS inode structure */
-
-	struct gfs_holder i_iopen_gh;  /* Glock holder for Inode Open lock */
-
-	/* Block allocation strategy, inode scope */
-	struct gfs_alloc *i_alloc; /* In-place block reservation structure */
-	uint64_t i_last_rg_alloc;  /* Most recent blk alloc was fm this rgrp */
-
-	spinlock_t i_spin;
-	struct rw_semaphore i_rw_mutex;
-
-	/* Cache of most-recently used buffers in indirect addressing chain */
-	struct buffer_head *i_cache[GFS_MAX_META_HEIGHT];
-
-	unsigned int i_greedy; /* The amount of time to be greedy */
-	unsigned long i_last_pfault; /* The time of the last page fault */
-};
-
-struct inode_info
-{
-        osi_list_t list;
-        uint64_t   inode;
-        uint32_t   link_count;   /* the number of links the inode
-                                  * thinks it has */
-        uint32_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;
-
-};
-
-/*
- *  GFS per-fd structure
- */
-
-#define GFF_DID_DIRECT_ALLOC    (0)
-
-struct gfs_file {
-	unsigned long f_flags; /* GFF_...  see above */
-
-	struct semaphore f_fl_lock; /* Lock to protect flock operations */
-	struct gfs_holder f_fl_gh; /* Holder for this f_vfile's flock */
-
-	struct gfs_inode *f_inode;        /* Incore GFS inode */
-	struct file *f_vfile;             /* Linux file struct */
-};
-
-/*
- *  Unlinked inode log entry incore structure
- */
-
-#define ULF_NEW_UL              (0)  /* Part of new (being built) trans */
-#define ULF_INCORE_UL           (1)  /* Part of incore-committed trans */
-#define ULF_IC_LIST             (2)
-#define ULF_OD_LIST             (3)
-#define ULF_LOCK                (4)  /* Protects access to this structure */
-
-struct gfs_unlinked {
-	osi_list_t ul_list;    /* Link to superblock's sd_unlinked_list */
-	unsigned int ul_count;       /* Usage count */
-
-	struct gfs_inum ul_inum;     /* Formal inode #, block addr */
-	unsigned long ul_flags;      /* ULF_... */
-
-	/* Log elements map us to a particular set of log operations functions,
-	   and to a particular transaction */
-	struct gfs_log_element ul_new_le;    /* New, not yet committed */
-	struct gfs_log_element ul_incore_le; /* Committed to incore log */
-	struct gfs_log_element ul_ondisk_le; /* Committed to ondisk log */
-};
-
-/*
- *  Quota log element
- *  One for each logged change in a block alloc value affecting a given quota.
- *  Only one of these for a given quota within a given transaction;
- *    multiple changes, within one transaction, for a given quota will be
- *    combined into one log element.
- */
-struct gfs_quota_le {
-	/* Log element maps us to a particular set of log operations functions,
-	   and to a particular transaction */
-	struct gfs_log_element ql_le;    /* Generic log element structure */
-
-	struct gfs_quota_data *ql_data;  /* The quota we're changing */
-	osi_list_t ql_data_list;   /* Link to quota's log element list */
-
-	int64_t ql_change;           /* # of blocks alloc'd (+) or freed (-) */
-};
-
-/*
- *  Quota structure
- *  One for each user or group quota.
- *  Summarizes all block allocation activity for a given quota, and supports
- *    recording updates of current block alloc values in GFS' special quota
- *    file, including the journaling of these updates, encompassing
- *    multiple transactions and log dumps.
- */
-
-#define QDF_USER                (0)   /* User (1) vs. group (0) quota */
-#define QDF_OD_LIST             (1)   /* Waiting for sync to quota file */
-#define QDF_LOCK                (2)   /* Protects access to this structure */
-
-struct gfs_quota_data {
-	osi_list_t qd_list;     /* Link to superblock's sd_quota_list */
-	unsigned int qd_count;        /* Usage count */
-
-	uint32_t qd_id;               /* User or group ID number */
-	unsigned long qd_flags;       /* QDF_... */
-
-	/* This list is for non-log-dump transactions */
-	osi_list_t qd_le_list;  /* List of gfs_quota_le log elements */
-
-	/* Summary of block alloc changes affecting this quota, in various
-	   stages of logging & syncing changes to the special quota file */
-	int64_t qd_change_new;  /* New, not yet committed to in-core log*/
-	int64_t qd_change_ic;   /* Committed to in-core log */
-	int64_t qd_change_od;   /* Committed to on-disk log */
-	int64_t qd_change_sync; /* Being synced to the in-place quota file */
-
-	struct gfs_quota_le qd_ondisk_ql; /* Log element for log dump */
-	uint64_t qd_sync_gen;         /* Sync-to-quota-file generation # */
-
-	/* Glock provides protection for quota, *and* provides
-	   lock value block (LVB) communication, between nodes, of current
-	   quota values.  Shared lock -> LVB read.  EX lock -> LVB write. */
-	struct gfs_glock *qd_gl;      /* glock for this quota */
-	struct gfs_quota_lvb qd_qb;   /* LVB (limit/warn/value) */
-
-	unsigned long qd_last_warn;   /* Jiffies of last warning to user */
-};
-
-/*
- * Log Buffer descriptor structure.
- * One for each block buffer recorded in the log.
- * When beginning a new transaction, GFS pre-allocates a number of these,
- *   and puts them on transaction's tr_free_bufs list.
- * Logged buffers are of two types:
- *   1).  Exact copies of buffers to be written to in-place location in FS.
- *   2).  Log-only buffers such as log headers and control blocks (e.g. tags).
- * A gfs_log_buf is required for both types; the ones for log-only buffers
- *   contain NULL in lb_unlock, and get cleaned up after the log write.
- * lb_bh is a "fake" buffer head that directs Linux block I/O to write the buf
- *   to the on-disk log location, rather than the on-disk in-place location.
- *   Used for both types.
- * lb_unlock points to the "real" buffer head that directs Linux to write the
- *   buf to its regular on-disk in-place filesystem location.  Once the commit
- *   to the on-disk log is finished, GFS unlocks the "real" buffer so it can be
- *   written to in-place block, or modified by another transaction.
- *   Used only for type 1).
- */
-struct gfs_log_buf {
-	/* Link to one of the transaction structure's lists */
-	osi_list_t lb_list;      /* Link to tr_free_bufs or tr_list */
-
-	struct buffer_head lb_bh;      /* "Fake" bh; for the log block */
-	struct buffer_head *lb_unlock; /* "Real" bh; for the in-place block */
-};
-
-/*
- *  Transaction structure
- *  One for each transaction
- *  This coordinates the logging and flushing of written metadata.
- */
-
-#define TRF_LOG_DUMP            (0x00000001)
-#define TRF_DUMMY               (0x00000002)
-
-struct gfs_trans {
-
-	/* Link to various lists */
-	osi_list_t tr_list;      /* Superblk's incore trans or AIL list*/
-
-	/* Initial creation stuff */
-
-	char *tr_file;                 /* Debug info: .c file creating trans */
-	unsigned int tr_line;          /* Debug info: codeline creating trans */
-
-	/* Reservations for on-disk space in journal.
-	   Meta blocks are copies of in-place filesystem blocks.  
-	   Extra blocks are log-only (log header and control blocks) */
-	unsigned int tr_mblks_asked;   /* # of meta log blocks requested */
-	unsigned int tr_eblks_asked;   /* # of extra log blocks requested */
-	unsigned int tr_seg_reserved;  /* # of segments actually reserved */
-
-	struct gfs_holder *tr_t_gh;    /* Glock holder for this transaction */
-
-	/* Stuff filled in during creation */
-
-	unsigned int tr_flags;         /* TRF_... */
-	osi_list_t tr_elements;  /* List of this trans' log elements */
-
-	/* Stuff modified during the commit */
-
-	/* When creating a new transaction, GFS pre-allocates as many of
-	   these buffers and descriptor structures as it might need for
-	   all loggable filesystem (meta)data, and log-control (log-only, not
-	   going to filesystem in-place location) data going to on-disk log.
-	   It keeps them on these "free" lists until they get used (and linked
-	   into tr_bufs list, below) or "refunded" if not needed. */
-	unsigned int tr_num_free_bufs; /* List of free gfs_log_buf structs */
-	osi_list_t tr_free_bufs; /* .. 1 for each log block */
-	unsigned int tr_num_free_bmem; /* List of free fs-block-size buffers */
-	osi_list_t tr_free_bmem; /* .. for log-only (e.g. tag) blocks */
-
-	/* Logged transaction starts with a (first) log header at a segment
-	   boundary, and fills contiguous blocks after that.  Each segment
-	   boundary block gets another log header. */
-	uint64_t tr_log_head;          /* The next log block # to fill */
-	uint64_t tr_first_head;	       /* Trans' first log header's block # */
-
-	/* gfs_log_buf structs move from tr_free_bufs to here when being used */
-	osi_list_t tr_bufs;      /* List of buffers going to the log */
-
-	/* Stuff that's part of the Active Items List (AIL) */
-
-	osi_list_t tr_ail_bufs;  /* List of buffers on AIL list */
-
-	/* # log elements of various types on tr_elements list */
-
-	unsigned int tr_num_gl;        /* Glocks */
-	unsigned int tr_num_buf;       /* Buffers */
-	unsigned int tr_num_iul;       /* Unlinked inodes */
-	unsigned int tr_num_ida;       /* De-allocated inodes */
-	unsigned int tr_num_q;         /* Quotas */
-};
-
-#define GFS_GLOCKD_DEFAULT (1)
-#define GFS_GLOCKD_MAX (32)
-
-struct gfs_args {
-	char ar_lockproto[GFS_LOCKNAME_LEN]; /* The name of the Lock Protocol */
-	char ar_locktable[GFS_LOCKNAME_LEN]; /* The name of the Lock Table */
-	char ar_hostdata[GFS_LOCKNAME_LEN]; /* The host specific data */
-
-        /*
-	 * GFS can invoke some flock and disk caching optimizations if it is
-	 * not in a cluster, i.e. is a local filesystem.  The chosen lock
-	 * module tells GFS, at mount time, if it supports clustering.
-	 * The nolock module is the only one that does not support clustering;
-	 * it sets to TRUE the local_fs field in the struct lm_lockops.
-	 * GFS can either optimize, or ignore the opportunity.
-	 * The user controls behavior via the following mount options.
-	 */
-	int ar_ignore_local_fs; /* Don't optimize even if local_fs is TRUE */
-	int ar_localflocks; /* Let the VFS do flock|fcntl locks for us */
-	int ar_localcaching; /* Local-style caching (dangerous on multihost) */
-	int ar_oopses_ok; /* Allow oopses */
-
-	int ar_debug; /* Oops on errors instead of trying to be graceful */
-	int ar_upgrade; /* Upgrade ondisk/multihost format */
-
-	unsigned int ar_num_glockd; /* # of glock cleanup daemons to run
-				       (more daemons => faster cleanup)  */
-	int ar_posix_acls; /* Enable posix acls */
-	int ar_suiddir; /* suiddir support */
-};
-
-struct gfs_tune {
-	spinlock_t gt_spin;
-
-	unsigned int gt_ilimit1;
-	unsigned int gt_ilimit1_tries;
-	unsigned int gt_ilimit1_min;
-	unsigned int gt_ilimit2;
-	unsigned int gt_ilimit2_tries;
-	unsigned int gt_ilimit2_min;
-	unsigned int gt_demote_secs; /* Cache retention for unheld glock */
-	unsigned int gt_incore_log_blocks;
-	unsigned int gt_jindex_refresh_secs; /* Check for new journal index */
-	unsigned int gt_depend_secs;
-
-	/* How often various daemons run (seconds) */
-	unsigned int gt_scand_secs; /* Find unused glocks and inodes */
-	unsigned int gt_recoverd_secs; /* Recover journal of crashed node */
-	unsigned int gt_logd_secs; /* Update log tail as AIL flushes */
-	unsigned int gt_quotad_secs; /* Sync changes to quota file, clean*/
-	unsigned int gt_inoded_secs; /* Toss unused inodes */
-
-	unsigned int gt_quota_simul_sync; /* Max # quotavals to sync at once */
-	unsigned int gt_quota_warn_period; /* Secs between quota warn msgs */
-	unsigned int gt_atime_quantum; /* Min secs between atime updates */
-	unsigned int gt_quota_quantum; /* Secs between syncs to quota file */
-	unsigned int gt_quota_scale_num; /* Numerator */
-	unsigned int gt_quota_scale_den; /* Denominator */
-	unsigned int gt_quota_enforce;
-	unsigned int gt_quota_account;
-	unsigned int gt_new_files_jdata;
-	unsigned int gt_new_files_directio;
-	unsigned int gt_max_atomic_write; /* Split large writes into this size*/
-	unsigned int gt_max_readahead; /* Max bytes to read-ahead from disk */
-	unsigned int gt_lockdump_size;
-	unsigned int gt_stall_secs; /* Detects trouble! */
-	unsigned int gt_complain_secs;
-	unsigned int gt_reclaim_limit; /* Max # glocks in reclaim list */
-	unsigned int gt_entries_per_readdir;
-	unsigned int gt_prefetch_secs; /* Usage window for prefetched glocks */
-	unsigned int gt_statfs_slots;
-	unsigned int gt_max_mhc; /* Max # of meta headers in mhc cache */
-	unsigned int gt_greedy_default;
-	unsigned int gt_greedy_quantum;
-	unsigned int gt_greedy_max;
-	unsigned int gt_rgrp_try_threshold;
-};
-
-/*
- *  One bucket of the filesystem's sd_gl_hash glock hash table.
- *
- *  A gfs_glock links into a bucket's list via glock's gl_list member.
- *
- */
-struct gfs_gl_hash_bucket {
-	rwlock_t hb_lock;              /* Protects list */
-	osi_list_t hb_list;      /* List of glocks in this bucket */
-};
-
-struct options {
-	char *device;
-	int yes:1;
-	int no:1;
-};
-
-/*
- *  "Super Block" Data Structure
- *  One per mounted filesystem.
- *  This is the big instance structure that ties everything together for
- *    a given mounted filesystem.  Each GFS mount has its own, supporting
- *    mounts of multiple GFS filesystems on each node.
- *  Pointer to this is usually seen as "sdp" throughout code.
- *  This is a very large structure, as structures go, in part because it
- *    contains arrays of hash buckets for various in-core caches.
- */
-
-#define SDF_JOURNAL_LIVE        (0)  /* Journaling is active (journal is writeable)*/
-#define SDF_SHUTDOWN            (1)  /* FS abnormaly shutdown */
-
-/* Run (1) / stop (0) flags for various daemons */
-#define SDF_SCAND_RUN           (2)  /* Put unused glocks on reclaim queue */
-#define SDF_GLOCKD_RUN          (3)  /* Reclaim (dealloc) unused glocks */
-#define SDF_RECOVERD_RUN        (4)  /* Recover journal of a crashed node */
-#define SDF_LOGD_RUN            (5)  /* Update log tail after AIL flushed */
-#define SDF_QUOTAD_RUN          (6)  /* Sync quota changes to file, cleanup */
-#define SDF_INODED_RUN          (7)  /* Deallocate unlinked inodes */
-
-/* (Re)mount options from Linux VFS */
-#define SDF_NOATIME             (8)  /* Don't change access time */
-#define SDF_ROFS                (9)  /* Read-only mode */
-
-/* Journal log dump support */
-#define SDF_NEED_LOG_DUMP       (10) /* Need to rewrite unlink and quota tags */
-#define SDF_FOUND_UL_DUMP       (11) /* Recovery found unlinked tags */
-#define SDF_FOUND_Q_DUMP        (12) /* Recovery found qutoa tags */
-#define SDF_IN_LOG_DUMP         (13) /* Serializes log dumps */
-
-/* Glock cache */
-#define GFS_GL_HASH_SHIFT       (13)    /* # hash buckets = 8K */
-#define GFS_GL_HASH_SIZE        (1 << GFS_GL_HASH_SHIFT)
-#define GFS_GL_HASH_MASK        (GFS_GL_HASH_SIZE - 1)
-
-/* Meta header cache */
-#define GFS_MHC_HASH_SHIFT      (10)    /* # hash buckets = 1K */
-#define GFS_MHC_HASH_SIZE       (1 << GFS_MHC_HASH_SHIFT)
-#define GFS_MHC_HASH_MASK       (GFS_MHC_HASH_SIZE - 1)
-
-/* Dependency cache */
-#define GFS_DEPEND_HASH_SHIFT   (10)    /* # hash buckets = 1K */
-#define GFS_DEPEND_HASH_SIZE    (1 << GFS_DEPEND_HASH_SHIFT)
-#define GFS_DEPEND_HASH_MASK    (GFS_DEPEND_HASH_SIZE - 1)
-
-struct gfs_sbd {
-	struct gfs_sb sd_sb;            /* GFS on-disk Super Block image */
-
-	struct super_block *sd_vfs;     /* Linux VFS device independent sb */
-
-	struct gfs_args sd_args;        /* Mount arguments */
-	unsigned long sd_flags;         /* SDF_... see above */
-
-	struct gfs_tune sd_tune;	/* Filesystem tuning structure */
-
-	/* Resource group stuff */
-
-	struct gfs_inode *sd_riinode;	/* Resource Index (rindex) inode */
-	uint64_t sd_riinode_vn;	        /* Resource Index version # (detects
-	                                   whether new rgrps have been added) */
-
-	osi_list_t sd_rglist;	/* List of all resource groups,
-					   on-disk order */
-	struct semaphore sd_rindex_lock;/* Serializes RIndex rereads */
-	osi_list_t sd_rg_mru_list;/* List of all resource groups,
-					   most-recently-used (MRU) order */
-	spinlock_t sd_rg_mru_lock;      /* Protect mru list */
-	osi_list_t sd_rg_recent;	/* List of rgrps from which blocks
-					   were recently allocated */
-	spinlock_t sd_rg_recent_lock;   /* Protect recent list */
-	struct gfs_rgrpd *sd_rg_forward;/* Next rgrp from which to attempt
-					   a block alloc */
-	spinlock_t sd_rg_forward_lock;  /* Protect forward pointer */
-
-	unsigned int sd_rgcount;	/* Total # of resource groups */
-
-	/*  Constants computed on mount  */
-
-	/* "bb" == "basic block" == 512Byte sector */
-	uint32_t sd_fsb2bb;             /* # 512B basic blocks in a FS block */
-	uint32_t sd_fsb2bb_shift;       /* Shift sector # to the right by 
-	                                   this to get FileSystem block addr */
-	uint32_t sd_diptrs;     /* Max # of block pointers in a dinode */
-	uint32_t sd_inptrs;     /* Max # of block pointers in an indirect blk */
-	uint32_t sd_jbsize;     /* Payload size (bytes) of a journaled metadata
-	                               block (GFS journals all meta blocks) */
-	uint32_t sd_hash_bsize; /* sizeof(exhash hash block) */
-	uint32_t sd_hash_bsize_shift;
-	uint32_t sd_hash_ptrs;  /* Number of points in a hash block */
-	uint32_t sd_max_dirres; /* Max blocks needed to add a directory entry */
-	uint32_t sd_max_height;	/* Max height of a file's tree */
-	uint64_t sd_heightsize[GFS_MAX_META_HEIGHT];
-	uint32_t sd_max_jheight; /* Max height, journaled file's tree */
-	uint64_t sd_jheightsize[GFS_MAX_META_HEIGHT];
-
-	/*  Lock Stuff  */
-
-	/* Glock cache (all glocks currently held by this node for this FS) */
-	struct gfs_gl_hash_bucket sd_gl_hash[GFS_GL_HASH_SIZE];
-
-	/* Glock reclaim support for scand and glockd */
-	osi_list_t sd_reclaim_list;   /* List of glocks to reclaim */
-	spinlock_t sd_reclaim_lock;
-	wait_queue_head_t sd_reclaim_wchan;
-	atomic_t sd_reclaim_count;          /* # glocks on reclaim list */
-
-	/* Lock module tells us if we're first-to-mount, 
-	   which journal to use, etc. */
-	struct lm_lockstruct sd_lockstruct; /* Info provided by lock module */
-
-	/*  Other caches */
-
-	/* Meta-header cache (incore copies of on-disk meta headers) */
-	osi_list_t sd_mhc[GFS_MHC_HASH_SIZE]; /* hash buckets */
-	osi_list_t sd_mhc_single;     /* Non-hashed list of all MHCs */
-	spinlock_t sd_mhc_lock;
-	atomic_t sd_mhc_count;              /* # MHCs in cache */
-
-	/* Dependency cache */
-	osi_list_t sd_depend[GFS_DEPEND_HASH_SIZE];  /* Hash buckets */
-	spinlock_t sd_depend_lock;
-	atomic_t sd_depend_count;           /* # dependencies in cache */
-
-	/* LIVE inter-node lock indicates that FS is mounted on at least
-	   one node */
-	struct gfs_holder sd_live_gh;       /* Glock holder for LIVE lock */
-
-	/* For quiescing the filesystem */
-	struct gfs_holder sd_freeze_gh;
-	struct semaphore sd_freeze_lock;
-	unsigned int sd_freeze_count;
-
-	/*  Inode Stuff  */
-
-	struct gfs_inode *sd_rooti;         /* FS's root inode */
-
-	/* Only 1 node at a time may rename (e.g. mv) directory from
-	   one directory to another. */
-	struct gfs_glock *sd_rename_gl;     /* Rename glock */
-
-	/*  Daemon stuff  */
-
-	/* Scan for glocks and inodes to toss from memory */
-	struct task_struct *sd_scand_process; /* Scand places on reclaim list*/
-	unsigned int sd_glockd_num;    /* # of glockd procs to do reclaiming*/
-
-	/* Recover journal of a crashed node */
-	struct task_struct *sd_recoverd_process;
-
-	/* Update log tail as AIL gets flushed to in-place on-disk blocks */
-	struct task_struct *sd_logd_process;
-
-	/* Sync quota updates to disk, and clean up unused quota structs */
-	struct task_struct *sd_quotad_process;
-
-	/* Clean up unused inode structures */
-	struct task_struct *sd_inoded_process;
-
-	/* Support for starting/stopping daemons */
-	struct semaphore sd_thread_lock;
-	struct completion sd_thread_completion;
-
-	/*  Log stuff  */
-
-	/* Transaction lock protects the following from one another:
-	   normal write transaction, journal replay (recovery), fs upgrade,
-	   fs read-only => read/write and read/write => read-only conversions.
-	   Also, acquiring the transaction lock in a state other than shared
-	   causes all other machines in the cluster to sync out their dirty
-	   data, mark their journal as being clean, and prevent any new FS
-	   modifications from occuring (i.e. quiesces the FS). */
-	struct gfs_glock *sd_trans_gl;	/* Transaction glock structure */
-
-	struct gfs_inode *sd_jiinode;	/* Journal index inode */
-	uint64_t sd_jiinode_vn;         /* Journal index version # (detects
-	                                   if new journals have been added) */
-
-	unsigned int sd_journals;	/* Number of journals in the FS */
-	struct gfs_jindex *sd_jindex;	/* Array of journal descriptors */
-	struct semaphore sd_jindex_lock;
-	unsigned long sd_jindex_refresh_time; /* Poll for new journals (secs) */
-
-	struct gfs_jindex sd_jdesc;	 /* This machine's journal descriptor */
-	struct gfs_holder sd_journal_gh; /* This machine's jrnl glock holder */
-
-	uint64_t sd_sequence;	/* Assigned to xactions in order they commit */
-	uint64_t sd_log_head;	/* Block number of next journal write */
-	uint64_t sd_log_wrap;
-
-	spinlock_t sd_log_seg_lock;
-	unsigned int sd_log_seg_free;	/* # of free segments in the log */
-	unsigned int sd_log_seg_ail2; /* # of freeable segments in the log */
-	osi_list_t sd_log_seg_list;
-	wait_queue_head_t sd_log_seg_wait;
-
-	/* "Active Items List" of transactions that have been flushed to
-	   on-disk log, and are waiting for flush to in-place on-disk blocks */
-	osi_list_t sd_log_ail;	/* "next" is head, "prev" is tail */
-
-	/* Transactions committed incore, but not yet flushed to on-disk log */
-	osi_list_t sd_log_incore;	/* "Next" is newest, "prev" is oldest */
-	unsigned int sd_log_buffers;	/* # of buffers in the incore log */
-
-	struct rw_semaphore sd_log_lock;	/* Lock for access to log values */
-
-	uint64_t sd_log_dump_last;
-	uint64_t sd_log_dump_last_wrap;
-
-	/*
-	 * Unlinked inode crap.
-	 * List includes newly created, not-yet-linked inodes,
-	 *   as well as inodes that have been unlinked and are waiting
-         *   to be de-allocated.
-	 */
-	osi_list_t sd_unlinked_list; /* List of unlinked inodes */
-	spinlock_t sd_unlinked_lock;       /* Protects list and members */
-
-	atomic_t sd_unlinked_ic_count;
-	atomic_t sd_unlinked_od_count;
-
-	/* Quota crap */
-
-	osi_list_t sd_quota_list; /* List of all gfs_quota_data structs */
-	spinlock_t sd_quota_lock;
-
-	atomic_t sd_quota_count;        /* # quotas on sd_quota_list */
-	atomic_t sd_quota_od_count;     /* # quotas waiting for sync to
-	                                   special on-disk quota file */
-
-	struct gfs_inode *sd_qinode;    /* Special on-disk quota file */
-
-	uint64_t sd_quota_sync_gen;     /* Generation, incr when sync to file */
-	unsigned long sd_quota_sync_time; /* Jiffies, last sync to quota file */
-
-	/* License crap */
-
-	struct gfs_inode *sd_linode;    /* Special on-disk license file */
-
-	/* Recovery stuff */
-
-	/* Lock module tells GFS, via callback, when a journal needs recovery.
-	   It stays on this list until recovery daemon performs recovery. */
-	osi_list_t sd_dirty_j;    /* List of dirty journals */
-	spinlock_t sd_dirty_j_lock;     /* Protects list */
-
-	/* Statistics for 3 possible recovery actions for each buffer in log,
-	     determined by comparing generation #s of logged block and
-	     in-place block.  Scope of stats is for one journal. */
-	unsigned int sd_recovery_replays; /* newer than in-place; copy it */
-	unsigned int sd_recovery_skips;   /* older than in-place; ignore it */
-	unsigned int sd_recovery_sames;   /* same as in-place; ignore it */
-
-	/* Counters */
-
-	/* current quantities of various things */
-	atomic_t sd_glock_count;      /* # of gfs_glock structs alloc'd */
-	atomic_t sd_glock_held_count; /* # of glocks locked by this node */
-	atomic_t sd_inode_count;      /* # of gfs_inode structs alloc'd */
-	atomic_t sd_bufdata_count;    /* # of gfs_bufdata structs alloc'd */
-
-	atomic_t sd_fh2dentry_misses; /* total # get_dentry misses */
-	atomic_t sd_reclaimed;        /* total # glocks reclaimed since mount */
-
-	/* total lock-related calls handled since mount */
-	atomic_t sd_glock_nq_calls;
-	atomic_t sd_glock_dq_calls;
-	atomic_t sd_glock_prefetch_calls;
-	atomic_t sd_lm_lock_calls;
-	atomic_t sd_lm_unlock_calls;
-	atomic_t sd_lm_callbacks;
-
-	atomic_t sd_lm_outstanding;
-	atomic_t sd_bio_reads;
-	atomic_t sd_bio_writes;
-	atomic_t sd_bio_outstanding;
-
-	/* total calls from Linux VFS handled since mount */
-	atomic_t sd_ops_address;
-	atomic_t sd_ops_dentry;
-	atomic_t sd_ops_export;
-	atomic_t sd_ops_file;
-	atomic_t sd_ops_inode;
-	atomic_t sd_ops_super;
-	atomic_t sd_ops_vm;
-
-	char sd_fsname[256];
-
-	/* Debugging crud */
-
-	unsigned long sd_last_warning;
-
-	spinlock_t sd_ail_lock;
-	osi_list_t sd_recovery_bufs;
-
-	osi_list_t sd_list;
-#ifndef __KERNEL__ /* if called from userland */
-	uint64_t last_fs_block;
-	uint64_t last_data_block;
-	uint64_t first_data_block;
-    /* contains list of data and metadata blocks and various info about each */
-	struct block_list *bl;
-	struct gfs_inode *lf_dip;       /* lost-n-found dir inode */
-	/* dir_list is used to keep track of directory inodes and
-	 * their parents */
-	osi_list_t dir_hash[FSCK_HASH_SIZE];
-	
-	/* inode_list is used to keep track of the link count of
-	 * inodes */
-	osi_list_t inode_hash[FSCK_HASH_SIZE];
-	osi_list_t dup_list;
-#endif
-};
-
-#endif /* __INCORE_DOT_H__ */
diff --git a/gfs/libgfs/inode.c b/gfs/libgfs/inode.c
deleted file mode 100644
index b288ef6..0000000
--- a/gfs/libgfs/inode.c
+++ /dev/null
@@ -1,322 +0,0 @@
-#include <stdint.h>
-#include "gfs_ondisk.h"
-#include "incore.h"
-#include "osi_user.h"
-#include "libgfs.h"
-
-/* FIXME: Not crazy about this name vs. load_inode, but I'm not very
- * creative ATM */
-/* replaces fs_copyin_dinode */
-int copyin_inode(struct gfs_sbd *sbp, osi_buf_t *bh, struct gfs_inode **inode)
-{
-	struct gfs_inode *ip;
-
-	if(!(ip = (struct gfs_inode *)malloc(sizeof(struct gfs_inode)))) {
-		log_err("Unable to allocate memory for inode\n");
-		return -1;
-	}
-	if(!memset(ip, 0, sizeof(struct gfs_inode))) {
-		log_err("Unable to zero inode memory\n");
-		return -1;
-	}
-	ip->i_sbd = sbp;
-
-	ip->i_num.no_addr = ip->i_num.no_formal_ino = BH_BLKNO(bh);
-	memset(&ip->i_di, 0, sizeof(struct gfs_dinode));
-
-	gfs_dinode_in(&ip->i_di, BH_DATA(bh));
-
-	*inode = ip;
-
-	return 0;
-}
-
-int load_inode(int disk_fd, struct gfs_sbd *sbp, uint64_t block,
-			   struct gfs_inode **inode)
-{
-	osi_buf_t *bh;
-
-	if(get_and_read_buf(disk_fd, sbp->sd_sb.sb_bsize, block, &bh, 0)){
-		log_err("Unable to retrieve block %"PRIu64"\n",
-			block);
-		return -1;
-	}
-
-	if(copyin_inode(sbp, bh, inode)) {
-		relse_buf(bh);
-		return -1;
-	}
-
-	relse_buf(bh);
-	return 0;
-}
-
-
-void free_inode(struct gfs_inode **inode)
-{
-	free(*inode);
-	inode = NULL;
-}
-
-
-int check_inode(struct gfs_inode *ip)
-{
-	int error = 0;
-	if(ip->i_di.di_header.mh_type != GFS_METATYPE_DI) {
-		return -1;
-	}
-
-	if(ip->i_num.no_formal_ino != ip->i_di.di_num.no_formal_ino){
-		log_err(
-			"In-core and on-disk formal inode"
-			"numbers do not match. %"PRIu64" %"PRIu64"\n",
-			ip->i_num.no_formal_ino,
-			ip->i_di.di_num.no_formal_ino);
-		error = -1;
-	}
-
-	/*  Handle a moved inode  */
-
-	if (ip->i_num.no_addr != ip->i_di.di_num.no_addr){
-		log_err("\tBlock # used to read disk inode: %"PRIu64"\n"
-			"\tBlock # recorded in disk inode : %"PRIu64"\n",
-			ip->i_num.no_addr, ip->i_di.di_num.no_addr);
-		error = -1;
-	}
-
-	return error;
-
-}
-
-
-
-/*int remove_inode(struct gfs_sbd *sbp, uint64_t block)
-{
-	struct gfs_inode *ip;
-	load_inode(sbp, block, &ip);
-	check_metatree(ip, &fxns);
-	free_inode(&ip);
-	return 0;
-}*/
-
-/**
- * fs_get_istruct - Get an inode given its number
- * @sdp: The GFS superblock
- * @inum: The inode number
- * @create: Flag to say if we are allowed to create a new struct gfs_inode
- * @ipp: pointer to put the returned inode in
- *
- * Returns: 0 on success, -1 on error
- */
-static int fs_get_istruct(int disk_fd, struct gfs_sbd *sdp,
-						  struct gfs_inum *inum,
-						  int create, struct gfs_inode **ipp)
-{
-	struct gfs_inode *ip = NULL;
-	int error = 0;
-
-	if (!create){
-		/* we are not currently tracking which inodes we already have */
-		error = -1;
-		goto out;
-	}
-
-	ip = (struct gfs_inode *)malloc(sizeof(struct gfs_inode));
-	// FIXME: handle failed malloc
-	ip->i_num = *inum;
-
-	ip->i_sbd = sdp;
-
-	error = fs_copyin_dinode(disk_fd, sdp->sd_sb.sb_bsize, ip, NULL);
-	if (error){
-		free(ip);
-		ip = NULL;
-		goto out;
-	}
-
- out:
-	*ipp = ip;
-
-	return error;
-}
-
-
-
-/**
- * make_dinode - Fill in a new dinode structure
- * @dip: the directory this inode is being created in
- * @inum: the inode number
- * @type: the file type
- * @mode: the file permissions
- * @cred: a credentials structure
- *
- */
-
-int make_dinode(int disk_fd, struct gfs_inode *dip,
-					   struct gfs_sbd *sdp, struct gfs_inum *inum,
-                       unsigned int type, unsigned int mode, osi_cred_t *cred)
-{
-	struct gfs_dinode di;
-	osi_buf_t *dibh;
-	struct gfs_rgrpd *rgd;
-	int error;
-
-	error = get_and_read_buf(disk_fd, sdp->sd_sb.sb_bsize, inum->no_addr,
-							 &dibh, 0);
-	if (error)
-		goto out;
-
-	if(check_meta(dibh, 0)){
-		struct gfs_meta_header mh;
-	        log_debug("Buffer #%"PRIu64" has no meta header.\n",
-			  BH_BLKNO(dibh));
-		memset(&mh, 0, sizeof(struct gfs_meta_header));
-		mh.mh_magic = GFS_MAGIC;
-		mh.mh_type = GFS_METATYPE_NONE;
-		gfs_meta_header_out(&mh, BH_DATA(dibh));
-		log_debug("meta header added.\n");
-	}
-
-	((struct gfs_meta_header *)BH_DATA(dibh))->mh_type =
-		cpu_to_gfs32(GFS_METATYPE_DI);
-	((struct gfs_meta_header *)BH_DATA(dibh))->mh_format =
-		cpu_to_gfs32(GFS_FORMAT_DI);
-
-	memset(BH_DATA(dibh) + sizeof(struct gfs_dinode), 0,
-	       BH_SIZE(dibh) - sizeof(struct gfs_dinode));
-
-	memset(&di, 0, sizeof(struct gfs_dinode));
-
-	gfs_meta_header_in(&di.di_header, BH_DATA(dibh));
-
-	di.di_num = *inum;
-
-	if (dip && (dip->i_di.di_mode & 02000))
-	{
-		di.di_mode = mode | ((type == GFS_FILE_DIR) ? 02000 : 0);
-		di.di_gid = dip->i_di.di_gid;
-	}
-	else
-	{
-		di.di_mode = mode;
-		di.di_gid = osi_cred_to_gid(cred);
-	}
-
-	di.di_uid = osi_cred_to_uid(cred);
-	di.di_nlink = 1;
-	di.di_blocks = 1;
-	di.di_atime = di.di_mtime = di.di_ctime = osi_current_time();
-
-	rgd = fs_blk2rgrpd(sdp, inum->no_addr);
-	if(!rgd){
-		log_crit("Unable to map block #%"PRIu64" to rgrp\n", inum->no_addr);
-		exit(1);
-	}
-
-	di.di_rgrp = rgd->rd_ri.ri_addr;
-	di.di_goal_rgrp = di.di_rgrp;
-	di.di_goal_dblk = di.di_goal_mblk = inum->no_addr - rgd->rd_ri.ri_data1;
-
-	di.di_type = type;
-
-	gfs_dinode_out(&di, BH_DATA(dibh));
-	if (write_buf(disk_fd, dibh, 0)){
-		log_err("make_dinode:  bad write_buf()\n");
-		error = -EIO;
-	}
-
-	relse_buf(dibh);
-
-
- out:
-
-	return error;
-}
-
-int create_inode(int disk_fd, struct gfs_sbd *sbp, unsigned int type,
-				 struct gfs_inode **ip)
-{
-	uint64_t block;
-	struct gfs_rgrpd *rgd;
-	osi_list_t *tmp;
-	struct gfs_inum inum;
-	int allocate=0;
-	unsigned int mode = 0755;
-	osi_cred_t cred;
-	cred.cr_uid = getuid();
-	cred.cr_gid = getgid();
- retry:
-	inum.no_addr = inum.no_formal_ino = 0;
-	/* Search for a resource group that has free space */
-	osi_list_foreach(tmp, (osi_list_t *)&sbp->sd_rglist) {
-		/* Create a new inode in that rgd */
-		rgd = osi_list_entry(tmp, struct gfs_rgrpd, rd_list);
-		if(fs_rgrp_read(disk_fd, rgd, FALSE)) {
-			return -1;
-		}
-		if(rgd->rd_rg.rg_freemeta){
-			block = fs_blkalloc_internal(rgd, 0,
-						     GFS_BLKST_FREEMETA, GFS_BLKST_USEDMETA, 1);
-			log_debug("Got block %"PRIu64"\n", block);
-			if(block == BFITNOENT) {
-				fs_rgrp_relse(rgd);
-				continue;
-			}
-			block += rgd->rd_ri.ri_data1;
-
-			inum.no_addr = inum.no_formal_ino = block;
-			/* FIXME: type isn't right */
-			block_set(sbp->bl, block, type);
-			/* write out the rgrp */
-			gfs_rgrp_out(&rgd->rd_rg, BH_DATA(rgd->rd_bh[0]));
-			write_buf(disk_fd, rgd->rd_bh[0], 0);
-			fs_rgrp_relse(rgd);
-			break;
-		}
-		else {
-			if(allocate && !clump_alloc(disk_fd, rgd, 0)){
-				block = fs_blkalloc_internal(rgd, 0,
-							     GFS_BLKST_FREEMETA,
-							     GFS_BLKST_USEDMETA, 1);
-				log_debug("Got block %"PRIu64"\n", block);
-
-				if(block == BFITNOENT) {
-					fs_rgrp_relse(rgd);
-					continue;
-				}
-				block += rgd->rd_ri.ri_data1;
-
-				inum.no_addr = inum.no_formal_ino = block;
-
-				/* FIXME: type isn't right */
-				block_set(sbp->bl, block, type);
-
-				/* write out the rgrp */
-				gfs_rgrp_out(&rgd->rd_rg, BH_DATA(rgd->rd_bh[0]));
-				write_buf(disk_fd, rgd->rd_bh[0], 0);
-				fs_rgrp_relse(rgd);
-				break;
-			}
-			fs_rgrp_relse(rgd);
-		}
-	}
-
-	if(!inum.no_addr){
-		if(allocate){
-			log_err("No space available for new file or directory.\n");
-			return -1;
-		} else {
-			allocate = 1;
-			goto retry;
-		}
-	}
-
-	/* We need to setup the inode without attaching it to a directory */
-	if (make_dinode(disk_fd, NULL, sbp, &inum, type, mode, &cred)) {
-		return -1;
-	}
-	if (fs_get_istruct(disk_fd, sbp, &inum, 1, ip)) {
-		return -1;
-	}
-	return 0;
-}
diff --git a/gfs/libgfs/libgfs.h b/gfs/libgfs/libgfs.h
deleted file mode 100644
index 803c3c0..0000000
--- a/gfs/libgfs/libgfs.h
+++ /dev/null
@@ -1,395 +0,0 @@
-/* These make the library more palatable to userland */
-
-#ifndef LIBGFS_H
-#define LIBGFS_H
-
-#include <stdint.h>
-#include "osi_user.h"
-#include "incore.h"
-
-struct qstr {
-        unsigned int hash;
-        unsigned int len;
-        const unsigned char *name;
-};
-#define up(x) ;
-#define up_write(x) ;
-#define down(x) ;
-#define down_write(x) ;
-#define printk printf
-
-/* ------------------------------------------------------------------------- */
-/* formerly bitmap.h:                                                        */
-/* ------------------------------------------------------------------------- */
-struct bmap {
-	uint64_t size;
-	uint64_t mapsize;
-	int chunksize;
-	int chunks_per_byte;
-	char *map;
-};
-
-int bitmap_create(struct bmap *bmap, uint64_t size, uint8_t bitsize);
-int bitmap_set(struct bmap *bmap, uint64_t offset, uint8_t val);
-int bitmap_get(struct bmap *bmap, uint64_t bit, uint8_t *val);
-int bitmap_clear(struct bmap *bmap, uint64_t offset);
-void bitmap_destroy(struct bmap *bmap);
-uint64_t bitmap_size(struct bmap *bmap);
-
-/* ------------------------------------------------------------------------- */
-/* formerly block_list.h:                                                    */
-/* ------------------------------------------------------------------------- */
-#define BMAP_COUNT 13
-
-enum block_list_type {
-	gbmap = 0,  /* Grouped bitmap */
-	dbmap,	    /* Ondisk bitmap - like grouped bitmap, but mmaps
-		     * the bitmaps onto file(s) ondisk - not implemented */
-};
-
-/* Must be kept in sync with mark_to_bitmap array in block_list.c */
-enum mark_block {
-	block_free = 0,
-	block_used,
-	indir_blk,
-	inode_dir,
-	inode_file,
-	inode_lnk,
-	inode_blk,
-	inode_chr,
-	inode_fifo,
-	inode_sock,
-	leaf_blk,
-	journal_blk,
-	meta_other,
-	meta_free,
-	meta_eattr,
-	meta_inval = 15,
-	bad_block,	/* Contains at least one bad block */
-	dup_block,	/* Contains at least one duplicate block */
-	eattr_block,	/* Contains an eattr */
-};
-
-struct block_query {
-	uint8_t block_type;
-	uint8_t bad_block;
-	uint8_t dup_block;
-	uint8_t eattr_block;
-};
-
-struct gbmap {
-	struct bmap group_map;
-	struct bmap bad_map;
-	struct bmap dup_map;
-	struct bmap eattr_map;
-};
-
-struct dbmap {
-	struct bmap group_map;
-	char *group_file;
-	struct bmap bad_map;
-	char *bad_file;
-	struct bmap dup_map;
-	char *dup_file;
-	struct bmap eattr_map;
-	char *eattr_file;
-};
-
-union block_lists {
-	struct gbmap gbmap;
-	struct dbmap dbmap;
-};
-
-
-/* bitmap implementation */
-struct block_list {
-	enum block_list_type type;
-	/* Union of bitmap, rle */
-	union block_lists list;
-};
-
-
-struct block_list *block_list_create(uint64_t size, enum block_list_type type);
-int block_mark(struct block_list *il, uint64_t block, enum mark_block mark);
-int block_set(struct block_list *il, uint64_t block, enum mark_block mark);
-int block_clear(struct block_list *il, uint64_t block, enum mark_block m);
-int block_check(struct block_list *il, uint64_t block,
-		struct block_query *val);
-int block_check_for_mark(struct block_list *il, uint64_t block,
-			 enum mark_block mark);
-void *block_list_destroy(struct block_list *il);
-int find_next_block_type(struct block_list *il, enum mark_block m, uint64_t *b);
-
-/* ------------------------------------------------------------------------- */
-/* formerly log.h:                                                           */
-/* ------------------------------------------------------------------------- */
-#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
-
-struct options;
-
-#define print_log(iif, priority, format...)	\
-do { \
-	print_log_level(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_log_level(int iif, int priority, char *file, int line, const char *format, ...);
-int query(struct options *opts, const char *format, ...);
-
-/* ------------------------------------------------------------------------- */
-/* formerly bio.h:                                                           */
-/* ------------------------------------------------------------------------- */
-/* buf_write flags */
-#define BW_WAIT 1
-
-
-#define BH_DATA(bh) ((char *)(bh)->b_data)
-#define BH_BLKNO(bh) ((uint64)(bh)->b_blocknr)
-#define BH_SIZE(bh) ((uint32)(bh)->b_size)
-#define BH_STATE(bh) ((uint32)(bh)->b_state)
-
-int get_buf(uint32_t sb_bsize, uint64 blkno, osi_buf_t **bhp);
-void relse_buf(osi_buf_t *bh);
-int read_buf(int disk_fd, osi_buf_t *bh, int flags);
-int write_buf(int disk_fd, osi_buf_t *bh, int flags);
-int get_and_read_buf(int disk_fd, uint32_t sb_bsize, uint64 blkno,
-					 osi_buf_t **bhp, int flags);
-
-/* ------------------------------------------------------------------------- */
-/* formerly fs_bits.h:                                                       */
-/* ------------------------------------------------------------------------- */
-#define BFITNOENT (0xFFFFFFFF)
-
-struct fs_bitmap
-{
-	uint32   bi_offset;	/* The offset in the buffer of the first byte */
-	uint32   bi_start;      /* The position of the first byte in this block */
-	uint32   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 fs_bitcount(unsigned char *buffer, unsigned int buflen,
-		     unsigned char state);
-uint32_t fs_bitfit(unsigned char *buffer, unsigned int buflen,
-		   uint32_t goal, unsigned char old_state);
-
-/* functions with blk #'s that are rgrp relative */
-uint32_t fs_blkalloc_internal(struct gfs_rgrpd *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 fs_get_bitmap(int disk_fd, struct gfs_sbd *sdp, uint64_t blkno, struct gfs_rgrpd *rgd);
-int fs_set_bitmap(int disk_fd, struct gfs_sbd *sdp, uint64_t blkno, int state);
-
-/* ------------------------------------------------------------------------- */
-/* formerly fs_bmap.h                                                        */
-/* ------------------------------------------------------------------------- */
-int fs_unstuff_dinode(int disk_fd, struct gfs_inode *ip);
-int fs_block_map(int disk_fd, struct gfs_inode *ip, uint64 lblock, int *new,
-		 uint64 *dblock, uint32 *extlen);
-
-/* ------------------------------------------------------------------------- */
-/* formerly iddev.h                                                          */
-/* ------------------------------------------------------------------------- */
-int device_size(int fd, uint64_t *bytes);
-
-/* ------------------------------------------------------------------------- */
-/* formerly util.h:                                                          */
-/* ------------------------------------------------------------------------- */
-#define do_lseek(fd, off) \
-  ((lseek((fd), (off), SEEK_SET) == (off)) ? 0 : -1)
-
-#define do_read(fd, buff, len) \
-  ((read((fd), (buff), (len)) == (len)) ? 0 : -1)
-
-#define do_write(fd, buff, len) \
-  ((write((fd), (buff), (len)) == (len)) ? 0 : -1)
-
-int compute_height(struct gfs_sbd *sdp, uint64 sz);
-int check_range(struct gfs_sbd *sdp, uint64 blkno);
-int set_meta(osi_buf_t *bh, int type, int format);
-int check_type(osi_buf_t *bh, int type);
-int check_meta(osi_buf_t *bh, int type);
-int next_rg_meta(struct gfs_rgrpd *rgd, uint64 *block, int first);
-int next_rg_meta_free(struct gfs_rgrpd *rgd, uint64 *block, int first, int *free);
-int next_rg_metatype(int disk_fd, struct gfs_rgrpd *rgd, uint64 *block, uint32 type, int first);
-struct di_info *search_list(osi_list_t *list, uint64 addr);
-
-/* ------------------------------------------------------------------------- */
-/* formerly rgrp.h:                                                          */
-/* ------------------------------------------------------------------------- */
-struct gfs_sbd;
-struct gfs_rgrpd;
-struct gfs_inode;
-
-int fs_compute_bitstructs(struct gfs_rgrpd *rgd);
-struct gfs_rgrpd *fs_blk2rgrpd(struct gfs_sbd *sdp, uint64_t blk);
-
-int fs_rgrp_read(int disk_fd, struct gfs_rgrpd *rgd, int repair_if_corrupted);
-void fs_rgrp_relse(struct gfs_rgrpd *rgd);
-int fs_rgrp_verify(struct gfs_rgrpd *rgd);
-int fs_rgrp_recount(int disk_fd, struct gfs_rgrpd *rgd);
-
-int clump_alloc(int disk_fd, struct gfs_rgrpd *rgd, uint32_t goal);
-int fs_blkalloc(int disk_fd, struct gfs_inode *ip, uint64_t *block);
-int fs_metaalloc(int disk_fd, struct gfs_inode *ip, uint64_t *block);
-
-/* ------------------------------------------------------------------------- */
-/* formerly file.h:                                                          */
-/* ------------------------------------------------------------------------- */
-int readi(int disk_fd, struct gfs_inode *ip, void *buf, uint64_t offset,
-		  unsigned int size);
-int writei(int disk_fd, struct gfs_inode *ip, void *buf, uint64_t offset,
-		   unsigned int size);
-
-/* ------------------------------------------------------------------------- */
-/* formerly inode.h:                                                         */
-/* ------------------------------------------------------------------------- */
-int copyin_inode(struct gfs_sbd *sbp, osi_buf_t *bh, struct gfs_inode **ip);
-int load_inode(int disk_fd, struct gfs_sbd *sbp, uint64_t block,
-			   struct gfs_inode **ip);
-void free_inode(struct gfs_inode **inode);
-int check_inode(struct gfs_inode *ip);
-int create_inode(int disk_fd, struct gfs_sbd *sbp, unsigned int type,
-				 struct gfs_inode **ip);
-int make_dinode(int disk_fd, struct gfs_inode *dip,
-					   struct gfs_sbd *sdp, struct gfs_inum *inum,
-				unsigned int type, unsigned int mode, osi_cred_t *cred);
-
-/* ------------------------------------------------------------------------- */
-/* formerly fs_inode.h:                                                      */
-/* ------------------------------------------------------------------------- */
-int fs_copyin_dinode(int disk_fd, uint32_t sb_bsize, struct gfs_inode *ip, osi_buf_t *bh);
-int fs_copyout_dinode(int disk_fd, uint32_t sb_bsize, struct gfs_inode *ip);
-int fs_mkdir(int disk_fd, struct gfs_inode *dip, char *new_dir, int mode, struct gfs_inode **nip);
-
-static __inline__ int fs_is_stuffed(struct gfs_inode *ip)
-{
-	return !ip->i_di.di_height;
-}
-
-static __inline__ int fs_is_jdata(struct gfs_inode *ip)
-{
-	return ip->i_di.di_flags & GFS_DIF_JDATA;
-}
-
-/* ------------------------------------------------------------------------- */
-/* formerly fs_dir.h:                                                        */
-/* ------------------------------------------------------------------------- */
-#define ID_FILENAME 0
-#define ID_INUM     1
-typedef struct identifier_s {
-	int type;
-
-	osi_filename_t *filename;
-	struct gfs_inum *inum;
-} identifier_t;
-
-int dirent_del(int disk_fd, struct gfs_inode *dip, osi_buf_t *bh,
-	       struct gfs_dirent *prev, struct gfs_dirent *cur);
-int gfs_inode_is_stuffed(struct gfs_inode *ip);
-int dirent_first(osi_buf_t *bh, struct gfs_dirent **dent);
-int dirent_next(osi_buf_t *bh, struct gfs_dirent **dent);
-int get_leaf_nr(int file_fd, struct gfs_inode *dip, uint32 index,
-				uint64 *leaf_out);
-int fs_filecmp(osi_filename_t *file1, char *file2, int len_of_file2);
-int fs_dirent_del(int disk_fd, struct gfs_inode *dip, osi_buf_t *bh, osi_filename_t *filename);
-int fs_dir_add(int disk_fd, struct gfs_inode *dip, osi_filename_t *filename,
-	       struct gfs_inum *inum, unsigned int type);
-int fs_dirent_alloc(int disk_fd, struct gfs_inode *dip, osi_buf_t *bh,
-		    int name_len, struct gfs_dirent **dent_out);
-
-int fs_dir_search(int disk_fd, struct gfs_inode *dip, identifier_t *id, unsigned int *type);
-int get_first_leaf(int disk_fd, struct gfs_inode *dip, uint32 index,
-				   osi_buf_t **bh_out);
-int get_next_leaf(int disk_fd, struct gfs_inode *dip,osi_buf_t *bh_in,osi_buf_t **bh_out);
-int get_leaf(int disk_fd, struct gfs_inode *dip, uint64 leaf_no,
-			 osi_buf_t **bhp);
-
-/* ------------------------------------------------------------------------- */
-/* formerly super.h:                                                         */
-/* ------------------------------------------------------------------------- */
-int read_sb(int disk_fd, struct gfs_sbd *sdp);
-int ji_update(int disk_fd, struct gfs_sbd *sdp);
-int ri_update(int disk_fd, struct gfs_sbd *sdp);
-int write_sb(int disk_fd, struct gfs_sbd *sdp);
-int set_block_ranges(int disk_fd, struct gfs_sbd *sdp);
-int read_super_block(int disk_fd, struct gfs_sbd *sdp);
-int compute_constants(struct gfs_sbd *sdp);
-
-/* ------------------------------------------------------------------------- */
-/* formerly rgrp.h:                                                          */
-/* ------------------------------------------------------------------------- */
-
-#endif
diff --git a/gfs/libgfs/log.c b/gfs/libgfs/log.c
deleted file mode 100644
index 52e0942..0000000
--- a/gfs/libgfs/log.c
+++ /dev/null
@@ -1,136 +0,0 @@
-#include <stdio.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <libintl.h>
-
-#include <sys/select.h>
-#include <unistd.h>
-
-#include "incore.h"
-#include "libgfs.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);
-		break;
-	case MSG_INFO:
-	case MSG_NOTICE:
-	case MSG_WARN:
-		vprintf(format, args);
-		break;
-	case MSG_ERROR:
-	case MSG_CRITICAL:
-	default:
-		vfprintf(stderr, format, args);
-		break;
-	}
-	return;
-}
-
-void print_log_level(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);
-}
-
-int query(struct options *opts, const char *format, ...)
-{
-
-	va_list args;
-	const char *transform;
-	char response;
-	fd_set rfds;
-	struct timeval tv;
-	int err = 0;
-	int ret = 0;
-
-	va_start(args, format);
-
-	transform = _(format);
-
-	if(opts->yes)
-		return 1;
-	if(opts->no)
-		return 0;
-
-	/* Watch stdin (fd 0) to see when it has input. */
-	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;
-		}
-		err = read(STDIN_FILENO, &response, sizeof(char));
-
-	}
- query:
-	vprintf(transform, args);
-
-	/* Make sure query is printed out */
-	fflush(NULL);
-
- rescan:
-	err = read(STDIN_FILENO, &response, sizeof(char));
-
-	if(tolower(response) == 'y') {
-		ret = 1;
-	} else if (tolower(response) == 'n') {
-		ret = 0;
-	} else if ((response == ' ') || (response == '\t')) {
-		goto rescan;
-	} else {
-		while(response != '\n')
-			err = read(STDIN_FILENO, &response, sizeof(char));
-		printf("Bad response, please type 'y' or 'n'.\n");
-		goto query;
-	}
-
-	/* Clip the input */
-	while((err = select(STDIN_FILENO + 1, &rfds, NULL, NULL, &tv))) {
-		if(err < 0) {
-			log_debug("Error in select() on stdin\n");
-			break;
-		}
-		err = read(STDIN_FILENO, &response, sizeof(char));
-	}
-
-	return ret;
-}
diff --git a/gfs/libgfs/ondisk.c b/gfs/libgfs/ondisk.c
deleted file mode 100644
index 1bbd5ef..0000000
--- a/gfs/libgfs/ondisk.c
+++ /dev/null
@@ -1,1282 +0,0 @@
-#ifndef HELPER_PROGRAM
-
-#include "libgfs.h"
-
-#define pv(struct, member, fmt) printk("  "#member" = "fmt"\n", struct->member);
-
-#else
-
-#include <stdio.h>
-#include <string.h>
-
-#include "global.h"
-#include "linux_endian.h"
-#include "gfs_ondisk.h" /* pull in kernel structures / routines */
-
-#define printk printf
-#define pv(struct, member, fmt) printf("  "#member" = "fmt"\n", struct->member);
-
-#endif				/*  !HELPER_PROGRAM  */
-
-#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) = gfs16_to_cpu((s2->member));}
-#define CPOUT_16(s1, s2, member) {(s2->member) = cpu_to_gfs16((s1->member));}
-#define CPIN_32(s1, s2, member) {(s1->member) = gfs32_to_cpu((s2->member));}
-#define CPOUT_32(s1, s2, member) {(s2->member) = cpu_to_gfs32((s1->member));}
-#define CPIN_64(s1, s2, member) {(s1->member) = gfs64_to_cpu((s2->member));}
-#define CPOUT_64(s1, s2, member) {(s2->member) = cpu_to_gfs64((s1->member));}
-
-#define pa(struct, member, count) print_array(#member, struct->member, count);
-
-/**
- * print_array - Print out an array of bytes
- * @title: what to print before the array
- * @buf: the array
- * @count: the number of bytes
- */
-
-static void
-print_array(char *title, char *buf, int count)
-{
-	int x;
-
-	printk("  %s =\n", title);
-	for (x = 0; x < count; x++) {
-		printk("%.2X ", (unsigned char) buf[x]);
-		if (x % 16 == 15)
-			printk("\n");
-	}
-	if (x % 16)
-		printk("\n");
-
-}
-
-/**
- * gfs_inum_in - Read in an inode number
- * @no: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_inum_in(struct gfs_inum *no, char *buf)
-{
-	struct gfs_inum *str = (struct gfs_inum *) buf;
-
-	CPIN_64(no, str, no_formal_ino);
-	CPIN_64(no, str, no_addr);
-
-}
-
-/**
- * gfs_inum_out - Write out an inode number
- * @no: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_inum_out(struct gfs_inum *no, char *buf)
-{
-	struct gfs_inum *str = (struct gfs_inum *) buf;
-
-	CPOUT_64(no, str, no_formal_ino);
-	CPOUT_64(no, str, no_addr);
-
-}
-
-/**
- * gfs_inum_print - Print out a inode number
- * @no: the cpu-order buffer
- *
- */
-
-void
-gfs_inum_print(struct gfs_inum *no)
-{
-
-	pv(no, no_formal_ino, "%" PRIu64);
-	pv(no, no_addr, "%" PRIu64);
-
-}
-
-/**
- * gfs_meta_header_in - Read in a metadata header
- * @mh: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_meta_header_in(struct gfs_meta_header *mh, char *buf)
-{
-	struct gfs_meta_header *str = (struct gfs_meta_header *) buf;
-
-	CPIN_32(mh, str, mh_magic);
-	CPIN_32(mh, str, mh_type);
-	CPIN_64(mh, str, mh_generation);
-	CPIN_32(mh, str, mh_format);
-	CPIN_32(mh, str, mh_incarn);
-
-}
-
-/**
- * gfs_meta_header_in - Write out a metadata header
- * @mh: the cpu-order structure
- * @buf: the disk-order buffer
- *
- * Don't ever change the generation number in this routine.
- * It's done manually in increment_generation().
- */
-
-void
-gfs_meta_header_out(struct gfs_meta_header *mh, char *buf)
-{
-	struct gfs_meta_header *str = (struct gfs_meta_header *) buf;
-
-	CPOUT_32(mh, str, mh_magic);
-	CPOUT_32(mh, str, mh_type);
-	/*CPOUT_64(mh, str, mh_generation); */
-	CPOUT_32(mh, str, mh_format);
-	CPOUT_32(mh, str, mh_incarn);
-
-}
-
-/**
- * gfs_meta_header_print - Print out a metadata header
- * @mh: the cpu-order buffer
- *
- */
-
-void
-gfs_meta_header_print(struct gfs_meta_header *mh)
-{
-
-	pv(mh, mh_magic, "0x%.8X");
-	pv(mh, mh_type, "%u");
-	pv(mh, mh_generation, "%" PRIu64);
-	pv(mh, mh_format, "%u");
-	pv(mh, mh_incarn, "%u");
-
-}
-
-/**
- * gfs_sb_in - Read in a superblock
- * @sb: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_sb_in(struct gfs_sb *sb, char *buf)
-{
-	struct gfs_sb *str = (struct gfs_sb *) buf;
-
-	gfs_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_flags);
-
-	CPIN_32(sb, str, sb_bsize);
-	CPIN_32(sb, str, sb_bsize_shift);
-	CPIN_32(sb, str, sb_seg_size);
-
-	gfs_inum_in(&sb->sb_jindex_di, (char *) &str->sb_jindex_di);
-	gfs_inum_in(&sb->sb_rindex_di, (char *) &str->sb_rindex_di);
-	gfs_inum_in(&sb->sb_root_di, (char *) &str->sb_root_di);
-
-	CPIN_08(sb, str, sb_lockproto, GFS_LOCKNAME_LEN);
-	CPIN_08(sb, str, sb_locktable, GFS_LOCKNAME_LEN);
-
-	gfs_inum_in(&sb->sb_quota_di, (char *) &str->sb_quota_di);
-	gfs_inum_in(&sb->sb_license_di, (char *) &str->sb_license_di);
-
-	CPIN_08(sb, str, sb_reserved, 96);
-
-}
-
-/**
- * gfs_sb_out - Write out a superblock
- * @sb: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_sb_out(struct gfs_sb *sb, char *buf)
-{
-	struct gfs_sb *str = (struct gfs_sb *) buf;
-
-	gfs_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_flags);
-
-	CPOUT_32(sb, str, sb_bsize);
-	CPOUT_32(sb, str, sb_bsize_shift);
-	CPOUT_32(sb, str, sb_seg_size);
-
-	gfs_inum_out(&sb->sb_jindex_di, (char *) &str->sb_jindex_di);
-	gfs_inum_out(&sb->sb_rindex_di, (char *) &str->sb_rindex_di);
-	gfs_inum_out(&sb->sb_root_di, (char *) &str->sb_root_di);
-
-	CPOUT_08(sb, str, sb_lockproto, GFS_LOCKNAME_LEN);
-	CPOUT_08(sb, str, sb_locktable, GFS_LOCKNAME_LEN);
-
-	gfs_inum_out(&sb->sb_quota_di, (char *) &str->sb_quota_di);
-	gfs_inum_out(&sb->sb_license_di, (char *) &str->sb_license_di);
-
-	CPOUT_08(sb, str, sb_reserved, 96);
-
-}
-
-/**
- * gfs_sb_print - Print out a superblock
- * @sb: the cpu-order buffer
- *
- */
-
-void
-gfs_sb_print(struct gfs_sb *sb)
-{
-	gfs_meta_header_print(&sb->sb_header);
-
-	pv(sb, sb_fs_format, "%u");
-	pv(sb, sb_multihost_format, "%u");
-	pv(sb, sb_flags, "%u");
-
-	pv(sb, sb_bsize, "%u");
-	pv(sb, sb_bsize_shift, "%u");
-	pv(sb, sb_seg_size, "%u");
-
-	gfs_inum_print(&sb->sb_jindex_di);
-	gfs_inum_print(&sb->sb_rindex_di);
-	gfs_inum_print(&sb->sb_root_di);
-
-	pv(sb, sb_lockproto, "%s");
-	pv(sb, sb_locktable, "%s");
-
-	gfs_inum_print(&sb->sb_quota_di);
-	gfs_inum_print(&sb->sb_license_di);
-
-	pa(sb, sb_reserved, 96);
-
-}
-
-/**
- * gfs_jindex_in - Read in a journal index structure
- * @jindex: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_jindex_in(struct gfs_jindex *jindex, char *buf)
-{
-	struct gfs_jindex *str = (struct gfs_jindex *) buf;
-
-	CPIN_64(jindex, str, ji_addr);
-	CPIN_32(jindex, str, ji_nsegment);
-	CPIN_32(jindex, str, ji_pad);
-
-	CPIN_08(jindex, str, ji_reserved, 64);
-
-}
-
-/**
- * gfs_jindex_out - Write out a journal index structure
- * @jindex: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_jindex_out(struct gfs_jindex *jindex, char *buf)
-{
-	struct gfs_jindex *str = (struct gfs_jindex *) buf;
-
-	CPOUT_64(jindex, str, ji_addr);
-	CPOUT_32(jindex, str, ji_nsegment);
-	CPOUT_32(jindex, str, ji_pad);
-
-	CPOUT_08(jindex, str, ji_reserved, 64);
-
-}
-
-/**
- * gfs_jindex_print - Print out a journal index structure
- * @ji: the cpu-order buffer
- *
- */
-
-void
-gfs_jindex_print(struct gfs_jindex *ji)
-{
-
-	pv(ji, ji_addr, "%" PRIu64);
-	pv(ji, ji_nsegment, "%u");
-	pv(ji, ji_pad, "%u");
-
-	pa(ji, ji_reserved, 64);
-
-}
-
-/**
- * gfs_rindex_in - Read in a resource index structure
- * @rindex: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_rindex_in(struct gfs_rindex *rindex, char *buf)
-{
-	struct gfs_rindex *str = (struct gfs_rindex *) buf;
-
-	CPIN_64(rindex, str, ri_addr);
-	CPIN_32(rindex, str, ri_length);
-	CPIN_32(rindex, str, ri_pad);
-
-	CPIN_64(rindex, str, ri_data1);
-	CPIN_32(rindex, str, ri_data);
-
-	CPIN_32(rindex, str, ri_bitbytes);
-
-	CPIN_08(rindex, str, ri_reserved, 64);
-
-}
-
-/**
- * gfs_rindex_out - Write out a resource index structure
- * @rindex: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_rindex_out(struct gfs_rindex *rindex, char *buf)
-{
-	struct gfs_rindex *str = (struct gfs_rindex *) buf;
-
-	CPOUT_64(rindex, str, ri_addr);
-	CPOUT_32(rindex, str, ri_length);
-	CPOUT_32(rindex, str, ri_pad);
-
-	CPOUT_64(rindex, str, ri_data1);
-	CPOUT_32(rindex, str, ri_data);
-
-	CPOUT_32(rindex, str, ri_bitbytes);
-
-	CPOUT_08(rindex, str, ri_reserved, 64);
-
-}
-
-/**
- * gfs_rindex_print - Print out a resource index structure
- * @ri: the cpu-order buffer
- *
- */
-
-void
-gfs_rindex_print(struct gfs_rindex *ri)
-{
-
-	pv(ri, ri_addr, "%" PRIu64);
-	pv(ri, ri_length, "%u");
-	pv(ri, ri_pad, "%u");
-
-	pv(ri, ri_data1, "%" PRIu64);
-	pv(ri, ri_data, "%u");
-
-	pv(ri, ri_bitbytes, "%u");
-
-	pa(ri, ri_reserved, 64);
-
-}
-
-/**
- * gfs_rgrp_in - Read in a resource group header
- * @rgrp: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_rgrp_in(struct gfs_rgrp *rgrp, char *buf)
-{
-	struct gfs_rgrp *str = (struct gfs_rgrp *) buf;
-
-	gfs_meta_header_in(&rgrp->rg_header, buf);
-
-	CPIN_32(rgrp, str, rg_flags);
-
-	CPIN_32(rgrp, str, rg_free);
-
-	CPIN_32(rgrp, str, rg_useddi);
-	CPIN_32(rgrp, str, rg_freedi);
-	gfs_inum_in(&rgrp->rg_freedi_list, (char *) &str->rg_freedi_list);
-
-	CPIN_32(rgrp, str, rg_usedmeta);
-	CPIN_32(rgrp, str, rg_freemeta);
-
-	CPIN_08(rgrp, str, rg_reserved, 64);
-
-}
-
-/**
- * gfs_rgrp_out - Write out a resource group header
- * @rgrp: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_rgrp_out(struct gfs_rgrp *rgrp, char *buf)
-{
-	struct gfs_rgrp *str = (struct gfs_rgrp *) buf;
-
-	gfs_meta_header_out(&rgrp->rg_header, buf);
-
-	CPOUT_32(rgrp, str, rg_flags);
-
-	CPOUT_32(rgrp, str, rg_free);
-
-	CPOUT_32(rgrp, str, rg_useddi);
-	CPOUT_32(rgrp, str, rg_freedi);
-	gfs_inum_out(&rgrp->rg_freedi_list, (char *) &str->rg_freedi_list);
-
-	CPOUT_32(rgrp, str, rg_usedmeta);
-	CPOUT_32(rgrp, str, rg_freemeta);
-
-	CPOUT_08(rgrp, str, rg_reserved, 64);
-
-}
-
-/**
- * gfs_rgrp_print - Print out a resource group header
- * @rg: the cpu-order buffer
- */
-
-void
-gfs_rgrp_print(struct gfs_rgrp *rg)
-{
-
-	gfs_meta_header_print(&rg->rg_header);
-
-	pv(rg, rg_flags, "%u");
-
-	pv(rg, rg_free, "%u");
-
-	pv(rg, rg_useddi, "%u");
-	pv(rg, rg_freedi, "%u");
-	gfs_inum_print(&rg->rg_freedi_list);
-
-	pv(rg, rg_usedmeta, "%u");
-	pv(rg, rg_freemeta, "%u");
-
-	pa(rg, rg_reserved, 64);
-
-}
-
-/**
- * gfs_quota_in - Read in a quota structures
- * @quota: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_quota_in(struct gfs_quota *quota, char *buf)
-{
-	struct gfs_quota *str = (struct gfs_quota *) buf;
-
-	CPIN_64(quota, str, qu_limit);
-	CPIN_64(quota, str, qu_warn);
-	CPIN_64(quota, str, qu_value);
-
-	CPIN_08(quota, str, qu_reserved, 64);
-
-}
-
-/**
- * gfs_quota_out - Write out a quota structure
- * @quota: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_quota_out(struct gfs_quota *quota, char *buf)
-{
-	struct gfs_quota *str = (struct gfs_quota *) buf;
-
-	CPOUT_64(quota, str, qu_limit);
-	CPOUT_64(quota, str, qu_warn);
-	CPOUT_64(quota, str, qu_value);
-
-	CPOUT_08(quota, str, qu_reserved, 64);
-
-}
-
-/**
- * gfs_quota_print - Print out a quota structure
- * @quota: the cpu-order buffer
- */
-
-void
-gfs_quota_print(struct gfs_quota *quota)
-{
-
-	pv(quota, qu_limit, "%" PRIu64);
-	pv(quota, qu_warn, "%" PRIu64);
-	pv(quota, qu_value, "%" PRId64);
-
-	pa(quota, qu_reserved, 64);
-
-}
-
-/**
- * gfs_dinode_in - Read in a dinode
- * @dinode: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_dinode_in(struct gfs_dinode *dinode, char *buf)
-{
-	struct gfs_dinode *str = (struct gfs_dinode *) buf;
-
-	gfs_meta_header_in(&dinode->di_header, buf);
-
-	gfs_inum_in(&dinode->di_num, (char *) &str->di_num);
-
-	CPIN_32(dinode, str, di_mode);
-	CPIN_32(dinode, str, di_uid);
-	CPIN_32(dinode, str, di_gid);
-	CPIN_32(dinode, str, di_nlink);
-	CPIN_64(dinode, str, di_size);
-	CPIN_64(dinode, str, di_blocks);
-	CPIN_64(dinode, str, di_atime);
-	CPIN_64(dinode, str, di_mtime);
-	CPIN_64(dinode, str, di_ctime);
-	CPIN_32(dinode, str, di_major);
-	CPIN_32(dinode, str, di_minor);
-
-	CPIN_64(dinode, str, di_rgrp);
-	CPIN_64(dinode, str, di_goal_rgrp);
-	CPIN_32(dinode, str, di_goal_dblk);
-	CPIN_32(dinode, str, di_goal_mblk);
-	CPIN_32(dinode, str, di_flags);
-	CPIN_32(dinode, str, di_payload_format);
-	CPIN_16(dinode, str, di_type);
-	CPIN_16(dinode, str, di_height);
-	CPIN_32(dinode, str, di_incarn);
-	CPIN_16(dinode, str, di_pad);
-
-	CPIN_16(dinode, str, di_depth);
-	CPIN_32(dinode, str, di_entries);
-
-	gfs_inum_in(&dinode->di_next_unused, (char *) &str->di_next_unused);
-
-	CPIN_64(dinode, str, di_eattr);
-
-	CPIN_08(dinode, str, di_reserved, 56);
-
-}
-
-/**
- * gfs_dinode_out - Write out a dinode
- * @dinode: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_dinode_out(struct gfs_dinode *dinode, char *buf)
-{
-	struct gfs_dinode *str = (struct gfs_dinode *) buf;
-
-	gfs_meta_header_out(&dinode->di_header, buf);
-
-	gfs_inum_out(&dinode->di_num, (char *) &str->di_num);
-
-	CPOUT_32(dinode, str, di_mode);
-	CPOUT_32(dinode, str, di_uid);
-	CPOUT_32(dinode, str, di_gid);
-	CPOUT_32(dinode, str, di_nlink);
-	CPOUT_64(dinode, str, di_size);
-	CPOUT_64(dinode, str, di_blocks);
-	CPOUT_64(dinode, str, di_atime);
-	CPOUT_64(dinode, str, di_mtime);
-	CPOUT_64(dinode, str, di_ctime);
-	CPOUT_32(dinode, str, di_major);
-	CPOUT_32(dinode, str, di_minor);
-
-	CPOUT_64(dinode, str, di_rgrp);
-	CPOUT_64(dinode, str, di_goal_rgrp);
-	CPOUT_32(dinode, str, di_goal_dblk);
-	CPOUT_32(dinode, str, di_goal_mblk);
-	CPOUT_32(dinode, str, di_flags);
-	CPOUT_32(dinode, str, di_payload_format);
-	CPOUT_16(dinode, str, di_type);
-	CPOUT_16(dinode, str, di_height);
-	CPOUT_32(dinode, str, di_incarn);
-	CPOUT_16(dinode, str, di_pad);
-
-	CPOUT_16(dinode, str, di_depth);
-	CPOUT_32(dinode, str, di_entries);
-
-	gfs_inum_out(&dinode->di_next_unused, (char *) &str->di_next_unused);
-
-	CPOUT_64(dinode, str, di_eattr);
-
-	CPOUT_08(dinode, str, di_reserved, 56);
-
-}
-
-/**
- * gfs_dinode_print - Print out a dinode
- * @di: the cpu-order buffer
- */
-
-void
-gfs_dinode_print(struct gfs_dinode *di)
-{
-
-	gfs_meta_header_print(&di->di_header);
-
-	gfs_inum_print(&di->di_num);
-
-	pv(di, di_mode, "0%o");
-	pv(di, di_uid, "%u");
-	pv(di, di_gid, "%u");
-	pv(di, di_nlink, "%u");
-	pv(di, di_size, "%" PRIu64);
-	pv(di, di_blocks, "%" PRIu64);
-	pv(di, di_atime, "%" PRId64);
-	pv(di, di_mtime, "%" PRId64);
-	pv(di, di_ctime, "%" PRId64);
-	pv(di, di_major, "%u");
-	pv(di, di_minor, "%u");
-
-	pv(di, di_rgrp, "%" PRIu64);
-	pv(di, di_goal_rgrp, "%" PRIu64);
-	pv(di, di_goal_dblk, "%u");
-	pv(di, di_goal_mblk, "%u");
-	pv(di, di_flags, "0x%.8X");
-	pv(di, di_payload_format, "%u");
-	pv(di, di_type, "%u");
-	pv(di, di_height, "%u");
-	pv(di, di_incarn, "%u");
-	pv(di, di_pad, "%u");
-
-	pv(di, di_depth, "%u");
-	pv(di, di_entries, "%u");
-
-	gfs_inum_print(&di->di_next_unused);
-
-	pv(di, di_eattr, "%" PRIu64);
-
-	pa(di, di_reserved, 56);
-
-}
-
-/**
- * gfs_indirect_in - copy in the header of an indirect block
- * @indirect: the in memory copy
- * @buf: the buffer copy
- *
- */
-
-void
-gfs_indirect_in(struct gfs_indirect *indirect, char *buf)
-{
-	struct gfs_indirect *str = (struct gfs_indirect *) buf;
-
-	gfs_meta_header_in(&indirect->in_header, buf);
-
-	CPIN_08(indirect, str, in_reserved, 64);
-
-}
-
-/**
- * gfs_indirect_out - copy out the header of an indirect block
- * @indirect: the in memory copy
- * @buf: the buffer copy
- *
- */
-
-void
-gfs_indirect_out(struct gfs_indirect *indirect, char *buf)
-{
-	struct gfs_indirect *str = (struct gfs_indirect *) buf;
-
-	gfs_meta_header_out(&indirect->in_header, buf);
-
-	CPOUT_08(indirect, str, in_reserved, 64);
-
-}
-
-/**
- * gfs_indirect_print - Print out a indirect block header
- * @indirect: the cpu-order buffer
- */
-
-void
-gfs_indirect_print(struct gfs_indirect *indirect)
-{
-
-	gfs_meta_header_print(&indirect->in_header);
-
-	pa(indirect, in_reserved, 64);
-
-}
-
-/**
- * gfs_dirent_in - Read in a directory entry
- * @dirent: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_dirent_in(struct gfs_dirent *dirent, char *buf)
-{
-	struct gfs_dirent *str = (struct gfs_dirent *) buf;
-
-	gfs_inum_in(&dirent->de_inum, (char *) &str->de_inum);
-	CPIN_32(dirent, str, de_hash);
-	CPIN_16(dirent, str, de_rec_len);
-	CPIN_16(dirent, str, de_name_len);
-	CPIN_16(dirent, str, de_type);
-
-	CPIN_08(dirent, str, de_reserved, 14);
-
-}
-
-/**
- * gfs_dirent_out - Write out a directory entry
- * @dirent: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_dirent_out(struct gfs_dirent *dirent, char *buf)
-{
-	struct gfs_dirent *str = (struct gfs_dirent *) buf;
-
-	gfs_inum_out(&dirent->de_inum, (char *) &str->de_inum);
-	CPOUT_32(dirent, str, de_hash);
-	CPOUT_16(dirent, str, de_rec_len);
-	CPOUT_16(dirent, str, de_name_len);
-	CPOUT_16(dirent, str, de_type);
-
-	CPOUT_08(dirent, str, de_reserved, 14);
-
-}
-
-/**
- * gfs_dirent_print - Print out a directory entry
- * @de: the cpu-order buffer
- * @name: the filename
- */
-
-void
-gfs_dirent_print(struct gfs_dirent *de, char *name)
-{
-	char buf[GFS_FNAMESIZE + 1];
-
-	gfs_inum_print(&de->de_inum);
-	pv(de, de_hash, "0x%.8X");
-	pv(de, de_rec_len, "%u");
-	pv(de, de_name_len, "%u");
-	pv(de, de_type, "%u");
-
-	pa(de, de_reserved, 14);
-
-	memset(buf, 0, GFS_FNAMESIZE + 1);
-	memcpy(buf, name, de->de_name_len);
-	printk("  name = %s\n", buf);
-
-}
-
-/**
- * gfs_leaf_in - Read in a directory leaf header
- * @leaf: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_leaf_in(struct gfs_leaf *leaf, char *buf)
-{
-	struct gfs_leaf *str = (struct gfs_leaf *) buf;
-
-	gfs_meta_header_in(&leaf->lf_header, buf);
-
-	CPIN_16(leaf, str, lf_depth);
-	CPIN_16(leaf, str, lf_entries);
-	CPIN_32(leaf, str, lf_dirent_format);
-	CPIN_64(leaf, str, lf_next);
-
-	CPIN_08(leaf, str, lf_reserved, 64);
-
-}
-
-/**
- * gfs_leaf_out - Write out a directory leaf header
- * @leaf: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_leaf_out(struct gfs_leaf *leaf, char *buf)
-{
-	struct gfs_leaf *str = (struct gfs_leaf *) buf;
-
-	gfs_meta_header_out(&leaf->lf_header, buf);
-
-	CPOUT_16(leaf, str, lf_depth);
-	CPOUT_16(leaf, str, lf_entries);
-	CPOUT_32(leaf, str, lf_dirent_format);
-	CPOUT_64(leaf, str, lf_next);
-
-	CPOUT_08(leaf, str, lf_reserved, 64);
-
-}
-
-/**
- * gfs_leaf_print - Print out a directory leaf header
- * @lf: the cpu-order buffer
- */
-
-void
-gfs_leaf_print(struct gfs_leaf *lf)
-{
-
-	gfs_meta_header_print(&lf->lf_header);
-
-	pv(lf, lf_depth, "%u");
-	pv(lf, lf_entries, "%u");
-	pv(lf, lf_dirent_format, "%u");
-	pv(lf, lf_next, "%" PRIu64);
-
-	pa(lf, lf_reserved, 64);
-
-}
-
-/**
- * gfs_log_header_in - Read in a log header
- * @head: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_log_header_in(struct gfs_log_header *head, char *buf)
-{
-	struct gfs_log_header *str = (struct gfs_log_header *) buf;
-
-	gfs_meta_header_in(&head->lh_header, buf);
-
-	CPIN_32(head, str, lh_flags);
-	CPIN_32(head, str, lh_pad);
-
-	CPIN_64(head, str, lh_first);
-	CPIN_64(head, str, lh_sequence);
-
-	CPIN_64(head, str, lh_tail);
-	CPIN_64(head, str, lh_last_dump);
-
-	CPIN_08(head, str, lh_reserved, 64);
-
-}
-
-/**
- * gfs_log_header_out - Write out a log header
- * @head: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_log_header_out(struct gfs_log_header *head, char *buf)
-{
-	struct gfs_log_header *str = (struct gfs_log_header *) buf;
-
-	gfs_meta_header_out(&head->lh_header, buf);
-
-	CPOUT_32(head, str, lh_flags);
-	CPOUT_32(head, str, lh_pad);
-
-	CPOUT_64(head, str, lh_first);
-	CPOUT_64(head, str, lh_sequence);
-
-	CPOUT_64(head, str, lh_tail);
-	CPOUT_64(head, str, lh_last_dump);
-
-	CPOUT_08(head, str, lh_reserved, 64);
-
-}
-
-/**
- * gfs_log_header_print - Print out a log header
- * @head: the cpu-order buffer
- */
-
-void
-gfs_log_header_print(struct gfs_log_header *lh)
-{
-
-	gfs_meta_header_print(&lh->lh_header);
-
-	pv(lh, lh_flags, "0x%.8X");
-	pv(lh, lh_pad, "%u");
-
-	pv(lh, lh_first, "%" PRIu64);
-	pv(lh, lh_sequence, "%" PRIu64);
-
-	pv(lh, lh_tail, "%" PRIu64);
-	pv(lh, lh_last_dump, "%" PRIu64);
-
-	pa(lh, lh_reserved, 64);
-
-}
-
-/**
- * gfs_desc_in - Read in a log descriptor
- * @desc: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_desc_in(struct gfs_log_descriptor *desc, char *buf)
-{
-	struct gfs_log_descriptor *str = (struct gfs_log_descriptor *) buf;
-
-	gfs_meta_header_in(&desc->ld_header, buf);
-
-	CPIN_32(desc, str, ld_type);
-	CPIN_32(desc, str, ld_length);
-	CPIN_32(desc, str, ld_data1);
-	CPIN_32(desc, str, ld_data2);
-
-	CPIN_08(desc, str, ld_reserved, 64);
-
-}
-
-/**
- * gfs_desc_out - Write out a log descriptor
- * @desc: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_desc_out(struct gfs_log_descriptor *desc, char *buf)
-{
-	struct gfs_log_descriptor *str = (struct gfs_log_descriptor *) buf;
-
-	gfs_meta_header_out(&desc->ld_header, buf);
-
-	CPOUT_32(desc, str, ld_type);
-	CPOUT_32(desc, str, ld_length);
-	CPOUT_32(desc, str, ld_data1);
-	CPOUT_32(desc, str, ld_data2);
-
-	CPOUT_08(desc, str, ld_reserved, 64);
-
-}
-
-/**
- * gfs_desc_print - Print out a log descriptor
- * @ld: the cpu-order buffer
- */
-
-void
-gfs_desc_print(struct gfs_log_descriptor *ld)
-{
-
-	gfs_meta_header_print(&ld->ld_header);
-
-	pv(ld, ld_type, "%u");
-	pv(ld, ld_length, "%u");
-	pv(ld, ld_data1, "%u");
-	pv(ld, ld_data2, "%u");
-
-	pa(ld, ld_reserved, 64);
-
-}
-
-/**
- * gfs_block_tag_in - Read in a block tag
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_block_tag_in(struct gfs_block_tag *tag, char *buf)
-{
-	struct gfs_block_tag *str = (struct gfs_block_tag *) buf;
-
-	CPIN_64(tag, str, bt_blkno);
-	CPIN_32(tag, str, bt_flags);
-	CPIN_32(tag, str, bt_pad);
-
-}
-
-/**
- * gfs_block_tag_out - Write out a block tag
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_block_tag_out(struct gfs_block_tag *tag, char *buf)
-{
-	struct gfs_block_tag *str = (struct gfs_block_tag *) buf;
-
-	CPOUT_64(tag, str, bt_blkno);
-	CPOUT_32(tag, str, bt_flags);
-	CPOUT_32(tag, str, bt_pad);
-
-}
-
-/**
- * gfs_block_tag_print - Print out a block tag
- * @tag: the cpu-order buffer
- */
-
-void
-gfs_block_tag_print(struct gfs_block_tag *tag)
-{
-
-	pv(tag, bt_blkno, "%" PRIu64);
-	pv(tag, bt_flags, "%u");
-	pv(tag, bt_pad, "%u");
-
-}
-
-/**
- * gfs_quota_tag_in - Read in a quota tag
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_quota_tag_in(struct gfs_quota_tag *tag, char *buf)
-{
-	struct gfs_quota_tag *str = (struct gfs_quota_tag *) buf;
-
-	CPIN_64(tag, str, qt_change);
-	CPIN_32(tag, str, qt_flags);
-	CPIN_32(tag, str, qt_id);
-
-}
-
-/**
- * gfs_quota_tag_out - Write out a quota tag
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_quota_tag_out(struct gfs_quota_tag *tag, char *buf)
-{
-	struct gfs_quota_tag *str = (struct gfs_quota_tag *) buf;
-
-	CPOUT_64(tag, str, qt_change);
-	CPOUT_32(tag, str, qt_flags);
-	CPOUT_32(tag, str, qt_id);
-
-}
-
-/**
- * gfs_quota_tag_print - Print out a quota tag
- * @tag: the cpu-order buffer
- */
-
-void
-gfs_quota_tag_print(struct gfs_quota_tag *tag)
-{
-
-	pv(tag, qt_change, "%" PRId64);
-	pv(tag, qt_flags, "0x%.8X");
-	pv(tag, qt_id, "%u");
-
-}
-
-/**
- * gfs_ea_header_in - Read in a Extended Attribute header
- * @tag: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_ea_header_in(struct gfs_ea_header *ea, char *buf)
-{
-	struct gfs_ea_header *str = (struct gfs_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;
-	CPIN_32(ea, str, ea_pad);
-
-}
-
-/**
- * gfs_ea_header_out - Write out a Extended Attribute header
- * @ea: the cpu-order structure
- * @buf: the disk-order buffer
- *
- */
-
-void
-gfs_ea_header_out(struct gfs_ea_header *ea, char *buf)
-{
-	struct gfs_ea_header *str = (struct gfs_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;
-	CPOUT_32(ea, str, ea_pad);
-
-}
-
-/**
- * gfs_ea_header_printt - Print out a Extended Attribute header
- * @ea: the cpu-order buffer
- */
-
-void
-gfs_ea_header_print(struct gfs_ea_header *ea, char *name)
-{
-	char buf[GFS_EA_MAX_NAME_LEN + 1];
-
-	pv(ea, ea_rec_len, "%u");
-	pv(ea, ea_data_len, "%u");
-	pv(ea, ea_name_len, "%u");
-	pv(ea, ea_type, "%u");
-	pv(ea, ea_flags, "%u");
-	pv(ea, ea_num_ptrs, "%u");
-	pv(ea, ea_pad, "%u");
-
-	memset(buf, 0, GFS_EA_MAX_NAME_LEN + 1);
-	memcpy(buf, name, ea->ea_name_len);
-	printf("  name = %s\n", buf);
-}
-
-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
-};
-
-/**
- * gfs_dir_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.
- *
- * 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
-gfs_dir_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;
-}
diff --git a/gfs/libgfs/rgrp.c b/gfs/libgfs/rgrp.c
deleted file mode 100644
index 6407b80..0000000
--- a/gfs/libgfs/rgrp.c
+++ /dev/null
@@ -1,593 +0,0 @@
-#include <stdint.h>
-#include "gfs_ondisk.h"
-#include "incore.h"
-#include "libgfs.h"
-
-/**
- * fs_compute_bitstructs - Compute the bitmap sizes
- * @rgd: The resource group descriptor
- *
- * Returns: 0 on success, -1 on error
- */
-int fs_compute_bitstructs(struct gfs_rgrpd *rgd)
-{
-	struct gfs_sbd *sdp = rgd->rd_sbd;
-	struct gfs_bitmap *bits;
-	uint32 length = rgd->rd_ri.ri_length;
-	uint32 bytes_left, bytes;
-	int x;
-
-	if(!(rgd->rd_bits = (struct gfs_bitmap *)malloc(length * sizeof(struct gfs_bitmap)))) {
-		log_err("Unable to allocate bitmap structure\n");
-		stack;
-		return -1;
-	}
-	if(!memset(rgd->rd_bits, 0, length * sizeof(struct gfs_bitmap))) {
-		log_err("Unable to zero bitmap structure\n");
-		stack;
-		return -1;
-	}
-	
-	bytes_left = rgd->rd_ri.ri_bitbytes;
-
-	for (x = 0; x < length; x++){
-		bits = &rgd->rd_bits[x];
-
-		if (length == 1){
-			bytes = bytes_left;
-			bits->bi_offset = sizeof(struct gfs_rgrp);
-			bits->bi_start = 0;
-			bits->bi_len = bytes;
-		}
-		else if (x == 0){
-			bytes = sdp->sd_sb.sb_bsize - sizeof(struct gfs_rgrp);
-			bits->bi_offset = sizeof(struct gfs_rgrp);
-			bits->bi_start = 0;
-			bits->bi_len = bytes;
-		}
-		else if (x + 1 == length){
-			bytes = bytes_left;
-			bits->bi_offset = sizeof(struct gfs_meta_header);
-			bits->bi_start = rgd->rd_ri.ri_bitbytes - bytes_left;
-			bits->bi_len = bytes;
-		}
-		else{
-			bytes = sdp->sd_sb.sb_bsize - sizeof(struct gfs_meta_header);
-			bits->bi_offset = sizeof(struct gfs_meta_header);
-			bits->bi_start = rgd->rd_ri.ri_bitbytes - bytes_left;
-			bits->bi_len = bytes;
-		}
-
-		bytes_left -= bytes;
-	}
-
-	if(bytes_left){
-		log_err( "fs_compute_bitstructs:  Too many blocks in rgrp to "
-			"fit into available bitmap.\n");
-		return -1;
-	}
-
-	if((rgd->rd_bits[length - 1].bi_start +
-	    rgd->rd_bits[length - 1].bi_len) * GFS_NBBY != rgd->rd_ri.ri_data){
-		log_err( "fs_compute_bitstructs:  # of blks in rgrp do not equal "
-			"# of blks represented in bitmap.\n"
-			"\tbi_start = %u\n"
-			"\tbi_len   = %u\n"
-			"\tGFS_NBBY = %u\n"
-			"\tri_data  = %u\n",
-			rgd->rd_bits[length - 1].bi_start,
-			rgd->rd_bits[length - 1].bi_len,
-			GFS_NBBY,
-			rgd->rd_ri.ri_data);
-		return -1;
-	}
-
-
-	if(!(rgd->rd_bh = (osi_buf_t **)malloc(length * sizeof(osi_buf_t *)))) {
-		log_err("Unable to allocate osi_buf structure\n");
-		stack;
-		return -1;
-	}
-	if(!memset(rgd->rd_bh, 0, length * sizeof(osi_buf_t *))) {
-		log_err("Unable to zero osi_buf structure\n");
-		stack;
-		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 gfs_rgrpd *fs_blk2rgrpd(struct gfs_sbd *sdp, uint64 blk)
-{
-	osi_list_t *tmp;
-	struct gfs_rgrpd *rgd = NULL;
-	struct gfs_rindex *ri;
-
-	for(tmp = (osi_list_t *)sdp->sd_rglist.next; 
-		tmp != (osi_list_t *)&sdp->sd_rglist; tmp = tmp->next){
-		rgd = osi_list_entry(tmp, struct gfs_rgrpd, rd_list);
-		ri = &rgd->rd_ri;
-
-		if (ri->ri_data1 <= blk && blk < ri->ri_data1 + ri->ri_data){
-			break;
-		} else
-			rgd = NULL;
-	}
-	return rgd;
-}
-
-/**
- * fs_rgrp_read - read in the resource group information from disk.
- * @rgd - resource group structure
- * @repair_if_corrupted - If TRUE, rgrps found to be corrupt should be repaired
- *                 according to the index.  If FALSE, no corruption is fixed.
- */
-int fs_rgrp_read(int disk_fd, struct gfs_rgrpd *rgd, int repair_if_corrupted)
-{
-	struct gfs_sbd *sdp = rgd->rd_sbd;
-	unsigned int x, length = rgd->rd_ri.ri_length;
-	int error;
-
-	if(rgd->rd_open_count){
-		log_debug("rgrp already read...\n");
-		rgd->rd_open_count++;
-		return 0;
-	}
-
-	for (x = 0; x < length; x++){
-		if(rgd->rd_bh[x]){
-			log_err("Programmer error!  Bitmaps are already present in rgrp.\n");
-			exit(1);
-		}
-		error = get_and_read_buf(disk_fd, sdp->sd_sb.sb_bsize,
-								 rgd->rd_ri.ri_addr + x, &(rgd->rd_bh[x]), 0);
-		if (error) {
-		  	log_err("Unable to read rgrp from disk.\n"); 
-		  	goto fail;
-		}
-
-		if(check_meta(rgd->rd_bh[x], (x) ? GFS_METATYPE_RB : GFS_METATYPE_RG)){
-			log_err("Buffer #%"PRIu64" (%d of %d) is neither"
-				" GFS_METATYPE_RB nor GFS_METATYPE_RG.\n",
-				BH_BLKNO(rgd->rd_bh[x]),
-				(int)x+1,
-				(int)length);
-			if (repair_if_corrupted) {
-				log_err("Attempting to repair.\n");
-				memset(&rgd->rd_rg, 0, sizeof(struct gfs_rgrp));
-				rgd->rd_rg.rg_header.mh_magic = GFS_MAGIC;
-				rgd->rd_rg.rg_header.mh_type = GFS_METATYPE_RG;
-				rgd->rd_rg.rg_header.mh_format = GFS_FORMAT_RG;
-				rgd->rd_rg.rg_free = rgd->rd_ri.ri_data;
-				gfs_rgrp_out(&rgd->rd_rg, BH_DATA(rgd->rd_bh[x]));
-				write_buf(disk_fd, rgd->rd_bh[x], BW_WAIT);
-			}
-			else {
-				error = -1;
-				goto fail;
-			}
-		}
-	}
-
-	gfs_rgrp_in(&rgd->rd_rg, BH_DATA(rgd->rd_bh[0]));
-	rgd->rd_open_count = 1;
-
-	return 0;
-
- fail:
-	for (x = 0; x < length; x++){
-		relse_buf(rgd->rd_bh[x]);
-		rgd->rd_bh[x] = NULL;
-	}
-
-	log_err("Resource group is corrupted.\n");
-	return error;
-}
-
-void fs_rgrp_relse(struct gfs_rgrpd *rgd)
-{
-	int x, length = rgd->rd_ri.ri_length;
-
-	rgd->rd_open_count--;
-	if(rgd->rd_open_count){
-		log_debug("rgrp still held...\n");
-	} else {
-		for (x = 0; x < length; x++){
-			relse_buf(rgd->rd_bh[x]);
-			rgd->rd_bh[x] = NULL;
-		}
-	}
-}
-
-
-/**
- * rgrp_verify - Verify that a resource group is consistent
- * @sdp: the filesystem
- * @rgd: the rgrp
- *
- * Returns: 0 if ok, -1 on error
- */
-int fs_rgrp_verify(struct gfs_rgrpd *rgd)
-{
-	struct gfs_bitmap *bits = NULL;
-	uint32 length = rgd->rd_ri.ri_length;
-	uint32 count[4], tmp;
-	int buf, x;
-
-	for (x = 0; x < 4; x++){
-		count[x] = 0;
-
-		for (buf = 0; buf < length; buf++){
-			bits = &rgd->rd_bits[buf];
-			count[x] += fs_bitcount((unsigned char *)
-						BH_DATA(rgd->rd_bh[buf]) +
-						bits->bi_offset,
-						bits->bi_len, x);
-		}
-	}
-
-	if(count[0] != rgd->rd_rg.rg_free){
-		log_err("free data mismatch:  %u != %u\n",
-			count[0], rgd->rd_rg.rg_free);
-		return -1;
-	}
-
-	tmp = rgd->rd_ri.ri_data -
-		(rgd->rd_rg.rg_usedmeta + rgd->rd_rg.rg_freemeta) -
-		(rgd->rd_rg.rg_useddi + rgd->rd_rg.rg_freedi) -
-		rgd->rd_rg.rg_free;
-
-	if(count[1] != tmp){
-		log_err("used data mismatch:  %u != %u\n",
-			count[1], tmp);
-		return -1;
-	}
-	if(count[2] != rgd->rd_rg.rg_freemeta){
-		log_err("free metadata mismatch:  %u != %u\n",
-			count[2], rgd->rd_rg.rg_freemeta);
-		return -1;
-	}
-
-	tmp = rgd->rd_rg.rg_usedmeta +
-		(rgd->rd_rg.rg_useddi + rgd->rd_rg.rg_freedi);
-
-	if(count[3] != tmp){
-		log_err("used metadata mismatch:  %u != %u\n",
-			count[3], tmp);
-		return -1;
-	}
-	return 0;
-}
-
-/**
- * fs_rgrp_recount - adjust block tracking numbers
- * rgd: resource group
- *
- * The resource groups keep track of how many free blocks, used blocks,
- * etc there are.  This function readjusts those numbers based on the
- * current state of the bitmap.
- *
- * Returns: 0 on success, -1 on failure
- */
-int fs_rgrp_recount(int disk_fd, struct gfs_rgrpd *rgd){
-	int i,j;
-	fs_bitmap_t *bits = NULL;
-	uint32 length = rgd->rd_ri.ri_length;
-	uint32 count[4], tmp;
-
-	for(i=0; i < 4; i++){
-		count[i] = 0;
-		for(j = 0; j < length; j++){
-			bits = (fs_bitmap_t *)&rgd->rd_bits[j];
-			count[i] += fs_bitcount((unsigned char *)
-						BH_DATA(rgd->rd_bh[j]) +
-						bits->bi_offset,
-						bits->bi_len, i);
-		}
-	}
-	if(count[0] != rgd->rd_rg.rg_free){
-		log_warn("\tAdjusting free block count (%u -> %u).\n",
-			rgd->rd_rg.rg_free, count[0]);
-		rgd->rd_rg.rg_free = count[0];
-	}
-	if(count[2] != rgd->rd_rg.rg_freemeta){
-		log_warn("\tAdjusting freemeta block count (%u -> %u).\n",
-		       rgd->rd_rg.rg_freemeta, count[2]);
-		rgd->rd_rg.rg_freemeta = count[2];
-	}
-	tmp = rgd->rd_rg.rg_usedmeta +
-		(rgd->rd_rg.rg_useddi + rgd->rd_rg.rg_freedi);
-
-	if(count[3] != tmp){
-		int first = 1;
-		struct gfs_sbd *sdp = rgd->rd_sbd;
-		uint32 useddi = 0;
-		uint32 freedi = 0;
-		uint64 block;
-		struct gfs_inode *ip;
-
-		while (1){  /* count the used dinodes */
-			if(next_rg_metatype(disk_fd, rgd, &block,
-					    GFS_METATYPE_DI, first)){
-				break;
-			}
-			first = 0;
-			if(load_inode(disk_fd, sdp, block, &ip)) {
-				stack;
-				continue;
-			}
-
-			if (ip->i_di.di_flags & GFS_DIF_UNUSED){
-				freedi++;
-				continue;
-			}
-			free_inode(&ip);
-			useddi++;
-		}
-
-		if(useddi != rgd->rd_rg.rg_useddi){
-			log_warn("\tAdjusting used dinode block count (%u -> %u).\n",
-				rgd->rd_rg.rg_useddi, useddi);
-			rgd->rd_rg.rg_useddi = useddi;
-		}
-		if(freedi != rgd->rd_rg.rg_freedi){
-			log_warn("\tAdjusting free dinode block count (%u -> %u).\n",
-				rgd->rd_rg.rg_freedi, freedi);
-			rgd->rd_rg.rg_freedi = freedi;
-		}
-		if(rgd->rd_rg.rg_usedmeta != count[3] - (freedi + useddi)){
-			log_warn("\tAdjusting used meta block count (%u -> %u).\n",
-				rgd->rd_rg.rg_usedmeta,
-				(count[3] - (freedi + useddi)));
-			rgd->rd_rg.rg_usedmeta = count[3] - (freedi + useddi);
-		}
-	}
-
-	tmp = rgd->rd_ri.ri_data -
-		(rgd->rd_rg.rg_usedmeta + rgd->rd_rg.rg_freemeta) -
-		(rgd->rd_rg.rg_useddi + rgd->rd_rg.rg_freedi) -
-		rgd->rd_rg.rg_free;
-
-	if(count[1] != tmp){
-		log_err("Could not reconcile rgrp block counts.\n");
-		return -1;
-	}
-	return 0;
-}
-
-/**
- * clump_alloc - Allocate a clump of metadata
- * @rgd: the resource group descriptor
- * @goal: the goal block in the RG
- *
- * Returns: 0 on success, -1 on failure
- */
-int clump_alloc(int disk_fd, struct gfs_rgrpd *rgd, uint32 goal)
-{
-	struct gfs_sbd *sdp = rgd->rd_sbd;
-	struct gfs_meta_header mh;
-	osi_buf_t *bh[GFS_META_CLUMP] = {0};
-	uint32 block;
-	int i,j;
-	int error = 0;
-
-	memset(&mh, 0, sizeof(struct gfs_meta_header));
-	mh.mh_magic = GFS_MAGIC;
-	mh.mh_type = GFS_METATYPE_NONE;
-
-	if(rgd->rd_rg.rg_free < GFS_META_CLUMP){
-		log_debug(" Not enough free blocks in rgrp.\n");
-		return -1;
-	}
-
-	for (i = 0; i < GFS_META_CLUMP; i++){
-		block = fs_blkalloc_internal(rgd, goal,
-					     GFS_BLKST_FREE,
-					     GFS_BLKST_FREEMETA, TRUE);
-		log_debug("Got block %u\n", block);
-
-		if(block == BFITNOENT) {
-			log_err("Unable to get enough blocks\n");
-			goto fail;
-		}
-		block += rgd->rd_ri.ri_data1;
-		block_set(rgd->rd_sbd->bl, block, meta_free);
-		if (get_buf(sdp->sd_sb.sb_bsize, block, &(bh[i]))){
-			log_err("Unable to allocate new buffer.\n");
-			goto fail;
-		}
-		gfs_meta_header_out(&mh, BH_DATA(bh[i]));
-
-		goal = block;
-	}
-
-	log_debug("64 Meta blocks (%"PRIu64" - %"PRIu64"), allocated in rgrp 0x%lx\n",
-		(rgd->rd_ri.ri_data1 + block)-63,
-		(rgd->rd_ri.ri_data1 + block),
-		(unsigned long)rgd);
-	for (j = 0; j < GFS_META_CLUMP; j++){
-
-		error = write_buf(disk_fd, bh[j], BW_WAIT);
-		if (error){
-			log_err("Unable to write allocated metablock to disk.\n");
-			goto fail;
-		}
-	}
-
-	if(rgd->rd_rg.rg_free < GFS_META_CLUMP){
-		log_err("More blocks were allocated from rgrp "
-			"than are available.\n");
-		goto fail;
-	}
-	rgd->rd_rg.rg_free -= GFS_META_CLUMP;
-	rgd->rd_rg.rg_freemeta += GFS_META_CLUMP;
-
-	for (i = 0; i < GFS_META_CLUMP; i++)
-		relse_buf(bh[i]);
-
-	return 0;
-
- fail:
-	log_debug("clump_alloc failing...\n");
-	for(--i; i >=0; i--){
-		fs_set_bitmap(disk_fd, sdp, BH_BLKNO(bh[i]), GFS_BLKST_FREE);
-		relse_buf(bh[i]);
-	}
-	return -1;
-}
-
-
-/**
- * fs_blkalloc - Allocate a data block
- * @ip: the inode to allocate the data block for
- * @block: the block allocated
- *
- * Returns: 0 on success, -1 on failure
- */
-int fs_blkalloc(int disk_fd, struct gfs_inode *ip, uint64 *block)
-{
-	osi_list_t *tmp;
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_rgrpd *rgd;
-	uint32 goal;
-	int same;
-
-	for(tmp = (osi_list_t *)sdp->sd_rglist.next;
-		tmp != (osi_list_t *)&sdp->sd_rglist; tmp = tmp->next){
-		rgd = osi_list_entry(tmp, struct gfs_rgrpd, rd_list);
-
-		if(!rgd){
-			log_err( "fs_blkalloc:  Bad rgrp list!\n");
-			return -1;
-		}
-
-		if(fs_rgrp_read(disk_fd, rgd, FALSE)){
-			log_err( "fs_blkalloc:  Unable to read rgrp.\n");
-			return -1;
-		}
-
-		if(!rgd->rd_rg.rg_free){
-			fs_rgrp_relse(rgd);
-			continue;
-		}
-
-		same = (rgd->rd_ri.ri_addr == ip->i_di.di_goal_rgrp);
-		goal = (same) ? ip->i_di.di_goal_dblk : 0;
-
-		*block = fs_blkalloc_internal(rgd, goal,
-					      GFS_BLKST_FREE,
-					      GFS_BLKST_USED, TRUE);
-
-		log_debug("Got block %"PRIu64"\n", *block);
-		if(*block == BFITNOENT) {
-			fs_rgrp_relse(rgd);
-			continue;
-		}
-		if (!same){
-			ip->i_di.di_goal_rgrp = rgd->rd_ri.ri_addr;
-			ip->i_di.di_goal_mblk = 0;
-		}
-
-		*block += rgd->rd_ri.ri_data1;
-		ip->i_di.di_goal_dblk = *block;
-
-		rgd->rd_rg.rg_free--;
-
-		gfs_rgrp_out(&rgd->rd_rg, BH_DATA(rgd->rd_bh[0]));
-		if(write_buf(disk_fd, rgd->rd_bh[0], 0)){
-			log_err( "Unable to write out rgrp block #%"
-				PRIu64".\n",
-				BH_BLKNO(rgd->rd_bh[0]));
-			fs_rgrp_relse(rgd);
-			return -1;
-		}
-		fs_rgrp_relse(rgd);
-		return 0;
-	}
-
-	return 1;
-}
-
-
-/**
- * fs_metaalloc - Allocate a metadata block to a file
- * @ip:  the file
- * @block: the block allocated
- *
- * Returns: 0 on success, -1 on failure
- */
-int fs_metaalloc(int disk_fd, struct gfs_inode *ip, uint64 *block)
-{
-	osi_list_t *tmp;
-	struct gfs_sbd *sdp = ip->i_sbd;
-	struct gfs_rgrpd *rgd;
-	uint32 goal;
-	int same;
-	int error = 0;
-
-	/* ATTENTION -- maybe we should try to allocate from goal rgrp first */
-	for(tmp = (osi_list_t *)sdp->sd_rglist.next;
-		tmp != (osi_list_t *)&sdp->sd_rglist; tmp = tmp->next){
-		rgd = osi_list_entry(tmp, struct gfs_rgrpd, rd_list);
-
-		if(!rgd){
-			log_err( "fs_metaalloc:  Bad rgrp list!\n");
-			return -1;
-		}
-
-		if(fs_rgrp_read(disk_fd, rgd, FALSE)){
-			log_err( "fs_metaalloc:  Unable to read rgrp.\n");
-			return -1;
-		}
-
-		same = (rgd->rd_ri.ri_addr == ip->i_di.di_goal_rgrp);
-		goal = (same) ? ip->i_di.di_goal_mblk : 0;
-
-		if (!rgd->rd_rg.rg_freemeta){
-			error = clump_alloc(disk_fd, rgd, goal);
-			if (error){
-				fs_rgrp_relse(rgd);
-				continue;
-			}
-		}
-
-
-		if(!rgd->rd_rg.rg_freemeta){
-			fs_rgrp_relse(rgd);
-			continue;
-		}
-		*block = fs_blkalloc_internal(rgd, goal,
-					      GFS_BLKST_FREEMETA,
-					      GFS_BLKST_USEDMETA, TRUE);
-		log_debug("Got block %"PRIu64"\n", *block);
-		if(*block == BFITNOENT) {
-			fs_rgrp_relse(rgd);
-			continue;
-		}
-		if (!same){
-			ip->i_di.di_goal_rgrp = rgd->rd_ri.ri_addr;
-			ip->i_di.di_goal_dblk = 0;
-		}
-		*block += rgd->rd_ri.ri_data1;
-		ip->i_di.di_goal_mblk = *block;
-
-		rgd->rd_rg.rg_freemeta--;
-		rgd->rd_rg.rg_usedmeta++;
-
-		gfs_rgrp_out(&rgd->rd_rg, BH_DATA(rgd->rd_bh[0]));
-		write_buf(disk_fd, rgd->rd_bh[0], 0);
-		fs_rgrp_relse(rgd);
-		/* if we made it this far, then we are ok */
-		return 0;
-	}
-
-	return -1;
-}
diff --git a/gfs/libgfs/size.c b/gfs/libgfs/size.c
deleted file mode 100644
index 289c04d..0000000
--- a/gfs/libgfs/size.c
+++ /dev/null
@@ -1,81 +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 "libgfs.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)
-{
-	unsigned long size;
-	off_t off;
-	int error;
-
-	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;
-	}
-
-	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/gfs/libgfs/super.c b/gfs/libgfs/super.c
deleted file mode 100644
index c479c27..0000000
--- a/gfs/libgfs/super.c
+++ /dev/null
@@ -1,531 +0,0 @@
-#include <unistd.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <errno.h>
-
-#include "osi_list.h"
-#include "osi_user.h"
-#include "gfs_ondisk.h"
-#include "incore.h"
-#include "libgfs.h"
-
-#ifndef BLKGETSIZE64
-#define BLKGETSIZE64 _IOR(0x12, 114, size_t)
-#endif
-
-#define DIV_RU(x, y) (((x) + (y) - 1) / (y))
-#define ri_compare(rg, ondisk, expected, field, fmt)	\
-	if (ondisk.field != expected.field) { \
-		log_warn("rgindex[%d] " #field " discrepancy: index 0x%" fmt \
-				 " != expected: 0x%" fmt "\n", \
-				 rg, ondisk.field, expected.field);	\
-		ondisk.field = expected.field; \
-		rgindex_modified = TRUE; \
-	}
-
-static uint64 total_journal_space;
-
-/**
- * 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
- */
-static int check_sb(struct gfs_sbd *sdp, struct gfs_sb *sb)
-{
-	int error = 0;
-	if (sb->sb_header.mh_magic != GFS_MAGIC ||
-	    sb->sb_header.mh_type != GFS_METATYPE_SB){
-		log_crit("Either the super block is corrupted, or this "
-			 "is not a GFS filesystem\n");
-		log_debug("Header magic: %X Header Type: %X\n",
-			  sb->sb_header.mh_magic,
-			  sb->sb_header.mh_type);
-		error = -EINVAL;
-		goto out;
-	}
-
-	/*  If format numbers match exactly, we're done.  */
-	if (sb->sb_fs_format != GFS_FORMAT_FS ||
-	    sb->sb_multihost_format != GFS_FORMAT_MULTI){
-		log_warn("Old file system detected.\n");
-	}
-
- out:
-	return error;
-}
-
-/*
- * compute_constants: compute constants for the superblock
- *
- * assumes:
- *    sb_bsize_shift is set either from the ondisk superblock or otherwise.
- *    sb_bsize is set either from the ondisk superblock or otherwise.
- */
-int compute_constants(struct gfs_sbd *sdp)
-{
-	unsigned int x;
-	uint64 space = 0;
-	int error = 0;
-
-	sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift - 9;
-	sdp->sd_diptrs =
-		(sdp->sd_sb.sb_bsize-sizeof(struct gfs_dinode)) /
-		sizeof(uint64);
-	sdp->sd_inptrs =
-		(sdp->sd_sb.sb_bsize-sizeof(struct gfs_indirect)) /
-		sizeof(uint64);
-	sdp->sd_jbsize = sdp->sd_sb.sb_bsize - sizeof(struct gfs_meta_header);
-	sdp->sd_hash_bsize = sdp->sd_sb.sb_bsize / 2;
-	sdp->sd_hash_ptrs = sdp->sd_hash_bsize / sizeof(uint64);
-	sdp->sd_heightsize[0] = sdp->sd_sb.sb_bsize -
-		sizeof(struct gfs_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;
-	}
-	sdp->sd_max_height = x;
-	if(sdp->sd_max_height > GFS_MAX_META_HEIGHT){
-		log_err("Bad max metadata height.\n");
-		error = -1;
-		return error;
-	}
-
-	sdp->sd_jheightsize[0] = sdp->sd_sb.sb_bsize -
-		sizeof(struct gfs_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 > GFS_MAX_META_HEIGHT){
-		log_err("Bad max jheight.\n");
-		error = -1;
-	}
-	return error;
-}
-
-/*
- * 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(int disk_fd, struct gfs_sbd *sdp)
-{
-	osi_buf_t *bh;
-	int error;
-	error = get_and_read_buf(disk_fd, 512, /* assume 512 block size at first */
-							 GFS_SB_ADDR >> sdp->sd_fsb2bb_shift, &bh, 0);
-	if (error){
-		log_crit("Unable to read superblock\n");
-		goto out;
-	}
-
-	gfs_sb_in(&sdp->sd_sb, BH_DATA(bh));
-
-	relse_buf(bh);
-
-	error = check_sb(sdp, &sdp->sd_sb);
-	if (error)
-		goto out;
-
-	compute_constants(sdp);
-
- out:
-
-	return error;
-}
-
-
-/*
- * ji_update - fill in journal info
- * ip: the journal index inode
- *
- * Given the inode for the journal index, read in all
- * the journal indexes.
- *
- * Returns: 0 on success, -1 on failure
- */
-int ji_update(int disk_fd, struct gfs_sbd *sdp)
-{
-	struct gfs_inode *ip = sdp->sd_jiinode;
-	char buf[sizeof(struct gfs_jindex)];
-	unsigned int j;
-	int error=0;
-
-
-	if(ip->i_di.di_size % sizeof(struct gfs_jindex) != 0){
-		log_err("The size reported in the journal index"
-			" inode is not a\n"
-			 "\tmultiple of the size of a journal index.\n");
-		return -1;
-	}
-
-	if(!(sdp->sd_jindex = (struct gfs_jindex *)malloc(ip->i_di.di_size))) {
-		log_err("Unable to allocate journal index\n");
-		return -1;
-	}
-	if(!memset(sdp->sd_jindex, 0, ip->i_di.di_size)) {
-		log_err("Unable to zero journal index\n");
-		return -1;
-	}
-	total_journal_space = 0;
-
-	for (j = 0; ; j++) {
-		struct gfs_jindex *journ;
-		error = readi(disk_fd, ip, buf, j * sizeof(struct gfs_jindex),
-				 sizeof(struct gfs_jindex));
-		if(!error)
-			break;
-		if (error != sizeof(struct gfs_jindex)){
-			log_err("An error occurred while reading the"
-				" journal index file.\n");
-			goto fail;
-		}
-
-		journ = sdp->sd_jindex + j;
-		gfs_jindex_in(journ, buf);
-		total_journal_space += journ->ji_nsegment * sdp->sd_sb.sb_seg_size;
-	}
-
-
-	if(j * sizeof(struct gfs_jindex) != ip->i_di.di_size){
-		log_err("journal inode size invalid\n");
-		log_debug("j * sizeof(struct gfs_jindex) !="
-			  " ip->i_di.di_size\n");
-		log_debug("%d != %d\n",
-			  j * sizeof(struct gfs_jindex), ip->i_di.di_size);
-		goto fail;
-	}
-	sdp->sd_journals = j;
-	log_debug("%d journals found.\n", j);
-
-	return 0;
-
- fail:
-	free(sdp->sd_jindex);
-	return -1;
-}
-
-/* Print out debugging information in same format as gfs_edit. */
-int hexdump(uint64 startaddr, const unsigned char *lpBuffer, int len)
-{
-	const unsigned char *pointer,*ptr2;
-	int i;
-	uint64 l;
-
-	pointer = (unsigned char *)lpBuffer;
-	ptr2 = (unsigned char *)lpBuffer;
-	l = 0;
-	while (l < len) {
-		log_info("%.8"PRIX64,startaddr + l);
-		for (i=0; i<16; i++) { /* first print it in hex */
-			if (i%4 == 0)
-				log_info(" ");
-			log_info("%02X",*pointer);
-			pointer++;
-		}
-		log_info(" [");
-		for (i=0; i<16; i++) { /* now print it in character format */
-			if ((*ptr2 >=' ') && (*ptr2 <= '~'))
-				log_info("%c",*ptr2);
-			else
-				log_info(".");
-			ptr2++;
-		}
-		log_info("] \n");
-		l+=16;
-	}
-	return (len);
-}
-
-
-/**
- * rgrplength2bitblocks - blerg - Stolen by Bob from gfs_mkfs.  Good 
- * candidate for gfslib.
- *
- * @sdp:    the superblock
- * @length: the number of blocks in a RG
- *
- * Give a number of blocks in a RG, figure out the number of blocks
- * needed for bitmaps.
- *
- * Returns: the number of bitmap blocks
- */
-
-uint32 rgrplength2bitblocks(struct gfs_sbd *sdp, uint32 length)
-{
-	uint32 bitbytes;
-	uint32 old_blocks = 0, blocks;
-	int tries = 0;
-	
-	for (;;) {
-		bitbytes = (length - old_blocks) / GFS_NBBY;
-		blocks = 1;
-
-		if (bitbytes > sdp->sd_sb.sb_bsize - sizeof(struct gfs_rgrp)) {
-			bitbytes -= sdp->sd_sb.sb_bsize - sizeof(struct gfs_rgrp);
-			blocks += DIV_RU(bitbytes, (sdp->sd_sb.sb_bsize -
-					      sizeof(struct gfs_meta_header)));
-		}
-		if (blocks == old_blocks)
-			break;
-		old_blocks = blocks;
-		if (tries++ > 10) {
-			blocks = 0;
-			break;
-		}
-	}
-	return blocks;
-}
-
-/*
- * ri_cleanup - free up the memory we previously allocated.
- */
-void ri_cleanup(osi_list_t *rglist)
-{
-	struct gfs_rgrpd *rgd;
-
-	while(!osi_list_empty(rglist)){
-		rgd = osi_list_entry(rglist->next, struct gfs_rgrpd, rd_list);
-		if(rgd->rd_bits)
-			free(rgd->rd_bits);
-		if(rgd->rd_bh)
-			free(rgd->rd_bh);
-		osi_list_del((osi_list_t *)&rgd->rd_list);
-		free(rgd);
-	}
-}
-
-/**
- * ri_update - attach rgrps to the super block
- * @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 ri_update(int disk_fd, struct gfs_sbd *sdp)
-{
-	struct gfs_rgrpd *rgd;
-	osi_list_t *tmp;
-	struct gfs_rindex buf;
-	unsigned int rg;
-	int error, count1 = 0, count2 = 0;
-	
-	for (rg = 0; ; rg++) {
-		error = readi(disk_fd, sdp->sd_riinode, (char *)&buf,
-					  rg * sizeof(struct gfs_rindex),
-					  sizeof(struct gfs_rindex));
-		if (!error)
-			break;
-		if (error != sizeof(struct gfs_rindex)){
-			log_err("Unable to read resource group index #%u.\n", rg);
-			goto fail;
-		}
-		rgd = (struct gfs_rgrpd *)malloc(sizeof(struct gfs_rgrpd));
-		// FIXME: handle failed malloc
-		rgd->rd_sbd = sdp;
-		osi_list_add_prev((osi_list_t *)&rgd->rd_list,
-						  (osi_list_t *)&sdp->sd_rglist);
-		gfs_rindex_in(&rgd->rd_ri, (char *)&buf);
-		if(fs_compute_bitstructs(rgd)){
-			goto fail;
-		}
-		rgd->rd_open_count = 0;
-		count1++;
-	}
-	log_debug("%u resource groups found.\n", rg);
-	for (tmp = (osi_list_t *)sdp->sd_rglist.next;
-		 tmp != (osi_list_t *)&sdp->sd_rglist; tmp = tmp->next) {
-		rgd = osi_list_entry(tmp, struct gfs_rgrpd, rd_list);
-		error = fs_rgrp_read(disk_fd, rgd, FALSE);
-		if (error) {
-			log_err("Unable to read in rgrp descriptor.\n");
-			goto fail;
-		}
-		fs_rgrp_relse(rgd);
-		count2++;
-	}
-	if (count1 != count2) {
-		log_err("Rgrps allocated (%d) does not equal"
-				" rgrps read (%d).\n", count1, count2);
-		goto fail;
-	}
-	sdp->sd_rgcount = count1;
-	return 0;
-
- fail:
-	while(!osi_list_empty((osi_list_t *)&sdp->sd_rglist)){
-		rgd = osi_list_entry((osi_list_t *)sdp->sd_rglist.next,
-							 struct gfs_rgrpd, rd_list);
-		if(rgd->rd_bits)
-			free(rgd->rd_bits);
-		if(rgd->rd_bh)
-			free(rgd->rd_bh);
-		osi_list_del((osi_list_t *)&rgd->rd_list);
-		free(rgd);
-	}
-	return -1;
-}
-
-/**
- * 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
- */
-int set_block_ranges(int disk_fd, struct gfs_sbd *sdp)
-{
-	struct gfs_jindex *jdesc;
-	struct gfs_rgrpd *rgd;
-	struct gfs_rindex *ri;
-	osi_list_t *tmp;
-	char buf[sdp->sd_sb.sb_bsize];
-	uint64 rmax = 0;
-	uint64 jmax = 0;
-	uint64 rmin = 0;
-	uint64 i;
-	int error;
-
-	log_info("Setting block ranges...\n");
-
-	for (tmp = (osi_list_t *)sdp->sd_rglist.next;
-		 tmp != (osi_list_t *)&sdp->sd_rglist; tmp = tmp->next)
-	{
-		rgd = osi_list_entry(tmp, struct gfs_rgrpd, rd_list);
-		ri = &rgd->rd_ri;
-		if (ri->ri_data1 + ri->ri_data - 1 > rmax)
-			rmax = ri->ri_data1 + ri->ri_data - 1;
-		if (!rmin || ri->ri_data1 < rmin)
-			rmin = ri->ri_data1;
-	}
-
-
-	for (i = 0; i < sdp->sd_journals; i++)
-	{
-		jdesc = &sdp->sd_jindex[i];
-
-		if ((jdesc->ji_addr+jdesc->ji_nsegment*sdp->sd_sb.sb_seg_size-1)
-		    > jmax)
-			jmax = jdesc->ji_addr + jdesc->ji_nsegment
-				* sdp->sd_sb.sb_seg_size - 1;
-	}
-
-	sdp->last_fs_block = (jmax > rmax) ? jmax : rmax;
-
-	sdp->last_data_block = rmax;
-	sdp->first_data_block = rmin;
-
-	if(do_lseek(disk_fd, (sdp->last_fs_block * sdp->sd_sb.sb_bsize))){
-		log_crit("Can't seek to last block in file system: %"
-			 PRIu64"\n", sdp->last_fs_block);
-		goto fail;
-	}
-
-	memset(buf, 0, sdp->sd_sb.sb_bsize);
-	error = read(disk_fd, buf, sdp->sd_sb.sb_bsize);
-	if (error != sdp->sd_sb.sb_bsize){
-		log_crit("Can't read last block in file system (%u), "
-			 "last_fs_block: %"PRIu64"\n",
-			 error, sdp->last_fs_block);
-		goto fail;
-	}
-
-	return 0;
-
- fail:
-	return -1;
-}
-
-int write_sb(int disk_fd, struct gfs_sbd *sbp)
-{
-	int error = 0;
-	osi_buf_t *bh;
-
-	error = get_and_read_buf(disk_fd, sbp->sd_sb.sb_bsize,
-							 GFS_SB_ADDR >> sbp->sd_fsb2bb_shift, &bh, 0);
-	if (error){
-		log_crit("Unable to read superblock\n");
-		goto out;
-	}
-
-	memset(BH_DATA(bh), 0, sbp->sd_sb.sb_bsize);
-	gfs_sb_out(&sbp->sd_sb, BH_DATA(bh));
-
-	/* FIXME: Should this set the BW_WAIT flag? */
-	if((error = write_buf(disk_fd, bh, 0))) {
-		stack;
-		goto out;
-	}
-
-	relse_buf(bh);
-out:
-	return error;
-
-}
-
-/**
- * read_super_block
- * @sdp:
- *
- * Returns: 0 on success, -1 on failure
- */
-int read_super_block(int disk_fd, struct gfs_sbd *sdp)
-{
-	uint32_t i;
-
-	sync();
-
-	/********************************************************************
-	 ***************** First, initialize all lists **********************
-	 ********************************************************************/
-	log_info("Initializing lists...\n");
-	osi_list_init((osi_list_t *)&sdp->sd_rglist);
-	for(i = 0; i < FSCK_HASH_SIZE; i++) {
-		osi_list_init(&sdp->dir_hash[i]);
-		osi_list_init(&sdp->inode_hash[i]);
-	}
-
-	/********************************************************************
-	 ************  next, read in on-disk SB and set constants  **********
-	 ********************************************************************/
-	sdp->sd_sb.sb_bsize = 512;
-	if (sdp->sd_sb.sb_bsize < GFS_BASIC_BLOCK)
-		sdp->sd_sb.sb_bsize = GFS_BASIC_BLOCK;
-
-	if(sizeof(struct gfs_sb) > sdp->sd_sb.sb_bsize){
-		log_crit("GFS superblock is larger than the blocksize!\n");
-		log_debug("sizeof(struct gfs_sb) > sdp->sb.sb_bsize\n");
-		return -1;
-	}
-
-	if(read_sb(disk_fd, sdp) < 0){
-		return -1;
-	}
-
-	return 0;
-}
diff --git a/gfs/libgfs/util.c b/gfs/libgfs/util.c
deleted file mode 100644
index 6e1b34c..0000000
--- a/gfs/libgfs/util.c
+++ /dev/null
@@ -1,271 +0,0 @@
-#include "libgfs.h"
-
-/**
- * compute_height
- * @sdp:
- * @sz:
- *
- */
-int compute_height(struct gfs_sbd *sdp, uint64 sz)
-{
-  unsigned int height;
-  uint64 space, old_space;
-  unsigned int bsize = sdp->sd_sb.sb_bsize;
-
-  if (sz <= (bsize - sizeof(struct gfs_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;
-}
-
-
-/*
- * 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 check_range(struct gfs_sbd *sdp, uint64 blkno){
-	if((blkno > sdp->last_fs_block) ||
-	   (blkno < sdp->first_data_block))
-		return -1;
-	return 0;
-}
-
-
-/*
- * set_meta - set the meta header of a buffer
- * @bh
- * @type
- *
- * Returns: 0 if ok, -1 on error
- */
-int set_meta(osi_buf_t *bh, int type, int format){
-  struct gfs_meta_header header;
-
-  if(!check_meta(bh, 0)){
-	  log_debug("Setting metadata\n");
-    ((struct gfs_meta_header *)BH_DATA(bh))->mh_type = cpu_to_gfs32(type);
-    ((struct gfs_meta_header *)BH_DATA(bh))->mh_format = cpu_to_gfs32(format);
-  } else {
-    memset(&header, 0, sizeof(struct gfs_meta_header));
-    header.mh_magic = GFS_MAGIC;
-    header.mh_type = type;
-    header.mh_format = format;
-
-    gfs_meta_header_out(&header, BH_DATA(bh));
-  }
-  return 0;
-}
-
-
-
-
-/*
- * check_meta - check the meta header of a buffer
- * @bh: buffer to check
- * @type: meta type (or 0 if don't care)
- *
- * Returns: 0 if ok, -1 on error
- */
-int check_meta(osi_buf_t *bh, int type){
-  uint32 check_magic = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_magic;
-  uint32 check_type = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
- 
-  check_magic = gfs32_to_cpu(check_magic);
-  check_type = gfs32_to_cpu(check_type);
-  if((check_magic != GFS_MAGIC) || (type && (check_type != type))){
-	  log_debug("For %"PRIu64" Expected %X:%X - got %X:%X\n", BH_BLKNO(bh), GFS_MAGIC, type,
-		    check_magic, check_type);
-    return -1;
-  }
-  return 0;
-}
-
-/*
- * check_type - check the meta type of a buffer
- * @bh: buffer to check
- * @type: meta type
- *
- * Returns: 0 if ok, -1 on error
- */
-int check_type(osi_buf_t *bh, int type){
-  uint32 check_magic = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_magic;
-  uint32 check_type = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
- 
-  check_magic = gfs32_to_cpu(check_magic);
-  check_type = gfs32_to_cpu(check_type);
-  if((check_magic != GFS_MAGIC) || (check_type != type)){
-    return -1;
-  }
-  return 0;
-}
-
-/**
- * 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 next_rg_meta(struct gfs_rgrpd *rgd, uint64 *block, int first)
-{
-  struct gfs_bitmap *bits = NULL;
-  uint32 length = rgd->rd_ri.ri_length;
-  uint32 blk = (first)? 0: (uint32)((*block+1)-rgd->rd_ri.ri_data1);
-  int i;
-
-  if(!first && (*block < rgd->rd_ri.ri_data1)){
-    log_err("next_rg_meta:  Start block is outside rgrp bounds.\n");
-    exit(1);
-  }
-
-  for(i=0; i < length; i++){
-    bits = &rgd->rd_bits[i];
-    if(blk < bits->bi_len*GFS_NBBY){
-      break;
-    }
-    blk -= bits->bi_len*GFS_NBBY;
-  }
-
-
-  for(; i < length; i++){
-    bits = &rgd->rd_bits[i];
-
-    blk = fs_bitfit((unsigned char *)BH_DATA(rgd->rd_bh[i]) + bits->bi_offset,
-                    bits->bi_len, blk, GFS_BLKST_USEDMETA);
-
-    if(blk != BFITNOENT){
-	    *block = blk + (bits->bi_start * GFS_NBBY) + rgd->rd_ri.ri_data1;
-	    break;
-    }
-
-    blk=0;
-  }
-
-  if(i == length){
-    return -1;
-  }
-  return 0;
-}
-
-/**
- * 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 next_rg_meta_free(struct gfs_rgrpd *rgd, uint64 *block, int first, int *mfree)
-{
-  struct gfs_bitmap *bits = NULL;
-  uint32 length = rgd->rd_ri.ri_length;
-  uint32 blk = (first)? 0: (uint32)((*block+1)-rgd->rd_ri.ri_data1);
-  uint32 ublk, fblk;
-  int i;
-
-  if(!first && (*block < rgd->rd_ri.ri_data1)){
-    log_err("next_rg_meta:  Start block is outside rgrp bounds.\n");
-    exit(1);
-  }
-
-  for(i=0; i < length; i++){
-    bits = &rgd->rd_bits[i];
-    if(blk < bits->bi_len*GFS_NBBY){
-      break;
-    }
-    blk -= bits->bi_len*GFS_NBBY;
-  }
-
-
-  for(; i < length; i++){
-    bits = &rgd->rd_bits[i];
-
-    ublk = fs_bitfit((unsigned char *)BH_DATA(rgd->rd_bh[i]) + bits->bi_offset,
-                    bits->bi_len, blk, GFS_BLKST_USEDMETA);
-
-    fblk = fs_bitfit((unsigned char *)BH_DATA(rgd->rd_bh[i]) + bits->bi_offset,
-			     bits->bi_len, blk, GFS_BLKST_FREEMETA);
-    if(ublk < fblk) {
-	    blk = ublk;
-	    *mfree = 0;
-    } else {
-	    blk = fblk;
-	    *mfree = 1;
-    }
-    if(blk != BFITNOENT){
-	    *block = blk + (bits->bi_start * GFS_NBBY) + rgd->rd_ri.ri_data1;
-	    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 next_rg_metatype(int disk_fd, struct gfs_rgrpd *rgd, uint64 *block,
-					 uint32 type, int first)
-{
-  struct gfs_sbd *sdp = rgd->rd_sbd;
-  osi_buf_t *bh=NULL;
-
-  do{
-    relse_buf(bh);
-    if(next_rg_meta(rgd, block, first))
-      return -1;
-
-    if (get_and_read_buf(disk_fd, sdp->sd_sb.sb_bsize, *block, &bh, 0)){
-      log_err("next_rg_metatype:  Unable to read meta block "
-	      "#%"PRIu64" from disk\n", *block);
-      exit(1);
-    }
-
-    if(check_meta(bh,0)){
-      log_err("next_rg_metatype:  next_rg_meta returned block #%"PRIu64",\n"
-	      "                   which is not a valid meta block.\n", *block);
-      exit(1);
-    }
-
-    first = 0;
-  } while(check_meta(bh, type));
-  relse_buf(bh);
-
-  return 0;
-}
diff --git a/gfs/man/Makefile b/gfs/man/Makefile
deleted file mode 100644
index 3895ff7..0000000
--- a/gfs/man/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGET= gfs.8 \
-	gfs_mount.8 \
-	gfs_edit.8 \
-	gfs_fsck.8 \
-	gfs_grow.8 \
-	gfs_jadd.8 \
-	gfs_mkfs.8 \
-	gfs_quota.8 \
-	gfs_tool.8
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/man.mk
diff --git a/gfs/man/gfs.8 b/gfs/man/gfs.8
deleted file mode 100644
index 22ab82f..0000000
--- a/gfs/man/gfs.8
+++ /dev/null
@@ -1,37 +0,0 @@
-.TH gfs 8
-
-.SH NAME
-gfs \- GFS reference guide
-
-.SH SYNOPSIS
-Overview of manpages and their locations
-
-.SH DESCRIPTION
-The GFS 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
-gfs
-GFS overview (this man page)
-.TP
-gfs_mount
-Mounting a GFS file system
-.TP
-gfs_fsck
-The GFS file system checker
-.TP
-gfs_grow
-Growing a GFS file system
-.TP
-gfs_jadd
-Adding a journal to a GFS file system
-.TP
-gfs_mkfs
-Make a GFS file system
-.TP
-gfs_quota
-Manipulate GFS disk quotas 
-.TP
-gfs_tool
-Tool to manipulate a GFS file system
-
diff --git a/gfs/man/gfs_edit.8 b/gfs/man/gfs_edit.8
deleted file mode 100644
index 0a53b8b..0000000
--- a/gfs/man/gfs_edit.8
+++ /dev/null
@@ -1 +0,0 @@
-.so man8/gfs2_edit.8
diff --git a/gfs/man/gfs_fsck.8 b/gfs/man/gfs_fsck.8
deleted file mode 100644
index e0894f0..0000000
--- a/gfs/man/gfs_fsck.8
+++ /dev/null
@@ -1,59 +0,0 @@
-.TH gfs_fsck 8
-
-.SH NAME
-gfs_fsck - Offline GFS file system checker
-
-.SH SYNOPSIS
-.B gfs_fsck
-[\fIOPTION\fR]... \fIDEVICE\fR
-
-.SH WARNING
-All GFS nodes \fImust\fP have the GFS filesystem unmounted before running
-gfs_fsck.  Failure to unmount all nodes may result in filesystem corruption.
-
-.SH DESCRIPTION
-gfs_fsck will check that the GFS 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
-gfs_fsck can do.  If important file system structures are destroyed, such that
-the checker can not determine what the repairs should be, reparations could
-fail.
-
-GFS 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 GFS can not
-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, gfs_fsck will only show the changes that
-would be made, not make any changes to the filesystem.
-.TP
-\fB-V\fP
-Version.
-
-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, gfs_fsck will not prompt before making
-changes.
diff --git a/gfs/man/gfs_grow.8 b/gfs/man/gfs_grow.8
deleted file mode 100644
index 6b0f144..0000000
--- a/gfs/man/gfs_grow.8
+++ /dev/null
@@ -1,63 +0,0 @@
-.TH gfs_grow 8
-
-.SH NAME
-gfs_grow - Expand a GFS filesystem
-
-.SH SYNOPSIS
-.B gfs_grow
-[\fIOPTION\fR]... <\fIDEVICE\fR|\fIMOINTPOINT\fR>...
-
-.SH DESCRIPTION
-gfs_grow is used to expand a GFS filesystem after the device
-upon which the filesystem resides has also been expanded.  By
-running gfs_grow on a GFS 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 GFS
-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 gfs_grow on a mounted filesystem; expansion of 
-unmounted filesystems is not supported.  You only need to
-run gfs_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 \fBgfs_grow\fP.  The gfs_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 gfs_grow with the \fB-Tv\fP flags to get a display
-of the current state of a mounted GFS filesystem.  This can be useful
-to do after the expansion process to see if the changes have been 
-successful.
-
-\fBgfs_grow\fP will consume all the remaining space in a device and add
-it to the filesystem.  If you want to add journals too, you need to add
-the journals first using \fBgfs_jadd\fP.
-
-.SH OPTIONS
-.TP 
-\fB-h\fP
-Prints out a short usage message and exits.
-.TP
-\fB-q\fP
-Quiet. Turns down the verbosity level.
-.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. You probably want to turn the
-verbosity level up in order to gain most information from this option.
-.TP
-\fB-V\fP
-Version. Print out version information, then exit.
-.TP
-\fB-v\fP
-Verbose. Turn up verbosity of messages.
-
-.SH SEE ALSO
-gfs_mkfs(8) gfs_jadd(8)
diff --git a/gfs/man/gfs_jadd.8 b/gfs/man/gfs_jadd.8
deleted file mode 100644
index 94975cf..0000000
--- a/gfs/man/gfs_jadd.8
+++ /dev/null
@@ -1,75 +0,0 @@
-.TH gfs_jadd 8
-
-.SH NAME
-gfs_jadd \- Add journals to a GFS filesystem
-
-.SH SYNOPSIS
-.B gfs_jadd
-[\fIOPTION\fR]... <\fIDEVICE\fR|\fIMOINTPOINT\fR>...
-
-.SH DESCRIPTION
-\fIgfs_jadd\fR is used to add journals to a GFS filesystem after
-the device upon which the filesystem resides has been grown.
-By running \fIgfs_jadd\fR
-on a GFS filesystem, you are filling in space between the current end
-of the filesystem and the end of the device upon which the filesystem
-resides.  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.
-
-\fIgfs_jadd\fR will not use space that has been formatted for filesystem data even if that space has never been populated with files.
-
-You may only run \fIgfs_jadd\fR on a mounted filesystem, addition of journals to 
-unmounted filesystems is not supported.  
-You only need to run \fIgfs_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 \fIgfs_jadd\fR. The
-\fIgfs_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.
-
-You can run \fIgfs_jadd\fR with the \fI-Tv\fR
-flags to get a display of the current state of a mounted GFS filesystem.
-This can be useful to do after the journal addition process to see if the
-changes have been successful.
-
-.SH OPTIONS
-.TP
-\fB-j num\fP
-The number of new journals to add. This defaults to 1.
-.TP
-\fB-J size\fP
-The size of the new journals in megabytes. The defaults to 128MB (the
-minimum size allowed is 32MB). If you want to add journals of different
-sizes to the filesystem, you'll need to run gfs_jadd once for each
-different size of journal. The size you specify here will be rounded
-down so that it is a multiple of the journal segment size which was
-specified at filesystem creation time.
-.TP
-\fB-h\fP
-Help. Prints out a short usage message and exits.
-.TP
-\fB-q\fP
-Quiet. Turns down the verbosity level.
-.TP
-\fB-T\fP
-Test. Do all calculations, but do not write any data to the disk and do
-not add journals. This is used to discover what the tool would
-have done were it run without this flag. You probably want to turn the
-verbosity level up in order to gain most information from this option.
-.TP
-\fB-V\fP
-Version. Print version information, then exit.
-.TP
-\fB-v\fP
-Verbose. Turn up verbosity of messages.
-
-.SH SEE ALSO
-gfs_mkfs(8) gfs_grow(8)
diff --git a/gfs/man/gfs_mkfs.8 b/gfs/man/gfs_mkfs.8
deleted file mode 100644
index 3da48cb..0000000
--- a/gfs/man/gfs_mkfs.8
+++ /dev/null
@@ -1,82 +0,0 @@
-.TH gfs_mkfs 8
-
-.SH NAME
-gfs_mkfs - Make a GFS filesystem
-
-.SH SYNOPSIS
-.B gfs_mkfs
-[\fIOPTION\fR]... \fIDEVICE\fR
-
-.SH DESCRIPTION
-gfs_mkfs 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, GFS filesystems should not deviate from the default value.
-.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 32 megabytes.
-.TP
-\fB-j\fP \fINumber\fR 
-The number of journals for gfs_mkfs to create.  You need at least one
-journal per machine that will mount the filesystem.
-.TP
-\fB-O\fP
-This option prevents gfs_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.  The locking
-protocol should be \fIlock_dlm\fR for a clustered file system or if you 
-are using GFS as a local filesystem (\fB1 node only\fP), you can specify the
-\fIlock_nolock\fR protocol.
-.TP
-\fB-q\fP
-Be quiet.  Don't print anything.
-.TP
-\fB-r\fP \fIMegaBytes\fR
-gfs_mkfs will try to make Resource Groups (RGs) 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, gfs_mkfs 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-s\fP \fIBlocks\fR 
-Journal segment size in filesystem blocks.  This value must be at
-least two and not large enough to produce a segment size greater than
-4MB.
-.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 GFS file
-system from others created (1 to 16 characters).  Lock_nolock doesn't
-use this field.
-.TP
-\fB-V\fP
-Print program version information, then exit.
-
-.SH EXAMPLE
-.TP
-gfs_mkfs -t mycluster:mygfs -p lock_dlm -j 2 /dev/vg0/mygfs
-This will make a Global File System on the block device
-"/dev/vg0/mygfs".  It will belong to "mycluster" and register itself
-as wanting locking for "mygfs".  It will use DLM for locking and make
-two journals.
diff --git a/gfs/man/gfs_mount.8 b/gfs/man/gfs_mount.8
deleted file mode 100644
index e2e842b..0000000
--- a/gfs/man/gfs_mount.8
+++ /dev/null
@@ -1,193 +0,0 @@
-.TH gfs_mount 8
-
-.SH NAME
-gfs_mount - GFS mount options
-
-.SH SYNOPSIS
-.B mount
-[\fIStandardMountOptions\fR] \fB-t\fP gfs \fIDEVICE\fR \fIMOUNTPOINT\fR \fB-o\fP [GFSOption1,GFSOption2,GFSOptionX...]
-
-.SH DESCRIPTION
-GFS 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 GFS filesystem, using the
-\fBmount\fP(8) command.  The \fIdevice\fR may be any block device on which you
-have created a GFS 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 GFS 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 GFS-specific options that can be passed to the GFS 
-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 GFS, and are not
-interpreted by the mount command nor by the kernel's Virtual File System.  GFS
-and non-GFS 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 gfs using "gfs_tool margs" (after loading the gfs kernel
-module, but before mounting GFS).  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:
-
-# gfs_tool margs "lockproto=lock_nolock,ignore_local_fs"
-
-Options loaded via "gfs_tool margs" have a lifetime of only one GFS
-mount.  If you wish to mount another GFS filesystem, you must set
-another group of options with "gfs_tool margs".
-
-If you have trouble mounting GFS, 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 GFS 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 \fBgfs_mkfs\fP(8), -p option.  It can be changed on-disk by
-using the \fBgfs_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 GFS
-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 \fBgfs_mkfs\fP(8), -t option.  It can be changed on-disk
-by using the \fBgfs_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 GFS 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 GFS 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 GFS.  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
-\fBoopses_ok\fP
-Normally, GFS automatically turns on the "kernel.panic_on_oops"
-sysctl to cause the machine to panic if an oops (an in-kernel
-segfault or GFS assertion failure) happens.  An oops on one machine of
-a cluster filesystem can cause the filesystem to stall on all machines
-in the cluster.  (Panics don't have this "feature".)  By turning on
-"panic_on_oops", GFS tries to make sure the cluster remains in
-operation even if one machine has a problem.  There are cases,
-however, where this behavior is not desirable -- debugging being
-the main one.  The \fBoopses_ok\fP option causes GFS to leave the
-"panic_on_oops" variable alone so oopses can happen.  Use this option
-with care.
-
-This is turned on automatically by the lock_nolock module,
-but can be overridden by using the \fBignore_local_fs\fP option.
-.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 GFS 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 GFS to upgrade the filesystem's on-disk format to the version
-supported by the current GFS software installation on this computer.
-If you try to mount an old-version disk image, GFS 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 GFS
-filesystem.
-.TP
-\fBnum_glockd\fP
-Tunes GFS to alleviate memory pressure when rapidly acquiring many locks (e.g.
-several processes scanning through huge directory trees).  GFS' 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 32.  Since this option was introduced, other
-methods of rapid cleanup have been developed within GFS, so this option may go
-away in the future.
-.TP
-\fBacl\fP
-Enables POSIX Access Control List \fBacl\fP(5) support within GFS.
-.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.
-
-.SH LINKS
-.TP 30
-http://sources.redhat.com/cluster
--- home site of GFS
-.TP
-http://www.suse.de/~agruen/acl/linux-acls/
--- good writeup on ACL support in Linux
-
-.SH SEE ALSO
-
-\fBgfs\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/gfs/man/gfs_quota.8 b/gfs/man/gfs_quota.8
deleted file mode 100644
index bc905ac..0000000
--- a/gfs/man/gfs_quota.8
+++ /dev/null
@@ -1,101 +0,0 @@
-.TH gfs_quota 8
-
-.SH NAME
-gfs_quota - Manipulate GFS disk quotas
-
-.SH SYNOPSIS
-.B gfs_quota
-<list|sync|get|limit|warn|check|init> [\fIOPTION\fR]...
-
-.SH DESCRIPTION
-gfs_quota is used to examine and change quota values in a GFS filesystem.
-This command has a number of different actions.
-
-.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: GFS 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 GFS filesystem (pre-GFS 5.1).
-
-.SH OPTIONS
-\fB-b\fP
-The units for disk space are filesystem blocks.
-.TP
-\fB-d\fP
-Don't include the space allocated to GFS' hidden files in
-what's reported for the root UID and GID values.  This is useful
-if you're trying to get the numbers reported by gfs_quota to match
-up with the numbers reported by du.
-.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 /gfs0
-
-gfs_quota limit -l 1048576 -k -u nobody -f /gfs0
-
diff --git a/gfs/man/gfs_tool.8 b/gfs/man/gfs_tool.8
deleted file mode 100644
index fe78259..0000000
--- a/gfs/man/gfs_tool.8
+++ /dev/null
@@ -1,137 +0,0 @@
-.TH gfs_tool 8
-
-.SH NAME
-gfs_tool - interface to gfs ioctl calls
-
-.SH SYNOPSIS
-.B gfs_tool
-\fICOMMAND\fR [\fIOPTION\fR]...
-
-.SH DESCRIPTION
-gfs_tool is an interface to a variety of the GFS ioctl calls.
-
-.SH COMMANDS
-.TP
-\fBclearflag\fP \fIFlag\fR \fIFile1\fR \fIFile2\fR \fI...\fR 
-Clear an attribute flag on a file.
-.TP
-\fBcounters\fP \fIMountPoint\fR [-c]
-Print out statistics about a filesystem.  If -c is used, gfs_tool continues
-to run printing out the stats once a second.
-.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
-\fBfreeze\fP \fIMountPoint\fR
-Freeze (quiesce) a GFS cluster.
-.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
-\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 gfs_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 GFS filesystems.  Each line represents
-a filesystem.  The columns represent (in order): 1) A number that
-is a cookie that represents the mounted filesystem. 2) The name of the
-device that holds the filesystem (well, the name as the Linux
-kernel knows it). 3) The lock table field that the filesystem was
-mounted with.
-.TP
-\fBlockdump\fP \fIMountPoint\fR \fI[buffersize]\fR
-Print out information about the locks this machine holds for a given
-filesystem. Buffersize is the size of the buffer (in bytes) that gfs_tool
-allocates to store the lock data during processing.  It defaults to 4194304
-bytes.
-.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 gfs_mount(8).
-.TP
-\fBreclaim\fP \fIFile\fR
-Returns unused on-disk metadata blocks to free blocks.
-.TP
-\fBrindex\fP \fIMountPoint\fR
-Print out the resource group index of a mounted filesystem.
-.TP
-\fBquota\fP \fIMountPoint\fR
-Print out the quota file of a mounted filesystem.  Also see
-the "gfs_quota list" command.
-.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.  There are four currently
-supported flags.  They are jdata, directio, inherit_jdata, and
-inherit_directio.
-  
-The \fIjdata\fR flag causes all the data written to a regular file
-to be journaled. The jdata flag can only be set (or cleared) if the file
-is zero length.
-
-The \fIdirectio\fR flag causes all I/O to a regular file to be Direct
-I/O, even if the O_DIRECT flag isn't used on the open() command.
-
-The \fIinherit_jdata\fR flag is set on a directory.  It causes all new
-regular files created in that directory automatically inherit the
-\fIjdata\fR flag.  The \fIinherit_jdata\fR is also inherited by any new
-subdirectories created in that directory.
-
-The \fIinherit_directio\fR flag is set on a directory.  It causes all new
-regular files created in that directory automatically inherit the
-\fIdirectio\fR flag.  The \fIinherit_directio\fR is also inherited by
-any new subdirectories created in that directory.
-.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 inodes 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 GFS cluster.
-.TP
-\fBversion\fP
-Print out the version of GFS that this program goes with.
-.TP
-\fBwithdraw\fP \fIMountPoint\fR
-Cause GFS to abnormally shutdown a given filesystem on this node.
-
diff --git a/gfs/tests/Makefile b/gfs/tests/Makefile
deleted file mode 100644
index 5b2e7c0..0000000
--- a/gfs/tests/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../make/defines.mk
-include $(OBJDIR)/make/passthrough.mk
-
-SUBDIRS=filecon2 mmdd
diff --git a/gfs/tests/filecon2/Makefile b/gfs/tests/filecon2/Makefile
deleted file mode 100644
index d443a70..0000000
--- a/gfs/tests/filecon2/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-TARGETS= filecon2_server filecon2_client
-
-all: $(TARGETS)
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-
-CFLAGS += -O3
-CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-CFLAGS += -I../../include
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${libdir}
-
-%: %.o
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-clean: generalclean
diff --git a/gfs/tests/filecon2/filecon2.h b/gfs/tests/filecon2/filecon2.h
deleted file mode 100644
index 96e03b7..0000000
--- a/gfs/tests/filecon2/filecon2.h
+++ /dev/null
@@ -1,146 +0,0 @@
-#ifndef __FILECON2_DOT_H__
-#define __FILECON2_DOT_H__
-
-
-
-/*  Extern Macro  */
-
-#ifndef EXTERN
-#define EXTERN extern
-#define INIT(X)
-#else
-#undef EXTERN
-#define EXTERN
-#define INIT(X) =X 
-#endif
-
-
-
-#define die(fmt, args...) \
-do \
-{ \
-  fprintf(stderr, "%s: ", prog_name); \
-  fprintf(stderr, fmt, ##args); \
-  exit(EXIT_FAILURE); \
-} \
-while (0)
-
-#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 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, buf, len) \
-do \
-{ \
-  int do_read_out; \
-  do_read_out = read((fd), (buf), (len)); \
-  if (do_read_out != (len)) \
-    die("bad read: result = %d (%s) on line %d of file %s\n", \
-        do_read_out, strerror(errno), __LINE__, __FILE__); \
-} \
-while (0)
-
-#define do_write(fd, buf, len) \
-do \
-{ \
-  int do_write_out; \
-  do_write_out = write((fd), (buf), (len)); \
-  if (do_write_out != (len)) \
-    die("bad write: result = %d (%s) on line %d of file %s\n", \
-        do_write_out, strerror(errno), __LINE__, __FILE__); \
-} \
-while (0)
-
-#define do_ftruncate(fd, off) \
-do \
-{ \
-  if (ftruncate((fd), (off)) < 0) \
-    die("bad truncate: %s on line %d of file %s\n", \
-	strerror(errno), __LINE__, __FILE__); \
-} \
-while (0)
-
-#define RAND(x) ((x) * (random() / (RAND_MAX + 1.0)))
-
-#define DIV_RU(x, y) (((x) + (y) - 1) / (y))
-
-
-
-#define FILECON2_PORT       (12046)
-#define FILECON2_MAGIC      (0x76543210)
-
-#define FCR_READ_BUFFERED   (16241)
-#define FCR_READ_DIRECT     (16242)
-#define FCR_READ_MMAPPED    (16243)
-#define FCR_WRITE_BUFFERED  (16244)
-#define FCR_WRITE_DIRECT    (16245)
-#define FCR_WRITE_MMAPPED   (16246)
-#define FCR_TRUNC           (16247)
-#define FCR_NOP             (16248)
-#define FCR_SEED            (16249)
-#define FCR_STOP            (16250)
-
-struct filecon2_request
-{
-  uint32 magic;
-  uint32 type;
-  uint32 length;
-  uint32 data;
-  uint64 offset;
-};
-typedef struct filecon2_request filecon2_request_t;
-
-static __inline__ void request_in(filecon2_request_t *req, char *buf)
-{
-  filecon2_request_t *str = (filecon2_request_t *)buf;
-  req->magic = be32_to_cpu(str->magic);
-  req->type = be32_to_cpu(str->type);
-  req->length = be32_to_cpu(str->length);
-  req->data = be32_to_cpu(str->data);
-  req->offset = be64_to_cpu(str->offset);
-}
-
-static __inline__ void request_out(filecon2_request_t *req, char *buf)
-{
-  filecon2_request_t *str = (filecon2_request_t *)buf;
-  str->magic = cpu_to_be32(req->magic);
-  str->type = cpu_to_be32(req->type);
-  str->length = cpu_to_be32(req->length);
-  str->data = cpu_to_be32(req->data);
-  str->offset = cpu_to_be64(req->offset);
-}
-
-
-EXTERN char *prog_name;
-EXTERN pid_t pid;
-
-
-#endif  /*  __FILECON2_DOT_H__  */
-
diff --git a/gfs/tests/filecon2/filecon2_client.c b/gfs/tests/filecon2/filecon2_client.c
deleted file mode 100644
index a2196c6..0000000
--- a/gfs/tests/filecon2/filecon2_client.c
+++ /dev/null
@@ -1,841 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <time.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-
-#include "global.h"
-#include "linux_endian.h"
-#define EXTERN
-#include "filecon2.h"
-
-
-
-#ifndef O_DIRECT
-#define O_DIRECT (0)
-#warning O_DIRECT is broken
-#endif
-#ifndef PAGE_SIZE
-#define PAGE_SIZE (65536)
-#endif
-
-#define CHANCES (8)
-
-#define PATTERN_RAND      (12341)
-#define PATTERN_OPNUM     (12342)
-
-
-
-struct operation
-{
-  char *name;
-  void (*func)();
-};
-typedef struct operation operation_t;
-
-
-
-unsigned int port = FILECON2_PORT;
-unsigned int seed = 0;
-uint64 offset = 0;
-uint64 length = 1048576;
-uint32 chunk = 1024;
-unsigned int pattern = PATTERN_RAND;
-int buffered = FALSE;
-int direct = FALSE;
-int mmapped = FALSE;  
-int trunc = FALSE;
-int nop = FALSE;
-unsigned int align = 1;
-int reread = FALSE;
-int respect_eof = FALSE;
-int check_file_size = FALSE;
-int verbose = FALSE;
-char *servername = NULL;
-char *filename = NULL;
-
-int user_seed = FALSE;
-int fd_b = -1, fd_d = -1;
-int sock;
-
-int first = FALSE;
-unsigned char *mmap_data = NULL;
-
-uint64 file_size;
-unsigned int opnum;
-
-float chances[CHANCES];
-
-
-
-
-
-void rand_extent(uint64 *o, uint32 *l)
-{
-  uint64 off;
-  uint32 len;
-
-  if (align > 1)
-  {
-    do
-    {
-      off = RAND(length / align);
-      len = RAND(chunk / align) + 1;
-      off *= align;
-      len *= align;
-    }
-    while (off + len > length);
-  }
-  else
-  {
-    do
-    {
-      off = RAND(length);
-      len = RAND(chunk) + 1;
-    }
-    while (off + len > length);
-  }
-
-  *o = off;
-  *l = len;
-}
-
-
-void fill_pattern(unsigned char *data, unsigned int len)
-{
-  unsigned int x;
-
-  switch (pattern)
-  {
-  case PATTERN_RAND:
-    while (len--)
-      *data++ = RAND(256);
-    break;
-
-  case PATTERN_OPNUM:
-    x = cpu_to_be32(opnum);
-    while (len)
-    {
-      if (len > sizeof(unsigned int))
-      {
-	memcpy(data, &x, sizeof(unsigned int));
-	data += sizeof(unsigned int);
-	len -= sizeof(unsigned int);
-      }
-      else
-      {
-	memcpy(data, &x, len);
-	break;
-      }
-    }
-    break;
-
-  default:
-    die("unknown pattern\n");
-  }
-}
-
-
-void do_first()
-{
-  filecon2_request_t req;
-  unsigned char data[sizeof(filecon2_request_t) + 1];
-
-  memset(&req, 0, sizeof(filecon2_request_t));
-  req.magic = FILECON2_MAGIC;
-  req.type = FCR_WRITE_BUFFERED;
-  req.length = 1;
-  req.data = 1;
-  req.offset = offset + length - 1;
-
-  fill_pattern(data + sizeof(filecon2_request_t), 1);
-
-  do_lseek(fd_b, offset + length - 1);
-  do_write(fd_b, data + sizeof(filecon2_request_t), 1);
-
-  request_out(&req, data);
-  do_write(sock, data, sizeof(filecon2_request_t) + 1);
-
-  mmap_data = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd_b, offset);
-  if (mmap_data == MAP_FAILED)
-    die("can't mmap file: %s\n", strerror(errno));
-
-  first = FALSE;
-}
-
-
-void do_check_file_size()
-{
-  struct stat st;
-  int error;
-
-  error = fstat(fd_b, &st);
-  if (error)
-    die("can't stat file: %s\n", strerror(errno));
-
-  if (file_size != st.st_size)
-    die("file size mismatch (server = %"PRIu64", me = %"PRIu64")\n",
-	file_size, st.st_size);
-}
-
-
-void op_buffered_read()
-{
-  filecon2_request_t req;
-  uint64 off;
-  uint32 len;
-  unsigned char *data;
-  int error;
-
-  rand_extent(&off, &len);
-  off += offset;
-
-  memset(&req, 0, sizeof(filecon2_request_t));
-  req.magic = FILECON2_MAGIC;
-  req.type = FCR_READ_BUFFERED;
-  req.length = len;
-  req.data = len;
-  req.offset = off;
-
-  type_alloc(data, char, sizeof(filecon2_request_t) + len);
-
-  do_lseek(fd_b, off);
-  error = read(fd_b, data + sizeof(filecon2_request_t), len);
-  if (error < 0)
-    die("error reading from file: %s\n", strerror(errno));
-  req.data = error;
-
-  request_out(&req, data);
-  do_write(sock, data, sizeof(filecon2_request_t) + req.data);
-
-  free(data);
-}
-
-
-void op_buffered_write()
-{
-  filecon2_request_t req;
-  uint64 off;
-  uint32 len;
-  unsigned char *data;
-
-  rand_extent(&off, &len);
-  off += offset;
-
-  memset(&req, 0, sizeof(filecon2_request_t));
-  req.magic = FILECON2_MAGIC;
-  req.type = FCR_WRITE_BUFFERED;
-  req.length = len;
-  req.data = len;
-  req.offset = off;
-
-  type_alloc(data, char, sizeof(filecon2_request_t) + len);
-
-  fill_pattern(data + sizeof(filecon2_request_t), len);
-
-  do_lseek(fd_b, off);
-  do_write(fd_b, data + sizeof(filecon2_request_t), len);
-
-  if (reread)
-  {
-    unsigned char *data_reread;
-
-    type_alloc(data_reread, char, len);
-
-    do_lseek(fd_b, off);
-    do_read(fd_b, data_reread, len);
-
-    if (memcmp(data + sizeof(filecon2_request_t), data_reread, len) != 0)
-      die("buffered write: bad reread\n");
-
-    free(data_reread);
-  }
-
-  request_out(&req, data);
-  do_write(sock, data, sizeof(filecon2_request_t) + req.data);
-
-  free(data);
-}
-
-
-void op_direct_read()
-{
-  filecon2_request_t req;
-  uint64 off;
-  uint32 len;
-  unsigned char *data, *data_orig;
-  unsigned int remainder;
-  int error;
-
-  if (respect_eof)
-  {
-    if (file_size < offset + align)
-    {
-      off = offset;
-      len = 0;
-    }
-    else
-      for (;;)
-      {
-	rand_extent(&off, &len);
-	off += offset;
-	if (off + len <= file_size)
-	  break;
-      }
-  }
-  else
-  {
-    rand_extent(&off, &len);
-    off += offset;
-  }
-
-  memset(&req, 0, sizeof(filecon2_request_t));
-  req.magic = FILECON2_MAGIC;
-  req.type = FCR_READ_DIRECT;
-  req.length = len;
-  req.data = len;
-  req.offset = off;
-
-  data = data_orig = malloc(sizeof(filecon2_request_t) + len + PAGE_SIZE);
-  if (!data)
-    die("out of memory\n");
-  remainder = ((unsigned long)(data + sizeof(filecon2_request_t))) & (PAGE_SIZE - 1);
-  if (remainder)
-    data += PAGE_SIZE - remainder;
-
-  do_lseek(fd_d, off);
-  error = read(fd_d, data + sizeof(filecon2_request_t), len);
-  if (error < 0)
-    die("error reading from file: %s\n", strerror(errno));
-  req.data = error;
-
-  request_out(&req, data);
-  do_write(sock, data, sizeof(filecon2_request_t) + req.data);
-
-  free(data_orig);
-}
-
-
-void op_direct_write()
-{
-  filecon2_request_t req;
-  uint64 off;
-  uint32 len;
-  unsigned char *data, *data_orig;
-  unsigned int remainder;
-
-  rand_extent(&off, &len);
-  off += offset;
-
-  memset(&req, 0, sizeof(filecon2_request_t));
-  req.magic = FILECON2_MAGIC;
-  req.type = FCR_WRITE_DIRECT;
-  req.length = len;
-  req.data = len;
-  req.offset = off;
-
-  data = data_orig = malloc(sizeof(filecon2_request_t) + len + PAGE_SIZE);
-  if (!data)
-    die("out of memory\n");
-  remainder = ((unsigned long)(data + sizeof(filecon2_request_t))) & (PAGE_SIZE - 1);
-  if (remainder)
-    data += PAGE_SIZE - remainder;
-
-  fill_pattern(data + sizeof(filecon2_request_t), len);
-
-  do_lseek(fd_d, off);
-  do_write(fd_d, data + sizeof(filecon2_request_t), len);
-
-  if (reread)
-  {
-    unsigned char *data_reread, *data_reread_orig;
-
-    data_reread = data_reread_orig = malloc(len + PAGE_SIZE);
-    if (!data_reread)
-      die("out of memory\n");
-    remainder = ((unsigned long)data_reread) & (PAGE_SIZE - 1);
-    if (remainder)
-      data_reread += PAGE_SIZE - remainder;
-
-    do_lseek(fd_d, off);
-    do_read(fd_d, data_reread, len);
-
-    if (memcmp(data + sizeof(filecon2_request_t), data_reread, len) != 0)
-      die("direct write: bad reread\n");
-
-    free(data_reread_orig);
-  }
-
-  request_out(&req, data);
-  do_write(sock, data, sizeof(filecon2_request_t) + req.data);
-
-  free(data_orig);
-}
-
-
-void op_mmapped_read()
-{
-  filecon2_request_t req;
-  uint64 off;
-  uint32 len;
-  unsigned char *data;
-
-  rand_extent(&off, &len);
-
-  memset(&req, 0, sizeof(filecon2_request_t));
-  req.magic = FILECON2_MAGIC;
-  req.type = FCR_READ_MMAPPED;
-  req.length = len;
-  req.data = len;
-  req.offset = offset + off;
-
-  type_alloc(data, char, sizeof(filecon2_request_t) + len);
-
-  memcpy(data + sizeof(filecon2_request_t), mmap_data + off, len);
-
-  request_out(&req, data);
-  do_write(sock, data, sizeof(filecon2_request_t) + req.data);
-
-  free(data);
-}
-
-
-void op_mmapped_write()
-{
-  filecon2_request_t req;
-  uint64 off;
-  uint32 len;
-  unsigned char *data;
-
-  rand_extent(&off, &len);
-
-  memset(&req, 0, sizeof(filecon2_request_t));
-  req.magic = FILECON2_MAGIC;
-  req.type = FCR_WRITE_MMAPPED;
-  req.length = len;
-  req.data = len;
-  req.offset = offset + off;
-
-  type_alloc(data, char, sizeof(filecon2_request_t) + len);
-
-  fill_pattern(data + sizeof(filecon2_request_t), len);
-
-  memcpy(mmap_data + off, data + sizeof(filecon2_request_t), len);
-
-  if (reread)
-  {
-    if (memcmp(mmap_data + off, data + sizeof(filecon2_request_t), len) != 0)
-      die("mmapped write: bad reread\n");
-  }
-
-  request_out(&req, data);
-  do_write(sock, data, sizeof(filecon2_request_t) + req.data);
-
-  free(data);
-}
-
-
-void op_trunc()
-{
-  filecon2_request_t req;
-  uint64 off;
-  unsigned char data[sizeof(filecon2_request_t)];
-
-  if (align > 1)
-  {
-    off = RAND((length / align) + 1);
-    off *= align;
-  }
-  else
-    off = RAND(length + 1);
-
-  off += offset;
-
-  memset(&req, 0, sizeof(filecon2_request_t));
-  req.magic = FILECON2_MAGIC;
-  req.type = FCR_TRUNC;
-  req.offset = off;
-
-  do_ftruncate(fd_b, off);
-
-  request_out(&req, data);
-  do_write(sock, data, sizeof(filecon2_request_t));
-}
-
-
-void op_nop()
-{
-  filecon2_request_t req;
-  unsigned char data[sizeof(filecon2_request_t)];
-
-  memset(&req, 0, sizeof(filecon2_request_t));
-  req.magic = FILECON2_MAGIC;
-  req.type = FCR_NOP;
-
-  request_out(&req, data);
-  do_write(sock, data, sizeof(filecon2_request_t));
-}
-
-
-const static operation_t ops[] =
-{
-  { "buffered read", op_buffered_read },
-  { "buffered write", op_buffered_write },
-  { "direct read", op_direct_read },
-  { "direct write", op_direct_write },
-  { "mmapped read", op_mmapped_read },
-  { "mmapped write", op_mmapped_write },
-  { "truncate", op_trunc },
-  { "nop", op_nop },
-};
-
-
-int do_op()
-{
-  filecon2_request_t req;
-  unsigned char buf[sizeof(filecon2_request_t)];
-  float c, x = 0.0;
-  unsigned int op;
-
-
-  do_read(sock, buf, sizeof(filecon2_request_t));
-  request_in(&req, buf);
-
-  if (req.magic != FILECON2_MAGIC)
-    die("magic number mismatch\n");
-  if (req.type == FCR_STOP)
-    return FALSE;
-  if (req.type)
-    die("strange message from server\n");
-
-  file_size = req.offset;
-  opnum = req.length;
-
-
-  if (first)
-  {
-    do_first();
-    return TRUE;
-  }
-  else if (check_file_size)
-    do_check_file_size();
-
-
-  for (;;)
-  {
-    op = 0;
-    c = RAND(1);
-
-    for (;;)
-    {
-      if (chances[op])
-      {
-	x += chances[op];
-	if (x > c)
-	{
-	  ops[op].func();
-	  return TRUE;
-	}
-      }
-
-      op++;
-      if (op == CHANCES)
-	break;
-    }
-  }
-
-
-  die("D'oh!\n");
-}
-
-
-void compute_chances()
-{
-  unsigned int x;
-  float sum = 0.0;
-
-  for (x = 0; x < CHANCES; x++)
-    chances[x] = 0.0;
-
-  if (buffered)
-  {
-    chances[0] = 1.0;
-    chances[1] = 1.0;
-  }
-  if (direct)
-  {
-    chances[2] = 1.0;
-    chances[3] = 1.0;
-  }
-  if (mmapped)
-  {
-    chances[4] = 1.0;
-    chances[5] = 1.0;
-  }
-  if (trunc)
-    chances[6] = 0.1;
-  if (nop)
-    chances[7] = 0.1;
-
-  for (x = 0; x < CHANCES; x++)
-    sum += chances[x];
-
-  for (x = 0; x < CHANCES; x++)
-    chances[x] /= sum;
-}
-
-
-void do_seed()
-{
-  filecon2_request_t req;
-  unsigned char buf[sizeof(filecon2_request_t)];
-
-  do_read(sock, buf, sizeof(filecon2_request_t));
-  request_in(&req, buf);
-
-  if (req.magic != FILECON2_MAGIC)
-    die("magic number mismatch\n");
-  if (req.type != FCR_SEED)
-    die("strange message from server\n");
-
-  if (!user_seed)
-    seed = req.length;
-
-  if (verbose)
-    printf("\nseed = %u\n", seed);
-
-  srandom(seed);
-}
-
-
-int main(int argc, char *argv[])
-{
-  int optchar, cont = TRUE;
-  struct hostent *hname;
-  struct sockaddr_in sin;
-  unsigned int x;
-  int error;
-
-
-  prog_name = argv[0];
-  pid = getpid();
-
-
-  if (argc < 3)
-  {
-    fprintf(stderr, "%s usage:\n\n", prog_name);
-    fprintf(stderr, "%s -p <port> -s <seed> -o <offset> -l <length> -c <chunksize> -f <pattern> -b -d -m -t -n -a <align> -r -e -x -v server file\n\n", prog_name);
-    fprintf(stderr, "  -p <port>          Port to connect to\n");
-    fprintf(stderr, "  -s <seed>          Seed for the random number generator\n");
-    fprintf(stderr, "  -o <offset>        The start of the active region in bytes\n");
-    fprintf(stderr, "  -l <length>        The length of the active region in bytes\n");
-    fprintf(stderr, "  -c <chunksize>     Read/Write up to this amount in one I/O\n");
-    fprintf(stderr, "  -f <pattern>       Do writes with this pattern (rand, opnum)\n");
-    fprintf(stderr, "  -b                 Do buffered I/O\n");
-    fprintf(stderr, "  -d                 Do direct I/O\n");
-    fprintf(stderr, "  -m                 Do memory mapped I/O\n");
-    fprintf(stderr, "  -t                 Do truncates\n");
-    fprintf(stderr, "  -n                 Do nops\n");
-    fprintf(stderr, "  -a <align>         I/O should be aligned to multiples of this value\n");
-    fprintf(stderr, "  -r                 Reread writes\n");
-    fprintf(stderr, "  -e                 Don't try to read past the EOF when doing Direct I/O\n");
-    fprintf(stderr, "  -x                 Always check to make sure the file's size is correct\n");
-    fprintf(stderr, "  -v                 Be verbose\n");
-    exit(EXIT_FAILURE);
-  }
-
-  while (cont)
-  {
-    optchar = getopt(argc, argv, "p:s:o:l:c:f:bdmtna:rexv");
-    switch (optchar)
-    {
-    case 'p':
-      sscanf(optarg, "%u", &port);
-      break;
-    case 's':
-      sscanf(optarg, "%u", &seed);
-      user_seed = TRUE;
-      break;
-    case 'o':
-      sscanf(optarg, "%"SCNu64"", &offset);
-      break;
-    case 'l':
-      sscanf(optarg, "%"SCNu64"", &length);
-      break;
-    case 'c':
-      sscanf(optarg, "%u", &chunk);
-      break;
-    case 'f':
-      if (strcmp(optarg, "rand") == 0)
-	pattern = PATTERN_RAND;
-      else if (strcmp(optarg, "opnum") == 0)
-	pattern = PATTERN_OPNUM;
-      else
-	die("unknown pattern %s\n", optarg);
-      break;
-    case 'b':
-      buffered = TRUE;
-      break;
-    case 'd':
-      direct = TRUE;
-      break;
-    case 'm':
-      mmapped = TRUE;
-      break;
-    case 't':
-      trunc = TRUE;
-      break;
-    case 'n':
-      nop = TRUE;
-      break;
-    case 'a':
-      sscanf(optarg, "%u", &align);
-      break;
-    case 'r':
-      reread = TRUE;
-      break;
-    case 'e':
-      respect_eof = TRUE;
-      break;
-    case 'x':
-      check_file_size = TRUE;
-      break;
-    case 'v':
-      verbose = TRUE;
-      break;
-    case EOF:
-      cont = FALSE;
-      break;
-    default:
-      die("bad argument\n");
-    }
-  }
-
-  if (optind < argc)
-    servername = argv[optind++];
-  else
-    die("no servername\n");
-
-  if (optind < argc)
-    filename = argv[optind++];
-  else
-    die("no filename\n");
-
-  if (port >= 65536)
-    die("invalid port number: %u\n", port);
-
-  if (align > chunk || chunk > length)
-    die("bad sizes, should be: -a <= -c < = -l\n");
-
-  if (offset % align)
-    die("offset not aligned\n");
-
-  if (mmapped)
-  {
-    if (trunc)
-      die("can't do both -m and -t\n");
-    first = TRUE;
-  }
-
-
-  compute_chances();
-
-
-  if (verbose)
-  {
-    printf("port = %u\n", port);
-    if (user_seed)
-      printf("seed = %u\n", seed);
-    else
-      printf("seed = <ProvidedByServer>\n");
-    printf("offset = %"PRIu64"\n", offset);
-    printf("length = %"PRIu64"\n", length);
-    printf("chunk = %u\n", chunk);
-    switch (pattern)
-    {
-    case PATTERN_RAND:
-      printf("pattern = rand\n");
-      break;
-    case PATTERN_OPNUM:
-      printf("pattern = opnum\n");
-      break;
-    default:
-      printf("pattern = unknown\n");
-      break;
-    }
-    printf("buffered = %d\n", buffered);
-    printf("direct = %d\n", direct);
-    printf("mmapped = %d\n", mmapped);  
-    printf("trunc = %d\n", trunc);
-    printf("nop = %d\n", nop);
-    printf("align = %u\n", align);
-    printf("reread = %d\n", reread);
-    printf("respect_eof = %d\n", respect_eof);
-    printf("check_file_size = %d\n", check_file_size);
-    printf("verbose = %d\n", verbose);
-    printf("servername = %s\n", servername);
-    printf("filename = %s\n", filename);
-
-    printf("\n");
-    for (x = 0; x < CHANCES; x++)
-      printf("%s %f\n", ops[x].name, chances[x]);
-  }
-
-
-  fd_b = open(filename, O_RDWR);
-  if (fd_b < 0)
-    die("can't open file %s: %s\n", filename, strerror(errno));
-
-  if (direct)
-  {
-    fd_d = open(filename, O_RDWR | O_DIRECT);
-    if (fd_d < 0)
-      die("can't open file %s: %s\n", filename, strerror(errno));
-  }
-
-
-  hname = gethostbyname(servername);
-  if (!hname)
-    die("can't resolve host %s: %s\n", servername, strerror(errno));
-
-  sock = socket(AF_INET, SOCK_STREAM, 0);
-  if (sock < 0)
-    die("can't open socket: %s\n", strerror(errno));
-
-  sin.sin_family = AF_INET;
-  sin.sin_addr.s_addr = *((uint32 *)*(hname->h_addr_list));
-  sin.sin_port = cpu_to_be16(port);
- 
-  error = connect(sock, (struct sockaddr *)&sin, sizeof(struct sockaddr_in));
-  if (error < 0)
-    die("can't connect to host %s (%u): %s\n", servername, port, strerror(errno));
-
-
-  do_seed();
-
-
-  while (do_op()) /* Do nothing */;
-
-
-  close(sock);
-  if (direct)
-    close(fd_d);
-  if (mmap_data)
-    munmap(mmap_data, length);
-  close(fd_b);
-
-
-  exit(EXIT_SUCCESS);
-}
-
-
-
diff --git a/gfs/tests/filecon2/filecon2_server.c b/gfs/tests/filecon2/filecon2_server.c
deleted file mode 100644
index bc59124..0000000
--- a/gfs/tests/filecon2/filecon2_server.c
+++ /dev/null
@@ -1,597 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <time.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-
-#include "global.h"
-#include "osi_list.h"
-#include "linux_endian.h"
-#define EXTERN
-#include "filecon2.h"
-
-
-
-struct log
-{
-  osi_list_t list;
-  unsigned int cli;
-  filecon2_request_t req;
-};
-typedef struct log log_t;
-
-
-
-int fd = -1;
-unsigned int clients = 0;
-struct sockaddr_in *ssin = NULL;
-int *sock = NULL;
-unsigned int t = 0;
-
-int log = FALSE;
-osi_list_decl(log_list);
-
-
-
-
-
-char *type2string(unsigned int type)
-{
-  char *type_string;
-
-  switch (type)
-  {
-  case FCR_READ_BUFFERED:
-    type_string = "read(b)";
-    break;
-  case FCR_READ_DIRECT:
-    type_string = "read(d)";
-    break;
-  case FCR_READ_MMAPPED:
-    type_string = "read(m)";
-    break;
-  case FCR_WRITE_BUFFERED:
-    type_string = "write(b)";
-    break;
-  case FCR_WRITE_DIRECT:
-    type_string = "write(d)";
-    break;
-  case FCR_WRITE_MMAPPED:
-    type_string = "write(m)";
-    break;
-  case FCR_TRUNC:
-    type_string = "trunc";
-    break;
-  case FCR_NOP:
-    type_string = "nop";
-    break;
-  case FCR_SEED:
-    type_string = "seed";
-    break;
-  case FCR_STOP:
-    type_string = "stop";
-    break;
-  default:
-    type_string = "unknown";
-    break;
-  }
-
-  return type_string;
-}
-
-
-void request_print(unsigned int cli, filecon2_request_t *req)
-{
-  printf("Request from %u/%.8X/%.4X:\n",
-	 cli, be32_to_cpu(ssin[cli].sin_addr.s_addr), be16_to_cpu(ssin[cli].sin_port));
-  printf("  magic = 0x%X\n", req->magic);
-  printf("  type = %s (%u)\n", type2string(req->type), req->type);
-  printf("  length = %u\n", req->length);
-  printf("  data = %u\n", req->data);
-  printf("  offset = %"PRIu64"\n", req->offset);
-}
-
-
-void dump_data(filecon2_request_t *req, unsigned char *client, unsigned char *server)
-{
-  FILE *outfile;
-  unsigned int x;
-  unsigned int first = (unsigned int)-1, last = (unsigned int)-1;
-  uint64 f1, l1, f2, l2;
-
-  for (x = 0; x < req->data; x++)
-    if (client[x] != server[x])
-    {
-      first = x;
-      break;
-    }
-
-  if (first == (unsigned int)-1)
-    die("blerg1\n");
-
-  for (x = req->data; x--; )
-    if (client[x] != server[x])
-    {
-      last = x;
-      break;
-    }
-
-  if (last == (unsigned int)-1)
-    die("blerg2\n");
-
-  f1 = req->offset + first;
-  l1 = req->offset + last;
-
-  printf("Error range (%"PRIu64" - %"PRIu64"), (%u - %u) \n",
-	 f1, l1, first, last);
-
-  if (log)
-  {
-    osi_list_t *tmp, *head;
-    log_t *l;
-    unsigned int t = 0;
-
-    for (head = &log_list, tmp = head->next;
-	 tmp != head;
-	 tmp = tmp->next, t++)
-    {
-      l = osi_list_entry(tmp, log_t, list);
-
-      if (l->req.type == FCR_NOP)
-	continue;
-      else if (l->req.type == FCR_TRUNC)
-      {
-	f2 = l->req.offset;
-	l2 = l->req.offset;
-      }
-      else
-      {
-	f2 = l->req.offset;
-	l2 = l->req.offset + l->req.data - 1;
-      }
-
-      if ((f1 <= f2 && f2 <= l1) ||
-	  (f1 <= l2 && l2 <= l1) ||
-	  (f2 <= f1 && f1 <= l2) ||
-	  (f2 <= l1 && l1 <= l2))
-      {
-	printf("%.7u: %u/%.8X/%.4X: %s (%"PRIu64" - %"PRIu64")\n",
-	       t,
-	       l->cli, be32_to_cpu(ssin[l->cli].sin_addr.s_addr), be16_to_cpu(ssin[l->cli].sin_port),
-	       type2string(l->req.type),
-	       f2, l2);
-      }
-    }
-  }
-
-  outfile = fopen("out.client", "w");
-  if (!outfile)
-    die("can't open file %s: %s\n", "out.client", strerror(errno));
-  for (x = 0; x < req->data; x++)
-  {
-    fprintf(outfile, "%.2X", client[x]);
-    if (x % 32 == 31)
-      fprintf(outfile, "\n");
-  }
-  if (x % 32)
-    fprintf(outfile, "\n");
-  fclose(outfile);
-
-  outfile = fopen("out.server", "w");
-  if (!outfile)
-    die("can't open file %s: %s\n", "out.server", strerror(errno));
-  for (x = 0; x < req->data; x++)
-  {
-    fprintf(outfile, "%.2X", server[x]);
-    if (x % 32 == 31)
-      fprintf(outfile, "\n");
-  }
-  if (x % 32)
-    fprintf(outfile, "\n");
-  fclose(outfile);
-}
-
-
-void do_op(unsigned int cli)
-{
-  struct stat st;
-  filecon2_request_t req;
-  unsigned char buf[sizeof(filecon2_request_t)];
-  uint64 first, last;
-  unsigned char *data1 = NULL;
-  unsigned char *data2;
-  unsigned int x = 0;
-  int error;
-
-  error = fstat(fd, &st);
-  if (error)
-    die("can't stat file: %s\n", strerror(errno));
-
-  memset(&req, 0, sizeof(filecon2_request_t));
-  req.magic = FILECON2_MAGIC;
-  req.length = t;
-  req.offset = st.st_size;
-  request_out(&req, buf);
-  do_write(sock[cli], buf, sizeof(filecon2_request_t));
-
-  do_read(sock[cli], buf, sizeof(filecon2_request_t));
-  request_in(&req, buf);
-
-  if (req.magic != FILECON2_MAGIC)
-  {
-    request_print(cli, &req);
-    die("magic number mismatch\n");
-  }
-
-  if (req.type == FCR_NOP)
-    first = last = 0;
-  else if (req.type == FCR_TRUNC)
-    first = last = req.offset;
-  else
-  {
-    first = req.offset;
-    last = req.offset + req.data - 1;
-  }
-
-  printf("%.7u: %d/%u/%.8X/%.4X: %s (%"PRIu64" - %"PRIu64")\n",
-	 t, pid,
-	 cli, be32_to_cpu(ssin[cli].sin_addr.s_addr), be16_to_cpu(ssin[cli].sin_port),
-	 type2string(req.type),
-	 first, last);
-
-  if (log)
-  {
-    log_t *l;
-    l = malloc(sizeof(log_t));
-    if (!l)
-      die("out of memory\n");
-    memset(l, 0, sizeof(log_t));
-    l->cli = cli;
-    l->req = req;
-    osi_list_add_prev(&l->list, &log_list);
-  }
-
-  if (req.data)
-  {
-    data1 = malloc(req.data);
-    if (!data1)
-    {
-      request_print(cli, &req);
-      die("out of memory\n");
-    }
-
-    for (;;)
-    {
-      error = read(sock[cli], data1 + x, req.data - x);
-      if (error < 0)
-      {
-	request_print(cli, &req);
-	die("can't read from socket: %s\n", strerror(errno));
-      }
-
-      x += error;
-
-      if (x == req.data)
-	break;
-      if (x > req.data)
-      {
-	request_print(cli, &req);
-	die("data overflow from client: %u\n", x);
-      }
-    }
-  }
-
-  if (req.type == FCR_READ_BUFFERED ||
-      req.type == FCR_READ_MMAPPED)
-  {
-    data2 = malloc(req.data + 1);  /*  req.data might be zero  */;
-    if (!data2)
-    {
-      request_print(cli, &req);
-      die("out of memory\n");
-    }
-
-    do_lseek(fd, req.offset);
-    error = read(fd, data2, req.length);
-    if (error < 0)
-    {
-      request_print(cli, &req);
-      die("bad read from file: %s\n", strerror(errno));
-    }
-
-    if (error != req.data)
-    {
-      request_print(cli, &req);
-      die("length mismatch from read: %u\n", error);
-    }
-    if (req.data && memcmp(data1, data2, req.data) != 0)
-    {
-      request_print(cli, &req);
-      dump_data(&req, data1, data2);
-      die("value mismatch\n");
-    }
-
-    free(data2);
-  }
-  else if (req.type == FCR_READ_DIRECT)
-  {
-    data2 = malloc(req.length + 1);
-    if (!data2)
-    {
-      request_print(cli, &req);
-      die("out of memory\n");
-    }
-
-    do_lseek(fd, req.offset);
-    error = read(fd, data2, req.length);
-    if (error < 0)
-    {
-      request_print(cli, &req);
-      die("bad read from file: %s\n", strerror(errno));
-    }
-
-    /*  FixMe!!!  */
-    if (error < req.data || error - req.data > 4096)
-    {
-      request_print(cli, &req);
-      die("length mismatch from read: %u\n", error);
-    }
-    if (req.data && memcmp(data1, data2, req.data) != 0)
-    {
-      request_print(cli, &req);
-      dump_data(&req, data1, data2);
-      die("value mismatch\n");
-    }
-
-    free(data2);
-  }
-  else if (req.type == FCR_WRITE_BUFFERED ||
-	   req.type == FCR_WRITE_DIRECT ||
-	   req.type == FCR_WRITE_MMAPPED)
-  {
-    if (!req.data)
-    {
-      request_print(cli, &req);
-      die("no data to write\n");
-    }
-    if (req.length != req.data)
-    {
-      request_print(cli, &req);
-      die("length != data on write\n");
-    }
-
-    do_lseek(fd, req.offset);
-    error = write(fd, data1, req.length);
-    if (error < 0)
-    {
-      request_print(cli, &req);
-      die("bad write to file: %s\n", strerror(errno));
-    }
-    if (error != req.length)
-    {
-      request_print(cli, &req);
-      die("short write: %u\n", error);
-    }
-  }
-  else if (req.type == FCR_TRUNC)
-  {
-    error = ftruncate(fd, req.offset);
-    if (error)
-    {
-      request_print(cli, &req);
-      die("bad truncate: %s\n", strerror(errno));
-    }
-  }
-  else if (req.type == FCR_NOP)
-  {
-    /*  Do nothing  */
-  }
-  else
-  {
-    request_print(cli, &req);
-    die("strange message from client\n");
-  }
-
-  if (req.data)
-    free(data1);
-}
-
-
-void do_seed(int sock)
-{
-  filecon2_request_t req;
-  unsigned char buf[sizeof(filecon2_request_t)];
-
-  memset(&req, 0, sizeof(filecon2_request_t));
-  req.magic = FILECON2_MAGIC;
-  req.type = FCR_SEED;
-  req.length = random();
-  request_out(&req, buf);
-  do_write(sock, buf, sizeof(filecon2_request_t));
-}
-
-
-void do_stop(int sock)
-{
-  filecon2_request_t req;
-  unsigned char buf[sizeof(filecon2_request_t)];
-
-  memset(&req, 0, sizeof(filecon2_request_t));
-  req.magic = FILECON2_MAGIC;
-  req.type = FCR_STOP;
-  request_out(&req, buf);
-  do_write(sock, buf, sizeof(filecon2_request_t));
-}
-
-
-int main(int argc, char *argv[])
-{
-  unsigned int port = FILECON2_PORT;
-  unsigned int seed = time(NULL) ^ getpid();
-  unsigned int wait_clients = 1;
-  unsigned int to = 0;
-  char *filename;
-
-  int optchar, cont = TRUE;
-  int asking_sock;
-  int trueint = TRUE;
-  struct sockaddr_in sin;
-  fd_set fds;
-  struct timeval tv;
-  unsigned int size;
-  unsigned int cli;
-  int error;
-
-
-  prog_name = argv[0];
-  pid = getpid();
-
-
-  if (argc < 2)
-  {
-    fprintf(stderr, "%s usage:\n\n", prog_name);
-    fprintf(stderr, "%s -p <port> -s <seed> -w <clients> -t <to> filename\n\n", prog_name);
-    fprintf(stderr, "  -p <port>          The port to listen on (%u by default)\n", FILECON2_PORT);
-    fprintf(stderr, "  -s <seed>          Seed for the random number generator\n");
-    fprintf(stderr, "  -w <clients>       Wait for a number of clients to join\n");
-    fprintf(stderr, "  -t <to>            Only do a given number of operations\n");
-    fprintf(stderr, "  -l                 Log operations for error reporting\n");
-    exit(EXIT_FAILURE);
-  }
-
-  while (cont)
-  {
-    optchar = getopt(argc, argv, "p:s:w:t:l");
-    switch (optchar)
-    {
-    case 'p':
-      sscanf(optarg, "%u", &port);
-      break;
-    case 's':
-      sscanf(optarg, "%u", &seed);
-      break;
-    case 'w':
-      sscanf(optarg, "%u", &wait_clients);
-      break;
-    case 't':
-      sscanf(optarg, "%u", &to);
-      break;
-    case 'l':
-      log = TRUE;
-      break;
-    case EOF:
-      cont = FALSE;
-      break;
-    default:
-      die("bad argument\n");
-    }
-  }
-
-  if (optind < argc)
-    filename = argv[optind];
-  else
-    die("no filename\n");
-
-  if (port >= 65536)
-    die("invalid port number: %u\n", port);
-
-
-  srandom(seed);
-
-
-  fd = open(filename, O_RDWR, 0644);
-  if (fd < 0)
-    die("can't open file %s: %s\n", filename, strerror(errno));
-
-
-  asking_sock = socket(AF_INET, SOCK_STREAM, 0);
-  if (asking_sock < 0)
-    die("can't open socket: %s\n", strerror(errno));
-
-  error = setsockopt(asking_sock, SOL_SOCKET, SO_REUSEADDR, &trueint, sizeof(int));
-  if (error < 0)
-    die("can't set SO_REUSEADDR: %s\n", strerror(errno));
-
-  sin.sin_family = AF_INET;
-  sin.sin_addr.s_addr = INADDR_ANY;
-  sin.sin_port = cpu_to_be16(port);
-
-  error = bind(asking_sock, (struct sockaddr *)&sin, sizeof(struct sockaddr_in));
-  if (error < 0)
-    die("can't bind to port %u: %s\n", port, strerror(errno));
-
-  error = listen(asking_sock, 5);
-  if (error < 0)
-    die("can't bind to socket: %s\n", strerror(errno));
-
-  
-  for (;;)
-  {
-    FD_ZERO(&fds);
-    FD_SET(asking_sock, &fds);
-    tv.tv_sec = 0;
-    tv.tv_usec = 0;
-
-    error = select(asking_sock + 1, &fds, NULL, NULL,
-		   (clients < wait_clients) ? NULL : &tv);
-    if (error < 0)
-      die("can't select: %s\n", strerror(errno));
-
-    if (error)  /*  Add a new client  */
-    {
-      cli = clients;
-      clients++;
-
-      sock = realloc(sock, clients * sizeof(int));
-      if (!sock)
-	die("can't alloc memory: %s\n", strerror(errno));
-      ssin = realloc(ssin, clients * sizeof(struct sockaddr_in));
-      if (!ssin)
-	die("can't alloc memory: %s\n", strerror(errno));
-
-      size = sizeof(struct sockaddr_in);
-      sock[cli] = accept(asking_sock, &ssin[cli], &size);
-      if (sock[cli] < 0)
-	die("can't accept: %s\n", strerror(errno));
-
-      do_seed(sock[cli]);
-
-      printf("connect %u/%.8X/%.4X\n",
-	     cli, be32_to_cpu(ssin[cli].sin_addr.s_addr), be16_to_cpu(ssin[cli].sin_port));
-    }
-
-    if (clients < wait_clients)
-      continue;
-
-
-    cli = RAND(clients);
-    do_op(cli);
-    t++;
-
-    if (to && t == to)
-      break;
-  }
-
-
-  for (cli = 0; cli < clients; cli++)
-  {
-    do_stop(sock[cli]);
-    close(sock[cli]);
-  }
-  close(fd);
-
-
-  exit(EXIT_SUCCESS);
-}
-
-
-
diff --git a/gfs/tests/mmdd/Makefile b/gfs/tests/mmdd/Makefile
deleted file mode 100644
index eb9cc9e..0000000
--- a/gfs/tests/mmdd/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-TARGETS= mmdd sfdd
-
-all: $(TARGETS)
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/clean.mk
-
-CFLAGS += -D_GNU_SOURCE
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${libdir}
-
-mmdd.o: mmdd.c
-	$(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ $<
-
-sfdd.o: mmdd.c
-	$(CC) $(CFLAGS) -DUSE_SENDFILE -c -o $@ $<
-
-%: %.o
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-clean: generalclean
-
--include mmdd.d
--include sfdd.d
diff --git a/gfs/tests/mmdd/mmdd.c b/gfs/tests/mmdd/mmdd.c
deleted file mode 100644
index 3864f71..0000000
--- a/gfs/tests/mmdd/mmdd.c
+++ /dev/null
@@ -1,703 +0,0 @@
-#ifdef __linux__
-#else
-#undef USE_SENDFILE
-#endif
-
-#ifdef __FreeBSD__
-#define O_SYNC O_FSYNC
-#else
-#endif
-
-#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/time.h>
-#include <sys/mman.h>
-#ifdef USE_SENDFILE
-#include <sys/sendfile.h>
-#endif
-
-
-
-#define die(fmt, args...) \
-do \
-{ \
-  fprintf(stderr, "%s: ", prog_name); \
-  fprintf(stderr, fmt, ##args); \
-  exit(EXIT_FAILURE); \
-} \
-while (0)
-
-#define TRUE (1)
-#define FALSE (0)
-
-
-
-#ifndef O_DIRECT
-#define O_DIRECT (0)
-#warning O_DIRECT is broken
-#endif
-#ifndef PAGE_SIZE
-#define PAGE_SIZE (65536)
-#endif
-
-
-
-char *prog_name;
-off_t read_offset = 0;
-off_t write_offset = 0;
-int private = FALSE;
-
-
-
-
-
-#ifdef USE_SENDFILE
-void send_sendfile(int ifd, int ofd, unsigned bs)
-{
-  int count;
-
-  count = sendfile(ofd, ifd, &read_offset, bs);
-  if (count != bs)
-    die("Bad sendfile return %d: %s\n", count, strerror(errno));   
-
-  write_offset += bs;
-}
-#endif
-
-
-void do_bothmapped(int ifd, int ofd, unsigned bs)
-{
-  char *data_in;
-  char *data_out;
-
-  data_in = mmap(NULL, bs, PROT_READ, (private) ? MAP_PRIVATE : MAP_SHARED, ifd, read_offset);
-  if (data_in == MAP_FAILED)
-    die("can't mmap file: %s\n", strerror(errno));
-
-  data_out = mmap(NULL, bs, PROT_READ | PROT_WRITE, (private) ? MAP_PRIVATE : MAP_SHARED, ofd, write_offset);
-  if (data_out == MAP_FAILED)
-    die("can't mmap file: %s\n", strerror(errno));
-  
-  memcpy(data_out, data_in, bs);
-
-  munmap(data_in, bs);
-  munmap(data_out, bs);
-
-  read_offset += bs;
-  write_offset += bs;
-}
-
-
-void do_imapped(int ifd, int ofd, unsigned bs)
-{
-  char *data;
-  int count;
-
-  data = mmap(NULL, bs, PROT_READ, (private) ? MAP_PRIVATE : MAP_SHARED, ifd, read_offset);
-  if (data == MAP_FAILED)
-    die("can't mmap file: %s\n", strerror(errno));
-
-  count = write(ofd, data, bs);
-  if (count != bs)
-    die("bad write return %d: %s\n", count, strerror(errno));
-
-  munmap(data, bs);
-
-  read_offset += bs;
-  write_offset += bs;
-}
-
-
-void do_omapped(int ifd, int ofd, unsigned bs)
-{
-  char *data;
-  int count;
-
-  data = mmap(NULL, bs, PROT_READ | PROT_WRITE, (private) ? MAP_PRIVATE : MAP_SHARED, ofd, write_offset);
-  if (data == MAP_FAILED)
-    die("can't mmap file: %s\n", strerror(errno));
-
-  count = read(ifd, data, bs);
-  if (count != bs)
-    die("bad read return %d: %s\n", count, strerror(errno));
-  
-  munmap(data, bs);
-
-  read_offset += bs;
-  write_offset += bs;
-}
-
-
-void do_mapped_read(int fd, char *buf, unsigned int bs)
-{
-  char *data;
-
-  data = mmap(NULL, bs, PROT_READ, (private) ? MAP_PRIVATE : MAP_SHARED, fd, read_offset);
-  if (data == MAP_FAILED)
-    die("can't mmap file: %s\n", strerror(errno));
-
-  memcpy(buf, data, bs);
-
-  munmap(data, bs);
-
-  read_offset += bs;
-}
-
-
-void do_raw_read(int fd, char *buf, unsigned int bs)
-{
-  int count;
-
-  count = read(fd, buf, bs);
-  if (count != bs)
-    die("bad read return %d: %s\n", count, strerror(errno));
-}
-
-
-void do_mapped_write(int fd, char *buf, unsigned int bs)
-{
-  char *data;
-
-  data = mmap(NULL, bs, PROT_READ | PROT_WRITE, (private) ? MAP_PRIVATE : MAP_SHARED, fd, write_offset);
-  if (data == MAP_FAILED)
-    die("can't mmap file: %s\n", strerror(errno));
-
-  memcpy(data, buf, bs);
-
-  munmap(data, bs);
-
-  write_offset += bs;
-}
-
-
-void do_raw_write(int fd, char *buf, unsigned int bs)
-{
-  int count;
-
-  count = write(fd, buf, bs);
-  if (count != bs)
-    die("bad write return %d: %s\n", count, strerror(errno));
-}
-
-
-int main(int argc, char *argv[])
-{
-  int arg;
-
-  char *ifname = NULL;
-  char *ofname = NULL;
-  int imapped = FALSE, omapped = FALSE;
-  unsigned int bs = 4096;
-  unsigned long long move = 0;
-  unsigned long long count = 0;
-  unsigned long long skip = 0;
-  unsigned long long seek = 0;
-  int do_fsync = FALSE;
-  int do_osync = FALSE;
-  int verbose = FALSE;
-  int notrunc = FALSE;
-  int nobounce = FALSE;
-  int append = FALSE;
-  int direct = FALSE;
-  int fgt = FALSE;
-  int do_excl = FALSE;
-  
-  int done_bs = FALSE;
-  int done_amount = FALSE;
-  int done_skip = FALSE;
-  int done_seek = FALSE;
-  int done_fsync = FALSE;
-  int done_osync = FALSE;
-  int done_notrunc = FALSE;
-  int done_nobounce = FALSE;
-  int done_append = FALSE;
-  int done_direct = FALSE;
-  int done_private = FALSE;
-  int done_fgt = FALSE;
-  int done_excl = FALSE;
-
-#ifdef USE_SENDFILE
-  int do_sendfile = FALSE;
-  int done_sendfile = FALSE;
-#endif
-  
-  int ifd = -1, ofd = -1;
-
-  char c;
-  char *data;
-  unsigned long long x;
-  unsigned int remainder;
-
-  unsigned int timeslots, index = 0;
-  struct timeval *tv;
-  unsigned long long t1, t2;
-  double seconds, mbps;
-
-  struct stat st;
-  char *fgt_name = NULL;
-  FILE *fgt_file;
-
-  int error;
-
-
-
-  prog_name = argv[0];
-
-
-
-  if (argc == 1)
-    die("options:  Help me!  Help me!\n");
-
-
-
-  for (arg = 1; arg < argc; arg++)
-  {
-    if (strncmp(argv[arg], "if=", 3) == 0)
-    {
-      if (ifname)
-	die("you're only allowed one \"i?f=\"\n");
-
-      ifname = argv[arg] + 3;
-      imapped = FALSE;
-    }
-    else if (strncmp(argv[arg], "imf=", 4) == 0)
-    {
-      if (ifname)
-	die("you're only allowed one \"i?f=\"\n");
-
-      ifname = argv[arg] + 4;
-      imapped = TRUE;
-    }
-    else if (strncmp(argv[arg], "of=", 3) == 0)
-    {
-      if (ofname)
-	die("you're only allowed one \"o?f=\"\n");
-
-      ofname = argv[arg] + 3;
-      omapped = FALSE;
-    }
-    else if (strncmp(argv[arg], "omf=", 4) == 0)
-    {
-      if (ofname)
-	die("you're only allowed one \"o?f=\"\n");
-
-      ofname = argv[arg] + 4;
-      omapped = TRUE;
-    }
-    else if (strncmp(argv[arg], "bs=", 3) == 0)
-    {
-      if (done_bs)
-	die("you're only allowed one \"bs=\"\n");
-      done_bs = TRUE;
-
-      bs = atoi(argv[arg] + 3);
-      c = argv[arg][strlen(argv[arg]) - 1];
-      if (c == 'k')
-	bs <<= 10;
-      else if (c == 'm')
-	bs <<= 20;
-      else if (c == 'g')
-	bs <<= 30;
-
-      if (!bs)
-	die("invalid blocksize: %u\n", bs);
-    }
-    else if (strncmp(argv[arg], "move=", 5) == 0)
-    {
-      if (done_amount)
-	die("you're only allowed one amount\n");
-      done_amount = TRUE;
-
-      sscanf(argv[arg] + 5, "%qu", &move);
-      c = argv[arg][strlen(argv[arg]) - 1];
-      if (c == 'k')
-	move <<= 10;
-      else if (c == 'm')
-	move <<= 20;
-      else if (c == 'g')
-	move <<= 30;
-
-      if (!move)
-	die("zero move\n");
-    }
-    else if (strncmp(argv[arg], "count=", 6) == 0)
-    {
-      if (done_amount)
-	die("you're only allowed one amount\n");
-      done_amount = TRUE;
-
-      sscanf(argv[arg] + 6, "%qu", &count);
-
-      if (!count)
-	die("zero count\n");
-    }
-    else if (strncmp(argv[arg], "skip=", 5) == 0)
-    {
-      if (done_skip)
-	die("you're only allowed one skip\n");
-      done_skip = TRUE;
-
-      sscanf(argv[arg] + 5, "%qu", &skip);
-    }
-    else if (strncmp(argv[arg], "seek=", 5) == 0)
-    {
-      if (done_seek)
-	die("you're only allowed one seek\n");
-      done_seek = TRUE;
-
-      sscanf(argv[arg] + 5, "%qu", &seek);
-    }
-    else if (strncmp(argv[arg], "fsync=", 6) == 0)
-    {
-      if (done_fsync)
-	die("you're only allowed one \"fsync=\"\n");
-      done_fsync = TRUE;
-
-      do_fsync = atoi(argv[arg] + 6);
-    }
-    else if (strncmp(argv[arg], "osync=", 6) == 0)
-    {
-      if (done_osync)
-	die("you're only allowed one \"osync=\"\n");
-      done_osync = TRUE;
-
-      do_osync = atoi(argv[arg] + 6);
-    }
-    else if (strncmp(argv[arg], "notrunc=", 8) == 0)
-    {
-      if (done_notrunc)
-	die("you're only allowed one \"notrunc=\"\n");
-      done_notrunc = TRUE;
-
-      notrunc = atoi(argv[arg] + 8);
-    }
-    else if (strncmp(argv[arg], "nobounce=", 9) == 0)
-    {
-      if (done_nobounce)
-	die("you're only allowed one \"nobounce=\"\n");
-      done_nobounce = TRUE;
-
-      nobounce = atoi(argv[arg] + 9);
-    }
-    else if (strncmp(argv[arg], "append=", 7) == 0)
-    {
-      if (done_append)
-	die("you're only allowed one \"append=\"\n");
-      done_append = TRUE;
-
-      append = atoi(argv[arg] + 7);
-    }
-    else if (strncmp(argv[arg], "direct=", 7) == 0)
-    {
-      if (done_direct)
-	die("you're only allowed one \"direct=\"\n");
-      done_direct = TRUE;
-
-      direct = atoi(argv[arg] + 7);
-    }
-#ifdef USE_SENDFILE
-    else if (strncmp(argv[arg], "sendfile=", 9) == 0)
-    {
-      if (done_sendfile)
-	die("you're only allowed one \"sendfile=\"\n");
-      done_sendfile = TRUE;
-
-      do_sendfile = atoi(argv[arg] + 9);
-    }
-#endif
-    else if (strncmp(argv[arg], "private=", 8) == 0)
-    {
-      if (done_private)
-	die("you're only allowed one \"private=\"\n");
-      done_private = TRUE;
-
-      private = atoi(argv[arg] + 8);
-    }
-    else if (strncmp(argv[arg], "fgt=", 4) == 0)
-    {
-      if (done_fgt)
-	die("you're only allowed one \"fgt=\"\n");
-      done_fgt = TRUE;
-
-      if (isdigit(*(argv[arg] + 4)))
-	fgt = atoi(argv[arg] + 4);
-      else
-      {
-	fgt = TRUE;
-	fgt_name = argv[arg] + 4;
-      }
-    }
-    else if (strncmp(argv[arg], "excl=", 5) == 0)
-    {
-      if (done_excl)
-	die("you're only allowed one \"excl=\"\n");
-      done_excl = TRUE;
-
-      do_excl = atoi(argv[arg] + 5);
-    }
-    else if (strcmp(argv[arg], "-v") == 0)
-    {
-      verbose = TRUE;
-    }
-    else
-    {
-      die("unknown/unimplemented option: %s\n", argv[arg]);
-    }
-  }
-
-
-
-  if (!done_amount)
-    die("need an amount to move\n");
-
-  if (verbose)
-  {
-    fprintf(stderr, "ifname = %s (%s)\n", ifname, (imapped) ? "mapped" : "raw");
-    fprintf(stderr, "ofname = %s (%s)\n", ofname, (omapped) ? "mapped" : "raw");
-    fprintf(stderr, "bs = %u\n", bs);
-    fprintf(stderr, "move = %qu\n", move);
-    fprintf(stderr, "count = %qu\n", count);
-    fprintf(stderr, "skip = %qu\n", skip);
-    fprintf(stderr, "seek = %qu\n", seek);
-    fprintf(stderr, "fsync = %d\n", do_fsync);
-    fprintf(stderr, "notrunc = %d\n", notrunc);
-    fprintf(stderr, "nobounce = %d\n", nobounce);
-    fprintf(stderr, "append = %d\n", append);
-    fprintf(stderr, "direct = %d\n", direct);
-#ifdef USE_SENDFILE
-    fprintf(stderr, "sendfile = %d\n", do_sendfile);
-#endif
-    fprintf(stderr, "private = %d\n", private);
-    fprintf(stderr, "fine grain timing = %d\n", fgt);
-    fprintf(stderr, "fine grain timing file = %s\n", (fgt_name) ? fgt_name : "NULL");
-    fprintf(stderr, "excl = %d\n", do_excl);
-  }
-
-  if (!count)
-  {
-    if (move % bs != 0)
-      die("move size (%qu) not divisible by block size (%u)\n", move, bs);
-    count = move / bs;
-  }
-
-
-
-  data = (char *)malloc(bs + PAGE_SIZE);
-  if (!data)
-    die("out of memory\n");
-
-  remainder = ((unsigned long)data) & (PAGE_SIZE - 1);
-  if (remainder)
-    data += PAGE_SIZE - remainder;
-
-  memset(data, 0, bs);
-
-
-
-  if (fgt)
-  {
-    if (count & 0xFFFFFFFFF0000000)
-      die("count is too high -- can't do fine grain timing\n");
-    timeslots = count + 3;
-  }
-  else
-    timeslots = 2;
-
-  tv = malloc(timeslots * sizeof(struct timeval));
-  if (!tv)
-    die("out of memory\n");
-
-
-
-  gettimeofday(&tv[index++], NULL);
-
-
-
-  if (ifname)
-  {
-    if (strcmp(ifname, "-") == 0)
-      ifd = STDIN_FILENO;
-    else
-    {
-      ifd = open(ifname, O_RDONLY | ((direct) ? O_DIRECT : 0));
-      if (ifd < 0)
-	die("can't open file %s: %s\n", ifname, strerror(errno));
-      if (verbose)
-      {
-	error = fstat(ifd, &st);
-	if (error)
-	  die("can't stat file %s: %s\n", ifname, strerror(errno));
-	fprintf(stderr, "input inode = %qu\n", (unsigned long long)st.st_ino);
-      }
-
-      if (skip && lseek(ifd, skip * bs, SEEK_SET) != skip * bs)
-	die("can't skip:  %s\n", strerror(errno));
-    }
-  }
-
-  if (ofname)
-  {
-    if (strcmp(ofname, "-") == 0)
-      ofd = STDOUT_FILENO;
-    else
-    {
-      ofd = open(ofname,
-		 O_RDWR |
-		 O_CREAT |
-		 ((notrunc) ? 0 : O_TRUNC) |
-		 ((direct) ? O_DIRECT : 0) |
-		 ((append) ? O_APPEND : 0) |
-		 ((do_osync) ? O_SYNC : 0) |
-		 ((do_excl) ? O_EXCL : 0),
-		 0644);
-      if (ofd < 0)
-	die("can't open file %s: %s\n", ofname, strerror(errno));
-      if (verbose)
-      {
-	error = fstat(ofd, &st);
-	if (error)
-	  die("can't stat file %s: %s\n", ofname, strerror(errno));
-	fprintf(stderr, "output inode = %qu\n", (unsigned long long)st.st_ino);
-      }
-
-      if (seek && lseek(ofd, seek * bs, SEEK_SET) != seek * bs)
-	die("can't seek:  %s\n", strerror(errno));
-    }
-  }
-
-  if (ofd >= 0 && omapped)
-  {
-    if (ftruncate(ofd, bs * count) < 0)
-      die("can't truncate bigger: %s\n", strerror(errno));
-  }
-
-
-
-  if (fgt)
-    gettimeofday(&tv[index++], NULL);
-
-
-
-  for (x = 0; x < count; x++)
-  {
-#ifdef USE_SENDFILE
-    if (do_sendfile && ifd >= 0 && ofd >= 0)
-      send_sendfile(ifd, ofd, bs);
-    else 
-#endif
-    if (nobounce && ifd >= 0 && ofd >= 0 && (imapped || omapped))
-    {
-      if (imapped && omapped)
-	do_bothmapped(ifd, ofd, bs);
-      else if (imapped)
-	do_imapped(ifd, ofd, bs);
-      else
-	do_omapped(ifd, ofd, bs);
-    }  
-    else
-    {
-      if (ifd >= 0)
-      {
-	if (imapped)
-	  do_mapped_read(ifd, data, bs);
-	else
-	  do_raw_read(ifd, data, bs);
-      }
-
-      if (ofd >= 0)
-      {
-	if (omapped)
-	  do_mapped_write(ofd, data, bs);
-	else
-	  do_raw_write(ofd, data, bs);
-      }
-    }
-
-    if (verbose)
-      fprintf(stderr, "%qu\n", x);
-
-    if (fgt)
-      gettimeofday(&tv[index++], NULL);
-  }
-
-
-
-  if (ifd >= 0)
-    close(ifd);
-
-  if (ofd >= 0)
-  {
-    if (do_fsync)
-      fsync(ofd);
-    close(ofd);
-  }
-
-
-
-  gettimeofday(&tv[index++], NULL);
-
-  if (index != timeslots)
-    die("index != timeslots\n");
-
-
-
-  if (fgt)
-  {
-    if (fgt_name)
-    {
-      fgt_file = fopen(fgt_name, "w");
-      if (!fgt_file)
-	die("can't open file %s:  %s\n", fgt_name, strerror(errno));
-    }
-    else
-      fgt_file = stderr;
-
-    t1 = (unsigned long long)tv[0].tv_sec * 1000000 + tv[0].tv_usec;
-    fprintf(fgt_file, "start = %qu\n", t1);
-
-    for (index = 1; index < timeslots; index++)
-    {
-      t1 = (unsigned long long)tv[index - 1].tv_sec * 1000000 + tv[index - 1].tv_usec;
-      t2 = (unsigned long long)tv[index].tv_sec * 1000000 + tv[index].tv_usec;
-
-      if (index == 1)
-	fprintf(fgt_file, "setup = %qu\n", t2 - t1);
-      else if (index == timeslots - 1)
-	fprintf(fgt_file, "cleanup = %qu\n", t2 - t1);
-      else
-	fprintf(fgt_file, "loop %u = %qu\n", index - 2, t2 - t1);
-    }
-
-    t1 = (unsigned long long)tv[0].tv_sec * 1000000 + tv[0].tv_usec;
-    t2 = (unsigned long long)tv[timeslots - 1].tv_sec * 1000000 + tv[timeslots - 1].tv_usec;
-
-    fprintf(fgt_file, "total = %qu\n", t2 - t1);
-
-    if (fgt_name)
-      fclose(fgt_file);
-  }
-
-
-
-  t1 = (unsigned long long)tv[0].tv_sec * 1000000 + tv[0].tv_usec;
-  t2 = (unsigned long long)tv[timeslots - 1].tv_sec * 1000000 + tv[timeslots - 1].tv_usec;
-
-  seconds = (t2 - t1) / 1000000.0;
-  mbps = bs * count / 1048576.0 / seconds;
-
-  fprintf(stderr, "seconds = %.4f, MB/s = %.4f\n", seconds, mbps);
-
-
-
-  exit(EXIT_SUCCESS);
-}
-
-
-
diff --git a/gfs2/mount/Makefile b/gfs2/mount/Makefile
index 8706b17..c0c1395 100644
--- a/gfs2/mount/Makefile
+++ b/gfs2/mount/Makefile
@@ -12,7 +12,6 @@ OBJS1=	mount.gfs2.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
diff --git a/gfs2/mount/gfs_ondisk.h b/gfs2/mount/gfs_ondisk.h
new file mode 100644
index 0000000..0648d28
--- /dev/null
+++ b/gfs2/mount/gfs_ondisk.h
@@ -0,0 +1,1904 @@
+/*
+ * On-disk structures.
+ *
+ * THE BIG PICTURE of on-disk layout:
+ *
+ * GFS filesystem code views the entire filesystem, including journals, as
+ * one contiguous group of blocks on one (perhaps virtual) storage device.
+ * The filesystem space is shared, not distributed; each node in the cluster
+ * must see the entire filesystem space.
+ *
+ * If the filesystem is spread across multiple physical storage devices,
+ * volume management (device mapping) must be used to present the fileystem
+ * space to GFS as one (virtual) device, with contiguous blocks.
+ *
+ * The superblock contains basic information about the filesytem, and appears
+ * at a location 64 KBytes into the filesystem.  The first 64 KBytes of the
+ * filesystem are empty, providing a safety buffer against wayward volume
+ * management software (that sometimes write data into the first few bytes of
+ * a device) or administrators.
+ *
+ * After the superblock, the rest of the filesystem is divided into multiple
+ * Resource Groups and several journals.
+ *
+ * The Resource Groups (RGs or rgrps) contain the allocatable blocks that are
+ * used for storing files, directories, etc., and all of the associated
+ * metadata.  Each RG has its own set of block allocation statistics (within
+ * the RG header), a number of blocks containing the block allocation bitmap,
+ * and a large number of allocatable blocks for file data and metadata.
+ * Multiple RGs allow multiple nodes to simultaneously allocate blocks from the 
+ * filesystem (using different RGs), enhancing parallel access.  RG size and
+ * number of RGs are determined by gfs_mkfs when creating the filesystem.
+ * An administrator can specify RG size (see man gfs_mkfs).
+ *
+ * The journals contain temporary copies of metadata blocks, along with
+ * other data, that allow GFS to recover the filesystem to a consistent state
+ * (at least as far as metadata is concerned) if a node fails in the midst
+ * of performing a write transaction.  There must be one journal for each node
+ * in the cluster.  Since access to the entire filesystem space is shared,
+ * if a node crashes, another node will be able to read the crashed node's
+ * journal, and perform recovery.
+ *
+ * Currently, gfs_mkfs places the journals right in the middle of a freshly
+ * created filesystem space, between 2 large groups of RGs.  From a filesystem
+ * layout perspective, this placement is not a requirement; the journals
+ * could be placed anywhere within the filesystem space.
+ *
+ * New Resource Groups and Journals may be added to the filesystem after the
+ * filesystem has been created, if the filesystem's (virtual) device is made
+ * larger.  See man gfs_grow and gfs_jadd.
+ *
+ * A few special hidden inodes are contained in a GFS filesystem.  They do
+ * not appear in any directories; instead, the superblock points to them
+ * using block numbers for their location.  The special inodes are:
+ *
+ *   Root inode:  Root directory of the filesystem
+ *   Resource Group Index:  A file containing block numbers and sizes of all RGs
+ *   Journal Index:  A file containing block numbers and sizes of all journals
+ *   Quota:  A file containing all quota information for the filesystem
+ *   License:  A file containing license information
+ *
+ * Note that there is NOTHING RELATED TO INTER-NODE LOCK MANAGEMENT ON-DISK.
+ * Locking is handled completely off-disk, typically via LAN.
+ *
+ * NOTE:
+ * If you add 8 byte fields to these structures, they must be 8 byte
+ * aligned.  4 byte field must be 4 byte aligned, etc...
+ *
+ * All structures must be a multiple of 8 bytes long.
+ *
+ * GRIPES:
+ * We should have forgetten about supporting 512B FS block sizes 
+ * and made the di_reserved field in the struct gfs_dinode structure
+ * much bigger.
+ *
+ * de_rec_len in struct gfs_dirent should really have been a 32-bit value
+ * as it now limits us to a 64k FS block size (with the current code
+ * in dir.c).
+ */
+
+#ifndef __GFS_ONDISK_DOT_H__
+#define __GFS_ONDISK_DOT_H__
+
+#define GFS_MAGIC               (0x01161970) /* for all on-disk headers */
+#define GFS_BASIC_BLOCK         (512)  /* "basic block" = "sector" = 512B */
+#define GFS_BASIC_BLOCK_SHIFT   (9)
+
+/*  Controls how much data can be logged in-core before dumping log to disk */
+
+#define GFS_DUMPS_PER_LOG       (4)    /* 1/4 of on-disk journal size*/
+
+/*  Lock numbers of the LM_TYPE_NONDISK type.  These protect certain
+ *  cluster-wide operations (rather than on-disk entities).
+ *  Currently, the LIVE lock is not used for any real purpose.  */
+
+#define GFS_MOUNT_LOCK          (0)    /* only one node can Mount at a time */
+#define GFS_LIVE_LOCK           (1)    /* shared by all mounted nodes */
+#define GFS_TRANS_LOCK          (2)    /* Transaction, protects jrnl recovery */
+#define GFS_RENAME_LOCK         (3)    /* only one node can Rename at a time */
+
+/*  On-disk format (version) numbers for various metadata types,
+ *  used in gfs_meta_header  */
+
+#define GFS_FORMAT_SB           (100)  /* Super-Block */
+#define GFS_FORMAT_RG           (200)  /* Resource Group Header */
+#define GFS_FORMAT_RB           (300)  /* Resource Group Block Alloc BitBlock */
+#define GFS_FORMAT_DI           (400)  /* "Disk" inode (dinode) */
+#define GFS_FORMAT_IN           (500)  /* Indirect dinode block list */
+#define GFS_FORMAT_LF           (600)  /* Leaf dinode block list */
+#define GFS_FORMAT_JD           (700)  /* Journal Data */
+#define GFS_FORMAT_LH           (800)  /* Log Header */
+#define GFS_FORMAT_LD           (900)  /* Log Descriptor */
+/*  These don't have actual struct gfs_meta_header structures to go with them */
+#define GFS_FORMAT_JI           (1000) /* Journal Index */
+#define GFS_FORMAT_RI           (1100) /* Resource Group Index */
+#define GFS_FORMAT_DE           (1200) /* Directory Entry */
+#define GFS_FORMAT_QU           (1500) /* Quota */
+#define GFS_FORMAT_EA           (1600) /* Extended Attribute */
+#define GFS_FORMAT_ED           (1700) /* Extended Attribute data */
+/*  These version #s are embedded in the superblock  */
+#define GFS_FORMAT_FS           (1309) /* Filesystem (all-encompassing) */
+#define GFS_FORMAT_MULTI        (1401) /* Multi-Host */
+
+/*
+ *  An on-disk inode number
+ *  Initially, the on-disk block address of the inode block is assigned as the
+ *  formal (permanent) ID as well.  Block address can change (to move inode
+ *  on-disk), but formal ID must stay unchanged once assigned.
+ */
+
+#define gfs_inum_equal(ino1, ino2) \
+(((ino1)->no_formal_ino == (ino2)->no_formal_ino) && \
+ ((ino1)->no_addr == (ino2)->no_addr))
+
+struct gfs_inum {
+	uint64_t no_formal_ino;        /* inode identifier */
+	uint64_t no_addr;              /* block # of dinode block */
+};
+
+/*
+ *  Generic metadata head structure
+ *
+ *  Every inplace buffer logged in the journal must start
+ *  with a struct gfs_meta_header.
+ *
+ *  In addition to telling what kind of metadata is in the block,
+ *  the metaheader contains the important generation and incarnation
+ *  numbers.
+ *
+ *  The generation number is used during journal recovery to determine
+ *  whether an in-place block on-disk is older than an on-disk journaled copy
+ *  of the block.  If so, GFS overwrites the in-place block with the journaled
+ *  version of the block.
+ *
+ *  A meta block's generation number must increment monotonically across the
+ *  cluster, each time new contents are committed to the block.  This means
+ *  that whenever GFS allocates a pre-existing metadata block, GFS must read
+ *  that block from disk (in case another node has incremented it).  It also
+ *  means that GFS must sync the block (with incremented generation number)
+ *  to disk (both log and in-place blocks), not only after changing contents
+ *  of the block, but also after de-allocating the block (GFS can't just throw
+ *  away incore metadata for a file that it's just erased).
+ *
+ *  The incarnation number is used only for on-disk (d)inodes.  GFS increments
+ *  it each time it de-allocates a dinode block (i.e. each time the dinode
+ *  loses its identity with a particular file, directory, etc.).  When the
+ *  dinode is later allocated (i.e. to be identified with a new file, etc.),
+ *  GFS copies the incarnation number into the VFS inode's i_generation member.
+ *  If GFS is used as the backing store for an NFS server, GFS uses this
+ *  i_generation number as part of the NFS filehandle, which differentiates
+ *  it from the previous identity of the dinode, and helps protect against
+ *  filesystem corruption that could happen with the use of outdated,
+ *  invalid, or malicious filehandles.  See ops_export.c.
+ *
+ *  GFS caches de-allocated meta-headers, to minimize disk reads.
+ *  See struct gfs_meta_header_cache.
+ */
+
+#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 */
+
+#define GFS_META_CLUMP          (64)   /* # blocks to convert fm data to meta */
+
+struct gfs_meta_header {
+	uint32_t mh_magic;      /* GFS_MAGIC sanity check magic number */
+	uint32_t mh_type;       /* GFS_METATYPE_XX type of metadata block */
+	uint64_t mh_generation; /* increment before writing to journal */
+	uint32_t mh_format;     /* GFS_FORMAT_XX (version # for this type) */
+	uint32_t mh_incarn;     /* increment when marking dinode "unused" */
+};
+
+/*
+ *  super-block structure
+ *
+ *  One of these is at beginning of filesystem.
+ *  It's probably good if SIZEOF_SB <= GFS_BASIC_BLOCK (512 bytes)
+ */
+
+/*  Address of SuperBlock in GFS basic blocks.  1st 64K of filesystem is empty
+    for safety against getting clobbered by wayward volume managers, etc.
+    64k was chosen because it's the largest GFS-supported fs block size.  */
+#define GFS_SB_ADDR             (128)
+
+/*  The lock number for the superblock (must be zero)  */
+#define GFS_SB_LOCK             (0)
+#define GFS_CRAP_LOCK           (1)
+
+/*  Requirement:  GFS_LOCKNAME_LEN % 8 == 0
+    Includes: the fencing zero at the end  */
+#define GFS_LOCKNAME_LEN        (64)
+
+struct gfs_sb {
+	/*  Order is important; need to be able to read old superblocks
+	    in order to support on-disk version upgrades */
+	struct gfs_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 gfs_inum sb_jindex_di;  /* journal index inode */
+	struct gfs_inum sb_rindex_di;  /* resource group index inode */
+	struct gfs_inum sb_root_di;    /* root directory inode */
+
+	/* Default inter-node locking protocol (lock module) and namespace */
+	char sb_lockproto[GFS_LOCKNAME_LEN]; /* lock protocol name */
+	char sb_locktable[GFS_LOCKNAME_LEN]; /* unique name for this FS */
+
+	/* More special inodes */
+	struct gfs_inum sb_quota_di;   /* quota inode */
+	struct gfs_inum sb_license_di; /* license inode */
+
+	char sb_reserved[96];
+};
+
+/*
+ *  journal index structure 
+ *
+ *  One for each journal used by the filesystem.
+ *  These descriptors are packed contiguously within the jindex inode (file).
+ */
+
+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];
+};
+
+/*
+ *  resource index structure 
+ *
+ *  One of these for each resource group in the filesystem.
+ *  These descriptors are packed contiguously within the rindex inode (file).
+ *  Also see struct gfs_rgrp.
+ */
+
+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];
+};
+
+/*
+ *  resource group header structure
+ *
+ *  One of these at beginning of the first block of an rgrp,
+ *     followed by block alloc bitmap data in remainder of first block.
+ *  Each resource group contains:
+ *    Header block, including block allocation statistics (struct gfs_rgrp)
+ *       and first part of block alloc bitmap.
+ *    Bitmap block(s), continuing block alloc bitmap started in header block.
+ *    Data/meta blocks, allocatable blocks containing file data and metadata.
+ *  
+ *  In older versions, now-unused (but previously allocated) dinodes were
+ *  saved for re-use in an on-disk linked list (chain).  This is no longer
+ *  done, but support still exists for reclaiming dinodes from this list,
+ *  to support upgrades from older on-disk formats.
+ */
+
+/* Each data block within rgrp is represented by 2 bits in the alloc bitmap */
+#define GFS_NBBY                (4)  /* # blocks represented by 1 bitmap byte */
+#define GFS_BIT_SIZE            (2)
+#define GFS_BIT_MASK            (0x00000003)
+
+/*
+ * 4 possible block allocation states:
+ *   bit 0 = alloc(1)/free(0)
+ *   bit 1 = metadata(1)/data(0)
+ */
+#define GFS_BLKST_FREE          (0)
+#define GFS_BLKST_USED          (1)
+#define GFS_BLKST_FREEMETA      (2)
+#define GFS_BLKST_USEDMETA      (3)
+
+struct gfs_rgrp {
+	struct gfs_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 gfs_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];
+};
+
+/*
+ *  quota structure
+ */
+
+struct gfs_quota {
+	uint64_t qu_limit;
+	uint64_t qu_warn;
+	int64_t qu_value;
+
+	char qu_reserved[64];
+};
+
+/*
+ *  dinode (disk inode) structure
+ *  The ondisk representation of inodes
+ *  One for each file, directory, etc.
+ *  GFS does not put more than one inode in a single block.
+ *  The inode may be "stuffed", carrying file data along with metadata,
+ *    if the file data is small enough.
+ *  Otherwise, the inode block contains pointers to other blocks that contain
+ *    either file data or other pointers to other blocks (indirect addressing
+ *    via a metadata tree).
+ */
+
+#define GFS_MAX_META_HEIGHT     (10)
+#define GFS_DIR_MAX_DEPTH       (17)
+
+/*  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 */
+
+/*  Dinode flags  */
+#define GFS_DIF_JDATA             (0x00000001) /* jrnl all data for this file */
+#define GFS_DIF_EXHASH            (0x00000002) /* hashed directory (leaves) */
+#define GFS_DIF_UNUSED            (0x00000004) /* unused dinode */
+#define GFS_DIF_EA_INDIRECT       (0x00000008) /* extended attribute, indirect*/
+#define GFS_DIF_DIRECTIO          (0x00000010)
+#define GFS_DIF_IMMUTABLE         (0x00000020) /* Can't change file */
+#define GFS_DIF_APPENDONLY        (0x00000040) /* Can only add to end of file */
+#define GFS_DIF_NOATIME           (0x00000080) /* Don't update access time
+						  (currently unused/ignored) */
+#define GFS_DIF_SYNC              (0x00000100) /* Flush to disk, don't cache
+						  (currently unused/ignored) */
+#define GFS_DIF_INHERIT_DIRECTIO  (0x40000000) /* new files get DIRECTIO flag */
+#define GFS_DIF_INHERIT_JDATA     (0x80000000) /* new files get JDATA flag */
+
+struct gfs_dinode {
+	struct gfs_meta_header di_header;
+
+	struct gfs_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 gfs_inum di_next_unused;  /* used in old versions only */
+
+	uint64_t di_eattr;	/* extended attribute block number */
+
+	char di_reserved[56];
+};
+
+/*
+ *  indirect block header
+ *
+ *  A component of a dinode's indirect addressing metadata tree.
+ *  These are pointed to by pointers in dinodes or other indirect blocks.
+ */
+
+struct gfs_indirect {
+	struct gfs_meta_header in_header;
+
+	char in_reserved[64];
+};
+
+/*
+ *  directory structure - many of these per directory file
+ *
+ * See comments at beginning of dir.c
+ */
+
+#define GFS_FNAMESIZE               (255)
+#define GFS_DIRENT_SIZE(name_len) ((sizeof(struct gfs_dirent) + (name_len) + 7) & ~7)
+#define IS_LEAF     (1) /* Hashed (leaf) directory */
+#define IS_DINODE   (2) /* Linear (stuffed dinode block) directory */
+
+struct gfs_dirent {
+	struct gfs_inum de_inum;    /* formal inode number and block address */
+	uint32_t de_hash;           /* hash of the filename */
+	uint16_t de_rec_len;        /* the length of the dirent */
+	uint16_t de_name_len;       /* the length of the name */
+	uint16_t de_type;           /* GFS_FILE_... type of dinode this points to */
+
+	char de_reserved[14];
+};
+
+/*
+ *  Header of leaf directory nodes
+ *
+ * See comments at beginning of dir.c
+ */
+
+struct gfs_leaf {
+	struct gfs_meta_header lf_header;
+
+	uint16_t lf_depth;          /* Depth of leaf */
+	uint16_t lf_entries;        /* Number of dirents in leaf */
+	uint32_t lf_dirent_format;  /* GFS_FORMAT_DE (version #) */
+	uint64_t lf_next;           /* Next leaf, if overflow */
+
+	char lf_reserved[64];
+};
+
+/*
+ *  Log header structure
+ *
+ *  Two of these are in the first block of a transaction log:
+ *    1)  at beginning of block
+ *    2)  at end of first 512-byte sector within block
+ */
+
+#define GFS_LOG_HEAD_UNMOUNT    (0x00000001)  /* log is clean, can unmount fs */
+
+struct gfs_log_header {
+	struct gfs_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];
+};
+
+/*
+ *  Log type descriptor
+ *
+ *  One of these for each chunk in a transaction
+ */
+
+#define GFS_LOG_DESC_METADATA   (300)    /* metadata */
+/*  ld_data1 is the number (quantity) of metadata blocks in the descriptor.
+    ld_data2 is unused.
+    */
+
+#define GFS_LOG_DESC_IUL        (400)    /* unlinked inode */
+/*  ld_data1 is TRUE if this is a dump.
+    ld_data2 is unused.
+    FixMe!!!  ld_data1 should be the number (quantity) of entries.
+              ld_data2 should be "TRUE if this is a dump".
+    */
+
+#define GFS_LOG_DESC_IDA        (401)    /* de-allocated inode */
+/*  ld_data1 is unused.
+    ld_data2 is unused.
+    FixMe!!!  ld_data1 should be the number (quantity) of entries.
+    */
+
+#define GFS_LOG_DESC_Q          (402)    /* quota */
+/*  ld_data1 is the number of quota changes in the descriptor.
+    ld_data2 is TRUE if this is a dump.
+    */
+
+#define GFS_LOG_DESC_LAST       (500)    /* final in a logged transaction */
+/*  ld_data1 is unused.
+    ld_data2 is unused.
+    */
+
+struct gfs_log_descriptor {
+	struct gfs_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];
+};
+
+/*
+ *  Metadata block tags
+ *
+ *  One for each logged block.  Tells where block really belongs on-disk.
+ *  These descriptor tags are packed contiguously after a gfs_log_descriptor.
+ */
+
+struct gfs_block_tag {
+	uint64_t bt_blkno;	/* inplace block number */
+	uint32_t bt_flags;	/* ?? */
+	uint32_t bt_pad;
+};
+
+/*
+ *  Quota Journal Tag
+ */
+
+#define GFS_QTF_USER            (0x00000001)
+
+struct gfs_quota_tag {
+	int64_t qt_change;
+	uint32_t qt_flags;      /* GFS_QTF_... */
+	uint32_t qt_id;
+};
+
+/*
+ *  Extended attribute header format
+ */
+
+#define GFS_EA_MAX_NAME_LEN     (255)
+#define GFS_EA_MAX_DATA_LEN     (65536)
+
+#define GFS_EATYPE_UNUSED       (0)
+#define GFS_EATYPE_USR          (1)     /* user attribute */
+#define GFS_EATYPE_SYS          (2)     /* system attribute */
+#define GFS_EATYPE_SECURITY	(3)	/* security attribute */
+
+#define GFS_EATYPE_LAST         (3)
+#define GFS_EATYPE_VALID(x)     ((x) <= GFS_EATYPE_LAST)
+
+#define GFS_EAFLAG_LAST         (0x01)	/* last ea in block */
+
+struct gfs_ea_header {
+	uint32_t ea_rec_len;    /* total record length: hdr + name + data */
+	uint32_t ea_data_len;   /* data length, in bytes */
+	uint8_t ea_name_len;    /* no NULL pointer after the string */
+	uint8_t ea_type;        /* GFS_EATYPE_... */
+	uint8_t ea_flags;       /* GFS_EAFLAG_... */
+	uint8_t ea_num_ptrs;    /* # fs blocks needed for EA */
+	uint32_t ea_pad;
+};
+
+/*
+ * Statfs change
+ * Describes an change to the pool of free and allocated
+ * blocks.
+ */
+
+struct gfs_statfs_change {
+	uint64_t sc_total;
+	uint64_t sc_free;
+	uint64_t sc_dinodes;
+};
+
+struct gfs_statfs_change_host {
+	int64_t sc_total;
+	int64_t sc_free;
+	int64_t sc_dinodes;
+};
+
+/*  Endian functions  */
+
+#define GFS_ENDIAN_BIG
+
+#ifdef GFS_ENDIAN_BIG
+
+#define gfs16_to_cpu be16_to_cpu
+#define gfs32_to_cpu be32_to_cpu
+#define gfs64_to_cpu be64_to_cpu
+
+#define cpu_to_gfs16 cpu_to_be16
+#define cpu_to_gfs32 cpu_to_be32
+#define cpu_to_gfs64 cpu_to_be64
+
+#else				/*  GFS_ENDIAN_BIG  */
+
+#define gfs16_to_cpu le16_to_cpu
+#define gfs32_to_cpu le32_to_cpu
+#define gfs64_to_cpu le64_to_cpu
+
+#define cpu_to_gfs16 cpu_to_le16
+#define cpu_to_gfs32 cpu_to_le32
+#define cpu_to_gfs64 cpu_to_le64
+
+#endif				/*  GFS_ENDIAN_BIG  */
+
+/*  Translation functions  */
+
+void gfs_inum_in(struct gfs_inum *no, char *buf);
+void gfs_inum_out(struct gfs_inum *no, char *buf);
+void gfs_meta_header_in(struct gfs_meta_header *mh, char *buf);
+void gfs_meta_header_out(struct gfs_meta_header *mh, char *buf);
+void gfs_sb_in(struct gfs_sb *sb, char *buf);
+void gfs_sb_out(struct gfs_sb *sb, char *buf);
+void gfs_jindex_in(struct gfs_jindex *jindex, char *buf);
+void gfs_jindex_out(struct gfs_jindex *jindex, char *buf);
+void gfs_rindex_in(struct gfs_rindex *rindex, char *buf);
+void gfs_rindex_out(struct gfs_rindex *rindex, char *buf);
+void gfs_rgrp_in(struct gfs_rgrp *rgrp, char *buf);
+void gfs_rgrp_out(struct gfs_rgrp *rgrp, char *buf);
+void gfs_quota_in(struct gfs_quota *quota, char *buf);
+void gfs_quota_out(struct gfs_quota *quota, char *buf);
+void gfs_dinode_in(struct gfs_dinode *dinode, char *buf);
+void gfs_dinode_out(struct gfs_dinode *dinode, char *buf);
+void gfs_indirect_in(struct gfs_indirect *indirect, char *buf);
+void gfs_indirect_out(struct gfs_indirect *indirect, char *buf);
+void gfs_dirent_in(struct gfs_dirent *dirent, char *buf);
+void gfs_dirent_out(struct gfs_dirent *dirent, char *buf);
+void gfs_leaf_in(struct gfs_leaf *leaf, char *buf);
+void gfs_leaf_out(struct gfs_leaf *leaf, char *buf);
+void gfs_log_header_in(struct gfs_log_header *head, char *buf);
+void gfs_log_header_out(struct gfs_log_header *head, char *buf);
+void gfs_desc_in(struct gfs_log_descriptor *desc, char *buf);
+void gfs_desc_out(struct gfs_log_descriptor *desc, char *buf);
+void gfs_block_tag_in(struct gfs_block_tag *btag, char *buf);
+void gfs_block_tag_out(struct gfs_block_tag *btag, char *buf);
+void gfs_quota_tag_in(struct gfs_quota_tag *qtag, char *buf);
+void gfs_quota_tag_out(struct gfs_quota_tag *qtag, char *buf);
+void gfs_ea_header_in(struct gfs_ea_header *qtag, char *buf);
+void gfs_ea_header_out(struct gfs_ea_header *qtag, char *buf);
+
+/*  Printing functions  */
+
+void gfs_inum_print(struct gfs_inum *no);
+void gfs_meta_header_print(struct gfs_meta_header *mh);
+void gfs_sb_print(struct gfs_sb *sb);
+void gfs_jindex_print(struct gfs_jindex *jindex);
+void gfs_rindex_print(struct gfs_rindex *rindex);
+void gfs_rgrp_print(struct gfs_rgrp *rgrp);
+void gfs_quota_print(struct gfs_quota *quota);
+void gfs_dinode_print(struct gfs_dinode *dinode);
+void gfs_indirect_print(struct gfs_indirect *indirect);
+void gfs_dirent_print(struct gfs_dirent *dirent, char *name);
+void gfs_leaf_print(struct gfs_leaf *leaf);
+void gfs_log_header_print(struct gfs_log_header *head);
+void gfs_desc_print(struct gfs_log_descriptor *desc);
+void gfs_block_tag_print(struct gfs_block_tag *tag);
+void gfs_quota_tag_print(struct gfs_quota_tag *tag);
+void gfs_ea_header_print(struct gfs_ea_header *ea, char *name);
+
+/*  The hash function for ExHash directories  */
+
+uint32_t gfs_dir_hash(const char *data, int len);
+
+#endif /* __GFS_ONDISK_DOT_H__ */
+
+
+
+#ifdef WANT_GFS_CONVERSION_FUNCTIONS
+
+#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) = gfs16_to_cpu((s2->member));}
+#define CPOUT_16(s1, s2, member) {(s2->member) = cpu_to_gfs16((s1->member));}
+#define CPIN_32(s1, s2, member) {(s1->member) = gfs32_to_cpu((s2->member));}
+#define CPOUT_32(s1, s2, member) {(s2->member) = cpu_to_gfs32((s1->member));}
+#define CPIN_64(s1, s2, member) {(s1->member) = gfs64_to_cpu((s2->member));}
+#define CPOUT_64(s1, s2, member) {(s2->member) = cpu_to_gfs64((s1->member));}
+
+#define pa(struct, member, count) print_array(#member, struct->member, count);
+
+/**
+ * print_array - Print out an array of bytes
+ * @title: what to print before the array
+ * @buf: the array
+ * @count: the number of bytes
+ *
+ */
+
+static void
+print_array(char *title, char *buf, int count)
+{
+	int x;
+
+	printk("  %s =\n", title);
+	for (x = 0; x < count; x++) {
+		printk("%.2X ", (unsigned char)buf[x]);
+		if (x % 16 == 15)
+			printk("\n");
+	}
+	if (x % 16)
+		printk("\n");
+}
+
+/**
+ * gfs_inum_in - Read in an inode number
+ * @no: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_inum_in(struct gfs_inum *no, char *buf)
+{
+	struct gfs_inum *str = (struct gfs_inum *)buf;
+
+	CPIN_64(no, str, no_formal_ino);
+	CPIN_64(no, str, no_addr);
+}
+
+/**
+ * gfs_inum_out - Write out an inode number
+ * @no: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_inum_out(struct gfs_inum *no, char *buf)
+{
+	struct gfs_inum *str = (struct gfs_inum *)buf;
+
+	CPOUT_64(no, str, no_formal_ino);
+	CPOUT_64(no, str, no_addr);
+}
+
+/**
+ * gfs_inum_print - Print out a inode number
+ * @no: the cpu-order buffer
+ *
+ */
+
+void
+gfs_inum_print(struct gfs_inum *no)
+{
+	pv(no, no_formal_ino, "%"PRIu64);
+	pv(no, no_addr, "%"PRIu64);
+}
+
+/**
+ * gfs_meta_header_in - Read in a metadata header
+ * @mh: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_meta_header_in(struct gfs_meta_header *mh, char *buf)
+{
+	struct gfs_meta_header *str = (struct gfs_meta_header *)buf;
+
+	CPIN_32(mh, str, mh_magic);
+	CPIN_32(mh, str, mh_type);
+	CPIN_64(mh, str, mh_generation);
+	CPIN_32(mh, str, mh_format);
+	CPIN_32(mh, str, mh_incarn);
+}
+
+/**
+ * gfs_meta_header_in - Write out a metadata header
+ * @mh: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ * Don't ever change the generation number in this routine.
+ * It's done manually in increment_generation().
+ */
+
+void
+gfs_meta_header_out(struct gfs_meta_header *mh, char *buf)
+{
+	struct gfs_meta_header *str = (struct gfs_meta_header *)buf;
+
+	CPOUT_32(mh, str, mh_magic);
+	CPOUT_32(mh, str, mh_type);
+#if 0
+	/* Don't do this!
+	   Mh_generation should only be change manually. */
+	CPOUT_64(mh, str, mh_generation);
+#endif
+	CPOUT_32(mh, str, mh_format);
+	CPOUT_32(mh, str, mh_incarn);
+}
+
+/**
+ * gfs_meta_header_print - Print out a metadata header
+ * @mh: the cpu-order buffer
+ *
+ */
+
+void
+gfs_meta_header_print(struct gfs_meta_header *mh)
+{
+	pv(mh, mh_magic, "0x%.8X");
+	pv(mh, mh_type, "%u");
+	pv(mh, mh_generation, "%"PRIu64);
+	pv(mh, mh_format, "%u");
+	pv(mh, mh_incarn, "%u");
+}
+
+/**
+ * gfs_sb_in - Read in a superblock
+ * @sb: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_sb_in(struct gfs_sb *sb, char *buf)
+{
+	struct gfs_sb *str = (struct gfs_sb *)buf;
+
+	gfs_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_flags);
+
+	CPIN_32(sb, str, sb_bsize);
+	CPIN_32(sb, str, sb_bsize_shift);
+	CPIN_32(sb, str, sb_seg_size);
+
+	gfs_inum_in(&sb->sb_jindex_di, (char *)&str->sb_jindex_di);
+	gfs_inum_in(&sb->sb_rindex_di, (char *)&str->sb_rindex_di);
+	gfs_inum_in(&sb->sb_root_di, (char *)&str->sb_root_di);
+
+	CPIN_08(sb, str, sb_lockproto, GFS_LOCKNAME_LEN);
+	CPIN_08(sb, str, sb_locktable, GFS_LOCKNAME_LEN);
+
+	gfs_inum_in(&sb->sb_quota_di, (char *)&str->sb_quota_di);
+	gfs_inum_in(&sb->sb_license_di, (char *)&str->sb_license_di);
+
+	CPIN_08(sb, str, sb_reserved, 96);
+}
+
+/**
+ * gfs_sb_out - Write out a superblock
+ * @sb: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_sb_out(struct gfs_sb *sb, char *buf)
+{
+	struct gfs_sb *str = (struct gfs_sb *)buf;
+
+	gfs_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_flags);
+
+	CPOUT_32(sb, str, sb_bsize);
+	CPOUT_32(sb, str, sb_bsize_shift);
+	CPOUT_32(sb, str, sb_seg_size);
+
+	gfs_inum_out(&sb->sb_jindex_di, (char *)&str->sb_jindex_di);
+	gfs_inum_out(&sb->sb_rindex_di, (char *)&str->sb_rindex_di);
+	gfs_inum_out(&sb->sb_root_di, (char *)&str->sb_root_di);
+
+	CPOUT_08(sb, str, sb_lockproto, GFS_LOCKNAME_LEN);
+	CPOUT_08(sb, str, sb_locktable, GFS_LOCKNAME_LEN);
+
+	gfs_inum_out(&sb->sb_quota_di, (char *)&str->sb_quota_di);
+	gfs_inum_out(&sb->sb_license_di, (char *)&str->sb_license_di);
+
+	CPOUT_08(sb, str, sb_reserved, 96);
+}
+
+/**
+ * gfs_sb_print - Print out a superblock
+ * @sb: the cpu-order buffer
+ *
+ */
+
+void
+gfs_sb_print(struct gfs_sb *sb)
+{
+	gfs_meta_header_print(&sb->sb_header);
+
+	pv(sb, sb_fs_format, "%u");
+	pv(sb, sb_multihost_format, "%u");
+	pv(sb, sb_flags, "%u");
+
+	pv(sb, sb_bsize, "%u");
+	pv(sb, sb_bsize_shift, "%u");
+	pv(sb, sb_seg_size, "%u");
+
+	gfs_inum_print(&sb->sb_jindex_di);
+	gfs_inum_print(&sb->sb_rindex_di);
+	gfs_inum_print(&sb->sb_root_di);
+
+	pv(sb, sb_lockproto, "%s");
+	pv(sb, sb_locktable, "%s");
+
+	gfs_inum_print(&sb->sb_quota_di);
+	gfs_inum_print(&sb->sb_license_di);
+
+	pa(sb, sb_reserved, 96);
+}
+
+/**
+ * gfs_jindex_in - Read in a journal index structure
+ * @jindex: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_jindex_in(struct gfs_jindex *jindex, char *buf)
+{
+	struct gfs_jindex *str = (struct gfs_jindex *)buf;
+
+	CPIN_64(jindex, str, ji_addr);
+	CPIN_32(jindex, str, ji_nsegment);
+	CPIN_32(jindex, str, ji_pad);
+
+	CPIN_08(jindex, str, ji_reserved, 64);
+}
+
+/**
+ * gfs_jindex_out - Write out a journal index structure
+ * @jindex: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_jindex_out(struct gfs_jindex *jindex, char *buf)
+{
+	struct gfs_jindex *str = (struct gfs_jindex *)buf;
+
+	CPOUT_64(jindex, str, ji_addr);
+	CPOUT_32(jindex, str, ji_nsegment);
+	CPOUT_32(jindex, str, ji_pad);
+
+	CPOUT_08(jindex, str, ji_reserved, 64);
+}
+
+/**
+ * gfs_jindex_print - Print out a journal index structure
+ * @ji: the cpu-order buffer
+ *
+ */
+
+void
+gfs_jindex_print(struct gfs_jindex *ji)
+{
+	pv(ji, ji_addr, "%"PRIu64);
+	pv(ji, ji_nsegment, "%u");
+	pv(ji, ji_pad, "%u");
+
+	pa(ji, ji_reserved, 64);
+}
+
+/**
+ * gfs_rindex_in - Read in a resource index structure
+ * @rindex: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_rindex_in(struct gfs_rindex *rindex, char *buf)
+{
+	struct gfs_rindex *str = (struct gfs_rindex *)buf;
+
+	CPIN_64(rindex, str, ri_addr);
+	CPIN_32(rindex, str, ri_length);
+	CPIN_32(rindex, str, ri_pad);
+
+	CPIN_64(rindex, str, ri_data1);
+	CPIN_32(rindex, str, ri_data);
+
+	CPIN_32(rindex, str, ri_bitbytes);
+
+	CPIN_08(rindex, str, ri_reserved, 64);
+}
+
+/**
+ * gfs_rindex_out - Write out a resource index structure
+ * @rindex: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_rindex_out(struct gfs_rindex *rindex, char *buf)
+{
+	struct gfs_rindex *str = (struct gfs_rindex *)buf;
+
+	CPOUT_64(rindex, str, ri_addr);
+	CPOUT_32(rindex, str, ri_length);
+	CPOUT_32(rindex, str, ri_pad);
+
+	CPOUT_64(rindex, str, ri_data1);
+	CPOUT_32(rindex, str, ri_data);
+
+	CPOUT_32(rindex, str, ri_bitbytes);
+
+	CPOUT_08(rindex, str, ri_reserved, 64);
+}
+
+/**
+ * gfs_rindex_print - Print out a resource index structure
+ * @ri: the cpu-order buffer
+ *
+ */
+
+void
+gfs_rindex_print(struct gfs_rindex *ri)
+{
+	pv(ri, ri_addr, "%"PRIu64);
+	pv(ri, ri_length, "%u");
+	pv(ri, ri_pad, "%u");
+
+	pv(ri, ri_data1, "%"PRIu64);
+	pv(ri, ri_data, "%u");
+
+	pv(ri, ri_bitbytes, "%u");
+
+	pa(ri, ri_reserved, 64);
+}
+
+/**
+ * gfs_rgrp_in - Read in a resource group header
+ * @rgrp: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_rgrp_in(struct gfs_rgrp *rgrp, char *buf)
+{
+	struct gfs_rgrp *str = (struct gfs_rgrp *)buf;
+
+	gfs_meta_header_in(&rgrp->rg_header, buf);
+
+	CPIN_32(rgrp, str, rg_flags);
+
+	CPIN_32(rgrp, str, rg_free);
+
+	CPIN_32(rgrp, str, rg_useddi);
+	CPIN_32(rgrp, str, rg_freedi);
+	gfs_inum_in(&rgrp->rg_freedi_list, (char *)&str->rg_freedi_list);
+
+	CPIN_32(rgrp, str, rg_usedmeta);
+	CPIN_32(rgrp, str, rg_freemeta);
+
+	CPIN_08(rgrp, str, rg_reserved, 64);
+}
+
+/**
+ * gfs_rgrp_out - Write out a resource group header
+ * @rgrp: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_rgrp_out(struct gfs_rgrp *rgrp, char *buf)
+{
+	struct gfs_rgrp *str = (struct gfs_rgrp *)buf;
+
+	gfs_meta_header_out(&rgrp->rg_header, buf);
+
+	CPOUT_32(rgrp, str, rg_flags);
+
+	CPOUT_32(rgrp, str, rg_free);
+
+	CPOUT_32(rgrp, str, rg_useddi);
+	CPOUT_32(rgrp, str, rg_freedi);
+	gfs_inum_out(&rgrp->rg_freedi_list, (char *)&str->rg_freedi_list);
+
+	CPOUT_32(rgrp, str, rg_usedmeta);
+	CPOUT_32(rgrp, str, rg_freemeta);
+
+	CPOUT_08(rgrp, str, rg_reserved, 64);
+}
+
+/**
+ * gfs_rgrp_print - Print out a resource group header
+ * @rg: the cpu-order buffer
+ *
+ */
+
+void
+gfs_rgrp_print(struct gfs_rgrp *rg)
+{
+	gfs_meta_header_print(&rg->rg_header);
+
+	pv(rg, rg_flags, "%u");
+
+	pv(rg, rg_free, "%u");
+
+	pv(rg, rg_useddi, "%u");
+	pv(rg, rg_freedi, "%u");
+	gfs_inum_print(&rg->rg_freedi_list);
+
+	pv(rg, rg_usedmeta, "%u");
+	pv(rg, rg_freemeta, "%u");
+
+	pa(rg, rg_reserved, 64);
+}
+
+/**
+ * gfs_quota_in - Read in a quota structures
+ * @quota: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_quota_in(struct gfs_quota *quota, char *buf)
+{
+	struct gfs_quota *str = (struct gfs_quota *)buf;
+
+	CPIN_64(quota, str, qu_limit);
+	CPIN_64(quota, str, qu_warn);
+	CPIN_64(quota, str, qu_value);
+
+	CPIN_08(quota, str, qu_reserved, 64);
+}
+
+/**
+ * gfs_quota_out - Write out a quota structure
+ * @quota: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_quota_out(struct gfs_quota *quota, char *buf)
+{
+	struct gfs_quota *str = (struct gfs_quota *)buf;
+
+	CPOUT_64(quota, str, qu_limit);
+	CPOUT_64(quota, str, qu_warn);
+	CPOUT_64(quota, str, qu_value);
+
+	CPOUT_08(quota, str, qu_reserved, 64);
+}
+
+/**
+ * gfs_quota_print - Print out a quota structure
+ * @quota: the cpu-order buffer
+ *
+ */
+
+void
+gfs_quota_print(struct gfs_quota *quota)
+{
+	pv(quota, qu_limit, "%"PRIu64);
+	pv(quota, qu_warn, "%"PRIu64);
+	pv(quota, qu_value, "%"PRId64);
+
+	pa(quota, qu_reserved, 64);
+}
+
+/**
+ * gfs_dinode_in - Read in a dinode
+ * @dinode: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_dinode_in(struct gfs_dinode *dinode, char *buf)
+{
+	struct gfs_dinode *str = (struct gfs_dinode *)buf;
+
+	gfs_meta_header_in(&dinode->di_header, buf);
+
+	gfs_inum_in(&dinode->di_num, (char *)&str->di_num);
+
+	CPIN_32(dinode, str, di_mode);
+	CPIN_32(dinode, str, di_uid);
+	CPIN_32(dinode, str, di_gid);
+	CPIN_32(dinode, str, di_nlink);
+	CPIN_64(dinode, str, di_size);
+	CPIN_64(dinode, str, di_blocks);
+	CPIN_64(dinode, str, di_atime);
+	CPIN_64(dinode, str, di_mtime);
+	CPIN_64(dinode, str, di_ctime);
+	CPIN_32(dinode, str, di_major);
+	CPIN_32(dinode, str, di_minor);
+
+	CPIN_64(dinode, str, di_rgrp);
+	CPIN_64(dinode, str, di_goal_rgrp);
+	CPIN_32(dinode, str, di_goal_dblk);
+	CPIN_32(dinode, str, di_goal_mblk);
+	CPIN_32(dinode, str, di_flags);
+	CPIN_32(dinode, str, di_payload_format);
+	CPIN_16(dinode, str, di_type);
+	CPIN_16(dinode, str, di_height);
+	CPIN_32(dinode, str, di_incarn);
+	CPIN_16(dinode, str, di_pad);
+
+	CPIN_16(dinode, str, di_depth);
+	CPIN_32(dinode, str, di_entries);
+
+	gfs_inum_in(&dinode->di_next_unused, (char *)&str->di_next_unused);
+
+	CPIN_64(dinode, str, di_eattr);
+
+	CPIN_08(dinode, str, di_reserved, 56);
+}
+
+/**
+ * gfs_dinode_out - Write out a dinode
+ * @dinode: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_dinode_out(struct gfs_dinode *dinode, char *buf)
+{
+	struct gfs_dinode *str = (struct gfs_dinode *)buf;
+
+	gfs_meta_header_out(&dinode->di_header, buf);
+
+	gfs_inum_out(&dinode->di_num, (char *)&str->di_num);
+
+	CPOUT_32(dinode, str, di_mode);
+	CPOUT_32(dinode, str, di_uid);
+	CPOUT_32(dinode, str, di_gid);
+	CPOUT_32(dinode, str, di_nlink);
+	CPOUT_64(dinode, str, di_size);
+	CPOUT_64(dinode, str, di_blocks);
+	CPOUT_64(dinode, str, di_atime);
+	CPOUT_64(dinode, str, di_mtime);
+	CPOUT_64(dinode, str, di_ctime);
+	CPOUT_32(dinode, str, di_major);
+	CPOUT_32(dinode, str, di_minor);
+
+	CPOUT_64(dinode, str, di_rgrp);
+	CPOUT_64(dinode, str, di_goal_rgrp);
+	CPOUT_32(dinode, str, di_goal_dblk);
+	CPOUT_32(dinode, str, di_goal_mblk);
+	CPOUT_32(dinode, str, di_flags);
+	CPOUT_32(dinode, str, di_payload_format);
+	CPOUT_16(dinode, str, di_type);
+	CPOUT_16(dinode, str, di_height);
+	CPOUT_32(dinode, str, di_incarn);
+	CPOUT_16(dinode, str, di_pad);
+
+	CPOUT_16(dinode, str, di_depth);
+	CPOUT_32(dinode, str, di_entries);
+
+	gfs_inum_out(&dinode->di_next_unused, (char *)&str->di_next_unused);
+
+	CPOUT_64(dinode, str, di_eattr);
+
+	CPOUT_08(dinode, str, di_reserved, 56);
+}
+
+/**
+ * gfs_dinode_print - Print out a dinode
+ * @di: the cpu-order buffer
+ *
+ */
+
+void
+gfs_dinode_print(struct gfs_dinode *di)
+{
+	gfs_meta_header_print(&di->di_header);
+
+	gfs_inum_print(&di->di_num);
+
+	pv(di, di_mode, "0%o");
+	pv(di, di_uid, "%u");
+	pv(di, di_gid, "%u");
+	pv(di, di_nlink, "%u");
+	pv(di, di_size, "%"PRIu64);
+	pv(di, di_blocks, "%"PRIu64);
+	pv(di, di_atime, "%"PRId64);
+	pv(di, di_mtime, "%"PRId64);
+	pv(di, di_ctime, "%"PRId64);
+	pv(di, di_major, "%u");
+	pv(di, di_minor, "%u");
+
+	pv(di, di_rgrp, "%"PRIu64);
+	pv(di, di_goal_rgrp, "%"PRIu64);
+	pv(di, di_goal_dblk, "%u");
+	pv(di, di_goal_mblk, "%u");
+	pv(di, di_flags, "0x%.8X");
+	pv(di, di_payload_format, "%u");
+	pv(di, di_type, "%u");
+	pv(di, di_height, "%u");
+	pv(di, di_incarn, "%u");
+	pv(di, di_pad, "%u");
+
+	pv(di, di_depth, "%u");
+	pv(di, di_entries, "%u");
+
+	gfs_inum_print(&di->di_next_unused);
+
+	pv(di, di_eattr, "%"PRIu64);
+
+	pa(di, di_reserved, 56);
+}
+
+/**
+ * gfs_indirect_in - copy in the header of an indirect block
+ * @indirect: the in memory copy
+ * @buf: the buffer copy
+ *
+ */
+
+void
+gfs_indirect_in(struct gfs_indirect *indirect, char *buf)
+{
+	struct gfs_indirect *str = (struct gfs_indirect *)buf;
+
+	gfs_meta_header_in(&indirect->in_header, buf);
+
+	CPIN_08(indirect, str, in_reserved, 64);
+}
+
+/**
+ * gfs_indirect_out - copy out the header of an indirect block
+ * @indirect: the in memory copy
+ * @buf: the buffer copy
+ *
+ */
+
+void
+gfs_indirect_out(struct gfs_indirect *indirect, char *buf)
+{
+	struct gfs_indirect *str = (struct gfs_indirect *)buf;
+
+	gfs_meta_header_out(&indirect->in_header, buf);
+
+	CPOUT_08(indirect, str, in_reserved, 64);
+}
+
+/**
+ * gfs_indirect_print - Print out a indirect block header
+ * @indirect: the cpu-order buffer
+ *
+ */
+
+void
+gfs_indirect_print(struct gfs_indirect *indirect)
+{
+	gfs_meta_header_print(&indirect->in_header);
+
+	pa(indirect, in_reserved, 64);
+}
+
+/**
+ * gfs_dirent_in - Read in a directory entry
+ * @dirent: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_dirent_in(struct gfs_dirent *dirent, char *buf)
+{
+	struct gfs_dirent *str = (struct gfs_dirent *)buf;
+
+	gfs_inum_in(&dirent->de_inum, (char *)&str->de_inum);
+	CPIN_32(dirent, str, de_hash);
+	CPIN_16(dirent, str, de_rec_len);
+	CPIN_16(dirent, str, de_name_len);
+	CPIN_16(dirent, str, de_type);
+
+	CPIN_08(dirent, str, de_reserved, 14);
+}
+
+/**
+ * gfs_dirent_out - Write out a directory entry
+ * @dirent: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_dirent_out(struct gfs_dirent *dirent, char *buf)
+{
+	struct gfs_dirent *str = (struct gfs_dirent *)buf;
+
+	gfs_inum_out(&dirent->de_inum, (char *)&str->de_inum);
+	CPOUT_32(dirent, str, de_hash);
+	CPOUT_16(dirent, str, de_rec_len);
+	CPOUT_16(dirent, str, de_name_len);
+	CPOUT_16(dirent, str, de_type);
+
+	CPOUT_08(dirent, str, de_reserved, 14);
+}
+
+/**
+ * gfs_dirent_print - Print out a directory entry
+ * @de: the cpu-order buffer
+ * @name: the filename
+ *
+ */
+
+void
+gfs_dirent_print(struct gfs_dirent *de, char *name)
+{
+	char buf[GFS_FNAMESIZE + 1];
+
+	gfs_inum_print(&de->de_inum);
+	pv(de, de_hash, "0x%.8X");
+	pv(de, de_rec_len, "%u");
+	pv(de, de_name_len, "%u");
+	pv(de, de_type, "%u");
+
+	pa(de, de_reserved, 14);
+
+	memset(buf, 0, GFS_FNAMESIZE + 1);
+	memcpy(buf, name, de->de_name_len);
+	printk("  name = %s\n", buf);
+}
+
+/**
+ * gfs_leaf_in - Read in a directory leaf header
+ * @leaf: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_leaf_in(struct gfs_leaf *leaf, char *buf)
+{
+	struct gfs_leaf *str = (struct gfs_leaf *)buf;
+
+	gfs_meta_header_in(&leaf->lf_header, buf);
+
+	CPIN_16(leaf, str, lf_depth);
+	CPIN_16(leaf, str, lf_entries);
+	CPIN_32(leaf, str, lf_dirent_format);
+	CPIN_64(leaf, str, lf_next);
+
+	CPIN_08(leaf, str, lf_reserved, 64);
+}
+
+/**
+ * gfs_leaf_out - Write out a directory leaf header
+ * @leaf: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_leaf_out(struct gfs_leaf *leaf, char *buf)
+{
+	struct gfs_leaf *str = (struct gfs_leaf *)buf;
+
+	gfs_meta_header_out(&leaf->lf_header, buf);
+
+	CPOUT_16(leaf, str, lf_depth);
+	CPOUT_16(leaf, str, lf_entries);
+	CPOUT_32(leaf, str, lf_dirent_format);
+	CPOUT_64(leaf, str, lf_next);
+
+	CPOUT_08(leaf, str, lf_reserved, 64);
+}
+
+/**
+ * gfs_leaf_print - Print out a directory leaf header
+ * @lf: the cpu-order buffer
+ *
+ */
+
+void
+gfs_leaf_print(struct gfs_leaf *lf)
+{
+	gfs_meta_header_print(&lf->lf_header);
+
+	pv(lf, lf_depth, "%u");
+	pv(lf, lf_entries, "%u");
+	pv(lf, lf_dirent_format, "%u");
+	pv(lf, lf_next, "%"PRIu64);
+
+	pa(lf, lf_reserved, 64);
+}
+
+/**
+ * gfs_log_header_in - Read in a log header
+ * @head: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_log_header_in(struct gfs_log_header *head, char *buf)
+{
+	struct gfs_log_header *str = (struct gfs_log_header *)buf;
+
+	gfs_meta_header_in(&head->lh_header, buf);
+
+	CPIN_32(head, str, lh_flags);
+	CPIN_32(head, str, lh_pad);
+
+	CPIN_64(head, str, lh_first);
+	CPIN_64(head, str, lh_sequence);
+
+	CPIN_64(head, str, lh_tail);
+	CPIN_64(head, str, lh_last_dump);
+
+	CPIN_08(head, str, lh_reserved, 64);
+}
+
+/**
+ * gfs_log_header_out - Write out a log header
+ * @head: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_log_header_out(struct gfs_log_header *head, char *buf)
+{
+	struct gfs_log_header *str = (struct gfs_log_header *)buf;
+
+	gfs_meta_header_out(&head->lh_header, buf);
+
+	CPOUT_32(head, str, lh_flags);
+	CPOUT_32(head, str, lh_pad);
+
+	CPOUT_64(head, str, lh_first);
+	CPOUT_64(head, str, lh_sequence);
+
+	CPOUT_64(head, str, lh_tail);
+	CPOUT_64(head, str, lh_last_dump);
+
+	CPOUT_08(head, str, lh_reserved, 64);
+}
+
+/**
+ * gfs_log_header_print - Print out a log header
+ * @head: the cpu-order buffer
+ *
+ */
+
+void
+gfs_log_header_print(struct gfs_log_header *lh)
+{
+	gfs_meta_header_print(&lh->lh_header);
+
+	pv(lh, lh_flags, "0x%.8X");
+	pv(lh, lh_pad, "%u");
+
+	pv(lh, lh_first, "%"PRIu64);
+	pv(lh, lh_sequence, "%"PRIu64);
+
+	pv(lh, lh_tail, "%"PRIu64);
+	pv(lh, lh_last_dump, "%"PRIu64);
+
+	pa(lh, lh_reserved, 64);
+}
+
+/**
+ * gfs_desc_in - Read in a log descriptor
+ * @desc: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_desc_in(struct gfs_log_descriptor *desc, char *buf)
+{
+	struct gfs_log_descriptor *str = (struct gfs_log_descriptor *)buf;
+
+	gfs_meta_header_in(&desc->ld_header, buf);
+
+	CPIN_32(desc, str, ld_type);
+	CPIN_32(desc, str, ld_length);
+	CPIN_32(desc, str, ld_data1);
+	CPIN_32(desc, str, ld_data2);
+
+	CPIN_08(desc, str, ld_reserved, 64);
+}
+
+/**
+ * gfs_desc_out - Write out a log descriptor
+ * @desc: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_desc_out(struct gfs_log_descriptor *desc, char *buf)
+{
+	struct gfs_log_descriptor *str = (struct gfs_log_descriptor *)buf;
+
+	gfs_meta_header_out(&desc->ld_header, buf);
+
+	CPOUT_32(desc, str, ld_type);
+	CPOUT_32(desc, str, ld_length);
+	CPOUT_32(desc, str, ld_data1);
+	CPOUT_32(desc, str, ld_data2);
+
+	CPOUT_08(desc, str, ld_reserved, 64);
+}
+
+/**
+ * gfs_desc_print - Print out a log descriptor
+ * @ld: the cpu-order buffer
+ *
+ */
+
+void
+gfs_desc_print(struct gfs_log_descriptor *ld)
+{
+	gfs_meta_header_print(&ld->ld_header);
+
+	pv(ld, ld_type, "%u");
+	pv(ld, ld_length, "%u");
+	pv(ld, ld_data1, "%u");
+	pv(ld, ld_data2, "%u");
+
+	pa(ld, ld_reserved, 64);
+}
+
+/**
+ * gfs_block_tag_in - Read in a block tag
+ * @tag: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_block_tag_in(struct gfs_block_tag *tag, char *buf)
+{
+	struct gfs_block_tag *str = (struct gfs_block_tag *)buf;
+
+	CPIN_64(tag, str, bt_blkno);
+	CPIN_32(tag, str, bt_flags);
+	CPIN_32(tag, str, bt_pad);
+}
+
+/**
+ * gfs_block_tag_out - Write out a block tag
+ * @tag: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_block_tag_out(struct gfs_block_tag *tag, char *buf)
+{
+	struct gfs_block_tag *str = (struct gfs_block_tag *)buf;
+
+	CPOUT_64(tag, str, bt_blkno);
+	CPOUT_32(tag, str, bt_flags);
+	CPOUT_32(tag, str, bt_pad);
+}
+
+/**
+ * gfs_block_tag_print - Print out a block tag
+ * @tag: the cpu-order buffer
+ *
+ */
+
+void
+gfs_block_tag_print(struct gfs_block_tag *tag)
+{
+	pv(tag, bt_blkno, "%"PRIu64);
+	pv(tag, bt_flags, "%u");
+	pv(tag, bt_pad, "%u");
+}
+
+/**
+ * gfs_quota_tag_in - Read in a quota tag
+ * @tag: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_quota_tag_in(struct gfs_quota_tag *tag, char *buf)
+{
+	struct gfs_quota_tag *str = (struct gfs_quota_tag *)buf;
+
+	CPIN_64(tag, str, qt_change);
+	CPIN_32(tag, str, qt_flags);
+	CPIN_32(tag, str, qt_id);
+}
+
+/**
+ * gfs_quota_tag_out - Write out a quota tag
+ * @tag: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_quota_tag_out(struct gfs_quota_tag *tag, char *buf)
+{
+	struct gfs_quota_tag *str = (struct gfs_quota_tag *)buf;
+
+	CPOUT_64(tag, str, qt_change);
+	CPOUT_32(tag, str, qt_flags);
+	CPOUT_32(tag, str, qt_id);
+}
+
+/**
+ * gfs_quota_tag_print - Print out a quota tag
+ * @tag: the cpu-order buffer
+ *
+ */
+
+void
+gfs_quota_tag_print(struct gfs_quota_tag *tag)
+{
+	pv(tag, qt_change, "%"PRId64);
+	pv(tag, qt_flags, "0x%.8X");
+	pv(tag, qt_id, "%u");
+}
+
+/**
+ * gfs_ea_header_in - Read in a Extended Attribute header
+ * @tag: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_ea_header_in(struct gfs_ea_header *ea, char *buf)
+{
+	struct gfs_ea_header *str = (struct gfs_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;
+	CPIN_32(ea, str, ea_pad);
+}
+
+/**
+ * gfs_ea_header_out - Write out a Extended Attribute header
+ * @ea: the cpu-order structure
+ * @buf: the disk-order buffer
+ *
+ */
+
+void
+gfs_ea_header_out(struct gfs_ea_header *ea, char *buf)
+{
+	struct gfs_ea_header *str = (struct gfs_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;
+	CPOUT_32(ea, str, ea_pad);
+}
+
+/**
+ * gfs_ea_header_printt - Print out a Extended Attribute header
+ * @ea: the cpu-order buffer
+ *
+ */
+
+void
+gfs_ea_header_print(struct gfs_ea_header *ea, char *name)
+{
+	char buf[GFS_EA_MAX_NAME_LEN + 1];
+
+	pv(ea, ea_rec_len, "%u");
+	pv(ea, ea_data_len, "%u");
+	pv(ea, ea_name_len, "%u");
+	pv(ea, ea_type, "%u");
+	pv(ea, ea_flags, "%u");
+	pv(ea, ea_num_ptrs, "%u");
+	pv(ea, ea_pad, "%u");
+
+	memset(buf, 0, GFS_EA_MAX_NAME_LEN + 1);
+	memcpy(buf, name, ea->ea_name_len);
+	printk("  name = %s\n", buf);
+}
+
+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
+};
+
+/**
+ * gfs_dir_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.
+ *
+ * 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
+gfs_dir_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  /* WANT_GFS_CONVERSION_FUNCTIONS */
+
diff --git a/group/Makefile b/group/Makefile
index 2717fb7..fe34807 100644
--- a/group/Makefile
+++ b/group/Makefile
@@ -1,8 +1,4 @@
 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
+SUBDIRS = libgfscontrol gfs_control gfs_controld man
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_controld/Makefile b/group/gfs_controld/Makefile
index 0b3a9e7..e194610 100644
--- a/group/gfs_controld/Makefile
+++ b/group/gfs_controld/Makefile
@@ -2,7 +2,7 @@ TARGET= gfs_controld
 
 SBINDIRT=$(TARGET)
 
-all: depends ${TARGET}
+all: ${TARGET}
 
 include ../../make/defines.mk
 include $(OBJDIR)/make/cobj.mk
@@ -22,10 +22,10 @@ OBJS= 	main.o \
 	logging.o
 
 CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${logtincdir} -I${dlmcontrolincdir}
-CFLAGS += -I${corosyncincdir} -I${openaisincdir}
+CFLAGS += -I${corosyncincdir} -I${openaisincdir} -I${fencedincdir}
 CFLAGS += -I${KERNEL_SRC}/include/
-CFLAGS += -I$(S)/../libgfscontrol -I$(S)/../../fence/libfenced/
-CFLAGS += -I$(S)/../lib/ -I$(S)/../include/
+CFLAGS += -I$(S)/../libgfscontrol 
+CFLAGS += -I$(S)/../include/
 CFLAGS += -I${incdir}
 
 LDFLAGS += -L${ccslibdir} -lccs -L${cmanlibdir} -lcman
@@ -33,19 +33,16 @@ 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${fencedlibdir} -lfenced
+LDFLAGS += -L${grouplibdir} -lgroup
 LDFLAGS += -L${libdir}
 
-LDDEPS += ../lib/libgroup.a
-LDDEPS += ../../fence/libfenced/libfenced.a
+LDDEPS += ${grouplibdir}/libgroup.a
+LDDEPS += ${fencedlibdir}/libfenced.a
 
 ${TARGET}: ${OBJS} ${LDDEPS}
 	$(CC) -o $@ $^ $(LDFLAGS)
 
-depends:
-	$(MAKE) -C ../lib all
-
 clean: generalclean
 
 -include $(OBJS:.o=.d)
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/man/Makefile b/group/man/Makefile
index 36f8b87..661f6a6 100644
--- a/group/man/Makefile
+++ b/group/man/Makefile
@@ -1,7 +1,4 @@
-TARGET= dlm_controld.8 \
-	gfs_controld.8 \
-	group_tool.8 \
-	groupd.8
+TARGET= gfs_controld.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/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..3b05ff2 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,8 +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@
 
@@ -32,69 +23,34 @@ OBJDIR = @OBJDIR@
 
 KERNEL_BUILD = @KERNEL_BUILD@
 KERNEL_SRC = @KERNEL_SRC@
-gfskincdir ?= @GFSKINCDIR@
 ccsincdir ?= @CCSINCDIR@
 ccslibdir ?= @CCSLIBDIR@
 cmanincdir ?= @CMANINCDIR@
 cmanlibdir ?= @CMANLIBDIR@
-dlmincdir ?= @DLMINCDIR@
-dlmlibdir ?= @DLMLIBDIR@
+groupincdir ?= @GROUPINCDIR@
+grouplibdir ?= @GROUPLIBDIR@
 dlmcontrolincdir ?= @DLMCONTROLINCDIR@
 dlmcontrollibdir ?= @DLMCONTROLLIBDIR@
-fenceincdir ?= @FENCEINCDIR@
-fencelibdir ?= @FENCELIBDIR@
+fencedincdir ?= @FENCEDINCDIR@
+fencedlibdir ?= @FENCEDLIBDIR@
 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..0250c17 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,39 +29,9 @@ 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}
-endif
-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..508fbf5 100644
--- a/make/uninstall.mk
+++ b/make/uninstall.mk
@@ -14,33 +14,9 @@ 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]