[PATCH] linux-user: implement OFD locks

Andreas Schwab posted 1 patch 3 years, 11 months ago
Test asan passed
Test docker-mingw@fedora passed
Test checkpatch passed
Test docker-quick@centos7 passed
Test FreeBSD passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/mvm7dx0cun3.fsf@suse.de
Maintainers: Riku Voipio <riku.voipio@iki.fi>, Laurent Vivier <laurent@vivier.eu>
linux-user/generic/fcntl.h | 4 ++++
linux-user/syscall.c       | 6 ++++++
2 files changed, 10 insertions(+)
[PATCH] linux-user: implement OFD locks
Posted by Andreas Schwab 3 years, 11 months ago
Signed-off-by: Andreas Schwab <schwab@suse.de>
---
 linux-user/generic/fcntl.h | 4 ++++
 linux-user/syscall.c       | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/linux-user/generic/fcntl.h b/linux-user/generic/fcntl.h
index 9f727d4df2..c85c5b9fed 100644
--- a/linux-user/generic/fcntl.h
+++ b/linux-user/generic/fcntl.h
@@ -99,6 +99,10 @@
 #define TARGET_F_SETLKW64      14
 #endif
 
+#define TARGET_F_OFD_GETLK     36
+#define TARGET_F_OFD_SETLK     37
+#define TARGET_F_OFD_SETLKW    38
+
 #ifndef TARGET_F_SETOWN_EX
 #define TARGET_F_SETOWN_EX     15
 #define TARGET_F_GETOWN_EX     16
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 7eac6b7d47..492450e77d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6097,6 +6097,9 @@ static int target_to_host_fcntl_cmd(int cmd)
     case TARGET_F_SETFD:
     case TARGET_F_GETFL:
     case TARGET_F_SETFL:
+    case TARGET_F_OFD_GETLK:
+    case TARGET_F_OFD_SETLK:
+    case TARGET_F_OFD_SETLKW:
         ret = cmd;
         break;
     case TARGET_F_GETLK:
@@ -6382,6 +6385,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
         break;
 
     case TARGET_F_GETLK64:
+    case TARGET_F_OFD_GETLK:
         ret = copy_from_user_flock64(&fl64, arg);
         if (ret) {
             return ret;
@@ -6393,6 +6397,8 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
         break;
     case TARGET_F_SETLK64:
     case TARGET_F_SETLKW64:
+    case TARGET_F_OFD_SETLK:
+    case TARGET_F_OFD_SETLKW:
         ret = copy_from_user_flock64(&fl64, arg);
         if (ret) {
             return ret;
-- 
2.26.2


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

Re: [PATCH] linux-user: implement OFD locks
Posted by Laurent Vivier 3 years, 11 months ago
Le 25/05/2020 à 09:59, Andreas Schwab a écrit :
> Signed-off-by: Andreas Schwab <schwab@suse.de>
> ---
>  linux-user/generic/fcntl.h | 4 ++++
>  linux-user/syscall.c       | 6 ++++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/linux-user/generic/fcntl.h b/linux-user/generic/fcntl.h
> index 9f727d4df2..c85c5b9fed 100644
> --- a/linux-user/generic/fcntl.h
> +++ b/linux-user/generic/fcntl.h
> @@ -99,6 +99,10 @@
>  #define TARGET_F_SETLKW64      14
>  #endif
>  
> +#define TARGET_F_OFD_GETLK     36
> +#define TARGET_F_OFD_SETLK     37
> +#define TARGET_F_OFD_SETLKW    38
> +
>  #ifndef TARGET_F_SETOWN_EX
>  #define TARGET_F_SETOWN_EX     15
>  #define TARGET_F_GETOWN_EX     16
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 7eac6b7d47..492450e77d 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -6097,6 +6097,9 @@ static int target_to_host_fcntl_cmd(int cmd)
>      case TARGET_F_SETFD:
>      case TARGET_F_GETFL:
>      case TARGET_F_SETFL:
> +    case TARGET_F_OFD_GETLK:
> +    case TARGET_F_OFD_SETLK:
> +    case TARGET_F_OFD_SETLKW:
>          ret = cmd;
>          break;
>      case TARGET_F_GETLK:
> @@ -6382,6 +6385,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
>          break;
>  
>      case TARGET_F_GETLK64:
> +    case TARGET_F_OFD_GETLK:
>          ret = copy_from_user_flock64(&fl64, arg);
>          if (ret) {
>              return ret;
> @@ -6393,6 +6397,8 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
>          break;
>      case TARGET_F_SETLK64:
>      case TARGET_F_SETLKW64:
> +    case TARGET_F_OFD_SETLK:
> +    case TARGET_F_OFD_SETLKW:
>          ret = copy_from_user_flock64(&fl64, arg);
>          if (ret) {
>              return ret;
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

Re: [PATCH] linux-user: implement OFD locks
Posted by Laurent Vivier 3 years, 11 months ago
Le 25/05/2020 à 09:59, Andreas Schwab a écrit :
> Signed-off-by: Andreas Schwab <schwab@suse.de>
> ---
>  linux-user/generic/fcntl.h | 4 ++++
>  linux-user/syscall.c       | 6 ++++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/linux-user/generic/fcntl.h b/linux-user/generic/fcntl.h
> index 9f727d4df2..c85c5b9fed 100644
> --- a/linux-user/generic/fcntl.h
> +++ b/linux-user/generic/fcntl.h
> @@ -99,6 +99,10 @@
>  #define TARGET_F_SETLKW64      14
>  #endif
>  
> +#define TARGET_F_OFD_GETLK     36
> +#define TARGET_F_OFD_SETLK     37
> +#define TARGET_F_OFD_SETLKW    38
> +
>  #ifndef TARGET_F_SETOWN_EX
>  #define TARGET_F_SETOWN_EX     15
>  #define TARGET_F_GETOWN_EX     16
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 7eac6b7d47..492450e77d 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -6097,6 +6097,9 @@ static int target_to_host_fcntl_cmd(int cmd)
>      case TARGET_F_SETFD:
>      case TARGET_F_GETFL:
>      case TARGET_F_SETFL:
> +    case TARGET_F_OFD_GETLK:
> +    case TARGET_F_OFD_SETLK:
> +    case TARGET_F_OFD_SETLKW:
>          ret = cmd;
>          break;
>      case TARGET_F_GETLK:
> @@ -6382,6 +6385,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
>          break;
>  
>      case TARGET_F_GETLK64:
> +    case TARGET_F_OFD_GETLK:
>          ret = copy_from_user_flock64(&fl64, arg);
>          if (ret) {
>              return ret;
> @@ -6393,6 +6397,8 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
>          break;
>      case TARGET_F_SETLK64:
>      case TARGET_F_SETLKW64:
> +    case TARGET_F_OFD_SETLK:
> +    case TARGET_F_OFD_SETLKW:
>          ret = copy_from_user_flock64(&fl64, arg);
>          if (ret) {
>              return ret;
> 

Applied to my linux-user branch.

Thanks,
Laurent