diff mbox

[LEDE-DEV] fstools: added f2fs to block-mount, rebased

Message ID AM3PR08MB0642C05C60E5E6EFC4F15B2392AA0@AM3PR08MB0642.eurprd08.prod.outlook.com
State Changes Requested
Headers show

Commit Message

Alberto Bursi Oct. 27, 2016, 9:10 a.m. UTC
added the code to recognize and operate the filesystem checker of f2fs
added f2fs to the filesystem whitelist of block so it can mount it on
/overlay at boot.

Signed-off-by: Alberto Bursi <alberto.bursi@outlook.it>
---
 block.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

Comments

John Crispin Oct. 27, 2016, 10:06 a.m. UTC | #1
Hi

subject is bad. the f2fs support is added to the block tool and not
block-mount. the "rebased needs to go to the front with the
subject-prefix or go below the tear line

one more comment inline

On 27/10/2016 11:10, Alberto Bursi wrote:
> added the code to recognize and operate the filesystem checker of f2fs
> added f2fs to the filesystem whitelist of block so it can mount it on
> /overlay at boot.
> 
> Signed-off-by: Alberto Bursi <alberto.bursi@outlook.it>
> ---
>  block.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/block.c b/block.c
> index 24becef..b161bb9 100644
> --- a/block.c
> +++ b/block.c
> @@ -690,6 +690,7 @@ static void check_filesystem(struct probe_info *pr)
>  	pid_t pid;
>  	struct stat statbuf;
>  	const char *e2fsck = "/usr/sbin/e2fsck";
> +	const char *f2fsck = "/usr/sbin/fsck.f2fs";
>  	const char *dosfsck = "/usr/sbin/dosfsck";
>  	const char *ckfs;
>  
> @@ -699,6 +700,8 @@ static void check_filesystem(struct probe_info *pr)
>  
>  	if (!strncmp(pr->type, "vfat", 4)) {
>  		ckfs = dosfsck;
> +	} else if (!strncmp(pr->type, "f2fs", 4)) {
> +		ckfs = f2fsck;
>  	} else if (!strncmp(pr->type, "ext", 3)) {
>  		ckfs = e2fsck;
>  	} else {
> @@ -713,8 +716,13 @@ static void check_filesystem(struct probe_info *pr)
>  
>  	pid = fork();
>  	if (!pid) {
> -		execl(ckfs, ckfs, "-p", pr->dev, NULL);
> -		exit(-1);
> +		if(!strncmp(pr->type, "f2fs", 4)) {
> +			execl(ckfs, ckfs, "-f", pr->dev, NULL);
> +			exit(-1);
> +		} else {
> +			execl(ckfs, ckfs, "-p", pr->dev, NULL);
> +			exit(-1);
> +		}
>  	} else if (pid > 0) {
>  		int status;
>  
> @@ -1293,8 +1301,9 @@ static int mount_extroot(char *cfg)
>  	}
>  	if (pr) {
>  		if (strncmp(pr->type, "ext", 3) &&
> -		    strncmp(pr->type, "ubifs", 5)) {
> -			ULOG_ERR("extroot: unsupported filesystem %s, try ext4\n", pr->type);
> +			strncmp(pr->type, "f2fs", 4) &&
> +			strncmp(pr->type, "ubifs", 5)) {

why do you change the indenting here ?

	John

> +			ULOG_ERR("extroot: unsupported filesystem %s, try ext4, f2fs or ubifs\n", pr->type);
>  			return -1;
>  		}
>  
>
diff mbox

Patch

diff --git a/block.c b/block.c
index 24becef..b161bb9 100644
--- a/block.c
+++ b/block.c
@@ -690,6 +690,7 @@  static void check_filesystem(struct probe_info *pr)
 	pid_t pid;
 	struct stat statbuf;
 	const char *e2fsck = "/usr/sbin/e2fsck";
+	const char *f2fsck = "/usr/sbin/fsck.f2fs";
 	const char *dosfsck = "/usr/sbin/dosfsck";
 	const char *ckfs;
 
@@ -699,6 +700,8 @@  static void check_filesystem(struct probe_info *pr)
 
 	if (!strncmp(pr->type, "vfat", 4)) {
 		ckfs = dosfsck;
+	} else if (!strncmp(pr->type, "f2fs", 4)) {
+		ckfs = f2fsck;
 	} else if (!strncmp(pr->type, "ext", 3)) {
 		ckfs = e2fsck;
 	} else {
@@ -713,8 +716,13 @@  static void check_filesystem(struct probe_info *pr)
 
 	pid = fork();
 	if (!pid) {
-		execl(ckfs, ckfs, "-p", pr->dev, NULL);
-		exit(-1);
+		if(!strncmp(pr->type, "f2fs", 4)) {
+			execl(ckfs, ckfs, "-f", pr->dev, NULL);
+			exit(-1);
+		} else {
+			execl(ckfs, ckfs, "-p", pr->dev, NULL);
+			exit(-1);
+		}
 	} else if (pid > 0) {
 		int status;
 
@@ -1293,8 +1301,9 @@  static int mount_extroot(char *cfg)
 	}
 	if (pr) {
 		if (strncmp(pr->type, "ext", 3) &&
-		    strncmp(pr->type, "ubifs", 5)) {
-			ULOG_ERR("extroot: unsupported filesystem %s, try ext4\n", pr->type);
+			strncmp(pr->type, "f2fs", 4) &&
+			strncmp(pr->type, "ubifs", 5)) {
+			ULOG_ERR("extroot: unsupported filesystem %s, try ext4, f2fs or ubifs\n", pr->type);
 			return -1;
 		}