Re: [PATCH 1/2] proc: Add struct mount & struct super_block addr in lx-mounts command

2020-08-18 Thread Ritesh Harjani




On 8/18/20 11:07 AM, Jan Kiszka wrote:

On 18.08.20 06:04, Ritesh Harjani wrote:

This is many times found useful while debugging some FS related issue.


   mount  super_block  fstype devname pathname options
0x888a0bfa4b40 0x888a0bfc1000 rootfs none / rw   0 0
0x888a02c065c0 0x8889fcf65000 ext4 /dev/root / rw  ,relatime 0 0
0x8889fc8cc040 0x888a0bb51000 devtmpfs devtmpfs /dev rw  ,relatime 0 0

Signed-off-by: Ritesh Harjani 
---
  scripts/gdb/linux/proc.py | 15 +++
  1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/scripts/gdb/linux/proc.py b/scripts/gdb/linux/proc.py
index 6a56bba233a9..c16fab981bdd 100644
--- a/scripts/gdb/linux/proc.py
+++ b/scripts/gdb/linux/proc.py
@@ -167,6 +167,9 @@ values of that process namespace"""
  if not namespace:
  raise gdb.GdbError("No namespace for current process")
  
+gdb.write("{:^18} {:^15} {:>9} {} {} options\n".format(

+  "mount", "super_block", "fstype", "devname", "pathname"))
+
  for vfs in lists.list_for_each_entry(namespace['list'],
   mount_ptr_type, "mnt_list"):
  devname = vfs['mnt_devname'].string()
@@ -190,14 +193,10 @@ values of that process namespace"""
  m_flags = int(vfs['mnt']['mnt_flags'])
  rd = "ro" if (s_flags & constants.LX_SB_RDONLY) else "rw"
  
-gdb.write(

-"{} {} {} {}{}{} 0 0\n"
-.format(devname,
-pathname,
-fstype,
-rd,
-info_opts(FS_INFO, s_flags),
-info_opts(MNT_INFO, m_flags)))
+gdb.write("{} {} {} {} {} {} {} {} 0 0\n".format(
+  vfs.format_string(), superblock.format_string(), fstype,
+  devname, pathname, rd, info_opts(FS_INFO, s_flags),
+  info_opts(MNT_INFO, m_flags)))


The last three format elements should not be space-separated. The effect
can even be seen in your example above.


yes, agreed. Will fix it in next version.

-ritesh


Re: [PATCH 1/2] proc: Add struct mount & struct super_block addr in lx-mounts command

2020-08-17 Thread Jan Kiszka
On 18.08.20 06:04, Ritesh Harjani wrote:
> This is many times found useful while debugging some FS related issue.
> 
> 
>   mount  super_block  fstype devname pathname options
> 0x888a0bfa4b40 0x888a0bfc1000 rootfs none / rw   0 0
> 0x888a02c065c0 0x8889fcf65000 ext4 /dev/root / rw  ,relatime 0 0
> 0x8889fc8cc040 0x888a0bb51000 devtmpfs devtmpfs /dev rw  ,relatime 0 0
> 
> Signed-off-by: Ritesh Harjani 
> ---
>  scripts/gdb/linux/proc.py | 15 +++
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/scripts/gdb/linux/proc.py b/scripts/gdb/linux/proc.py
> index 6a56bba233a9..c16fab981bdd 100644
> --- a/scripts/gdb/linux/proc.py
> +++ b/scripts/gdb/linux/proc.py
> @@ -167,6 +167,9 @@ values of that process namespace"""
>  if not namespace:
>  raise gdb.GdbError("No namespace for current process")
>  
> +gdb.write("{:^18} {:^15} {:>9} {} {} options\n".format(
> +  "mount", "super_block", "fstype", "devname", "pathname"))
> +
>  for vfs in lists.list_for_each_entry(namespace['list'],
>   mount_ptr_type, "mnt_list"):
>  devname = vfs['mnt_devname'].string()
> @@ -190,14 +193,10 @@ values of that process namespace"""
>  m_flags = int(vfs['mnt']['mnt_flags'])
>  rd = "ro" if (s_flags & constants.LX_SB_RDONLY) else "rw"
>  
> -gdb.write(
> -"{} {} {} {}{}{} 0 0\n"
> -.format(devname,
> -pathname,
> -fstype,
> -rd,
> -info_opts(FS_INFO, s_flags),
> -info_opts(MNT_INFO, m_flags)))
> +gdb.write("{} {} {} {} {} {} {} {} 0 0\n".format(
> +  vfs.format_string(), superblock.format_string(), 
> fstype,
> +  devname, pathname, rd, info_opts(FS_INFO, s_flags),
> +  info_opts(MNT_INFO, m_flags)))

The last three format elements should not be space-separated. The effect
can even be seen in your example above.

Jan

>  
>  
>  LxMounts()
> 

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux


[PATCH 1/2] proc: Add struct mount & struct super_block addr in lx-mounts command

2020-08-17 Thread Ritesh Harjani
This is many times found useful while debugging some FS related issue.


  mount  super_block  fstype devname pathname options
0x888a0bfa4b40 0x888a0bfc1000 rootfs none / rw   0 0
0x888a02c065c0 0x8889fcf65000 ext4 /dev/root / rw  ,relatime 0 0
0x8889fc8cc040 0x888a0bb51000 devtmpfs devtmpfs /dev rw  ,relatime 0 0

Signed-off-by: Ritesh Harjani 
---
 scripts/gdb/linux/proc.py | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/scripts/gdb/linux/proc.py b/scripts/gdb/linux/proc.py
index 6a56bba233a9..c16fab981bdd 100644
--- a/scripts/gdb/linux/proc.py
+++ b/scripts/gdb/linux/proc.py
@@ -167,6 +167,9 @@ values of that process namespace"""
 if not namespace:
 raise gdb.GdbError("No namespace for current process")
 
+gdb.write("{:^18} {:^15} {:>9} {} {} options\n".format(
+  "mount", "super_block", "fstype", "devname", "pathname"))
+
 for vfs in lists.list_for_each_entry(namespace['list'],
  mount_ptr_type, "mnt_list"):
 devname = vfs['mnt_devname'].string()
@@ -190,14 +193,10 @@ values of that process namespace"""
 m_flags = int(vfs['mnt']['mnt_flags'])
 rd = "ro" if (s_flags & constants.LX_SB_RDONLY) else "rw"
 
-gdb.write(
-"{} {} {} {}{}{} 0 0\n"
-.format(devname,
-pathname,
-fstype,
-rd,
-info_opts(FS_INFO, s_flags),
-info_opts(MNT_INFO, m_flags)))
+gdb.write("{} {} {} {} {} {} {} {} 0 0\n".format(
+  vfs.format_string(), superblock.format_string(), fstype,
+  devname, pathname, rd, info_opts(FS_INFO, s_flags),
+  info_opts(MNT_INFO, m_flags)))
 
 
 LxMounts()
-- 
2.25.4