• J
    fs: add SEEK_HOLE and SEEK_DATA flags · 982d8165
    Josef Bacik 提交于
    This just gets us ready to support the SEEK_HOLE and SEEK_DATA flags.  Turns out
    using fiemap in things like cp cause more problems than it solves, so lets try
    and give userspace an interface that doesn't suck.  We need to match solaris
    here, and the definitions are
    
    *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.
    
    So in the generic case the entire file is data and there is a virtual hole at
    the end.  That means we will just return i_size for SEEK_HOLE and will return
    the same offset for SEEK_DATA.  This is how Solaris does it so we have to do it
    the same way.
    
    Thanks,
    Signed-off-by: NJosef Bacik <josef@redhat.com>
    Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
    982d8165
read_write.c 21.7 KB