All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] Make --mount-point option generally available
@ 2022-06-30 17:14 Kelvin Zhang via Linux-erofs
  2022-07-01  4:20 ` Gao Xiang
  0 siblings, 1 reply; 8+ messages in thread
From: Kelvin Zhang via Linux-erofs @ 2022-06-30 17:14 UTC (permalink / raw)
  To: linux-erofs mailing list, Miao Xie, Fang Wei; +Cc: Kelvin Zhang

This option does not have any android specific dependencies. It is also
useful for all selinux enabled fs images, so move it out of android
specific feature sets.

Signed-off-by: Kelvin Zhang <zhangkelvin@google.com>
---
 include/erofs/config.h | 2 +-
 lib/xattr.c            | 2 --
 mkfs/main.c            | 6 +++---
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/include/erofs/config.h b/include/erofs/config.h
index 0a1b18b..030054b 100644
--- a/include/erofs/config.h
+++ b/include/erofs/config.h
@@ -65,8 +65,8 @@ struct erofs_configure {
 	u32 c_dict_size;
 	u64 c_unix_timestamp;
 	u32 c_uid, c_gid;
+	const char *mount_point;
 #ifdef WITH_ANDROID
-	char *mount_point;
 	char *target_out_path;
 	char *fs_config_file;
 	char *block_list_file;
diff --git a/lib/xattr.c b/lib/xattr.c
index 00fb963..cf5c447 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -210,12 +210,10 @@ static struct xattr_item *erofs_get_selabel_xattr(const char *srcpath,
 		unsigned int len[2];
 		char *kvbuf, *fspath;
 
-#ifdef WITH_ANDROID
 		if (cfg.mount_point)
 			ret = asprintf(&fspath, "/%s/%s", cfg.mount_point,
 				       erofs_fspath(srcpath));
 		else
-#endif
 			ret = asprintf(&fspath, "/%s", erofs_fspath(srcpath));
 		if (ret <= 0)
 			return ERR_PTR(-ENOMEM);
diff --git a/mkfs/main.c b/mkfs/main.c
index b62a8aa..879c2f2 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -50,8 +50,8 @@ static struct option long_options[] = {
 	{"quiet", no_argument, 0, 12},
 	{"blobdev", required_argument, NULL, 13},
 	{"ignore-mtime", no_argument, NULL, 14},
-#ifdef WITH_ANDROID
 	{"mount-point", required_argument, NULL, 512},
+#ifdef WITH_ANDROID
 	{"product-out", required_argument, NULL, 513},
 	{"fs-config-file", required_argument, NULL, 514},
 	{"block-list-file", required_argument, NULL, 515},
@@ -103,9 +103,9 @@ static void usage(void)
 #ifndef NDEBUG
 	      " --random-pclusterblks randomize pclusterblks for big pcluster (debugging only)\n"
 #endif
+	      " --mount-point=X       X=prefix of target fs path (default: /)\n"
 #ifdef WITH_ANDROID
 	      "\nwith following android-specific options:\n"
-	      " --mount-point=X       X=prefix of target fs path (default: /)\n"
 	      " --product-out=X       X=product_out directory\n"
 	      " --fs-config-file=X    X=fs_config file\n"
 	      " --block-list-file=X   X=block_list file\n"
@@ -314,7 +314,6 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
 		case 10:
 			cfg.c_compress_hints_file = optarg;
 			break;
-#ifdef WITH_ANDROID
 		case 512:
 			cfg.mount_point = optarg;
 			/* all trailing '/' should be deleted */
@@ -322,6 +321,7 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
 			if (opt && optarg[opt - 1] == '/')
 				optarg[opt - 1] = '\0';
 			break;
+#ifdef WITH_ANDROID
 		case 513:
 			cfg.target_out_path = optarg;
 			break;
-- 
2.37.0.rc0.161.g10f37bed90-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v1] Make --mount-point option generally available
  2022-06-30 17:14 [PATCH v1] Make --mount-point option generally available Kelvin Zhang via Linux-erofs
@ 2022-07-01  4:20 ` Gao Xiang
  2022-07-01 23:00   ` [PATCH v2] " Kelvin Zhang via Linux-erofs
  0 siblings, 1 reply; 8+ messages in thread
From: Gao Xiang @ 2022-07-01  4:20 UTC (permalink / raw)
  To: Kelvin Zhang; +Cc: Miao Xie, linux-erofs mailing list

Hi Kelvin,

On Thu, Jun 30, 2022 at 10:14:42AM -0700, Kelvin Zhang wrote:

erofs-utils: make --mount-point option generally available

> This option does not have any android specific dependencies. It is also
> useful for all selinux enabled fs images, so move it out of android
> specific feature sets.

Thanks for this patch!  The patch itself looks good to me,
yet could you give some example how to use it for all selinux
enabled fs images w/o Android in the commit message.

That would be much better to us!

Thanks,
Gao Xiang

> 
> Signed-off-by: Kelvin Zhang <zhangkelvin@google.com>
> ---
>  include/erofs/config.h | 2 +-
>  lib/xattr.c            | 2 --
>  mkfs/main.c            | 6 +++---
>  3 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/include/erofs/config.h b/include/erofs/config.h
> index 0a1b18b..030054b 100644
> --- a/include/erofs/config.h
> +++ b/include/erofs/config.h
> @@ -65,8 +65,8 @@ struct erofs_configure {
>  	u32 c_dict_size;
>  	u64 c_unix_timestamp;
>  	u32 c_uid, c_gid;
> +	const char *mount_point;
>  #ifdef WITH_ANDROID
> -	char *mount_point;
>  	char *target_out_path;
>  	char *fs_config_file;
>  	char *block_list_file;
> diff --git a/lib/xattr.c b/lib/xattr.c
> index 00fb963..cf5c447 100644
> --- a/lib/xattr.c
> +++ b/lib/xattr.c
> @@ -210,12 +210,10 @@ static struct xattr_item *erofs_get_selabel_xattr(const char *srcpath,
>  		unsigned int len[2];
>  		char *kvbuf, *fspath;
>  
> -#ifdef WITH_ANDROID
>  		if (cfg.mount_point)
>  			ret = asprintf(&fspath, "/%s/%s", cfg.mount_point,
>  				       erofs_fspath(srcpath));
>  		else
> -#endif
>  			ret = asprintf(&fspath, "/%s", erofs_fspath(srcpath));
>  		if (ret <= 0)
>  			return ERR_PTR(-ENOMEM);
> diff --git a/mkfs/main.c b/mkfs/main.c
> index b62a8aa..879c2f2 100644
> --- a/mkfs/main.c
> +++ b/mkfs/main.c
> @@ -50,8 +50,8 @@ static struct option long_options[] = {
>  	{"quiet", no_argument, 0, 12},
>  	{"blobdev", required_argument, NULL, 13},
>  	{"ignore-mtime", no_argument, NULL, 14},
> -#ifdef WITH_ANDROID
>  	{"mount-point", required_argument, NULL, 512},
> +#ifdef WITH_ANDROID
>  	{"product-out", required_argument, NULL, 513},
>  	{"fs-config-file", required_argument, NULL, 514},
>  	{"block-list-file", required_argument, NULL, 515},
> @@ -103,9 +103,9 @@ static void usage(void)
>  #ifndef NDEBUG
>  	      " --random-pclusterblks randomize pclusterblks for big pcluster (debugging only)\n"
>  #endif
> +	      " --mount-point=X       X=prefix of target fs path (default: /)\n"
>  #ifdef WITH_ANDROID
>  	      "\nwith following android-specific options:\n"
> -	      " --mount-point=X       X=prefix of target fs path (default: /)\n"
>  	      " --product-out=X       X=product_out directory\n"
>  	      " --fs-config-file=X    X=fs_config file\n"
>  	      " --block-list-file=X   X=block_list file\n"
> @@ -314,7 +314,6 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
>  		case 10:
>  			cfg.c_compress_hints_file = optarg;
>  			break;
> -#ifdef WITH_ANDROID
>  		case 512:
>  			cfg.mount_point = optarg;
>  			/* all trailing '/' should be deleted */
> @@ -322,6 +321,7 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
>  			if (opt && optarg[opt - 1] == '/')
>  				optarg[opt - 1] = '\0';
>  			break;
> +#ifdef WITH_ANDROID
>  		case 513:
>  			cfg.target_out_path = optarg;
>  			break;
> -- 
> 2.37.0.rc0.161.g10f37bed90-goog

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] Make --mount-point option generally available
  2022-07-01  4:20 ` Gao Xiang
