[New-bugs-announce] [issue10142] Support for SEEK_HOLE/SEEK_DATA

Jesús Cea Avión report at bugs.python.org
Tue Oct 19 05:15:19 CEST 2010


New submission from Jesús Cea Avión <jcea at jcea.es>:

ZFS supports SEEK_HOLE/SEEK_DATA in "lseek()" syscall.

Oracle Solaris man page por "lseek":

"""
[...]
       o  If whence is SEEK_HOLE, the offset of the start of  the
          next  hole greater than or equal to the supplied offset
          is returned. The definition of a hole is provided  near
          the end of the DESCRIPTION.

       o  If whence is SEEK_DATA, the file pointer is set to  the
          start  of the next non-hole file region greater than or
          equal to the supplied offset.


     The  symbolic  constants   SEEK_SET,   SEEK_CUR,   SEEK_END,
     SEEK_HOLE,   and   SEEK_DATA   are  defined  in  the  header
     <unistd.h>.
[...]
     A "hole" is defined as a contiguous  range  of  bytes  in  a
     file,  all  having the value of zero, but not all zeros in a
     file are guaranteed to be represented as holes returned with
     SEEK_HOLE. Filesystems are allowed to expose ranges of zeros
     with SEEK_HOLE, but not required to.  Applications  can  use
     SEEK_HOLE  to  optimise  their behavior for ranges of zeros,
     but must not depend on it to find all such ranges in a file.
     The  existence  of  a  hole  at the end of every data region
     allows for easy programming and implies that a virtual  hole
     exists  at  the  end  of  the  file. Applications should use
     fpathconf(_PC_MIN_HOLE_SIZE) or  pathconf(_PC_MIN_HOLE_SIZE)
     to  determine if a filesystem supports SEEK_HOLE. See fpath-
     conf(2).

     For filesystems that do not supply information about  holes,
     the file will be represented as one entire data region.
"""

Implementation would be trivial. Simply conditionally compile the constant export in the C module. Or adopt the approach in the last phrase.

Any novice?.

----------
keywords: easy
messages: 119112
nosy: jcea
priority: normal
severity: normal
status: open
title: Support for SEEK_HOLE/SEEK_DATA
type: feature request
versions: Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10142>
_______________________________________


More information about the New-bugs-announce mailing list