qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: piaojun <piaojun@huawei.com>
To: Liam Merwick <liam.merwick@oracle.com>, <virtio-fs@redhat.com>,
	<qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] virtiofsd: fix compile error if 'F_OFD_GETLK' not defined
Date: Tue, 30 Jul 2019 21:08:54 +0800	[thread overview]
Message-ID: <5D404166.1010506@huawei.com> (raw)
In-Reply-To: <8748798a-ac4f-4c0a-96fa-190e24dca52b@oracle.com>

Hi Liam,

On 2019/7/30 20:22, Liam Merwick wrote:
> On 30/07/2019 01:27, piaojun wrote:
>> Use F_GETLK for fcntl when F_OFD_GETLK not defined.
> 
> 
> Use F_GETLK/F_SETLK for fcntl when F_OFD_GETLK/F_OFD_SETLK not defined.
> 
>>
>> Signed-off-by: Jun Piao <piaojun@huawei.com>
>> ---
>>   contrib/virtiofsd/passthrough_ll.c | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>> diff --git a/contrib/virtiofsd/passthrough_ll.c b/contrib/virtiofsd/passthrough_ll.c
>> index 9ae1381..757785b 100644
>> --- a/contrib/virtiofsd/passthrough_ll.c
>> +++ b/contrib/virtiofsd/passthrough_ll.c
>> @@ -1619,7 +1619,11 @@ static void lo_getlk(fuse_req_t req, fuse_ino_t ino,
>>           return;
>>       }
>>
>> +#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;
>>       pthread_mutex_unlock(&inode->plock_mutex);
>> @@ -1668,7 +1672,12 @@ 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_GETLK
> 
> 
> This checks for F_OFD_GETLK but uses F_OFD_SETLK (albeit unlikely one being defined without the other)

Right, F_OFD_SETLK looks better.

> 
> 
>>       ret = fcntl(plock->fd, F_OFD_SETLK, lock);
>> +#else
>> +    ret = fcntl(plock->fd, F_SETLK, lock);
>> +#endif
>>       if (ret == -1) {
>>           saverr = errno;
>>       }
>>
> Might qemu_lock_fd()/qemu_unlock_fd() in util/osdep.c be useful to hide this instead?

Yes, I'm trying re-write do_getlk/setlk with qemu_lock_fd, and thanks for
your suggestion.

Thanks,
Jun

> 
> Regards,
> Liam
> 


  reply	other threads:[~2019-07-30 13:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-30  0:27 [Qemu-devel] [PATCH] virtiofsd: fix compile error if 'F_OFD_GETLK' not defined piaojun
2019-07-30 12:22 ` Liam Merwick
2019-07-30 13:08   ` piaojun [this message]
2019-07-30 13:28 ` Eric Blake
2019-07-30 14:00   ` piaojun
2019-08-01 14:20   ` [Qemu-devel] [Virtio-fs] " Dr. David Alan Gilbert
2019-08-01 14:26     ` Dr. David Alan Gilbert
2019-08-02  8:16       ` piaojun

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=5D404166.1010506@huawei.com \
    --to=piaojun@huawei.com \
    --cc=liam.merwick@oracle.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).