@ 2022-07-01 23:00   ` Kelvin Zhang via Linux-erofs
  2022-07-02  4:53     ` Gao Xiang
  2022-07-04  2:19     ` Yue Hu
  0 siblings, 2 replies; 8+ messages in thread
From: Kelvin Zhang via Linux-erofs @ 2022-07-01 23:00 UTC (permalink / raw)
  To: linux-erofs mailing list, Miao Xie, Fang Wei; +Cc: Kelvin Zhang

This option does not have any android specific dependencies. It is also
useful for all selinux enabled fs images, so move it out of android
specific feature sets.

e.g. mkfs.erofs --file-contexts=selinux_context_file
--mount_point=/product product.img your_product_out_dir

Signed-off-by: Kelvin Zhang <zhangkelvin@google.com>
---
 include/erofs/config.h | 2 +-
 lib/xattr.c            | 2 --
 mkfs/main.c            | 6 +++---
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/include/erofs/config.h b/include/erofs/config.h
index 0a1b18b..030054b 100644
--- a/include/erofs/config.h
+++ b/include/erofs/config.h
@@ -65,8 +65,8 @@ struct erofs_configure {
 	u32 c_dict_size;
 	u64 c_unix_timestamp;
 	u32 c_uid, c_gid;
+	const char *mount_point;
 #ifdef WITH_ANDROID
-	char *mount_point;
 	char *target_out_path;
 	char *fs_config_file;
 	char *block_list_file;
diff --git a/lib/xattr.c b/lib/xattr.c
index 00fb963..cf5c447 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -210,12 +210,10 @@ static struct xattr_item *erofs_get_selabel_xattr(const char *srcpath,
 		unsigned int len[2];
 		char *kvbuf, *fspath;
 
-#ifdef WITH_ANDROID
 		if (cfg.mount_point)
 			ret = asprintf(&fspath, "/%s/%s", cfg.mount_point,
 				       erofs_fspath(srcpath));
 		else
-#endif
 			ret = asprintf(&fspath, "/%s", erofs_fspath(srcpath));
 		if (ret <= 0)
 			return ERR_PTR(-ENOMEM);
diff --git a/mkfs/main.c b/mkfs/main.c
index b62a8aa..879c2f2 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -50,8 +50,8 @@ static struct option long_options[] = {
 	{"quiet", no_argument, 0, 12},
 	{"blobdev", required_argument, NULL, 13},
 	{"ignore-mtime", no_argument, NULL, 14},
-#ifdef WITH_ANDROID
 	{"mount-point", required_argument, NULL, 512},
+#ifdef WITH_ANDROID
 	{"product-out", required_argument, NULL, 513},
 	{"fs-config-file", required_argument, NULL, 514},
 	{"block-list-file", required_argument, NULL, 515},
@@ -103,9 +103,9 @@ static void usage(void)
 #ifndef NDEBUG
 	      " --random-pclusterblks randomize pclusterblks for big pcluster (debugging only)\n"
 #endif
+	      " --mount-point=X       X=prefix of target fs path (default: /)\n"
 #ifdef WITH_ANDROID
 	      "\nwith following android-specific options:\n"
-	      " --mount-point=X       X=prefix of target fs path (default: /)\n"
 	      " --product-out=X       X=product_out directory\n"
 	      " --fs-config-file=X    X=fs_config file\n"
 	      " --block-list-file=X   X=block_list file\n"
@@ -314,7 +314,6 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
 		case 10:
 			cfg.c_compress_hints_file = optarg;
 			break;
-#ifdef WITH_ANDROID
 		case 512:
 			cfg.mount_point = optarg;
 			/* all trailing '/' should be deleted */
@@ -322,6 +321,7 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
 			if (opt && optarg[opt - 1] == '/')
 				optarg[opt - 1] = '\0';
 			break;
+#ifdef WITH_ANDROID
 		case 513:
 			cfg.target_out_path = optarg;
 			break;
-- 
2.37.0.rc0.161.g10f37bed90-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] Make --mount-point option generally available
  2022-07-01 23:00   ` [PATCH v2] " Kelvin Zhang via Linux-erofs
