1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
From ffc79f128ca577908899689fffbdbbd97a7af2ef Mon Sep 17 00:00:00 2001
From: Stefan Bischoff <stefan.bischoff@9plus.de>
Date: Tue, 12 Nov 2019 16:11:32 +0100
Subject: [PATCH] client: Fixes for missing consts SEEK_DATA and SEEK_HOLE on
alpine linux
Fixes: https://tracker.ceph.com/issues/42602
Signed-off-by: Stefan Bischoff <stefan.bischoff@lw-rulez.de>
---
src/client/Client.cc | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/client/Client.cc b/src/client/Client.cc
index 281b4ef03123..737bfabe67f7 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -8908,9 +8908,28 @@ loff_t Client::_lseek(Fh *f, loff_t offset, int whence)
{
Inode *in = f->inode.get();
int r;
+ bool whence_check = false;
loff_t pos = -1;
- if (whence == SEEK_END || whence == SEEK_DATA || whence == SEEK_HOLE) {
+ switch (whence) {
+ case SEEK_END:
+ whence_check = true;
+ break;
+
+#ifdef SEEK_DATA
+ case SEEK_DATA:
+ whence_check = true;
+ break;
+#endif
+
+#ifdef SEEK_HOLE
+ case SEEK_HOLE:
+ whence_check = true;
+ break;
+#endif
+ }
+
+ if (whence_check) {
r = _getattr(in, CEPH_STAT_CAP_SIZE, f->actor_perms);
if (r < 0) {
return r;
@@ -8930,6 +8949,7 @@ loff_t Client::_lseek(Fh *f, loff_t offset, int whence)
pos = in->size + offset;
break;
+#ifdef SEEK_DATA
case SEEK_DATA:
if (offset < 0 || static_cast<uint64_t>(offset) >= in->size) {
r = -ENXIO;
@@ -8937,7 +8957,9 @@ loff_t Client::_lseek(Fh *f, loff_t offset, int whence)
}
pos = offset;
break;
+#endif
+#ifdef SEEK_HOLE
case SEEK_HOLE:
if (offset < 0 || static_cast<uint64_t>(offset) >= in->size) {
r = -ENXIO;
@@ -8946,6 +8968,7 @@ loff_t Client::_lseek(Fh *f, loff_t offset, int whence)
pos = in->size;
}
break;
+#endif
default:
ldout(cct, 1) << __func__ << ": invalid whence value " << whence << dendl;
|