mirror of
https://gitee.com/openharmony/third_party_f2fs-tools
synced 2024-11-23 10:10:00 +00:00
f2fs-tools: support zoned device in Android
commit ea9921f4f5b947084a70a94573c472bd953e1c0d category: bugfix issue: #I6VAS0 CVE: NA Signed-off-by: DongSenhao <dongsenhao2@huawei.com> --------------------------------------- This requires to change Android.bp in AOSP. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Change-Id: I28a4a701513cb2420cdf0e0e2aa3f60e712f2fcb Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
This commit is contained in:
parent
fefda1af29
commit
89c91958fa
@ -95,6 +95,7 @@ AC_CHECK_HEADERS(m4_flatten([
|
|||||||
blkid/blkid.h
|
blkid/blkid.h
|
||||||
byteswap.h
|
byteswap.h
|
||||||
fcntl.h
|
fcntl.h
|
||||||
|
kernel/uapi/linux/blkzoned.h
|
||||||
linux/blkzoned.h
|
linux/blkzoned.h
|
||||||
linux/falloc.h
|
linux/falloc.h
|
||||||
linux/fiemap.h
|
linux/fiemap.h
|
||||||
@ -222,7 +223,13 @@ AC_CONFIG_FILES([
|
|||||||
|
|
||||||
AC_CHECK_MEMBER([struct blk_zone.capacity],
|
AC_CHECK_MEMBER([struct blk_zone.capacity],
|
||||||
[AC_DEFINE(HAVE_BLK_ZONE_REP_V2, [1], [report zones includes zone capacity])],
|
[AC_DEFINE(HAVE_BLK_ZONE_REP_V2, [1], [report zones includes zone capacity])],
|
||||||
[], [[#include <linux/blkzoned.h>]])
|
[], [[
|
||||||
|
#ifdef HAVE_KERNEL_UAPI_LINUX_BLKZONED_H
|
||||||
|
#include <kernel/uapi/linux/blkzoned.h>
|
||||||
|
#elif defined(HAVE_LINUX_BLKZONED_H)
|
||||||
|
#include <linux/blkzoned.h>
|
||||||
|
#endif
|
||||||
|
]])
|
||||||
|
|
||||||
# export library version info for mkfs/libf2fs_format_la
|
# export library version info for mkfs/libf2fs_format_la
|
||||||
AC_SUBST(FMT_CURRENT, 7)
|
AC_SUBST(FMT_CURRENT, 7)
|
||||||
|
@ -2994,7 +2994,7 @@ struct write_pointer_check_data {
|
|||||||
int dev_index;
|
int dev_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int chk_and_fix_wp_with_sit(int i, void *blkzone, void *opaque)
|
static int chk_and_fix_wp_with_sit(int UNUSED(i), void *blkzone, void *opaque)
|
||||||
{
|
{
|
||||||
struct blk_zone *blkz = (struct blk_zone *)blkzone;
|
struct blk_zone *blkz = (struct blk_zone *)blkzone;
|
||||||
struct write_pointer_check_data *wpd = opaque;
|
struct write_pointer_check_data *wpd = opaque;
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
|
#define HAVE_BLK_ZONE_REP_V2 1
|
||||||
#define HAVE_BYTESWAP_H 1
|
#define HAVE_BYTESWAP_H 1
|
||||||
#define HAVE_FCNTL_H 1
|
#define HAVE_FCNTL_H 1
|
||||||
#define HAVE_FALLOC_H 1
|
#define HAVE_FALLOC_H 1
|
||||||
|
#define HAVE_KERNEL_UAPI_LINUX_BLKZONED_H 1
|
||||||
|
#define HAVE_LINUX_BLKZONED_H 1
|
||||||
#define HAVE_LINUX_HDREG_H 1
|
#define HAVE_LINUX_HDREG_H 1
|
||||||
#define HAVE_LINUX_LIMITS_H 1
|
#define HAVE_LINUX_LIMITS_H 1
|
||||||
#define HAVE_POSIX_ACL_H 1
|
#define HAVE_POSIX_ACL_H 1
|
||||||
@ -19,6 +22,7 @@
|
|||||||
#define HAVE_SYS_SYSMACROS_H 1
|
#define HAVE_SYS_SYSMACROS_H 1
|
||||||
#define HAVE_SYS_XATTR_H 1
|
#define HAVE_SYS_XATTR_H 1
|
||||||
#define HAVE_UNISTD_H 1
|
#define HAVE_UNISTD_H 1
|
||||||
|
#define HAVE_SCSI_SG_H 1
|
||||||
|
|
||||||
#define HAVE_FALLOCATE 1
|
#define HAVE_FALLOCATE 1
|
||||||
#define HAVE_FSETXATTR 1
|
#define HAVE_FSETXATTR 1
|
||||||
|
@ -50,7 +50,9 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#ifdef HAVE_LINUX_BLKZONED_H
|
#ifdef HAVE_KERNEL_UAPI_LINUX_BLKZONED_H
|
||||||
|
#include <kernel/uapi/linux/blkzoned.h>
|
||||||
|
#elif defined(HAVE_LINUX_BLKZONED_H)
|
||||||
#include <linux/blkzoned.h>
|
#include <linux/blkzoned.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -36,11 +36,9 @@
|
|||||||
#ifdef HAVE_SYS_UTSNAME_H
|
#ifdef HAVE_SYS_UTSNAME_H
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#endif
|
#endif
|
||||||
#ifndef WITH_ANDROID
|
|
||||||
#ifdef HAVE_SCSI_SG_H
|
#ifdef HAVE_SCSI_SG_H
|
||||||
#include <scsi/sg.h>
|
#include <scsi/sg.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LINUX_HDREG_H
|
#ifdef HAVE_LINUX_HDREG_H
|
||||||
#include <linux/hdreg.h>
|
#include <linux/hdreg.h>
|
||||||
#endif
|
#endif
|
||||||
@ -48,10 +46,8 @@
|
|||||||
#include <linux/limits.h>
|
#include <linux/limits.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WITH_ANDROID
|
|
||||||
/* SCSI command for standard inquiry*/
|
/* SCSI command for standard inquiry*/
|
||||||
#define MODELINQUIRY 0x12,0x00,0x00,0x00,0x4A,0x00
|
#define MODELINQUIRY 0x12,0x00,0x00,0x00,0x4A,0x00
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _WIN32 /* O_BINARY is windows-specific flag */
|
#ifndef _WIN32 /* O_BINARY is windows-specific flag */
|
||||||
#define O_BINARY 0
|
#define O_BINARY 0
|
||||||
@ -902,7 +898,7 @@ int get_device_info(int i)
|
|||||||
#ifdef HDIO_GETGIO
|
#ifdef HDIO_GETGIO
|
||||||
struct hd_geometry geom;
|
struct hd_geometry geom;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(WITH_ANDROID) && defined(__linux__)
|
#ifdef __linux__
|
||||||
sg_io_hdr_t io_hdr;
|
sg_io_hdr_t io_hdr;
|
||||||
unsigned char reply_buffer[96] = {0};
|
unsigned char reply_buffer[96] = {0};
|
||||||
unsigned char model_inq[6] = {MODELINQUIRY};
|
unsigned char model_inq[6] = {MODELINQUIRY};
|
||||||
@ -1004,7 +1000,7 @@ int get_device_info(int i)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(WITH_ANDROID) && defined(__linux__)
|
#ifdef __linux__
|
||||||
/* Send INQUIRY command */
|
/* Send INQUIRY command */
|
||||||
memset(&io_hdr, 0, sizeof(sg_io_hdr_t));
|
memset(&io_hdr, 0, sizeof(sg_io_hdr_t));
|
||||||
io_hdr.interface_id = 'S';
|
io_hdr.interface_id = 'S';
|
||||||
@ -1035,7 +1031,7 @@ int get_device_info(int i)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(WITH_ANDROID) && defined(__linux__)
|
#ifdef __linux__
|
||||||
if (S_ISBLK(stat_buf->st_mode)) {
|
if (S_ISBLK(stat_buf->st_mode)) {
|
||||||
if (f2fs_get_zoned_model(i) < 0) {
|
if (f2fs_get_zoned_model(i) < 0) {
|
||||||
free(stat_buf);
|
free(stat_buf);
|
||||||
|
Loading…
Reference in New Issue
Block a user