Skip to contentSkip to conversation

introduce command abi version

PATCH In review Jean-Christophe PLAGNIOL-VILLARD 3 participants 16 messages Oct 22, 2012 – Oct 29, 2012

lore
Share & tools
lore
#0 lore raw

cover introduce command abi version

Hi,

This will allow to detect command incompability between different version of barebox

The following changes since commit a6f852d401b63e1de0efe73a11efd5403870b594:

Merge branch 'pu/compiler-warnings' (2012-10-21 10:57:54 +0200)

are available in the git repository at:

git://git.jcrosoft.org/barebox.git delivery/command_abi_version

for you to fetch changes up to 5ee2adb18c6e0e609e5633de4d4c6d9383b14173:

environment: detect command_abi_version (2012-10-22 14:34:25 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (3):
command: introduce abi version
envfs: add command_abi_version support
environment: detect command_abi_version

 commands/loadenv.c    |   11 ++++++++++-
 common/command.c      |    2 ++
 common/environment.c  |    7 ++++++-
 common/startup.c      |   42 ++++++++++++++++++++++++++++++++----------
 include/command.h     |    1 +
 include/command_abi.h |   12 ++++++++++++
 include/envfs.h       |    4 ++--
 include/environment.h |   13 ++++++++++++-
 scripts/bareboxenv.c  |    9 ++++++++-
 9 files changed, 85 insertions(+), 16 deletions(-)
 create mode 100644 include/command_abi.h

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#7 lore raw

PATCH 3/3 environment: detect command_abi_version

In reply to Jean-Christophe PLAGNIOL-VILLARD

Detect the environment command_abi_version and if not compatible swith to the defaultenv. The user will still able to force the laod via loadenv command.

---
 common/startup.c |   42 ++++++++++++++++++++++++++++++++----------
 1 file changed, 32 insertions(+), 10 deletions(-)
common/startup.c +32 -10
index affb5a9..df6edfa 100644
@@ -88,6 +88,36 @@ static int mount_root(void)
 fs_initcall(mount_root);
 #endif
 
+static void env_handling(void)
+{
+	uint16_t command_abi_version;
+
+	if (!IS_ENABLED(CONFIG_ENV_HANDLING))
+		return;
+
+	if (envfs_load(default_environment_path, "/env", &command_abi_version)) {
+		if (!IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT))
+			return;
+
+		printf("no valid environment found on %s\n",
+			default_environment_path);
+		goto load_defaultenv;
+	}
+
+	if (command_abi_version < COMMAND_ABI_VERSION) {
+		printf("environment found on %s have command_abi_version (%u) < current version (%u)\n",
+			default_environment_path,
+			command_abi_version, COMMAND_ABI_VERSION);
+		goto load_defaultenv;
+	}
+
+	return;
+
+load_defaultenv:
+	printf("Using default environment\n");
+	envfs_load("/dev/defaultenv", "/env", NULL);
+}
+
 void start_barebox (void)
 {
 	initcall_t *initcall;
@@ -105,16 +135,8 @@ void start_barebox (void)
 
 	debug("initcalls done\n");
 
-#ifdef CONFIG_ENV_HANDLING
-	if (envfs_load(default_environment_path, "/env", NULL)) {
-#ifdef CONFIG_DEFAULT_ENVIRONMENT
-		printf("no valid environment found on %s. "
-			"Using default environment\n",
-			default_environment_path);
-		envfs_load("/dev/defaultenv", "/env", NULL);
-#endif
-	}
-#endif
+	env_handling();
+
 #ifdef CONFIG_COMMAND_SUPPORT
 	printf("running /env/bin/init...\n");
 
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 2/3 envfs: add command_abi_version support

In reply to Jean-Christophe PLAGNIOL-VILLARD

allow to store the command abi version
This will allow to detect incompatibility

Increase envfs minor to 1

---
 commands/loadenv.c    |   11 ++++++++++-
 common/environment.c  |    7 ++++++-
 common/startup.c      |    4 ++--
 include/envfs.h       |    4 ++--
 include/environment.h |   13 ++++++++++++-
 scripts/bareboxenv.c  |    9 ++++++++-
 6 files changed, 40 insertions(+), 8 deletions(-)
commands/loadenv.c +10 -1
index 5bf1740..c52ee4b 100644
@@ -26,6 +26,9 @@
 
 static int do_loadenv(int argc, char *argv[])
 {
+	int ret;
+	uint16_t command_abi_version;
+
 	char *filename, *dirname;
 
 	if (argc < 3)
@@ -37,7 +40,13 @@ static int do_loadenv(int argc, char *argv[])
 	else
 		filename = argv[1];
 	printf("loading environment from %s\n", filename);
-	return envfs_load(filename, dirname);
+	ret = envfs_load(filename, dirname, &command_abi_version);
+
+	if (command_abi_version < COMMAND_ABI_VERSION)
+		pr_warn("environment command_abi_verison (%u) < current version (%u)\n",
+			command_abi_version, COMMAND_ABI_VERSION);
+
+	return ret;
 }
 
 BAREBOX_CMD_HELP_START(loadenv)
common/environment.c +6 -1
index 69c4c0a..e0207e9 100644
@@ -162,6 +162,7 @@ int envfs_save(char *filename, char *dirname)
 
 	super = (struct envfs_super *)buf;
 	super->magic = ENVFS_32(ENVFS_MAGIC);
+	super->command_abi_version = ENVFS_16(COMMAND_ABI_VERSION);
 	super->major = ENVFS_MAJOR;
 	super->minor = ENVFS_MINOR;
 	super->size = ENVFS_32(size);
@@ -206,7 +207,7 @@ EXPORT_SYMBOL(envfs_save);
  * Note: This function will also be used on the host! See note in the header
  * of this file.
  */
-int envfs_load(char *filename, char *dir)
+int envfs_load(char *filename, char *dir, uint16_t *command_abi_version)
 {
 	struct envfs_super super;
 	void *buf = NULL, *buf_free = NULL;
@@ -235,6 +236,7 @@ int envfs_load(char *filename, char *dir)
 		goto out;
 	}
 
+
 	if ( ENVFS_32(super.magic) != ENVFS_MAGIC) {
 		printf("envfs: wrong magic on %s\n", filename);
 		ret = -EIO;
@@ -248,6 +250,9 @@ int envfs_load(char *filename, char *dir)
 		goto out;
 	}
 
+	if (command_abi_version)
+		*command_abi_version = ENVFS_16(super.command_abi_version);
+
 	size = ENVFS_32(super.size);
 	buf = xmalloc(size);
 	buf_free = buf;
common/startup.c +2 -2
index 78926c9..affb5a9 100644
@@ -106,12 +106,12 @@ void start_barebox (void)
 	debug("initcalls done\n");
 
 #ifdef CONFIG_ENV_HANDLING
-	if (envfs_load(default_environment_path, "/env")) {
+	if (envfs_load(default_environment_path, "/env", NULL)) {
 #ifdef CONFIG_DEFAULT_ENVIRONMENT
 		printf("no valid environment found on %s. "
 			"Using default environment\n",
 			default_environment_path);
-		envfs_load("/dev/defaultenv", "/env");
+		envfs_load("/dev/defaultenv", "/env", NULL);
 #endif
 	}
 #endif
include/envfs.h +2 -2
index 3d14fcb..6503d22 100644
@@ -6,7 +6,7 @@
 #endif
 
 #define ENVFS_MAJOR		1
-#define ENVFS_MINOR		0
+#define ENVFS_MINOR		1
 
 #define ENVFS_MAGIC		    0x798fba79	/* some random number */
 #define ENVFS_INODE_MAGIC	0x67a8c78d
@@ -40,7 +40,7 @@ struct envfs_super {
 	uint32_t size;			/* size of data */
 	uint8_t major;			/* major */
 	uint8_t minor;			/* minor */
-	uint16_t future;		/* reserved for future use */
+	uint16_t command_abi_version;	/* command abi version */
 	uint32_t flags;			/* feature flags */
 	uint32_t sb_crc;		/* crc for the superblock */
 };
include/environment.h +12 -1
index 95e75e7..64de26f 100644
@@ -74,8 +74,19 @@ int env_push_context(void);
 /* defaults to /dev/env0 */
 extern char *default_environment_path;
 
-int envfs_load(char *filename, char *dirname);
+#ifdef CONFIG_ENV_HANDLING
+int envfs_load(char *filename, char *dir, uint16_t *command_abi_version);
 int envfs_save(char *filename, char *dirname);
+#else
+static inline int envfs_load(char *filename, char *dir, uint16_t *command_abi_version)
+{
+	return -EINVAL;
+}
+static inline int envfs_save(char *filename, char *dirname)
+{
+	return -EINVAL;
+}
+#endif
 
 int export(const char *);
 
scripts/bareboxenv.c +8 -1
index f44a1f8..6bd23e8 100644
@@ -115,6 +115,7 @@ char *concat_subpath_file(const char *path, const char *f)
 }
 
 #include "../lib/recursive_action.c"
+#include "../include/command_abi.h"
 #include "../include/envfs.h"
 #include "../crypto/crc32.c"
 #include "../lib/make_directory.c"
@@ -189,14 +190,20 @@ int main(int argc, char *argv[])
 	}
 
 	if (load) {
+		uint16_t command_abi_version;
+
 		if (verbose)
 			printf("loading env from file %s to %s\n", filename, dirname);
-		envfs_load(filename, dirname);
+		envfs_load(filename, dirname, &command_abi_version);
+		if (verbose)
+			printf("with command_abi_version = %u\n", command_abi_version);
 	}
 	if (save) {
 		if (verbose)
 			printf("saving contents of %s to file %s\n", dirname, filename);
 		envfs_save(filename, dirname);
+		if (verbose)
+			printf("with command_abi_version = %u\n", COMMAND_ABI_VERSION);
 	}
 	exit(0);
 }
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 1/3 command: introduce abi version

