Re: [PATCH 10/33] Add struct target_freebsd_fhandle and fcntl flags to bsd-user/syscall_defs.h

2023-08-08 Thread Warner Losh
On Tue, Aug 8, 2023 at 3:26 PM Richard Henderson <
richard.hender...@linaro.org> wrote:

> On 8/7/23 23:07, Karim Taha wrote:
> > +struct target_freebsd_fid {
> > +u_short fid_len;/* len of data in bytes */
> > +u_short fid_data0;  /* force longword align */
> > +charfid_data[TARGET_MAXFIDSZ];  /* data (variable len) */
>
> uint16_t?
>

These were copied from FreeBSD's sys/mount.h... Changing to uint16_t likely
is a good idea, though. I'll handle the logistics of making changes like
this in
bsd-user upstream with Kariim.

Warner


> Otherwise,
> Acked-by: Richard Henderson 
>


Re: [PATCH 10/33] Add struct target_freebsd_fhandle and fcntl flags to bsd-user/syscall_defs.h

2023-08-08 Thread Richard Henderson

On 8/7/23 23:07, Karim Taha wrote:

+struct target_freebsd_fid {
+u_short fid_len;/* len of data in bytes */
+u_short fid_data0;  /* force longword align */
+charfid_data[TARGET_MAXFIDSZ];  /* data (variable len) */


uint16_t?

Otherwise,
Acked-by: Richard Henderson 


r~



[PATCH 10/33] Add struct target_freebsd_fhandle and fcntl flags to bsd-user/syscall_defs.h

2023-08-08 Thread Karim Taha
From: Stacey Son 

Signed-off-by: Stacey Son 
Signed-off-by: Karim Taha 
---
 bsd-user/syscall_defs.h | 51 +
 1 file changed, 51 insertions(+)

diff --git a/bsd-user/syscall_defs.h b/bsd-user/syscall_defs.h
index ab59d00a47..608731f0ac 100644
--- a/bsd-user/syscall_defs.h
+++ b/bsd-user/syscall_defs.h
@@ -340,6 +340,57 @@ struct target_statfs {
 char  f_mntonname[1024];/* directory on which mounted */
 };
 
+/* File identifier. These are unique per filesystem on a single machine. */
+#define TARGET_MAXFIDSZ 16
+
+struct target_freebsd_fid {
+u_short fid_len;/* len of data in bytes */
+u_short fid_data0;  /* force longword align */
+charfid_data[TARGET_MAXFIDSZ];  /* data (variable len) */
+};
+
+/* Generic file handle */
+struct target_freebsd_fhandle {
+target_freebsd_fsid_t   fh_fsid;/* Filesystem id of mount point */
+struct target_freebsd_fid fh_fid;   /* Filesys specific id */
+};
+typedef struct target_freebsd_fhandle target_freebsd_fhandle_t;
+
+/*
+ * sys/fcntl.h
+ */
+#define TARGET_F_DUPFD  0
+#define TARGET_F_GETFD  1
+#define TARGET_F_SETFD  2
+#define TARGET_F_GETFL  3
+#define TARGET_F_SETFL  4
+#define TARGET_F_GETOWN 5
+#define TARGET_F_SETOWN 6
+#define TARGET_F_OGETLK 7
+#define TARGET_F_OSETLK 8
+#define TARGET_F_OSETLKW9
+#define TARGET_F_DUP2FD 10
+#define TARGET_F_GETLK  11
+#define TARGET_F_SETLK  12
+#define TARGET_F_SETLKW 13
+#define TARGET_F_SETLK_REMOTE   14
+#define TARGET_F_READAHEAD  15
+#define TARGET_F_RDAHEAD16
+#define TARGET_F_DUPFD_CLOEXEC 17
+#define TARGET_F_DUP2FD_CLOEXEC18
+/* FreeBSD-specific */
+#define TARGET_F_ADD_SEALS  19
+#define TARGET_F_GET_SEALS  20
+
+struct target_freebsd_flock {
+int64_t l_start;
+int64_t l_len;
+int32_t l_pid;
+int16_t l_type;
+int16_t l_whence;
+int32_t l_sysid;
+} QEMU_PACKED;
+
 #define safe_syscall0(type, name) \
 type safe_##name(void) \
 { \
-- 
2.40.0