All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 3/6 v2] f2fs-tools: support zoned device in Android
Date: Tue, 26 Apr 2022 16:06:23 -0700	[thread overview]
Message-ID: <Ymh678gnPofwuo7M@google.com> (raw)
In-Reply-To: <20220422211819.2230879-3-jaegeuk@kernel.org>

This requires to change Android.bp in AOSP.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Change-Id: I28a4a701513cb2420cdf0e0e2aa3f60e712f2fcb
---
 configure.ac             |  9 ++++++++-
 fsck/fsck.c              |  2 +-
 include/android_config.h |  4 ++++
 include/f2fs_fs.h        |  4 +++-
 lib/libf2fs.c            | 10 +++-------
 5 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index f0ed5f6528d9..e8ce0057c4ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,6 +95,7 @@ AC_CHECK_HEADERS(m4_flatten([
 	blkid/blkid.h
 	byteswap.h
 	fcntl.h
+	kernel/uapi/linux/blkzoned.h
 	linux/blkzoned.h
 	linux/falloc.h
 	linux/fiemap.h
@@ -222,7 +223,13 @@ AC_CONFIG_FILES([
 
 AC_CHECK_MEMBER([struct blk_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
 AC_SUBST(FMT_CURRENT, 7)
diff --git a/fsck/fsck.c b/fsck/fsck.c
index 19a28b0eedad..3b37519e9054 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -2994,7 +2994,7 @@ struct write_pointer_check_data {
 	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 write_pointer_check_data *wpd = opaque;
diff --git a/include/android_config.h b/include/android_config.h
index ce6723309447..d7e4f60d91c6 100644
--- a/include/android_config.h
+++ b/include/android_config.h
@@ -1,7 +1,10 @@
 #if defined(__linux__)
+#define HAVE_BLK_ZONE_REP_V2 1
 #define HAVE_BYTESWAP_H 1
 #define HAVE_FCNTL_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_LIMITS_H 1
 #define HAVE_POSIX_ACL_H 1
@@ -19,6 +22,7 @@
 #define HAVE_SYS_SYSMACROS_H 1
 #define HAVE_SYS_XATTR_H 1
 #define HAVE_UNISTD_H 1
+#define HAVE_SCSI_SG_H 1
 
 #define HAVE_FALLOCATE 1
 #define HAVE_FSETXATTR 1
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index 1d7103c1d6fe..d6374270c188 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -50,7 +50,9 @@
 #endif
 #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>
 #endif
 
diff --git a/lib/libf2fs.c b/lib/libf2fs.c
index 63d07f26c739..afdbbbe17d84 100644
--- a/lib/libf2fs.c
+++ b/lib/libf2fs.c
@@ -34,11 +34,9 @@
 #ifdef HAVE_SYS_UTSNAME_H
 #include <sys/utsname.h>
 #endif
-#ifndef WITH_ANDROID
 #ifdef HAVE_SCSI_SG_H
 #include <scsi/sg.h>
 #endif
-#endif
 #ifdef HAVE_LINUX_HDREG_H
 #include <linux/hdreg.h>
 #endif
@@ -46,10 +44,8 @@
 #include <linux/limits.h>
 #endif
 
-#ifndef WITH_ANDROID
 /* SCSI command for standard inquiry*/
 #define MODELINQUIRY	0x12,0x00,0x00,0x00,0x4A,0x00
-#endif
 
 #ifndef _WIN32 /* O_BINARY is windows-specific flag */
 #define O_BINARY 0
@@ -900,7 +896,7 @@ int get_device_info(int i)
 #ifdef HDIO_GETGIO
 	struct hd_geometry geom;
 #endif
-#if !defined(WITH_ANDROID) && defined(__linux__)
+#ifdef __linux__
 	sg_io_hdr_t io_hdr;
 	unsigned char reply_buffer[96] = {0};
 	unsigned char model_inq[6] = {MODELINQUIRY};
@@ -1002,7 +998,7 @@ int get_device_info(int i)
 #endif
 		}
 
-#if !defined(WITH_ANDROID) && defined(__linux__)
+#ifdef __linux__
 		/* Send INQUIRY command */
 		memset(&io_hdr, 0, sizeof(sg_io_hdr_t));
 		io_hdr.interface_id = 'S';
@@ -1033,7 +1029,7 @@ int get_device_info(int i)
 		return -1;
 	}
 
-#if !defined(WITH_ANDROID) && defined(__linux__)
+#ifdef __linux__
 	if (S_ISBLK(stat_buf->st_mode)) {
 		if (f2fs_get_zoned_model(i) < 0) {
 			free(stat_buf);
-- 
2.36.0.rc2.479.g8af0fa9b8e-goog



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  reply	other threads:[~2022-04-26 23:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-22 21:18 [f2fs-dev] [PATCH 1/6] libf2fs_io: add unused mactor to avoid build failure Jaegeuk Kim
2022-04-22 21:18 ` [f2fs-dev] [PATCH 2/6] android_config.h: add missing liblz4 Jaegeuk Kim
2022-04-22 21:18 ` [f2fs-dev] [PATCH 3/6] f2fs-tools: support zoned device in Android Jaegeuk Kim
2022-04-26 23:06   ` Jaegeuk Kim [this message]
2022-04-22 21:18 ` [f2fs-dev] [PATCH 4/6] f2fs-tools: use fsync() " Jaegeuk Kim
2022-04-22 21:18 ` [f2fs-dev] [PATCH 5/6] f2fs-tools: use android config only if there's no config.h Jaegeuk Kim
2022-04-26 16:30   ` [f2fs-dev] [PATCH 5/6 v2] " Jaegeuk Kim
2022-04-22 21:18 ` [f2fs-dev] [PATCH 6/6] mkfs.f2fs: check uuid library Jaegeuk Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Ymh678gnPofwuo7M@google.com \
    --to=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.