In reply to Jean-Christophe PLAGNIOL-VILLARD

This will allow to detect incompatibility between the env abi and the current barebox one

---
 common/command.c      |    2 ++
 include/command.h     |    1 +
 include/command_abi.h |   12 ++++++++++++
 3 files changed, 15 insertions(+)
 create mode 100644 include/command_abi.h
common/command.c +2 -0
index 873b3ff..c80538c 100644
@@ -154,6 +154,8 @@ static int init_command_list(void)
 {
 	struct command *cmdtp;
 
+	export_env_ull("command_abi_version", COMMAND_ABI_VERSION);
+
 	for (cmdtp = &__barebox_cmd_start;
 			cmdtp != &__barebox_cmd_end;
 			cmdtp++)
include/command.h +1 -0
index ffc722c..c49a014 100644
@@ -25,6 +25,7 @@
 
 #include <linux/list.h>
 #include <linux/stringify.h>
+#include <command_abi.h>
 
 #ifndef NULL
 #define NULL	0
include/command_abi.h new file +12 -0
new file mode 100644
index 0000000..264c003
@@ -0,0 +1,12 @@
+/*
+ * (C) Copyright 2012 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
+ *
+ * Under GPL v2
+ */
+
+#ifndef __COMMAND_ABI_H__
+#define __COMMAND_ABI_H__
+
+#define COMMAND_ABI_VERSION	0
+
+#endif /* __COMMAND_ABI_H__ */
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#14 lore raw
In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD

Hi,

This will allow to detect command incompability between different version of barebox

Generally a good move. I want to it some more time to apply it though as this is a significant change.
Nevertheless some comments inline.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

Re: [PATCH 2/3] envfs: add command_abi_version support

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 30 lines · Jean-Christophe PLAGNIOL-VILLARD

allow to store the command abi version
This will allow to detect incompatibility

Increase envfs minor to 1

---
 commands/loadenv.c    |   11 ++++++++++-
 common/environment.c  |    7 ++++++-
 common/startup.c      |    4 ++--
 include/envfs.h       |    4 ++--
 include/environment.h |   13 ++++++++++++-
 scripts/bareboxenv.c  |    9 ++++++++-
 6 files changed, 40 insertions(+), 8 deletions(-)
commands/loadenv.c +3 -0
index 5bf1740..c52ee4b 100644
@@ -26,6 +26,9 @@
 
 static int do_loadenv(int argc, char *argv[])
 {
+	int ret;
+	uint16_t command_abi_version;
+
 	char *filename, *dirname;
 
 	if (argc < 3)

commands/loadenv.c static int do_loadenv(int argc, char *argv[]) · line 45

Quoted 7 lines
commands/loadenv.c +3 -1
@@ -37,7 +40,13 @@ static int do_loadenv(int argc, char *argv[])
 	else
 		filename = argv[1];
 	printf("loading environment from %s\n", filename);
-	return envfs_load(filename, dirname);
+	ret = envfs_load(filename, dirname, &command_abi_version);
+
+	if (command_abi_version < COMMAND_ABI_VERSION)

'!=' instead of '<'? The incompatibility is often in both directions.

We may have to introduce min/max, I'm not sure on that.

commands/loadenv.c int envfs_load(char *filename, char *dir) · line 242

Quoted 13 lines
commands/loadenv.c +2 -1
-int envfs_load(char *filename, char *dir)
+int envfs_load(char *filename, char *dir, uint16_t *command_abi_version)
 {
 	struct envfs_super super;
 	void *buf = NULL, *buf_free = NULL;
@@ -235,6 +236,7 @@ int envfs_load(char *filename, char *dir)
 		goto out;
 	}
 
+
 	if ( ENVFS_32(super.magic) != ENVFS_MAGIC) {
 		printf("envfs: wrong magic on %s\n", filename);
 		ret = -EIO;

Drop this hunk.

Quoted 22 lines
scripts/bareboxenv.c +4 -1
index f44a1f8..6bd23e8 100644
@@ -115,6 +115,7 @@ char *concat_subpath_file(const char *path, const char *f)
 }
 
 #include "../lib/recursive_action.c"
+#include "../include/command_abi.h"
 #include "../include/envfs.h"
 #include "../crypto/crc32.c"
 #include "../lib/make_directory.c"
@@ -189,14 +190,20 @@ int main(int argc, char *argv[])
 	}
 
 	if (load) {
+		uint16_t command_abi_version;
+
 		if (verbose)
 			printf("loading env from file %s to %s\n", filename, dirname);
-		envfs_load(filename, dirname);
+		envfs_load(filename, dirname, &command_abi_version);

scripts/bareboxenv.c int main(int argc, char *argv[]) · line 207

Quoted 10 lines
scripts/bareboxenv.c +4 -0
+		if (verbose)
+			printf("with command_abi_version = %u\n", command_abi_version);
 	}
 	if (save) {
 		if (verbose)
 			printf("saving contents of %s to file %s\n", dirname, filename);
 		envfs_save(filename, dirname);
+		if (verbose)
+			printf("with command_abi_version = %u\n", COMMAND_ABI_VERSION);
 	}

For testing purposes or for generating an environment for another barebox version it would be useful to be able to specify the ABI version from the command line.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

Re: [PATCH 2/3] envfs: add command_abi_version support

Quoted 41 lines · Sascha Hauer
Quoted 30 lines · Jean-Christophe PLAGNIOL-VILLARD

allow to store the command abi version
This will allow to detect incompatibility

Increase envfs minor to 1

---
 commands/loadenv.c    |   11 ++++++++++-
 common/environment.c  |    7 ++++++-
 common/startup.c      |    4 ++--
 include/envfs.h       |    4 ++--
 include/environment.h |   13 ++++++++++++-
 scripts/bareboxenv.c  |    9 ++++++++-
 6 files changed, 40 insertions(+), 8 deletions(-)
commands/loadenv.c +3 -0
index 5bf1740..c52ee4b 100644
@@ -26,6 +26,9 @@
 
 static int do_loadenv(int argc, char *argv[])
 {
+	int ret;
+	uint16_t command_abi_version;
+
 	char *filename, *dirname;
 
 	if (argc < 3)

commands/loadenv.c static int do_loadenv(int argc, char *argv[]) · line 45

Quoted 7 lines
commands/loadenv.c +3 -1
@@ -37,7 +40,13 @@ static int do_loadenv(int argc, char *argv[])
 	else
 		filename = argv[1];
 	printf("loading environment from %s\n", filename);
-	return envfs_load(filename, dirname);
+	ret = envfs_load(filename, dirname, &command_abi_version);
+
+	if (command_abi_version < COMMAND_ABI_VERSION)

'!=' instead of '<'? The incompatibility is often in both directions.

Quoted 1 line

We may have to introduce min/max, I'm not sure on that.

no if your env is compatible with more recent but back compatible too

as you do this with the example of mount update I did recently

if [ $command_abi_version -lt 1 ]
then
mount /dev/disk0.0 fat /mnt
else

	mount /dev/disk0.0 /mnt

fi

Quoted 46 lines
Quoted 8 lines
commands/loadenv.c +1 -1
-int envfs_load(char *filename, char *dir)
+int envfs_load(char *filename, char *dir, uint16_t *command_abi_version)
 {
 	struct envfs_super super;
 	void *buf = NULL, *buf_free = NULL;

commands/loadenv.c int envfs_load(char *filename, char *dir) · line 242

Quoted 7 lines
commands/loadenv.c +1 -0
@@ -235,6 +236,7 @@ int envfs_load(char *filename, char *dir)
 		goto out;
 	}
 
+
 	if ( ENVFS_32(super.magic) != ENVFS_MAGIC) {
 		printf("envfs: wrong magic on %s\n", filename);
 		ret = -EIO;

Drop this hunk.

Quoted 28 lines
scripts/bareboxenv.c +6 -1
index f44a1f8..6bd23e8 100644
@@ -115,6 +115,7 @@ char *concat_subpath_file(const char *path, const char *f)
 }
 
 #include "../lib/recursive_action.c"
+#include "../include/command_abi.h"
 #include "../include/envfs.h"
 #include "../crypto/crc32.c"
 #include "../lib/make_directory.c"
@@ -189,14 +190,20 @@ int main(int argc, char *argv[])
 	}
 
 	if (load) {
+		uint16_t command_abi_version;
+
 		if (verbose)
 			printf("loading env from file %s to %s\n", filename, dirname);
-		envfs_load(filename, dirname);
+		envfs_load(filename, dirname, &command_abi_version);
+		if (verbose)
+			printf("with command_abi_version = %u\n", command_abi_version);
 	}
 	if (save) {
 		if (verbose)
 			printf("saving contents of %s to file %s\n", dirname, filename);
Quoted 8 lines

scripts/bareboxenv.c int main(int argc, char *argv[]) · line 207

Quoted 4 lines
scripts/bareboxenv.c +2 -0
 		envfs_save(filename, dirname);
+		if (verbose)
+			printf("with command_abi_version = %u\n", COMMAND_ABI_VERSION);
 	}

For testing purposes or for generating an environment for another barebox version it would be useful to be able to specify the ABI version from the command line.

yeah I was thinking of it too

as I was thinking to genereate an env compatible with multiple version as we have the way to detect it

Best Regards,
J.

Quoted 8 lines

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#15 lore raw
In reply to Sascha Hauer
Quoted 9 lines · Sascha Hauer
Quoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD

Hi,

This will allow to detect command incompability between different version of barebox

Generally a good move. I want to it some more time to apply it though as this is a significant change.
Nevertheless some comments inline.

I'm going to resend the boot sequence and want to bump the command ABI

I was think to use a major minor to report minor command udpate such as nand test which is not critical as mount which need major bump

one a issue I get is how to describe env compatible with multiple version of barebox and choose if env is more recent than the current barebox do not udpate it

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#5 lore raw

Re: [PATCH 2/3] envfs: add command_abi_version support

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 2 lines

We may have to introduce min/max, I'm not sure on that.

no if your env is compatible with more recent but back compatible too

Quoted 8 lines

as you do this with the example of mount update I did recently

if [ $command_abi_version -lt 1 ]
then
mount /dev/disk0.0 fat /mnt
else

	mount /dev/disk0.0 /mnt

fi

That is going to be *very* painful.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

Re: [PATCH 2/3] envfs: add command_abi_version support

Quoted 7 lines · Sascha Hauer
Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 2 lines

We may have to introduce min/max, I'm not sure on that.

no if your env is compatible with more recent but back compatible too

as you do this with the example of mount update I did recently

Quoted 8 lines
Quoted 6 lines

if [ $command_abi_version -lt 1 ]
then
mount /dev/disk0.0 fat /mnt
else

	mount /dev/disk0.0 /mnt

fi

That is going to be *very* painful.

no the idea is to allow it for external script or if we want to load an env for multiple version of barebox

remote udpate
or boot script store on a usb key or mmc and that can be used on different version of barebox because in production we use different version of barebox in the life time of the product

env generate by barebox are for the current version

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#8 lore raw

Re: [PATCH 1/3] command: introduce abi version

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 42 lines · Jean-Christophe PLAGNIOL-VILLARD

This will allow to detect incompatibility between the env abi and the current barebox one

---
 common/command.c      |    2 ++
 include/command.h     |    1 +
 include/command_abi.h |   12 ++++++++++++
 3 files changed, 15 insertions(+)
 create mode 100644 include/command_abi.h
common/command.c +2 -0
index 873b3ff..c80538c 100644
@@ -154,6 +154,8 @@ static int init_command_list(void)
 {
 	struct command *cmdtp;
 
+	export_env_ull("command_abi_version", COMMAND_ABI_VERSION);
+
 	for (cmdtp = &__barebox_cmd_start;
 			cmdtp != &__barebox_cmd_end;
 			cmdtp++)
include/command.h +1 -0
index ffc722c..c49a014 100644
@@ -25,6 +25,7 @@
 
 #include <linux/list.h>
 #include <linux/stringify.h>
+#include <command_abi.h>
 
 #ifndef NULL
 #define NULL	0
include/command_abi.h new file +0 -0
new file mode 100644
index 0000000..264c003

include/command_abi.h line 10

Quoted 10 lines
include/command_abi.h new file +10 -0
@@ -0,0 +1,12 @@
+/*
+ * (C) Copyright 2012 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
+ *
+ * Under GPL v2
+ */
+
+#ifndef __COMMAND_ABI_H__
+#define __COMMAND_ABI_H__
+
+#define COMMAND_ABI_VERSION	0

Please describe what this is. Something like:

/*
* This tracks incompatible changes to the barebox command interface.
* This number is increased when changes are introduced which will cause
* an older environment to no longer work. This could be:
*
* - changes in commandline options to commands
* - renames of commands
* - rename of device files
*
* If you change this value, add a explanation of the actual change to
* Documentation/command-abi-changes.txt
*/

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#9 lore raw

Re: [PATCH 1/3] command: introduce abi version

Quoted 3 lines · Sascha Hauer
Quoted 2 lines · Jean-Christophe PLAGNIOL-VILLARD

This will allow to detect incompatibility between the env abi and the current barebox one

...

Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+#define COMMAND_ABI_VERSION	0

Please describe what this is. Something like:

Quoted 12 lines

/*
* This tracks incompatible changes to the barebox command interface.
* This number is increased when changes are introduced which will cause
* an older environment to no longer work. This could be:
*
* - changes in commandline options to commands
* - renames of commands
* - rename of device files
*
* If you change this value, add a explanation of the actual change to
* Documentation/command-abi-changes.txt
*/

I wonder how this will work in practice. If I use a simple /env/bin/init script and someone makes changes to a command which isn't used by my /env/bin/init, will it still cause my environment to be detected as incompatible?

Maybe it would be a good idea to give the user control
over when to change COMMAND_ABI_VERSION by putting it into menuconfig?

Either way I guess it means the default environment's init script would need to implement automatic update to not lose important settings.

Bottom line: It's much better to not make incompatible ABI changes _ever_.

Johannes

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#10 lore raw

Re: [PATCH 1/3] command: introduce abi version

Quoted 28 lines · Johannes Stezenbach
Quoted 3 lines · Sascha Hauer
Quoted 2 lines · Jean-Christophe PLAGNIOL-VILLARD

This will allow to detect incompatibility between the env abi and the current barebox one

...

Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+#define COMMAND_ABI_VERSION	0

Please describe what this is. Something like:

Quoted 12 lines

/*
* This tracks incompatible changes to the barebox command interface.
* This number is increased when changes are introduced which will cause
* an older environment to no longer work. This could be:
*
* - changes in commandline options to commands
* - renames of commands
* - rename of device files
*
* If you change this value, add a explanation of the actual change to
* Documentation/command-abi-changes.txt
*/

I wonder how this will work in practice. If I use a simple /env/bin/init script and someone makes changes to a command which isn't used by my /env/bin/init, will it still cause my environment to be detected as incompatible?

Quoted 5 lines

Maybe it would be a good idea to give the user control
over when to change COMMAND_ABI_VERSION by putting it into menuconfig?

Either way I guess it means the default environment's init script would need to implement automatic update to not lose important settings.

I see the same problems and I am not really happy with introducing an ABI version.
Also, introducing an ABI version could motivate people to break the ABI just because it's simple to do so and we have a standard way of doing it.

Quoted 2 lines

Bottom line: It's much better to not make incompatible ABI changes _ever_.

Agreed. In case of the change to the mount command this could mean to preserve the old ABI at least for compatibility. In case of my USB/MMC disk example this could mean to add links.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#11 lore raw

Re: [PATCH 1/3] command: introduce abi version

In reply to Johannes Stezenbach
Quoted 28 lines · Johannes Stezenbach
Quoted 3 lines · Sascha Hauer
Quoted 2 lines · Jean-Christophe PLAGNIOL-VILLARD

This will allow to detect incompatibility between the env abi and the current barebox one

...

Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+#define COMMAND_ABI_VERSION	0

Please describe what this is. Something like:

Quoted 12 lines

/*
* This tracks incompatible changes to the barebox command interface.
* This number is increased when changes are introduced which will cause
* an older environment to no longer work. This could be:
*
* - changes in commandline options to commands
* - renames of commands
* - rename of device files
*
* If you change this value, add a explanation of the actual change to
* Documentation/command-abi-changes.txt
*/

I wonder how this will work in practice. If I use a simple /env/bin/init script and someone makes changes to a command which isn't used by my /env/bin/init, will it still cause my environment to be detected as incompatible?

Quoted 5 lines

Maybe it would be a good idea to give the user control
over when to change COMMAND_ABI_VERSION by putting it into menuconfig?

Either way I guess it means the default environment's init script would need to implement automatic update to not lose important settings.

here you loose nothing we just load defaulenv then you load the old one if you one the code does not save the defaultenv automatlically

Quoted 2 lines

Bottom line: It's much better to not make incompatible ABI changes _ever_.

I disagree here sometimes we do need as the ABI is really not convinian or POSIX or like this linux one

Best Regrds.
J.

Quoted 3 lines

Johannes

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#12 lore raw

Re: [PATCH 1/3] command: introduce abi version

Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · Johannes Stezenbach

I wonder how this will work in practice. If I use a simple /env/bin/init script and someone makes changes to a command which isn't used by my /env/bin/init, will it still cause my environment to be detected as incompatible?

Quoted 7 lines
Quoted 5 lines

Maybe it would be a good idea to give the user control
over when to change COMMAND_ABI_VERSION by putting it into menuconfig?

Either way I guess it means the default environment's init script would need to implement automatic update to not lose important settings.

here you loose nothing we just load defaulenv then you load the old one if you one the code does not save the defaultenv automatlically

Well, the whole point of having an environment is that the user can save a customized version. So by definition falling back to the default means you are going to annoy seme users (even though it's usually not difficult to restore the customizations).

Quoted 3 lines
Quoted 1 line

Bottom line: It's much better to not make incompatible ABI changes _ever_.

I disagree here sometimes we do need as the ABI is really not convinian or POSIX or like this linux one

Well, if an ABI or API is fundamentally broken it might be a good idea to fix it. But it should be well justified. And COMMAND_ABI_VERSION seems to make the issue worse and not better, by forcing an incompatibility where there actually might be none.

Johannes

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#13 lore raw

Re: [PATCH 1/3] command: introduce abi version

Quoted 13 lines · Johannes Stezenbach
Quoted 12 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 11 lines · Johannes Stezenbach

I wonder how this will work in practice. If I use a simple /env/bin/init script and someone makes changes to a command which isn't used by my /env/bin/init, will it still cause my environment to be detected as incompatible?

Maybe it would be a good idea to give the user control
over when to change COMMAND_ABI_VERSION by putting it into menuconfig?

Either way I guess it means the default environment's init script would need to implement automatic update to not lose important settings.

Quoted 7 lines
Quoted 2 lines

here you loose nothing we just load defaulenv then you load the old one if you one the code does not save the defaultenv automatlically

Well, the whole point of having an environment is that the user can save a customized version. So by definition falling back to the default means you are going to annoy seme users (even though it's usually not difficult to restore the customizations).

here the issue iin the env we have 2 part the default and the config

so we should speperate them so we can update the rootfs and keep the config ABI

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox