linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH u-boot 1/2] fs: btrfs: skip xattrs in directory listing
@ 2021-02-09 18:05 Marek Behún
  2021-02-09 18:05 ` [PATCH u-boot 2/2] fs: btrfs: change directory list output to be aligned as before Marek Behún
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Marek Behún @ 2021-02-09 18:05 UTC (permalink / raw)
  To: u-boot; +Cc: linux-btrfs, Marek Behún, David Sterba, Qu Wenruo, Tom Rini

Skip xattrs in directory listing. U-Boot filesystem drivers do not list
xattrs.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: David Sterba <dsterba@suse.com>
Cc: Qu Wenruo <wqu@suse.com>
Cc: Tom Rini <trini@konsulko.com>
---
 fs/btrfs/btrfs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/btrfs.c b/fs/btrfs/btrfs.c
index 346b2c4341..6b4c5feb53 100644
--- a/fs/btrfs/btrfs.c
+++ b/fs/btrfs/btrfs.c
@@ -29,7 +29,6 @@ static int show_dir(struct btrfs_root *root, struct extent_buffer *eb,
 		[BTRFS_FT_FIFO]		= "FIFO",
 		[BTRFS_FT_SOCK]		= "SOCK",
 		[BTRFS_FT_SYMLINK]	= "SYMLINK",
-		[BTRFS_FT_XATTR]	= "XATTR"
 	};
 	u8 type = btrfs_dir_type(eb, di);
 	char namebuf[BTRFS_NAME_LEN];
@@ -38,6 +37,10 @@ static int show_dir(struct btrfs_root *root, struct extent_buffer *eb,
 	time_t mtime;
 	int ret = 0;
 
+	/* skip XATTRs in directory listing */
+	if (type == BTRFS_FT_XATTR)
+		return 0;
+
 	btrfs_dir_item_key_to_cpu(eb, di, &key);
 
 	if (key.type == BTRFS_ROOT_ITEM_KEY) {
-- 
2.26.2


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

* [PATCH u-boot 2/2] fs: btrfs: change directory list output to be aligned as before
  2021-02-09 18:05 [PATCH u-boot 1/2] fs: btrfs: skip xattrs in directory listing Marek Behún
@ 2021-02-09 18:05 ` Marek Behún
  2021-02-10  0:20   ` Qu Wenruo
  2021-02-25 13:25   ` Tom Rini
  2021-02-10  0:20 ` [PATCH u-boot 1/2] fs: btrfs: skip xattrs in directory listing Qu Wenruo
  2021-02-25 13:24 ` Tom Rini
  2 siblings, 2 replies; 6+ messages in thread
From: Marek Behún @ 2021-02-09 18:05 UTC (permalink / raw)
  To: u-boot; +Cc: linux-btrfs, Marek Behún, David Sterba, Qu Wenruo, Tom Rini

Since commit 325dd1f642dd ("fs: btrfs: Use btrfs_iter_dir() to ...")
when btrfs is listing a directory, the output is not aligned:

  <SYMLINK>         15  Wed Sep 09 13:20:03 2020  boot.scr -> @/boot/boot.scr
  <DIR>          0  Tue Feb 02 12:42:09 2021  @
  <FILE>        108  Tue Feb 02 12:54:04 2021  1.info

Return back to how it was displayed previously, i.e.:

  <SYM>         15  Wed Sep 09 13:20:03 2020  boot.scr -> @/boot/boot.scr
  <DIR>          0  Tue Feb 02 12:42:09 2021  @
  <   >        108  Tue Feb 02 12:54:04 2021  1.info

Instead of '<FILE>', print '<   >', as ext4 driver.

If an unknown directory item type is encountered, we will print the type
number left padded with spaces, enclosed by '?', instead of '<' and '>',
i.e.:

  ? 30?        .............................  name

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Fixes: 325dd1f642dd ("fs: btrfs: Use btrfs_iter_dir() to replace ...")
Cc: David Sterba <dsterba@suse.com>
Cc: Qu Wenruo <wqu@suse.com>
Cc: Tom Rini <trini@konsulko.com>
---
 fs/btrfs/btrfs.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/btrfs/btrfs.c b/fs/btrfs/btrfs.c
