From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [PATCH 1/5] mkfs.f2fs: set encryption feature
Date: Fri, 8 May 2015 21:24:37 -0700 [thread overview]
Message-ID: <1431145481-2184-1-git-send-email-jaegeuk@kernel.org> (raw)
This patch add to support encryption feature.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
include/f2fs_fs.h | 7 +++++++
mkfs/f2fs_format.c | 2 ++
mkfs/f2fs_format_main.c | 16 +++++++++++++++-
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index d23ae1b..6aefa5d 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -251,6 +251,7 @@ struct f2fs_configuration {
int fix_on;
int bug_on;
int auto_fix;
+ __le32 feature; /* defined features */
} __attribute__((packed));
#ifdef CONFIG_64BIT
@@ -315,6 +316,8 @@ enum {
#define MAX_ACTIVE_NODE_LOGS 8
#define MAX_ACTIVE_DATA_LOGS 8
+#define F2FS_FEATURE_ENCRYPT 0x0001
+
/*
* For superblock
*/
@@ -353,6 +356,10 @@ struct f2fs_super_block {
__le32 cp_payload;
__u8 version[VERSION_LEN]; /* the kernel version */
__u8 init_version[VERSION_LEN]; /* the initial kernel version */
+ __le32 feature; /* defined features */
+ __u8 encryption_level; /* versioning level for encryption */
+ __u8 encrypt_pw_salt[16]; /* Salt used for string2key algorithm */
+ __u8 reserved[871]; /* valid reserved region */
} __attribute__((packed));
/*
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index 094afa3..f879bca 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -364,6 +364,8 @@ static int f2fs_prepare_super_block(void)
memcpy(sb.version, config.version, VERSION_LEN);
memcpy(sb.init_version, config.version, VERSION_LEN);
+ sb.feature = config.feature;
+
return 0;
}
diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c
index 9a96798..5a9e7e2 100644
--- a/mkfs/f2fs_format_main.c
+++ b/mkfs/f2fs_format_main.c
@@ -33,6 +33,7 @@ static void mkfs_usage()
MSG(0, " -e [extension list] e.g. \"mp3,gif,mov\"\n");
MSG(0, " -l label\n");
MSG(0, " -o overprovision ratio [default:5]\n");
+ MSG(0, " -O set feature\n");
MSG(0, " -q quiet mode\n");
MSG(0, " -s # of segments per section [default:1]\n");
MSG(0, " -z # of sections per zone [default:1]\n");
@@ -61,9 +62,19 @@ static void f2fs_show_info()
MSG(0, "Info: Trim is %s\n", config.trim ? "enabled": "disabled");
}
+static void parse_feature(char *features)
+{
+ if (!strcmp(features, "encrypt")) {
+ config.feature |= cpu_to_le32(F2FS_FEATURE_ENCRYPT);
+ } else {
+ MSG(0, "Error: Wrong features\n");
+ mkfs_usage();
+ }
+}
+
static void f2fs_parse_options(int argc, char *argv[])
{
- static const char *option_string = "qa:d:e:l:o:s:z:t:";
+ static const char *option_string = "qa:d:e:l:o:O:s:z:t:";
int32_t option=0;
while ((option = getopt(argc,argv,option_string)) != EOF) {
@@ -91,6 +102,9 @@ static void f2fs_parse_options(int argc, char *argv[])
case 'o':
config.overprovision = atoi(optarg);
break;
+ case 'O':
+ parse_feature(strdup(optarg));
+ break;
case 's':
config.segs_per_sec = atoi(optarg);
break;
--
2.1.1
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
next reply other threads:[~2015-05-09 4:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-09 4:24 Jaegeuk Kim [this message]
2015-05-09 4:24 ` [PATCH 2/5] fsck.f2fs: show superblock features and encryption info Jaegeuk Kim
2015-05-09 4:24 ` [PATCH 3/5] dump.f2fs: show i_advise field in inode Jaegeuk Kim
2015-05-09 4:24 ` [PATCH 4/5] fsck.f2fs: avoid build warning Jaegeuk Kim
2015-05-09 4:24 ` [PATCH 5/5] fsck.f2fs: add hash conversion for encrypted dentries 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=1431145481-2184-1-git-send-email-jaegeuk@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).