@ 2022-07-02  4:53     ` Gao Xiang
  2022-07-03 20:54       ` Gao Xiang
  2022-07-04  2:19     ` Yue Hu
  1 sibling, 1 reply; 8+ messages in thread
From: Gao Xiang @ 2022-07-02  4:53 UTC (permalink / raw)
  To: Kelvin Zhang; +Cc: Miao Xie, linux-erofs mailing list

On Fri, Jul 01, 2022 at 04:00:30PM -0700, Kelvin Zhang wrote:
> This option does not have any android specific dependencies. It is also
> useful for all selinux enabled fs images, so move it out of android
> specific feature sets.
> 
> e.g. mkfs.erofs --file-contexts=selinux_context_file
> --mount_point=/product product.img your_product_out_dir
> 
> Signed-off-by: Kelvin Zhang <zhangkelvin@google.com>

Apart from the subject without the prefix, Looks good to me,

Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Will play with it and apply later...

Thanks,
Gao Xiang


> ---
>  include/erofs/config.h | 2 +-
>  lib/xattr.c            | 2 --
>  mkfs/main.c            | 6 +++---
>  3 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/include/erofs/config.h b/include/erofs/config.h
> index 0a1b18b..030054b 100644
> --- a/include/erofs/config.h
> +++ b/include/erofs/config.h
> @@ -65,8 +65,8 @@ struct erofs_configure {
>  	u32 c_dict_size;
>  	u64 c_unix_timestamp;
>  	u32 c_uid, c_gid;
> +	const char *mount_point;
>  #ifdef WITH_ANDROID
> -	char *mount_point;
>  	char *target_out_path;
>  	char *fs_config_file;
>  	char *block_list_file;
> diff --git a/lib/xattr.c b/lib/xattr.c
> index 00fb963..cf5c447 100644
> --- a/lib/xattr.c
> +++ b/lib/xattr.c
> @@ -210,12 +210,10 @@ static struct xattr_item *erofs_get_selabel_xattr(const char *srcpath,
>  		unsigned int len[2];
>  		char *kvbuf, *fspath;
>  
> -#ifdef WITH_ANDROID
>  		if (cfg.mount_point)
>  			ret = asprintf(&fspath, "/%s/%s", cfg.mount_point,
>  				       erofs_fspath(srcpath));
>  		else
> -#endif
>  			ret = asprintf(&fspath, "/%s", erofs_fspath(srcpath));
>  		if (ret <= 0)
>  			return ERR_PTR(-ENOMEM);
> diff --git a/mkfs/main.c b/mkfs/main.c
> index b62a8aa..879c2f2 100644
> --- a/mkfs/main.c
> +++ b/mkfs/main.c
> @@ -50,8 +50,8 @@ static struct option long_options[] = {
>  	{"quiet", no_argument, 0, 12},
>  	{"blobdev", required_argument, NULL, 13},
>  	{"ignore-mtime", no_argument, NULL, 14},
> -#ifdef WITH_ANDROID
>  	{"mount-point", required_argument, NULL, 512},
> +#ifdef WITH_ANDROID
>  	{"product-out", required_argument, NULL, 513},
>  	{"fs-config-file", required_argument, NULL, 514},
>  	{"block-list-file", required_argument, NULL, 515},
> @@ -103,9 +103,9 @@ static void usage(void)
>  #ifndef NDEBUG
>  	      " --random-pclusterblks randomize pclusterblks for big pcluster (debugging only)\n"
>  #endif
> +	      " --mount-point=X       X=prefix of target fs path (default: /)\n"
>  #ifdef WITH_ANDROID
>  	      "\nwith following android-specific options:\n"
> -	      " --mount-point=X       X=prefix of target fs path (default: /)\n"
>  	      " --product-out=X       X=product_out directory\n"
>  	      " --fs-config-file=X    X=fs_config file\n"
>  	      " --block-list-file=X   X=block_list file\n"
> @@ -314,7 +314,6 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
>  		case 10:
>  			cfg.c_compress_hints_file = optarg;
>  			break;
> -#ifdef WITH_ANDROID
>  		case 512:
>  			cfg.mount_point = optarg;
>  			/* all trailing '/' should be deleted */
> @@ -322,6 +321,7 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
>  			if (opt && optarg[opt - 1] == '/')
>  				optarg[opt - 1] = '\0';
>  			break;
> +#ifdef WITH_ANDROID
>  		case 513:
>  			cfg.target_out_path = optarg;
>  			break;
> -- 
> 2.37.0.rc0.161.g10f37bed90-goog

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] Make --mount-point option generally available
  2022-07-02  4:53     ` Gao Xiang
