From: piaojun <piaojun@huawei.com>
To: <virtio-fs@redhat.com>, <qemu-devel@nongnu.org>
Cc: dgilbert@redhat.com
Subject: [Qemu-devel] [PATCH v2] virtiofsd: fix compile error if 'F_OFD_GETLK' not defined
Date: Fri, 2 Aug 2019 16:38:32 +0800 [thread overview]
Message-ID: <5D43F688.8000607@huawei.com> (raw)
Use F_GETLK for fcntl when F_OFD_GETLK not defined, such as kernel 3.10.
Signed-off-by: Jun Piao <piaojun@huawei.com>
---
v2:
- Use F_OFD_SETLK to replace F_OFD_GETLK in #ifdef.
---
contrib/virtiofsd/passthrough_ll.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/contrib/virtiofsd/passthrough_ll.c b/contrib/virtiofsd/passthrough_ll.c
index a81c01d..c69f2f3 100644
--- a/contrib/virtiofsd/passthrough_ll.c
+++ b/contrib/virtiofsd/passthrough_ll.c
@@ -1780,7 +1780,11 @@ static void lo_getlk(fuse_req_t req, fuse_ino_t ino,
goto out;
}
+#ifdef F_OFD_GETLK
ret = fcntl(plock->fd, F_OFD_GETLK, lock);
+#else
+ ret = fcntl(plock->fd, F_GETLK, lock);
+#endif
if (ret == -1)
saverr = errno;
@@ -1831,7 +1835,11 @@ static void lo_setlk(fuse_req_t req, fuse_ino_t ino,
/* TODO: Is it alright to modify flock? */
lock->l_pid = 0;
+#ifdef F_OFD_SETLK
ret = fcntl(plock->fd, F_OFD_SETLK, lock);
+#else
+ ret = fcntl(plock->fd, F_GETLK, lock);
+#endif
if (ret == -1) {
saverr = errno;
}
--
next reply other threads:[~2019-08-02 8:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-02 8:38 piaojun [this message]
2019-08-02 10:53 ` [Qemu-devel] [PATCH v2] virtiofsd: fix compile error if 'F_OFD_GETLK' not defined Dr. David Alan Gilbert
2019-08-02 11:10 ` Daniel P. Berrangé
2019-08-04 8:18 ` piaojun
2019-08-06 13:27 ` [Qemu-devel] [Virtio-fs] " Vivek Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5D43F688.8000607@huawei.com \
--to=piaojun@huawei.com \
--cc=dgilbert@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=virtio-fs@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).