Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ physio(K) — OpenDesktop Software Development System 1.0.0d

Media Vault

Software Library

Restoration Projects

Artifacts Sought



     PHYSIO(K)                 UNIX System V                 PHYSIO(K)



     Name
          physio, physck - raw I/O for block drivers

     Syntax
          int
          physck(nblocks, rwflag)
          daddr_t nblocks;
          int rwflag;

          int
          physio(routine, bp, dev, rwflag)
          int (*routine) ();
          struct buf *bp;
          int dev, rwflag;

     Description
          The physck routine ensures that a requested raw I/O request
          can be serviced by the device being read from or written to.
          The nblocks argument to physck is the maximum number of
          512-byte blocks on the device, or in the disk partition.
          The number of blocks is converted to bytes to find the size
          limit and then compared with  u.u_offset.  If u.u_offset is
          greater than the size limit, and rwflag is B_WRITE, then
          u.u_error is set to ENXIO and a 0 (zero) is returned.  If
          u.u_offset is greater than or equal to the limit, and rwflag
          is B_READ, then 0 (zero) is returned and no error is  set.
          If u.u_offset plus u.u_count is greater than the limit, then
          u.u_count is reduced by the number of bytes that it differs
          from the limit and the test is completed.  physio returns 1
          on all successful tests.

          The physio routine provides a raw (direct) I/O interface for
          block-device drivers.  It validates the request, builds a
          buffer header, locks the process in core, and calls a
          routine, to queue the request.  The routine usually called
          is one containing a call to dma_breakup(K), or routine may
          be a call to an xxstrategy routine.

     Warning
          Before calling physio, make sure that the buffer is not busy
          (b_flags contains B_BUSY).

     Notes
          If the data transfer crosses a 64K segment boundary, physio
          may break the request into 3 pieces.  If the data request
          crosses a 4K page boundary, the request is broken into BSIZE
          pieces.  BSIZE is defined in sys/fs/s5param.h and varies by
          file system size.

     Parameters
               nblocks        the number of 512-byte blocks to be read
                              from the device or written to the
                              device.

               rwflag         an I/O flag.  Set to B_READ for reading;
                              set to B_WRITE for writing.

               routine        the address of a routine to be executed,
                              generally xxbreakup or xxstrategy.

               bp             a pointer to the buffer header
                              describing the request to be filled.
                              Ensure that the buffer is not busy
                              before calling physio.  Set the bp
                              argument to NULL to have physio allocate
                              a buffer.  The following example
                              illustrates such a call:


                              physio(xxbreakup, (struct buf *) NULL,
                                     dev, B_READ);


               dev            an integer specifying the device number
                              (includes both the major and minor
                              device numbers)

               rwflag         an I/O flag.  Set to B_READ for reading;
                              set to B_WRITE for writing.  The
                              possible values are:B_READ - read from
                              disk to user memory, and B_WRITE - write
                              from user memory to disk.

          The u.u_base , u.u_count , and u.u_offset values must be set
          up prior to the physio call, and must point to the
          appropriate user-data area.

     See Also
          db_read(K), db_write(K), dma_breakup(K), pio_breakup(K)

















     Page 2                                           (printed 7/6/89)



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