Skip to contentSkip to conversation

lseek: functional SEEK_HOLE and SEEK_DATA test

PATCH Superseded Zorro Lang 2 participants 3 messages Apr 8, 2017 – Apr 11, 2017

lore
Share & tools
lore

Zorro Lang

author
#0 lore raw

PATCH v3 1/1 lseek: functional SEEK_HOLE and SEEK_DATA test

This case does functional SEEK_HOLE and SEEK_DATA of lseek(2) testing.

Since version 3.1, Linux supports the following additional values for whence:

SEEK_DATA
Adjust the file offset to the next location in the file greater than or equal to offset containing data. If offset points to data, then the file offset is set to offset.

SEEK_HOLE
Adjust the file offset to the next hole in the file greater than or equal to offset. If offset points into the middle of a hole, then the file offset is set to offset. If there is no hole past offset, then the file offset is adjusted to the end of the file (i.e., there is an implicit hole at the end of any file).

This case will cover above description.

---

Hi,

V3 did below changes:
1) change the description about GPLv2.
2) change get_blocksize() function's offset initial value.
3) change TBROK to TCONF, if filesystem doesn't support real SEEK_DATA/SEEK_HOLE.
4) change the print format in test_lseek().

Thanks,
Zorro

 runtest/ltplite                           |   1 +
 runtest/stress.part3                      |   1 +
 runtest/syscalls                          |   1 +
 testcases/kernel/syscalls/.gitignore      |   1 +
 testcases/kernel/syscalls/lseek/lseek11.c | 238 ++++++++++++++++++++++++++++++
 5 files changed, 242 insertions(+)
 create mode 100644 testcases/kernel/syscalls/lseek/lseek11.c
runtest/ltplite +1 -0
index d4580ad..e895b93 100644
@@ -415,6 +415,7 @@ lseek07 lseek07
 lseek08 lseek08
 lseek09 lseek09
 lseek10 lseek10
+lseek11 lseek11
 
 lstat01A symlink01 -T lstat01
 lstat01 lstat01
runtest/stress.part3 +1 -0
index 41f8b25..bd84752 100644
@@ -341,6 +341,7 @@ lseek07 lseek07
 lseek08 lseek08
 lseek09 lseek09
 lseek10 lseek10
+lseek11 lseek11
 
 lstat01A symlink01 -T lstat01
 lstat01 lstat01
runtest/syscalls +1 -0
index 48f6492..7ac022c 100644
@@ -548,6 +548,7 @@ lseek07 lseek07
 lseek08 lseek08
 lseek09 lseek09
 lseek10 lseek10
+lseek11 lseek11
 
 lstat01A symlink01 -T lstat01
 lstat01A_64 symlink01 -T lstat01_64
testcases/kernel/syscalls/.gitignore +1 -0
index bebaa89..60f13df 100644
@@ -500,6 +500,7 @@
 /lseek/lseek08
 /lseek/lseek09
 /lseek/lseek10
+/lseek/lseek11
 /lstat/lstat01
 /lstat/lstat01_64
 /lstat/lstat02
testcases/kernel/syscalls/lseek/lseek11.c new file +238 -0

238 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/1 lseek: functional SEEK_HOLE and SEEK_DATA test

Hi!
Pushed with minor changes, thanks.

I've added a lapi/seek.h header with fallback defintion for SEEK_DATA and SEEK_HOLE, dropped the ifdefs from the test, and added a a check if SEEK_HOLE is implemented to the test setup() function.

And also removed a few backslashes from the tst_res(... lines since these are not needed at all.

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

PATCH v3 1/1 lseek: functional SEEK_HOLE and SEEK_DATA test

Quoted 9 lines · Cyril Hrubis

Hi!
Pushed with minor changes, thanks.

I've added a lapi/seek.h header with fallback defintion for SEEK_DATA and SEEK_HOLE, dropped the ifdefs from the test, and added a a check if SEEK_HOLE is implemented to the test setup() function.

And also removed a few backslashes from the tst_res(... lines since these are not needed at all.

Thanks for doing this :)

Quoted 4 lines
Signature · 3 lines
-- 
Cyril Hrubis
[email protected]