erofs-utils: mount: don't overwrite layer_index with -1 again
PATCH 1/1 erofs-utils: mount: don't overwrite layer_index with -1 again
Initialize ocicfg only when nbdsrc.type changes to EROFSNBD_SOURCE_OCI.
Fixes 6a7cfdb9cd66 ("erofs-utils: oci: add support for indexing by layer digest")
Cc Chengyu Zhu <[email protected]>
Signed-off-by Gao Xiang <[email protected]>
--- mount/main.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
mount/main.c +5 -8
@@ -83,10 +83,6 @@ static int erofsmount_parse_oci_option(const char *option)char *p;long idx; -if (oci_cfg->layer_index ==0 && !oci_cfg->blob_digest && - !oci_cfg->platform && !oci_cfg->username && !oci_cfg->password) - oci_cfg->layer_index =-1 ; - p =strstr (option,"oci.blob=" );if (p !=NULL ) { p +=strlen ("oci.blob=" );
@@ -147,10 +143,6 @@ static int erofsmount_parse_oci_option(const char *option) } } } - -if (oci_cfg->platform || oci_cfg->username || oci_cfg->password || - oci_cfg->blob_digest || oci_cfg->layer_index >=0 ) - nbdsrc.type =EROFSNBD_SOURCE_OCI ;return 0 ; }#else
@@ -191,6 +183,11 @@ static long erofsmount_parse_flagopts(char *s, long flags, char **more) *comma ='\0' ;if (strncmp (s,"oci" ,3 ) ==0 ) { +/* Initialize ocicfg here iff != EROFSNBD_SOURCE_OCI */ +if (nbdsrc.type !=EROFSNBD_SOURCE_OCI ) { + nbdsrc.type =EROFSNBD_SOURCE_OCI ; + nbdsrc.ocicfg.layer_index =-1 ; + } err =erofsmount_parse_oci_option (s);if (err <0 )return err;
Signature · 1 line
2.43.5
Reviewed-by Chengyu Zhu <[email protected]>
Thanks,
Chengyu
Quoted 53 lines
2025年10月7日 11:22,Gao Xiang <[email protected]> 写道:
Initialize ocicfg only when nbdsrc.type changes to
EROFSNBD_SOURCE_OCI.Fixes 6a7cfdb9cd66 ("erofs-utils: oci: add support for indexing by layer digest")Cc Chengyu Zhu <[email protected]>Signed-off-by Gao Xiang <[email protected]>---
mount/main.c| 13 +++++--------1 file changed, 5 insertions(+), 8 deletions(-)mount/main.c +5
-8@@ -83,10 +83,6 @@ static int erofsmount_parse_oci_option(const char *option)char *p;long idx; -if (oci_cfg->layer_index ==0 && !oci_cfg->blob_digest && - !oci_cfg->platform && !oci_cfg->username && !oci_cfg->password) - oci_cfg->layer_index =-1 ; - p =strstr (option,"oci.blob=" );if (p !=NULL ) { p +=strlen ("oci.blob=" );@@ -147,10 +143,6 @@ static int erofsmount_parse_oci_option(const char *option) } } } - -if (oci_cfg->platform || oci_cfg->username || oci_cfg->password || - oci_cfg->blob_digest || oci_cfg->layer_index >=0 ) - nbdsrc.type =EROFSNBD_SOURCE_OCI ;return 0 ; }#else @@ -191,6 +183,11 @@ static long erofsmount_parse_flagopts(char *s, long flags, char **more) *comma ='\0' ;if (strncmp (s,"oci" ,3 ) ==0 ) { +/* Initialize ocicfg here iff != EROFSNBD_SOURCE_OCI */ +if (nbdsrc.type !=EROFSNBD_SOURCE_OCI ) { + nbdsrc.type =EROFSNBD_SOURCE_OCI ; + nbdsrc.ocicfg.layer_index =-1 ; + } err =erofsmount_parse_oci_option (s);if (err <0 )return err;Signature · 1 line
2.43.5