• David 'Digit' Turner's avatar
    Ignore wipe operation on non-block devices. · eb5fcc3e
    David 'Digit' Turner authored
    The implementation of make_ext4fs() calls make_ext4fs_internal() by
    forcing the |wipe| parameter to true, which is problematic when the
    library is used within the emulator (the wipe operation will always
    fail on non-Linux platforms).
    
    This patch does the following:
    
    - Add a 'is_block_device_fd()' function to check that a file descriptor
      points to a real block device.
    
    - Modify the implementation of wipe_block_device() uses it to return
      silently when trying to wipe a non-block-device file.
    
    - Add a WIPE_IS_SUPPORTED flag in wipe.h that indicates whether
      block device wiping is supported on the current platform
      (for now, this is only the case on Linux).
    
    BUG=NONE
    
    Change-Id: I62b62b7c3e99b465c3b876154231e7c2fe541b23
    eb5fcc3e
wipe.c 1.61 KB