Skip to contentSkip to conversation

syscalls/fgetxattr02: Use loop instead of RAM disk

PATCH New Cyril Hrubis 2 participants 5 messages Feb 20, 2020 – Feb 25, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls/fgetxattr02: Use loop instead of RAM disk

There are minimal systems that does not ship with RAM disk kernel module which makes this test fail with ENXIO when we attempt to open the block device in the test setup.

LTP depends on heavily on loop device driver already so it makes sense to switch over to a loop device backed block device instead.

---
 testcases/kernel/syscalls/fgetxattr/fgetxattr02.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/fgetxattr/fgetxattr02.c +4 -3
index 02e81810a..82fb676be 100644
@@ -210,7 +210,8 @@ static void setup(void)
 	size_t i = 0;
 	struct sockaddr_un sun;
 
-	dev_t dev = makedev(1, 3);
+	dev_t chr_dev = makedev(1, 3);
+	dev_t blk_dev = makedev(7, 3);
 
 	SAFE_TOUCH(FILENAME, 0644, NULL);
 	SAFE_TOUCH(SYMLINKF, 0644, NULL);
@@ -219,8 +220,8 @@ static void setup(void)
 
 	/* root: mknod(2) needs it to create something other than a file */
 	SAFE_MKNOD(FIFO, S_IFIFO | 0777, 0);
-	SAFE_MKNOD(CHR, S_IFCHR | 0777, dev);
-	SAFE_MKNOD(BLK, S_IFBLK | 0777, dev);
+	SAFE_MKNOD(CHR, S_IFCHR | 0777, chr_dev);
+	SAFE_MKNOD(BLK, S_IFBLK | 0777, blk_dev);
 
 	for (i = 0; i < ARRAY_SIZE(tc); i++) {
 
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/1 syscalls/fgetxattr02: Use loop instead of RAM disk

Hi Cyril> There are minimal systems that does not ship with RAM disk kernel module

Quoted 16 lines

which makes this test fail with ENXIO when we attempt to open the block device in the test setup.

LTP depends on heavily on loop device driver already so it makes sense to switch over to a loop device backed block device instead.

---
  testcases/kernel/syscalls/fgetxattr/fgetxattr02.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/fgetxattr/fgetxattr02.c +0 -0
index 02e81810a..82fb676be 100644

testcases/kernel/syscalls/fgetxattr/fgetxattr02.c static void setup(void) · line 214

Quoted 6 lines
testcases/kernel/syscalls/fgetxattr/fgetxattr02.c +2 -1
@@ -210,7 +210,8 @@ static void setup(void)
  	size_t i = 0;
  	struct sockaddr_un sun;
 
-	dev_t dev = makedev(1, 3);
+	dev_t chr_dev = makedev(1, 3);
+	dev_t blk_dev = makedev(7, 3);

Can we use tst_find_free_loopdev to avoid a fixed loop dev like
copy_file_range02.c?

Best Regards
Yang Xu

Quoted 15 lines
testcases/kernel/syscalls/fgetxattr/fgetxattr02.c +2 -2
  	SAFE_TOUCH(FILENAME, 0644, NULL);
  	SAFE_TOUCH(SYMLINKF, 0644, NULL);
@@ -219,8 +220,8 @@ static void setup(void)
 
  	/* root: mknod(2) needs it to create something other than a file */
  	SAFE_MKNOD(FIFO, S_IFIFO | 0777, 0);
-	SAFE_MKNOD(CHR, S_IFCHR | 0777, dev);
-	SAFE_MKNOD(BLK, S_IFBLK | 0777, dev);
+	SAFE_MKNOD(CHR, S_IFCHR | 0777, chr_dev);
+	SAFE_MKNOD(BLK, S_IFBLK | 0777, blk_dev);
 
  	for (i = 0; i < ARRAY_SIZE(tc); i++) {
 
#2 lore raw

PATCH 1/1 syscalls/fgetxattr02: Use loop instead of RAM disk

Hi!

Quoted 19 lines
Quoted 19 lines

which makes this test fail with ENXIO when we attempt to open the block device in the test setup.

LTP depends on heavily on loop device driver already so it makes sense to switch over to a loop device backed block device instead.

---
  testcases/kernel/syscalls/fgetxattr/fgetxattr02.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/fgetxattr/fgetxattr02.c +0 -0
index 02e81810a..82fb676be 100644
@@ -210,7 +210,8 @@ static void setup(void)
  	size_t i = 0;
  	struct sockaddr_un sun;
 
Quoted 5 lines

testcases/kernel/syscalls/fgetxattr/fgetxattr02.c static void setup(void) · line 214

Quoted 3 lines
testcases/kernel/syscalls/fgetxattr/fgetxattr02.c +2 -1
-	dev_t dev = makedev(1, 3);
+	dev_t chr_dev = makedev(1, 3);
+	dev_t blk_dev = makedev(7, 3);

Can we use tst_find_free_loopdev to avoid a fixed loop dev like
copy_file_range02.c?

I do not think that it matters here, we are not actually touching the block device here, we just need to be able to open the block device so that we can add an attribute to the file we have created. I does not matter if it's used or not.

Signature · 2 lines
Cyril Hrubis
[email protected]
#3 lore raw

PATCH 1/1 syscalls/fgetxattr02: Use loop instead of RAM disk

Hi

Quoted 26 lines

Hi!

Quoted 19 lines
Quoted 19 lines

which makes this test fail with ENXIO when we attempt to open the block device in the test setup.

LTP depends on heavily on loop device driver already so it makes sense to switch over to a loop device backed block device instead.

---
   testcases/kernel/syscalls/fgetxattr/fgetxattr02.c | 7 ++++---
   1 file changed, 4 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/fgetxattr/fgetxattr02.c +0 -0
index 02e81810a..82fb676be 100644
@@ -210,7 +210,8 @@ static void setup(void)
   	size_t i = 0;
   	struct sockaddr_un sun;
 
Quoted 5 lines

testcases/kernel/syscalls/fgetxattr/fgetxattr02.c static void setup(void) · line 214

Quoted 3 lines
testcases/kernel/syscalls/fgetxattr/fgetxattr02.c +2 -1
-	dev_t dev = makedev(1, 3);
+	dev_t chr_dev = makedev(1, 3);
+	dev_t blk_dev = makedev(7, 3);

Can we use tst_find_free_loopdev to avoid a fixed loop dev like
copy_file_range02.c?

Quoted 4 lines

I do not think that it matters here, we are not actually touching the block device here, we just need to be able to open the block device so that we can add an attribute to the file we have created. I does not matter if it's used or not.

Sound reasonable, feel free to add

Quoted 1 line