@ 2022-07-03 20:54       ` Gao Xiang
  0 siblings, 0 replies; 8+ messages in thread
From: Gao Xiang @ 2022-07-03 20:54 UTC (permalink / raw)
  To: Kelvin Zhang; +Cc: Miao Xie, linux-erofs mailing list

On Sat, Jul 02, 2022 at 12:53:17PM +0800, Gao Xiang wrote:
> On Fri, Jul 01, 2022 at 04:00:30PM -0700, Kelvin Zhang wrote:
> > This option does not have any android specific dependencies. It is also
> > useful for all selinux enabled fs images, so move it out of android
> > specific feature sets.
> > 
> > e.g. mkfs.erofs --file-contexts=selinux_context_file
> > --mount_point=/product product.img your_product_out_dir
> > 
> > Signed-off-by: Kelvin Zhang <zhangkelvin@google.com>
> 
> Apart from the subject without the prefix, Looks good to me,
> 
> Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
> 
> Will play with it and apply later...

I tried to apply it to each branch but without any luck.
Would you mind rebasing it?

Thanks,
Gao Xiang

> 
> Thanks,
> Gao Xiang
> 
> 
> > ---
> >  include/erofs/config.h | 2 +-
> >  lib/xattr.c            | 2 --
> >  mkfs/main.c            | 6 +++---
> >  3 files changed, 4 insertions(+), 6 deletions(-)
> > 
> > diff --git a/include/erofs/config.h b/include/erofs/config.h
> > index 0a1b18b..030054b 100644
> > --- a/include/erofs/config.h
> > +++ b/include/erofs/config.h
> > @@ -65,8 +65,8 @@ struct erofs_configure {
> >  	u32 c_dict_size;
> >  	u64 c_unix_timestamp;
> >  	u32 c_uid, c_gid;
> > +	const char *mount_point;
> >  #ifdef WITH_ANDROID
> > -	char *mount_point;
> >  	char *target_out_path;
> >  	char *fs_config_file;
> >  	char *block_list_file;
> > diff --git a/lib/xattr.c b/lib/xattr.c
> > index 00fb963..cf5c447 100644
> > --- a/lib/xattr.c
> > +++ b/lib/xattr.c
> > @@ -210,12 +210,10 @@ static struct xattr_item *erofs_get_selabel_xattr(const char *srcpath,
> >  		unsigned int len[2];
> >  		char *kvbuf, *fspath;
> >  
> > -#ifdef WITH_ANDROID
> >  		if (cfg.mount_point)
> >  			ret = asprintf(&fspath, "/%s/%s", cfg.mount_point,
> >  				       erofs_fspath(srcpath));
> >  		else
> > -#endif
> >  			ret = asprintf(&fspath, "/%s", erofs_fspath(srcpath));
> >  		if (ret <= 0)
> >  			return ERR_PTR(-ENOMEM);
> > diff --git a/mkfs/main.c b/mkfs/main.c
> > index b62a8aa..879c2f2 100644
> > --- a/mkfs/main.c
> > +++ b/mkfs/main.c
> > @@ -50,8 +50,8 @@ static struct option long_options[] = {
> >  	{"quiet", no_argument, 0, 12},
> >  	{"blobdev", required_argument, NULL, 13},
> >  	{"ignore-mtime", no_argument, NULL, 14},
> > -#ifdef WITH_ANDROID
> >  	{"mount-point", required_argument, NULL, 512},
> > +#ifdef WITH_ANDROID
> >  	{"product-out", required_argument, NULL, 513},
> >  	{"fs-config-file", required_argument, NULL, 514},
> >  	{"block-list-file", required_argument, NULL, 515},
> > @@ -103,9 +103,9 @@ static void usage(void)
> >  #ifndef NDEBUG
> >  	      " --random-pclusterblks randomize pclusterblks for big pcluster (debugging only)\n"
> >  #endif
> > +	      " --mount-point=X       X=prefix of target fs path (default: /)\n"
> >  #ifdef WITH_ANDROID
> >  	      "\nwith following android-specific options:\n"
> > -	      " --mount-point=X       X=prefix of target fs path (default: /)\n"
> >  	      " --product-out=X       X=product_out directory\n"
> >  	      " --fs-config-file=X    X=fs_config file\n"
> >  	      " --block-list-file=X   X=block_list file\n"
> > @@ -314,7 +314,6 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
> >  		case 10:
> >  			cfg.c_compress_hints_file = optarg;
> >  			break;
> > -#ifdef WITH_ANDROID
> >  		case 512:
> >  			cfg.mount_point = optarg;
> >  			/* all trailing '/' should be deleted */
> > @@ -322,6 +321,7 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
> >  			if (opt && optarg[opt - 1] == '/')
> >  				optarg[opt - 1] = '\0';
> >  			break;
> > +#ifdef WITH_ANDROID
> >  		case 513:
> >  			cfg.target_out_path = optarg;
> >  			break;
> > -- 
> > 2.37.0.rc0.161.g10f37bed90-goog

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] Make --mount-point option generally available
  2022-07-01 23:00   ` [PATCH v2] " Kelvin Zhang via Linux-erofs
  2022-07-02  4:53     ` Gao Xiang
@ 2022-07-04  2:19     ` Yue Hu
  2022-07-07 17:40       ` [PATCH v3] erofs-utils: " Kelvin Zhang via Linux-erofs
  1 sibling, 1 reply; 8+ messages in thread
From: Yue Hu @ 2022-07-04  2:19 UTC (permalink / raw)
  To: Kelvin Zhang via Linux-erofs; +Cc: Kelvin Zhang, Miao Xie

Hi Kelvin,

On Fri,  1 Jul 2022 16:00:30 -0700
Kelvin Zhang via Linux-erofs <linux-erofs@lists.ozlabs.org> wrote:

> This option does not have any android specific dependencies. It is also
> useful for all selinux enabled fs images, so move it out of android
> specific feature sets.
> 
> e.g. mkfs.erofs --file-contexts=selinux_context_file
> --mount_point=/product product.img your_product_out_dir
> 
> Signed-off-by: Kelvin Zhang <zhangkelvin@google.com>
> ---
>  include/erofs/config.h | 2 +-
>  lib/xattr.c            | 2 --
>  mkfs/main.c            | 6 +++---
>  3 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/include/erofs/config.h b/include/erofs/config.h
> index 0a1b18b..030054b 100644
> --- a/include/erofs/config.h
> +++ b/include/erofs/config.h
> @@ -65,8 +65,8 @@ struct erofs_configure {
>  	u32 c_dict_size;
>  	u64 c_unix_timestamp;
>  	u32 c_uid, c_gid;
> +	const char *mount_point;
>  #ifdef WITH_ANDROID
> -	char *mount_point;
>  	char *target_out_path;
>  	char *fs_config_file;
>  	char *block_list_file;
> diff --git a/lib/xattr.c b/lib/xattr.c
> index 00fb963..cf5c447 100644
> --- a/lib/xattr.c
> +++ b/lib/xattr.c
> @@ -210,12 +210,10 @@ static struct xattr_item *erofs_get_selabel_xattr(const char *srcpath,
>  		unsigned int len[2];
>  		char *kvbuf, *fspath;
>  
> -#ifdef WITH_ANDROID
>  		if (cfg.mount_point)
>  			ret = asprintf(&fspath, "/%s/%s", cfg.mount_point,
>  				       erofs_fspath(srcpath));
>  		else
> -#endif
>  			ret = asprintf(&fspath, "/%s", erofs_fspath(srcpath));
>  		if (ret <= 0)
>  			return ERR_PTR(-ENOMEM);
> diff --git a/mkfs/main.c b/mkfs/main.c
> index b62a8aa..879c2f2 100644
> --- a/mkfs/main.c
> +++ b/mkfs/main.c
> @@ -50,8 +50,8 @@ static struct option long_options[] = {
>  	{"quiet", no_argument, 0, 12},
>  	{"blobdev", required_argument, NULL, 13},
>  	{"ignore-mtime", no_argument, NULL, 14},
> -#ifdef WITH_ANDROID
>  	{"mount-point", required_argument, NULL, 512},
> +#ifdef WITH_ANDROID
>  	{"product-out", required_argument, NULL, 513},
>  	{"fs-config-file", required_argument, NULL, 514},
>  	{"block-list-file", required_argument, NULL, 515},
> @@ -103,9 +103,9 @@ static void usage(void)
>  #ifndef NDEBUG
>  	      " --random-pclusterblks randomize pclusterblks for big pcluster (debugging only)\n"
>  #endif
> +	      " --mount-point=X       X=prefix of target fs path (default: /)\n"
>  #ifdef WITH_ANDROID
>  	      "\nwith following android-specific options:\n"
> -	      " --mount-point=X       X=prefix of target fs path (default: /)\n"
>  	      " --product-out=X       X=product_out directory\n"
>  	      " --fs-config-file=X    X=fs_config file\n"
>  	      " --block-list-file=X   X=block_list file\n"
> @@ -314,7 +314,6 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
>  		case 10:
>  			cfg.c_compress_hints_file = optarg;
>  			break;
> -#ifdef WITH_ANDROID
>  		case 512:
>  			cfg.mount_point = optarg;
>  			/* all trailing '/' should be deleted */
> @@ -322,6 +321,7 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
>  			if (opt && optarg[opt - 1] == '/')
>  				optarg[opt - 1] = '\0';
>  			break;
> +#ifdef WITH_ANDROID
>  		case 513:
>  			cfg.target_out_path = optarg;
>  			break;

As Xiang pointed out, it is common convention to prefix the subject line to let us
distinguish from others more easily.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3] erofs-utils: Make --mount-point option generally available
  2022-07-04  2:19     ` Yue Hu
