Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

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

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

vdm(7)

ioctl(2)

open(2)



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


NAME
       vdmphys - Physical Subdriver of the Virtual Disk Manager

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

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

DESCRIPTION
       The Physical Subdriver is a pseudo-device driver that works under the
       Virtual Disk Management (VDM) framework (see vdm(7)).  The purpose of
       the Physical Subdriver is to act as a translator between VDM
       interfaces and physical device driver interfaces such as SCSI device
       drivers (see sd(7)).

STRUCTURES
       The structures defined in this section are pointed to by fields in
       structures used by 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 Physical Subdriver is defined by
       DGVDMPHYSSUBDRIVERID.

       Unless otherwise noted, the version field in the following structures
       is an input field that must be set to
       DGVDMPHYSIOCTLPACKETVERSION0.  Additionally, all packets must
       have every byte set to zero before it is used.

   DGVDMCREATEINSTANCE
       The subdriverattributespacketptr field points to the following
       structure:

       struct dgvdmphyscreatepacket
            {
            int       version;
            int       openflag;
            devt          childdevicenumber;
            };

       The openflag field is an input field that indicates the intended use
       of the physical instance.  The value of this field are can be
       ORDONLY or ORDWR (the same values as those used in the open(2)
       system call for the argument having the same name).  The ORDONLY
       value causes the physical instance to limit I/O to only reads.  The
       ORDWR value causes the physical instance to allow reads and writes.

       The childdevicenumber field is the device number of any physical
       disk device.  The device number can be obtained for these devices
       using dgsysctl(2).  Additionally, the childdevicenumber cannot be
       the device number of a VDM instance.

   DGVDMLINKCHILDINSTANCE
       Physical instances are limited to one child which is required when



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




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


       the instance is created; therefore, a child instance cannot be added
       to a physical instance.  If an attempt is made to perform this
       operation, the command will fail and errno will be set to EOPNOTSUPP.

   DGVDMGETCHILDINSTANCE
       Because instances of the Physical Subdriver have only one child, a
       child's role is not ambiguous so the childpacketptr is not used by
       the Physical Subdriver.

       The childsubdriverid output field of the VDM's packet is set to
       DGVDMSUBDRIVERIDOFANONVDMDEVICE.

   DGVDMEXTRACTINSTANCE
       Because a child's functionality is moved to its parent with this
       command, a physical instance cannot be extracted because its child is
       not a VDM instance so it has no functionality that can be moved.  If
       an attempt is made to perform this operation, the command will fail
       and errno will be set to EINVAL.

   DGVDMGETATTRIBUTES
       The subdriverattributespacketptr field points to the following
       structure:

       struct dgvdmphysgetpacket
            {
            int       version;
            int       openflag;
            devt          childdevicenumber;
            };

       The meaning of the above fields are the same as those in the create
       packet.

   DGVDMUPDATEATTRIBUTES
       The subdriverattributespacketptr field points to the following
       structure:

       struct dgvdmphysupdatepacket
            {
            int       version;
            int       openflag;
            };

       The meaning of the above fields are the same as those in the create
       packet.

   DGVDMUNLINKCHILDINSTANCE
       This command results in a child being removed from an instance.
       Since physical instances are required to have a child, a child cannot
       be removed from a physical instance.  If an attempt is made to
       perform this operation, the command will fail and errno will be set
       to EOPNOTSUPP.





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




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


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

       1.     Issue the command to an exported instance of the Physical
              Subdriver.  In this case, the fildes 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 fildes 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.

   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 functions defined in the vdm(7) man page.
        *  These functions all begin with a vdm prefix.
        */

       /***********************************************************************
        *  This macro initializes a packet used by the Physical Subdriver.
        ***********************************************************************/
       #define vdmphysinitpacket(p) \
               (bzero((char *)&p, sizeof(p)), \
               p.version = DGVDMPHYSIOCTLPACKETVERSION0);

       /***********************************************************************
        *  This function creates a physical instance for the given device
        *  specification - like sd(insc(),0).
        ***********************************************************************/
       devt vdmphyscreateinstance (
       char * instancename,



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




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


       char * devicespecification,
       int    openflag
                                     )
       {
       int                             status;
       struct dgsysctlnametodevice nametodevicepkt;
       struct dgvdmphyscreatepacket createpkt;
       devt                           devicenumber;

       nametodevicepkt.devicename = devicespecification;
       status = dgsysctl(DGSYSCTLNAMETODEVICE, &nametodevicepkt);
       if (status != 0)
           {
           return (NODEV);
           }

       vdmphysinitpacket(createpkt);
       createpkt.openflag = openflag;
       createpkt.childdevicenumber = nametodevicepkt.devicenumber;
       devicenumber = vdmcreateinstance(
                          instancename, DGVDMPHYSSUBDRIVERID, &createpkt);

       return (devicenumber);
       }

       int vdmphysexample (void)
       {
       devt devicenumber;

       /*
        *  Create a physical instance by first getting a device number of
        *  a physical device on the system and then issuing the create.
        */
       devicenumber = vdmphyscreateinstance("a", "sd(insc(),0)", ORDWR);
       if (devicenumber == NODEV)
           {
           perror("sd(insc(),0)");
           exit(1);
           }

       exit(0);
       }



FILES
       Files in or under /dev

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







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


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