Whamcloud - gitweb
libext2fs: add unixfd_io_manager
authorAdrien Schildknecht <adriens@google.com>
Wed, 10 Aug 2016 21:08:16 +0000 (17:08 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 10 Aug 2016 21:08:16 +0000 (17:08 -0400)
commit4ccf9e4fe165cfa966c8af0f3d310230aa5c3a1e
tree8a041fdd60a507263578707429aa4fd8d22c6238
parentd4e5abfb1bb990a029005c1a801961fc1a0ba866
libext2fs: add unixfd_io_manager

This new manager is similar to the unix_io_manager except it takes a
file descriptor as first argument instead of a filename.

Some programs may want libext2fs to directly use a fd instead of
letting it opening the file.
The use case for such a io_manager would be to let programs use
a fd even if the filename is unknown:
  - the fd comes from a temporary file (O_TMPFILE);
  - the fd comes from a unix socket...

Refactoring unix_open() also fix a bug when the IO_DIRECT flag was
specified: ext2fs_get_dio_alignment() was called before the file was
actually opened, resulting in an alignment of 0.

Signed-off-by: Adrien Schildknecht <adriens@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/ext2_io.h
lib/ext2fs/unix_io.c