Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ vdmtest(7) — DG/UX 5.4R3.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

vdm(7)

vdmphys(7)

ioctl(2)



vdmtest(7)                     DG/UX 5.4R3.00                     vdmtest(7)


NAME
       vdmtest - Test Subdriver of the Virtual Disk Manager

SYNOPSIS
       #include <types.h>
       #include <ioctl.h>

       ioctl(int fildes, int command, int argument);

DESCRIPTION
       The Test Subdriver is a pseudo-device driver that works under the
       Virtual Disk Management (VDM) framework (see vdm(7)).  The purpose of
       the Test Subdriver is to pass all I/O to its single child unless
       instructed to interrupt the I/O.  The interruption can be to all I/O
       or to groups of blocks.  The purpose of the interruption is to test
       the impact and handling of failures in other subdrivers and
       application programs.

STRUCTURES
       The structures defined in this section are pointed to by fields
       described in VDM commands (see vdm(7)).  The VDM command and the
       field in the argument structure will be described.  For many VDM
       commands, a subdriver ID is required as an input value.  The
       subdriver ID for the Test Subdriver is defined by
       DGVDMTESTSUBDRIVERID.

       All of the Test Subdriver's packets contain a version field.  This
       field provides compatibility to application programs not yet using
       the most up to date versions of the packets available.  Unless it is
       noted specifically, this field should be filled with the value
       DGVDMTESTIOCTLPACKETVERSION0.

   DGVDMCREATEINSTANCE
       The subdriverattributespacketptr field points to the following
       structure:

       struct dgvdmtestcreatepacket
            {
            int                version;
            devt              childdevicenumber;
            };

       The childdevicenumber field is an input field and identifies the
       instance that will be have its I/O intercepted.

   DGVDMLINKCHILDINSTANCE
       Test instances are limited to one child which is required when the
       instance is created; therefore, a child instance cannot be added to a
       test instance.

   DGVDMGETCHILDINSTANCE
       Although this command is supported, no packet is required since the
       child's device number is returned as part of the VDM framework
       packet.



Licensed material--property of copyright holder(s)                         1




vdmtest(7)                     DG/UX 5.4R3.00                     vdmtest(7)


   DGVDMGETATTRIBUTES
       This command is not supported by the Test Subdriver.  If an attempt
       is made to perform this operation, the command will fail and errno
       will be set to EOPNOTSUPP.

   DGVDMUPDATEATTRIBUTES
       This command is not supported by the Test Subdriver.  Changes to the
       attributes of the Test Subdriver are specific commands described in
       the IOCTLS section below.  If an attempt is made to perform this
       operation, the command will fail and errno will be set to EOPNOTSUPP.

   DGVDMEXTRACTINSTANCE
       Instances of the Test Subdriver can be extracted when they are no
       longer needed.

   DGVDMUNLINKCHILDINSTANCE
       A test instance has and requires a child; therefore, a child cannot
       be removed from a test instance.  If an attempt is made to perform
       this operation, the command will fail and errno will be set to
       EOPNOTSUPP.

IOCTLS
       The ioctls supported by the Test Subdriver are listed below.  The
       ioctl(2) command can be issued to the Test Subdriver in two ways:

       1.     Issue the command to an exported instance of the Test
              Subdriver.  In this case, the fd is an open file descriptor of
              the device node created when the instance was exported.  The
              command and the argument are described below.

       2.     Use the DGVDMIOCTLSUBDRIVER command described in more
              detail in vdm(7).  In this case, the fd is an open file
              descriptor of /dev/vdm device node.  The argument is a pointer
              to a structure that contains command and argument fields.  The
              values supplied for these fields are described below.

   DGVDMTESTFAILBLOCKS
       This command causes a range of contiguous blocks to report failures
       when a read is attempted from them.  The following is a packet for
       this command.

       struct dgvdmtestfailblocks
           {
           daddrt             startingblock;
           unsigned long       numberofblocks;
           };

       The fildes argument is used to identify the instance.

       The startingblock is an input field indicating the first block that
       should return EIO when accessed on read.  The sizeinblocks field is
       an input field that describes the number of blocks from the given
       starting block that should also report an I/O failure.




Licensed material--property of copyright holder(s)                         2