@ 2022-07-07 17:40       ` Kelvin Zhang via Linux-erofs
  2022-07-07 17:57         ` Gao Xiang
  0 siblings, 1 reply; 8+ messages in thread
From: Kelvin Zhang via Linux-erofs @ 2022-07-07 17:40 UTC (permalink / raw)
  To: linux-erofs mailing list, Miao Xie, Fang Wei; +Cc: Kelvin Zhang

This option does not have any android specific dependencies. It is also
useful for all selinux enabled fs images, so move it out of android
specific feature sets.

e.g. mkfs.erofs --file-contexts=selinux_context_file
--mount_point=/product product.img your_product_out_dir

Signed-off-by: Kelvin Zhang <zhangkelvin@google.com>
---
 include/erofs/config.h | 2 +-
 lib/xattr.c            | 2 --
 mkfs/main.c            | 6 +++---
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/include/erofs/config.h b/include/erofs/config.h
index 0d0916c..2daf46c 100644
--- a/include/erofs/config.h
+++ b/include/erofs/config.h
@@ -67,8 +67,8 @@ struct erofs_configure {
 	u32 c_dict_size;
 	u64 c_unix_timestamp;
 	u32 c_uid, c_gid;
+	const char *mount_point;
 #ifdef WITH_ANDROID
-	char *mount_point;
 	char *target_out_path;
 	char *fs_config_file;
 	char *block_list_file;
diff --git a/lib/xattr.c b/lib/xattr.c
index 71ffe3e..c8ce278 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -210,12 +210,10 @@ static struct xattr_item *erofs_get_selabel_xattr(const char *srcpath,
 		unsigned int len[2];
 		char *kvbuf, *fspath;
 
-#ifdef WITH_ANDROID
 		if (cfg.mount_point)
 			ret = asprintf(&fspath, "/%s/%s", cfg.mount_point,
 				       erofs_fspath(srcpath));
 		else
-#endif
 			ret = asprintf(&fspath, "/%s", erofs_fspath(srcpath));
 		if (ret <= 0)
 			return ERR_PTR(-ENOMEM);
diff --git a/mkfs/main.c b/mkfs/main.c
index d2c9830..deb8e1f 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -51,8 +51,8 @@ static struct option long_options[] = {
 	{"blobdev", required_argument, NULL, 13},
 	{"ignore-mtime", no_argument, NULL, 14},
 	{"preserve-mtime", no_argument, NULL, 15},
-#ifdef WITH_ANDROID
 	{"mount-point", required_argument, NULL, 512},
+#ifdef WITH_ANDROID
 	{"product-out", required_argument, NULL, 513},
 	{"fs-config-file", required_argument, NULL, 514},
 	{"block-list-file", required_argument, NULL, 515},
@@ -105,9 +105,9 @@ static void usage(void)
 #ifndef NDEBUG
 	      " --random-pclusterblks randomize pclusterblks for big pcluster (debugging only)\n"
 #endif
+	      " --mount-point=X       X=prefix of target fs path (default: /)\n"
 #ifdef WITH_ANDROID
 	      "\nwith following android-specific options:\n"
-	      " --mount-point=X       X=prefix of target fs path (default: /)\n"
 	      " --product-out=X       X=product_out directory\n"
 	      " --fs-config-file=X    X=fs_config file\n"
 	      " --block-list-file=X   X=block_list file\n"
@@ -323,7 +323,6 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
 		case 10:
 			cfg.c_compress_hints_file = optarg;
 			break;
-#ifdef WITH_ANDROID
 		case 512:
 			cfg.mount_point = optarg;
 			/* all trailing '/' should be deleted */
@@ -331,6 +330,7 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
 			if (opt && optarg[opt - 1] == '/')
 				optarg[opt - 1] = '\0';
 			break;
+#ifdef WITH_ANDROID
 		case 513:
 			cfg.target_out_path = optarg;
 			break;
-- 
2.37.0.rc0.161.g10f37bed90-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v3] erofs-utils: Make --mount-point option generally available
  2022-07-07 17:40       ` [PATCH v3] erofs-utils: " Kelvin Zhang via Linux-erofs
@ 2022-07-07 17:57         ` Gao Xiang
  0 siblings, 0 replies; 8+ messages in thread
From: Gao Xiang @ 2022-07-07 17:57 UTC (permalink / raw)
  To: Kelvin Zhang; +Cc: Miao Xie, linux-erofs mailing list

On Thu, Jul 07, 2022 at 10:40:58AM -0700, Kelvin Zhang wrote:
> This option does not have any android specific dependencies. It is also
> useful for all selinux enabled fs images, so move it out of android
> specific feature sets.
> 
> e.g. mkfs.erofs --file-contexts=selinux_context_file
> --mount_point=/product product.img your_product_out_dir
> 
> Signed-off-by: Kelvin Zhang <zhangkelvin@google.com>

Looks good to me,
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Thanks,
Gao Xiang

> ---
>  include/erofs/config.h | 2 +-
>  lib/xattr.c            | 2 --
>  mkfs/main.c            | 6 +++---
>  3 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/include/erofs/config.h b/include/erofs/config.h
> index 0d0916c..2daf46c 100644
> --- a/include/erofs/config.h
> +++ b/include/erofs/config.h
> @@ -67,8 +67,8 @@ struct erofs_configure {
>  	u32 c_dict_size;
>  	u64 c_unix_timestamp;
>  	u32 c_uid, c_gid;
> +	const char *mount_point;
>  #ifdef WITH_ANDROID
> -	char *mount_point;
>  	char *target_out_path;
>  	char *fs_config_file;
>  	char *block_list_file;
> diff --git a/lib/xattr.c b/lib/xattr.c
> index 71ffe3e..c8ce278 100644
> --- a/lib/xattr.c
> +++ b/lib/xattr.c
> @@ -210,12 +210,10 @@ static struct xattr_item *erofs_get_selabel_xattr(const char *srcpath,
>  		unsigned int len[2];
>  		char *kvbuf, *fspath;
>  
> -#ifdef WITH_ANDROID
>  		if (cfg.mount_point)
>  			ret = asprintf(&fspath, "/%s/%s", cfg.mount_point,
>  				       erofs_fspath(srcpath));
>  		else
> -#endif
>  			ret = asprintf(&fspath, "/%s", erofs_fspath(srcpath));
>  		if (ret <= 0)
>  			return ERR_PTR(-ENOMEM);
> diff --git a/mkfs/main.c b/mkfs/main.c
> index d2c9830..deb8e1f 100644
> --- a/mkfs/main.c
> +++ b/mkfs/main.c
> @@ -51,8 +51,8 @@ static struct option long_options[] = {
>  	{"blobdev", required_argument, NULL, 13},
>  	{"ignore-mtime", no_argument, NULL, 14},
>  	{"preserve-mtime", no_argument, NULL, 15},
> -#ifdef WITH_ANDROID
>  	{"mount-point", required_argument, NULL, 512},
> +#ifdef WITH_ANDROID
>  	{"product-out", required_argument, NULL, 513},
>  	{"fs-config-file", required_argument, NULL, 514},
>  	{"block-list-file", required_argument, NULL, 515},
> @@ -105,9 +105,9 @@ static void usage(void)
>  #ifndef NDEBUG
>  	      " --random-pclusterblks randomize pclusterblks for big pcluster (debugging only)\n"
>  #endif
> +	      " --mount-point=X       X=prefix of target fs path (default: /)\n"
>  #ifdef WITH_ANDROID
>  	      "\nwith following android-specific options:\n"
> -	      " --mount-point=X       X=prefix of target fs path (default: /)\n"
>  	      " --product-out=X       X=product_out directory\n"
>  	      " --fs-config-file=X    X=fs_config file\n"
>  	      " --block-list-file=X   X=block_list file\n"
> @@ -323,7 +323,6 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
>  		case 10:
>  			cfg.c_compress_hints_file = optarg;
>  			break;
> -#ifdef WITH_ANDROID
>  		case 512:
>  			cfg.mount_point = optarg;
>  			/* all trailing '/' should be deleted */
> @@ -331,6 +330,7 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
>  			if (opt && optarg[opt - 1] == '/')
>  				optarg[opt - 1] = '\0';
>  			break;
> +#ifdef WITH_ANDROID
>  		case 513:
>  			cfg.target_out_path = optarg;
>  			break;
> -- 
> 2.37.0.rc0.161.g10f37bed90-goog

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-07-07 17:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-30 17:14 [PATCH v1] Make --mount-point option generally available Kelvin Zhang via Linux-erofs
2022-07-01  4:20 ` Gao Xiang
2022-07-01 23:00   ` [PATCH v2] " Kelvin Zhang via Linux-erofs
2022-07-02  4:53     ` Gao Xiang
2022-07-03 20:54       ` Gao Xiang
2022-07-04  2:19     ` Yue Hu
2022-07-07 17:40       ` [PATCH v3] erofs-utils: " Kelvin Zhang via Linux-erofs
2022-07-07 17:57         ` Gao Xiang

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.