Skip to contentSkip to conversation

open_by_handle: Don't use MAX_HANDLE_SZ

PATCH In review Palmer Dabbelt 3 participants 3 messages Oct 29, 2020 – Nov 9, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 open_by_handle: Don't use MAX_HANDLE_SZ

When I compile this normally I end up with the definition of MAX_HANDLE_SZ, but when I compile it in a minimal buildroot-based environment I don't. I'm not sure where this is supposed to come from, but as of 3f4760c2 ("open_by_handle: add option -z to query file handle size") it appears to be unnecessary.

---
I haven't actually run this, as I haven't figured out how to yet. It does build, though.

---
 src/open_by_handle.c | 1 -
 1 file changed, 1 deletion(-)
src/open_by_handle.c +0 -1
index 0f74ed08..ddeffb7a 100644
@@ -92,7 +92,6 @@ Examples:
 
 struct handle {
 	struct file_handle fh;
-	unsigned char fid[MAX_HANDLE_SZ];
 } handle[MAXFILES], dir_handle;
 
 void usage(void)
Signature · 1 line
2.29.1.341.ge80a0c044ae-goog
#1 lore raw
Quoted 20 lines · Palmer Dabbelt

When I compile this normally I end up with the definition of MAX_HANDLE_SZ, but when I compile it in a minimal buildroot-based environment I don't. I'm not sure where this is supposed to come from, but as of 3f4760c2 ("open_by_handle: add option -z to query file handle size") it appears to be unnecessary.

---
I haven't actually run this, as I haven't figured out how to yet. It does build, though.

---
 src/open_by_handle.c | 1 -
 1 file changed, 1 deletion(-)
src/open_by_handle.c +0 -0
index 0f74ed08..ddeffb7a 100644

src/open_by_handle.c Examples: · line 95

Quoted 5 lines
src/open_by_handle.c +0 -1
@@ -92,7 +92,6 @@ Examples:
 
 struct handle {
        struct file_handle fh;
-       unsigned char fid[MAX_HANDLE_SZ];
 } handle[MAXFILES], dir_handle;

This is absolutely wrong!

I don't know what's the best way to fix the build error, but this fid member is absolutely needed.

For all I care, you can define MAX_TEST_HANDLE_SZ to 128 or to MAX_HANDLE_SZ if it is defined.

The test doesn't really care what the value of MAX_HANDLE_SZ is. It just needs to be large enough to accomodate for the size of file handles of the tested filesystem.

Thanks,
Amir.

#2 lore raw
In reply to Palmer Dabbelt
Quoted 5 lines · Palmer Dabbelt

When I compile this normally I end up with the definition of MAX_HANDLE_SZ, but when I compile it in a minimal buildroot-based environment I don't. I'm not sure where this is supposed to come from, but as of 3f4760c2 ("open_by_handle: add option -z to query file handle size") it appears to be unnecessary.

Hmmm - it should be trivial to find where it comes from with grep:

$ grep -R MAX_HANDLE_SZ /usr/include
/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h:# define	MAX_HANDLE_SZ	128
$

IOWs, MAX_HANDLE_SZ is defined via:

#include <fcntl.h>

which src/open_by_handle.c already includes.

IOWs, this looks like a problem with your build root environment not defining MAX_HANDLE_SZ correctly, not a problem with fstests.

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]