index 6b4c5feb53..52a243a659 100644
--- a/fs/btrfs/btrfs.c
+++ b/fs/btrfs/btrfs.c
@@ -22,13 +22,13 @@ static int show_dir(struct btrfs_root *root, struct extent_buffer *eb,
 	struct btrfs_inode_item ii;
 	struct btrfs_key key;
 	static const char* dir_item_str[] = {
-		[BTRFS_FT_REG_FILE]	= "FILE",
+		[BTRFS_FT_REG_FILE]	= "   ",
 		[BTRFS_FT_DIR] 		= "DIR",
-		[BTRFS_FT_CHRDEV]	= "CHRDEV",
-		[BTRFS_FT_BLKDEV]	= "BLKDEV",
-		[BTRFS_FT_FIFO]		= "FIFO",
-		[BTRFS_FT_SOCK]		= "SOCK",
-		[BTRFS_FT_SYMLINK]	= "SYMLINK",
+		[BTRFS_FT_CHRDEV]	= "CHR",
+		[BTRFS_FT_BLKDEV]	= "BLK",
+		[BTRFS_FT_FIFO]		= "FIF",
+		[BTRFS_FT_SOCK]		= "SCK",
+		[BTRFS_FT_SYMLINK]	= "SYM",
 	};
 	u8 type = btrfs_dir_type(eb, di);
 	char namebuf[BTRFS_NAME_LEN];
@@ -93,7 +93,7 @@ static int show_dir(struct btrfs_root *root, struct extent_buffer *eb,
 	if (type < ARRAY_SIZE(dir_item_str) && dir_item_str[type])
 		printf("<%s> ", dir_item_str[type]);
 	else
-		printf("DIR_ITEM.%u", type);
+		printf("?%3u? ", type);
 	if (type == BTRFS_FT_CHRDEV || type == BTRFS_FT_BLKDEV) {
 		ASSERT(key.type == BTRFS_INODE_ITEM_KEY);
 		printf("%4llu,%5llu  ", btrfs_stack_inode_rdev(&ii) >> 20,
-- 
2.26.2


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

* Re: [PATCH u-boot 2/2] fs: btrfs: change directory list output to be aligned as before
  2021-02-09 18:05 ` [PATCH u-boot 2/2] fs: btrfs: change directory list output to be aligned as before Marek Behún
@ 2021-02-10  0:20   ` Qu Wenruo
  2021-02-25 13:25   ` Tom Rini
  1 sibling, 0 replies; 6+ messages in thread
From: Qu Wenruo @ 2021-02-10  0:20 UTC (permalink / raw)
  To: Marek Behún, u-boot; +Cc: linux-btrfs, David Sterba, Qu Wenruo, Tom Rini



On 2021/2/10 上午2:05, Marek Behún wrote:
> Since commit 325dd1f642dd ("fs: btrfs: Use btrfs_iter_dir() to ...")
> when btrfs is listing a directory, the output is not aligned:
>
>    <SYMLINK>         15  Wed Sep 09 13:20:03 2020  boot.scr -> @/boot/boot.scr
>    <DIR>          0  Tue Feb 02 12:42:09 2021  @
>    <FILE>        108  Tue Feb 02 12:54:04 2021  1.info
>
> Return back to how it was displayed previously, i.e.:
>
>    <SYM>         15  Wed Sep 09 13:20:03 2020  boot.scr -> @/boot/boot.scr
>    <DIR>          0  Tue Feb 02 12:42:09 2021  @
>    <   >        108  Tue Feb 02 12:54:04 2021  1.info
>
> Instead of '<FILE>', print '<   >', as ext4 driver.
>
> If an unknown directory item type is encountered, we will print the type
> number left padded with spaces, enclosed by '?', instead of '<' and '>',
> i.e.:
>
>    ? 30?        .............................  name
>
> Signed-off-by: Marek Behún <marek.behun@nic.cz>
> Fixes: 325dd1f642dd ("fs: btrfs: Use btrfs_iter_dir() to replace ...")
> Cc: David Sterba <dsterba@suse.com>
> Cc: Qu Wenruo <wqu@suse.com>
> Cc: Tom Rini <trini@konsulko.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>


> ---
>   fs/btrfs/btrfs.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/fs/btrfs/btrfs.c b/fs/btrfs/btrfs.c
> index 6b4c5feb53..52a243a659 100644
> --- a/fs/btrfs/btrfs.c
> +++ b/fs/btrfs/btrfs.c
> @@ -22,13 +22,13 @@ static int show_dir(struct btrfs_root *root, struct extent_buffer *eb,
>   	struct btrfs_inode_item ii;
>   	struct btrfs_key key;
>   	static const char* dir_item_str[] = {
> -		[BTRFS_FT_REG_FILE]	= "FILE",
> +		[BTRFS_FT_REG_FILE]	= "   ",
>   		[BTRFS_FT_DIR] 		= "DIR",
> -		[BTRFS_FT_CHRDEV]	= "CHRDEV",
> -		[BTRFS_FT_BLKDEV]	= "BLKDEV",
> -		[BTRFS_FT_FIFO]		= "FIFO",
> -		[BTRFS_FT_SOCK]		= "SOCK",
> -		[BTRFS_FT_SYMLINK]	= "SYMLINK",
> +		[BTRFS_FT_CHRDEV]	= "CHR",
> +		[BTRFS_FT_BLKDEV]	= "BLK",
> +		[BTRFS_FT_FIFO]		= "FIF",
> +		[BTRFS_FT_SOCK]		= "SCK",
> +		[BTRFS_FT_SYMLINK]	= "SYM",

Since btrfs-progs also use similar output for its dump-tree, I guess
it's also possible to use the similar 3 chars output, except the FILE.

Thanks,
Qu
>   	};
>   	u8 type = btrfs_dir_type(eb, di);
>   	char namebuf[BTRFS_NAME_LEN];
> @@ -93,7 +93,7 @@ static int show_dir(struct btrfs_root *root, struct extent_buffer *eb,
>   	if (type < ARRAY_SIZE(dir_item_str) && dir_item_str[type])
>   		printf("<%s> ", dir_item_str[type]);
>   	else
> -		printf("DIR_ITEM.%u", type);
> +		printf("?%3u? ", type);
>   	if (type == BTRFS_FT_CHRDEV || type == BTRFS_FT_BLKDEV) {
>   		ASSERT(key.type == BTRFS_INODE_ITEM_KEY);
>   		printf("%4llu,%5llu  ", btrfs_stack_inode_rdev(&ii) >> 20,
>

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

* Re: [PATCH u-boot 1/2] fs: btrfs: skip xattrs in directory listing
  2021-02-09 18:05 [PATCH u-boot 1/2] fs: btrfs: skip xattrs in directory listing Marek Behún
  2021-02-09 18:05 ` [PATCH u-boot 2/2] fs: btrfs: change directory list output to be aligned as before Marek Behún
@ 2021-02-10  0:20 ` Qu Wenruo
  2021-02-25 13:24 ` Tom Rini
  2 siblings, 0 replies; 6+ messages in thread
From: Qu Wenruo @ 2021-02-10  0:20 UTC (permalink / raw)
  To: Marek Behún, u-boot; +Cc: linux-btrfs, David Sterba, Qu Wenruo, Tom Rini



On 2021/2/10 上午2:05, Marek Behún wrote:
> Skip xattrs in directory listing. U-Boot filesystem drivers do not list
> xattrs.
>
> Signed-off-by: Marek Behún <marek.behun@nic.cz>
> Cc: David Sterba <dsterba@suse.com>
> Cc: Qu Wenruo <wqu@suse.com>
> Cc: Tom Rini <trini@konsulko.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> ---
>   fs/btrfs/btrfs.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/btrfs.c b/fs/btrfs/btrfs.c
> index 346b2c4341..6b4c5feb53 100644
> --- a/fs/btrfs/btrfs.c
> +++ b/fs/btrfs/btrfs.c
> @@ -29,7 +29,6 @@ static int show_dir(struct btrfs_root *root, struct extent_buffer *eb,
>   		[BTRFS_FT_FIFO]		= "FIFO",
>   		[BTRFS_FT_SOCK]		= "SOCK",
>   		[BTRFS_FT_SYMLINK]	= "SYMLINK",
> -		[BTRFS_FT_XATTR]	= "XATTR"
>   	};
>   	u8 type = btrfs_dir_type(eb, di);
>   	char namebuf[BTRFS_NAME_LEN];
> @@ -38,6 +37,10 @@ static int show_dir(struct btrfs_root *root, struct extent_buffer *eb,
>   	time_t mtime;
>   	int ret = 0;
>
> +	/* skip XATTRs in directory listing */
> +	if (type == BTRFS_FT_XATTR)
> +		return 0;
> +
>   	btrfs_dir_item_key_to_cpu(eb, di, &key);
>
>   	if (key.type == BTRFS_ROOT_ITEM_KEY) {
>

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

* Re: [PATCH u-boot 1/2] fs: btrfs: skip xattrs in directory listing
  2021-02-09 18:05 [PATCH u-boot 1/2] fs: btrfs: skip xattrs in directory listing Marek Behún
  2021-02-09 18:05 ` [PATCH u-boot 2/2] fs: btrfs: change directory list output to be aligned as before Marek Behún
  2021-02-10  0:20 ` [PATCH u-boot 1/2] fs: btrfs: skip xattrs in directory listing Qu Wenruo
@ 2021-02-25 13:24 ` Tom Rini
  2 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2021-02-25 13:24 UTC (permalink / raw)
  To: Marek Behún; +Cc: u-boot, linux-btrfs, David Sterba, Qu Wenruo

[-- Attachment #1: Type: text/plain, Size: 403 bytes --]

On Tue, Feb 09, 2021 at 07:05:07PM +0100, Marek Behún wrote:

> Skip xattrs in directory listing. U-Boot filesystem drivers do not list
> xattrs.
> 
> Signed-off-by: Marek Behún <marek.behun@nic.cz>
> Cc: David Sterba <dsterba@suse.com>
> Cc: Qu Wenruo <wqu@suse.com>
> Cc: Tom Rini <trini@konsulko.com>
> Reviewed-by: Qu Wenruo <wqu@suse.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH u-boot 2/2] fs: btrfs: change directory list output to be aligned as before
  2021-02-09 18:05 ` [PATCH u-boot 2/2] fs: btrfs: change directory list output to be aligned as before Marek Behún
  2021-02-10  0:20   ` Qu Wenruo
@ 2021-02-25 13:25   ` Tom Rini
  1 sibling, 0 replies; 6+ messages in thread
From: Tom Rini @ 2021-02-25 13:25 UTC (permalink / raw)
  To: Marek Behún; +Cc: u-boot, linux-btrfs, David Sterba, Qu Wenruo

[-- Attachment #1: Type: text/plain, Size: 1252 bytes --]

On Tue, Feb 09, 2021 at 07:05:08PM +0100, Marek Behún wrote:

> Since commit 325dd1f642dd ("fs: btrfs: Use btrfs_iter_dir() to ...")
> when btrfs is listing a directory, the output is not aligned:
> 
>   <SYMLINK>         15  Wed Sep 09 13:20:03 2020  boot.scr -> @/boot/boot.scr
>   <DIR>          0  Tue Feb 02 12:42:09 2021  @
>   <FILE>        108  Tue Feb 02 12:54:04 2021  1.info
> 
> Return back to how it was displayed previously, i.e.:
> 
>   <SYM>         15  Wed Sep 09 13:20:03 2020  boot.scr -> @/boot/boot.scr
>   <DIR>          0  Tue Feb 02 12:42:09 2021  @
>   <   >        108  Tue Feb 02 12:54:04 2021  1.info
> 
> Instead of '<FILE>', print '<   >', as ext4 driver.
> 
> If an unknown directory item type is encountered, we will print the type
> number left padded with spaces, enclosed by '?', instead of '<' and '>',
> i.e.:
> 
>   ? 30?        .............................  name
> 
> Signed-off-by: Marek Behún <marek.behun@nic.cz>
> Fixes: 325dd1f642dd ("fs: btrfs: Use btrfs_iter_dir() to replace ...")
> Cc: David Sterba <dsterba@suse.com>
> Cc: Qu Wenruo <wqu@suse.com>
> Cc: Tom Rini <trini@konsulko.com>
> Reviewed-by: Qu Wenruo <wqu@suse.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

end of thread, other threads:[~2021-02-25 13:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-09 18:05 [PATCH u-boot 1/2] fs: btrfs: skip xattrs in directory listing Marek Behún
2021-02-09 18:05 ` [PATCH u-boot 2/2] fs: btrfs: change directory list output to be aligned as before Marek Behún
2021-02-10  0:20   ` Qu Wenruo
2021-02-25 13:25   ` Tom Rini
2021-02-10  0:20 ` [PATCH u-boot 1/2] fs: btrfs: skip xattrs in directory listing Qu Wenruo
2021-02-25 13:24 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).