diff mbox

[LEDE-DEV] fstools: added f2fs to block-mount, really correct indentation

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

Commit Message

Alberto Bursi Oct. 21, 2016, 12:54 p.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 | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

Comments

John Crispin Oct. 25, 2016, 6:32 a.m. UTC | #1
Hi,

after some recent changes in the fstools repo this patch applies but
causes a compile error. could you please rebase/test/send the patch

there were also a lot of whitespace errors. please use tabs to indent
your c code
	John

On 21/10/2016 14:54, 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 | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/block.c b/block.c
> index 9de8343..073ad05 100644
> --- a/block.c
> +++ b/block.c
> @@ -687,6 +687,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;
>  
> @@ -696,6 +697,8 @@ static void check_filesystem(struct probe_info *pr)
>  
>  	if (!strncmp(pr->type, "vfat", 4)) {
>  		ckfs = dosfsck;
> +   	} else if (!strncmp(pr->id->name, "f2fs", 4)) {
> +        	ckfs = f2fsck;
>  	} else if (!strncmp(pr->type, "ext", 3)) {
>  		ckfs = e2fsck;
>  	} else {
> @@ -710,8 +713,12 @@ static void check_filesystem(struct probe_info *pr)
>  
>  	pid = fork();
>  	if (!pid) {
> -		execl(ckfs, ckfs, "-p", pr->dev, NULL);
> -		exit(-1);
> +		if(!strncmp(pr->id->name, "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;
>  
> @@ -1154,8 +1161,9 @@ static int mount_extroot(char *cfg)
>  	}
>  	if (pr) {
>  		if (strncmp(pr->type, "ext", 3) &&
> +	            strncmp(pr->id->name, "f2fs", 4) &&
>  		    strncmp(pr->type, "ubifs", 5)) {
> -			ULOG_ERR("extroot: unsupported filesystem %s, try ext4\n", pr->type);
> +			ULOG_ERR("extroot: unsupported filesystem %s, try ext4 or f2fs\n", pr->type);
>  			return -1;
>  		}
>  
>
diff mbox

Patch

diff --git a/block.c b/block.c
index 9de8343..073ad05 100644
--- a/block.c
+++ b/block.c
@@ -687,6 +687,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;
 
@@ -696,6 +697,8 @@  static void check_filesystem(struct probe_info *pr)
 
 	if (!strncmp(pr->type, "vfat", 4)) {
 		ckfs = dosfsck;
+   	} else if (!strncmp(pr->id->name, "f2fs", 4)) {
+        	ckfs = f2fsck;
 	} else if (!strncmp(pr->type, "ext", 3)) {
 		ckfs = e2fsck;
 	} else {
@@ -710,8 +713,12 @@  static void check_filesystem(struct probe_info *pr)
 
 	pid = fork();
 	if (!pid) {
-		execl(ckfs, ckfs, "-p", pr->dev, NULL);
-		exit(-1);
+		if(!strncmp(pr->id->name, "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;
 
@@ -1154,8 +1161,9 @@  static int mount_extroot(char *cfg)
 	}
 	if (pr) {
 		if (strncmp(pr->type, "ext", 3) &&
+	            strncmp(pr->id->name, "f2fs", 4) &&
 		    strncmp(pr->type, "ubifs", 5)) {
-			ULOG_ERR("extroot: unsupported filesystem %s, try ext4\n", pr->type);
+			ULOG_ERR("extroot: unsupported filesystem %s, try ext4 or f2fs\n", pr->type);
 			return -1;
 		}