[PATCH] tools: Remove redundant specification of default string encodings

4 views
Skip to first unread message

Jan Kiszka

unread,
Dec 15, 2016, 4:49:42 AM12/15/16
to Jailhouse
utf-8 is the default, no need to repeat that.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
tools/jailhouse-cell-linux | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/jailhouse-cell-linux b/tools/jailhouse-cell-linux
index f65d957..d3be988 100755
--- a/tools/jailhouse-cell-linux
+++ b/tools/jailhouse-cell-linux
@@ -339,7 +339,7 @@ class ARMCommon:

self.params = 'kernel=0x%x dtb=0x%x' % (self._kernel_addr,
self._dtb_addr)
- self.params = self.params.encode('utf-8')
+ self.params = self.params.encode()

self.dtb = DTB(args.dtb.read())

@@ -627,7 +627,7 @@ class JailhouseCell:
JAILHOUSE_CELL_ID_UNUSED = -1

def __init__(self, config):
- self.name = config.name.encode('utf-8')
+ self.name = config.name.encode()

self.dev = open('/dev/jailhouse')

--
2.1.4

Ralf Ramsauer

unread,
Jan 10, 2017, 11:27:14 AM1/10/17
to Jan Kiszka, Jailhouse


On 12/15/2016 10:49 AM, Jan Kiszka wrote:
> utf-8 is the default, no need to repeat that.
>
> Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
> ---
> tools/jailhouse-cell-linux | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/jailhouse-cell-linux b/tools/jailhouse-cell-linux
> index f65d957..d3be988 100755
> --- a/tools/jailhouse-cell-linux
> +++ b/tools/jailhouse-cell-linux
> @@ -339,7 +339,7 @@ class ARMCommon:
>
> self.params = 'kernel=0x%x dtb=0x%x' % (self._kernel_addr,
> self._dtb_addr)
> - self.params = self.params.encode('utf-8')
> + self.params = self.params.encode()
Hmm, we still have a python2/3 compatibility issue here:

On python3 on ARM, jailhouse cell linux --write-param now produces sth.
like:

[...]
jailhouse cell load jetson-tk1-linux-demo linux-loader.bin -s
"b'kernel=0xe8002000 dtb=0xe8000000'" -a 0x100 /root/zImage-inmate-4.9
-a 0xe8002000 /root/rootfs.cpio -a 0xe908d000 foo -a 0xe8000000
jailhouse cell start jetson-tk1-linux-demo

Look at the parameters for the linux-loader: "b'kernel=0xe8002000
dtb=0xe8000000'".

Before printing this to stdout, on python3 we would actually need to
.decode() the string, otherwise the string contains the b''...

Ralf

Jan Kiszka

unread,
Jan 10, 2017, 12:13:33 PM1/10/17
to Ralf Ramsauer, Jailhouse
Yeah, I was almost afraid we release the version without a bug...

Please send a patch like that, the approach looks good to me.

Jan

--
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux
Reply all
Reply to author
Forward
0 new messages