Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ physiock(D3) — UnixWare 2.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought






       physiock(D3)                                            physiock(D3)


       NAME
             physiock - validate and issue a raw I/O request

       SYNOPSIS
             #include <sys/types.h>
             #include <sys/buf.h>
             #include <sys/uio.h>
             #include <sys/ddi.h>
             int physiock(void (*strat)(), buf_t *bp, dev_t dev, int rwflag,
                   daddr_t nblocks, uio_t *uiop);

          Arguments
             strat     Address of the driver strategy(D2) routine, or
                       similar function.
             bp        Pointer to the buf(D4) structure describing the I/O
                       request.
             dev       External device number.
             rwflag    Flag indicating whether the access is a read or a
                       write.
             nblocks   Number of blocks that the logical device dev can
                       support.
             uiop      Pointer to the uio(D4) structure that defines the
                       user space of the I/O request.

       DESCRIPTION
             physiock is called by the character interface ioctl(D2),
             read(D2), and write(D2) routines of block drivers to help
             perform unbuffered I/O while maintaining the buffer header as
             the interface structure.

          Return Values
             physiock returns 0 if the result is successful, or the
             appropriate error number on failure.  If a partial transfer
             occurs, the uio structure is updated to indicate the amount
             not transferred and an error is returned.  physiock returns
             the ENXIO error if an attempt is made to read beyond the end
             of the device.  If a read is performed at the end of the
             device, 0 is returned.  ENXIO is also returned if an attempt
             is made to write at or beyond the end of a the device.  EFAULT
             is returned if user memory is not valid.  EAGAIN is returned
             if physiock could not lock all of the pages.

       USAGE
             physiock performs the following functions:




                           Copyright 1994 Novell, Inc.               Page 1













      physiock(D3)                                            physiock(D3)


                  verifies the requested transfer is valid by checking if
                  the offset is at or past the end of the device (this
                  check is bypassed if the size parameter argument nblocks
                  is zero)

                  sets up a buffer header describing the transfer

                  faults pages in and locks the pages impacted by the I/O
                  transfer so they can't be swapped out

                  calls the driver strategy routine passed to it (strat)

                  sleeps until the transfer is complete and is awakened by
                  a call to biodone(D3) from the driver's I/O completion
                  handler

                  performs the necessary cleanup and updates, then returns
                  to the driver routine

            A transfer using physiock is considered valid if the specified
            data location exists on the device, and the user has specified
            a storage area large enough that exists in user memory space.

            If bp is set to NULL, a buffer is allocated temporarily and
            freed after the transfer completes.

            If rwflag is set to B_READ, the direction of the data transfer
            will be from the kernel to the user's buffer.  If rwflag is
            set to B_WRITE, the direction of the data transfer will be
            from the user's buffer to the kernel.

            One block is equal to NBPSCTR bytes.  NBPSCTR is defined in
            sys/param.h.

            Some device drivers need nblocks to be arbitrarily large (for
            example, for tapes whose sizes are unknown).  In this case,
            nblocks should be no larger than (222)-1.  For arbitrarily
            large cases on SVR4.2 MP systems, nblocks should be 0 (zero).

         Level
            Base only.

         Synchronization Constraints
            Can sleep.




                          Copyright 1994 Novell, Inc.               Page 2













       physiock(D3)                                            physiock(D3)


             Driver-defined basic locks and read/write locks may not be
             held across calls to this function.

             Driver-defined sleep locks may be held across calls to this
             function.

          Examples
             See dma_pageio(D3) for an example of physiock.

       REFERENCES
             buf(D4), dma_pageio(D3), ioctl(D2), read(D2), strategy(D2),
             uio(D4), write(D2)

       NOTICES
          Portability
             All processors

          Applicability
             ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp





























                           Copyright 1994 Novell, Inc.               Page 3








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