vdmtest(7)                     DG/UX 5.4R3.00                     vdmtest(7)


   DGVDMTESTFAILINSTANCE
       The command causes the instance to return a failure an all read and
       write accesses to it.

       The fildes argument is used to identify the instance and no argument
       is required.

   DGVDMTESTREPAIRINSTANCE
       The command causes the instance to stop returning failures.

       The fildes argument is used to identify the instance and no argument
       is required.

   DSKIOCGET
       This command returns the size of an instance and is described in more
       detail in dsk(7).

   DSKIOCUSAGE
       This command returns statistics associated with the use of an
       instance and is described in more detail in dsk(7).

   DSKIOCGETADDRESS
       This command returns the logical address at which a given memory
       address to the specified instance should be mapped.

EXAMPLE
       #include <errno.h>
       #include <fcntl.h>
       #include <stdio.h>
       #include <string.h>
       #include <sys/dgsysctl.h>
       #include <sys/ioctl.h>
       #include <unistd.h>

       /*
        *  This example makes use of the vdmioctl() function described in the
        *  vdm(7) man page.  The vdmioctl() function issues ioctl(2) commands
        *  to the /dev/vdm device node.
        */

       int main (void)
       {
       int                                     status;
       devt                                   physdevicenumber;
       devt                                   testdevicenumber;
       struct dgvdmcreateinstancepacket    createinstancepkt;
       struct dgsysctlnametodevice         nametodevicepkt;
       struct dgvdmtestcreatepacket         createtestpkt;
       extern int                              errno;

       /*
        *  Create a physical instance by first getting a device number of
        *  a physical device on the system and then issuing the create.
        */



Licensed material--property of copyright holder(s)                         3




vdmtest(7)                     DG/UX 5.4R3.00                     vdmtest(7)


       nametodevicepkt.devicename = "sd(insc(),0)";
       status = dgsysctl(DGSYSCTLNAMETODEVICE, &nametodevicepkt);
       if (status == -1)
           {
           perror("sd(insc(),0)");
           exit(1);
           }

       /*
        *  Create a physical instance.
        */
       createphyspkt.childdevicenumber = nametodevicepkt.devicenumber;

       createinstancepkt.subdriverid = DGVDMPHYSSUBDRIVERID;
       createinstancepkt.subdriverattributespacketptr = &createphyspkt;
       strcpy (createinstancepkt.instancename, "a");

       status = vdmioctl(DGVDMCREATEINSTANCE, &createinstancepkt);
       if (status == -1)
           {
           perror("create a");
           exit(1);
           }

       /*
        *  Create a test instance on top of the physical instance.
        */

       initvdmpacket(createinstancepkt);
       inittestpacket(createtestpkt);
       createtestpkt.childdevicenumber = adevicenumber;

       createinstancepkt.subdriverid    = DGVDMTESTSUBDRIVERID;
       createinstancepkt.subdriverattributespacketptr = &createtestpkt;
       strcpy (createinstancepkt.instancename, "b");

       status = vdmioctl(DGVDMCREATEINSTANCE, &createinstancepkt);
       if (status == -1)
           {
           perror("b");
           exit(1);
           }

       bdevicenumber = createinstancepkt.devicenumber;

       /*
        *  Cause some blocks to fail.
        */
       inittestpkt(failblockspkt);
       failblockspkt.startingblock = adevicenumber;
       listchildspkt.numberofblocks = 0;

       status = vdmioctlsubdriver(
                    DGVDMTESTSUBDRIVERID,



Licensed material--property of copyright holder(s)                         4




vdmtest(7)                     DG/UX 5.4R3.00                     vdmtest(7)


                    adevicenumber,
                    DGVDMTESTFAILBLOCKS,
                    (int)&failblockspkt);

       if (status == -1)
           {
           perror("fail blocks");
           exit(1);
           }

       /*
        *  Now cause the whole instance to report failures.
        */
       inittestpkt(failblockspkt);

       status = vdmioctlsubdriver(
                    DGVDMTESTSUBDRIVERID,
                    adevicenumber,
                    DGVDMTESTFAILINSTANCE,
                    (int)NULL);

       if (status == -1)
           {
           perror("fail instance");
           exit(1);
           }

       exit(0);
       }


FILES
       Files in or under /dev

SEE ALSO
       vdm(7), vdmphys(7), ioctl(2).





















Licensed material--property of copyright holder(s)                         5


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026