All of lore.kernel.org
 help / color / mirror / Atom feed
From: Warner Losh <imp@bsdimp.com>
To: qemu-devel@nongnu.org
Cc: Kyle Evans <kevans@freebsd.org>, Warner Losh <imp@bsdimp.com>,
	Stacey Son <sson@FreeBSD.org>,
	Richard Henderson <richard.henderson@linaro.org>
Subject: [PULL 34/41] bsd-user: Add link and list extattr functions to os-extattr.h
Date: Thu, 17 Sep 2026 22:24:15 -0600	[thread overview]
Message-ID: <20260918042422.38713-35-imp@bsdimp.com> (raw)
In-Reply-To: <20260918042422.38713-1-imp@bsdimp.com>

Add extattr_get_link, extattr_set_link, extattr_delete_link,
extattr_list_fd, extattr_list_file, and extattr_list_link.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Assisted-by: Claude Opus 4.6 (1M context)
Acked-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
---
 bsd-user/freebsd/os-extattr.h | 172 ++++++++++++++++++++++++++++++++++
 1 file changed, 172 insertions(+)

diff --git a/bsd-user/freebsd/os-extattr.h b/bsd-user/freebsd/os-extattr.h
index fb3ef27346..90f0c64c93 100644
--- a/bsd-user/freebsd/os-extattr.h
+++ b/bsd-user/freebsd/os-extattr.h
@@ -204,5 +204,177 @@ static inline abi_long do_freebsd_extattr_delete_fd(abi_long arg1,
     return ret;
 }
 
+/* extattr_get_link(2) */
+static inline abi_long do_freebsd_extattr_get_link(abi_long arg1,
+                                                   abi_long arg2,
+                                                   abi_long arg3,
+                                                   abi_long arg4,
+                                                   abi_long arg5)
+{
+    abi_long ret;
+    void *p, *a, *d;
+
+    p = lock_user_string(arg1);
+    if (p == NULL) {
+        return -TARGET_EFAULT;
+    }
+    a = lock_user_string(arg3);
+    if (a == NULL) {
+        unlock_user(p, arg1, 0);
+        return -TARGET_EFAULT;
+    }
+    if (arg4 && arg5 > 0) {
+        d = lock_user(VERIFY_WRITE, arg4, arg5, 0);
+        if (d == NULL) {
+            unlock_user(a, arg3, 0);
+            unlock_user(p, arg1, 0);
+            return -TARGET_EFAULT;
+        }
+        ret = get_errno(extattr_get_link(path(p), arg2, a, d, arg5));
+        unlock_user(d, arg4, arg5);
+    } else {
+        ret = get_errno(extattr_get_link(path(p), arg2, a, NULL, arg5));
+    }
+    unlock_user(a, arg3, 0);
+    unlock_user(p, arg1, 0);
+
+    return ret;
+}
+
+/* extattr_set_link(2) */
+static inline abi_long do_freebsd_extattr_set_link(abi_long arg1,
+                                                   abi_long arg2,
+                                                   abi_long arg3,
+                                                   abi_long arg4,
+                                                   abi_long arg5)
+{
+    abi_long ret;
+    void *p, *a, *d;
+
+    p = lock_user_string(arg1);
+    if (p == NULL) {
+        return -TARGET_EFAULT;
+    }
+    a = lock_user_string(arg3);
+    if (a == NULL) {
+        unlock_user(p, arg1, 0);
+        return -TARGET_EFAULT;
+    }
+    d = lock_user(VERIFY_READ, arg4, arg5, 1);
+    if (d == NULL) {
+        unlock_user(a, arg3, 0);
+        unlock_user(p, arg1, 0);
+        return -TARGET_EFAULT;
+    }
+    ret = get_errno(extattr_set_link(path(p), arg2, a, d, arg5));
+    unlock_user(d, arg4, arg5);
+    unlock_user(a, arg3, 0);
+    unlock_user(p, arg1, 0);
+
+    return ret;
+}
+
+/* extattr_delete_link(2) */
+static inline abi_long do_freebsd_extattr_delete_link(abi_long arg1,
+                                                      abi_long arg2,
+                                                      abi_long arg3)
+{
+    abi_long ret;
+    void *p, *a;
+
+    p = lock_user_string(arg1);
+    if (p == NULL) {
+        return -TARGET_EFAULT;
+    }
+    a = lock_user_string(arg3);
+    if (a == NULL) {
+        unlock_user(p, arg1, 0);
+        return -TARGET_EFAULT;
+    }
+    ret = get_errno(extattr_delete_link(path(p), arg2, a));
+    unlock_user(a, arg3, 0);
+    unlock_user(p, arg1, 0);
+
+    return ret;
+}
+
+/* extattr_list_fd(2) */
+static inline abi_long do_freebsd_extattr_list_fd(
+    abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4)
+{
+    abi_long ret;
+    void *d;
+
+    if (arg3 && arg4 > 0) {
+        d = lock_user(VERIFY_WRITE, arg3, arg4, 0);
+        if (d == NULL) {
+            return -TARGET_EFAULT;
+        }
+        ret = get_errno(extattr_list_fd(arg1, arg2, d, arg4));
+        unlock_user(d, arg3, arg4);
+    } else {
+        ret = get_errno(extattr_list_fd(arg1, arg2, NULL, arg4));
+    }
+    return ret;
+}
+
+/* extattr_list_file(2) */
+static inline abi_long do_freebsd_extattr_list_file(
+    abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4)
+{
+    abi_long ret;
+    void *p, *d;
+
+    p = lock_user_string(arg1);
+    if (p == NULL) {
+        return -TARGET_EFAULT;
+    }
+    if (arg3 && arg4 > 0) {
+        d = lock_user(VERIFY_WRITE, arg3, arg4, 0);
+        if (d == NULL) {
+            unlock_user(p, arg1, 0);
+            return -TARGET_EFAULT;
+        }
+        ret = get_errno(extattr_list_file(path(p), arg2, d, arg4));
+        unlock_user(d, arg3, arg4);
+    } else {
+        ret = get_errno(extattr_list_file(path(p), arg2, NULL, arg4));
+    }
+    unlock_user(p, arg1, 0);
+
+    return ret;
+}
+
+/* extattr_list_link(2) */
+static inline abi_long do_freebsd_extattr_list_link(
+    abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4)
+{
+    abi_long ret;
+    void *p, *d;
+
+    p = lock_user_string(arg1);
+    if (p == NULL) {
+        return -TARGET_EFAULT;
+    }
+    if (arg3 && arg4 > 0) {
+        d = lock_user(VERIFY_WRITE, arg3, arg4, 0);
+        if (d == NULL) {
+            unlock_user(p, arg1, 0);
+            return -TARGET_EFAULT;
+        }
+        ret = get_errno(extattr_list_link(path(p), arg2, d, arg4));
+        unlock_user(d, arg3, arg4);
+    } else {
+        ret = get_errno(extattr_list_link(path(p), arg2, NULL, arg4));
+    }
+    unlock_user(p, arg1, 0);
+
+    return ret;
+}
+
+/*
+ *  Access Control Lists
+ */
+
 
 #endif /* FREEBSD_OS_EXTATTR_H */
-- 
2.55.0



  parent reply	other threads:[~2026-09-18  4:27 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18  4:23 [PULL 00/41] Misc 2026q2 v4 patches Warner Losh
2026-09-18  4:23 ` [PULL 01/41] bsd-user: Upstream most of the remaining system calls Warner Losh
2026-09-18  4:23 ` [PULL 02/41] bsd-user: Rename cpu_env to env throughout bsd-user Warner Losh
2026-09-18  4:23 ` [PULL 03/41] bsd-user: Fix copy direciton in preadv Warner Losh
2026-09-18  4:23 ` [PULL 04/41] bsd-user: Add bsd-signal.h with sigaction through sigreturn Warner Losh
2026-09-18  4:23 ` [PULL 05/41] bsd-user: Add signal shims sigwait through kill and os-signal.h Warner Losh
2026-09-18  4:23 ` [PULL 06/41] bsd-user: Add signal system call dispatch Warner Losh
2026-09-18  4:23 ` [PULL 07/41] bsd-user: move sys/shm.h lines Warner Losh
2026-09-18  4:23 ` [PULL 08/41] bsd-user: Remove mmap defines Warner Losh
2026-09-18  4:23 ` [PULL 09/41] bsd-user: Use target_suseconds_t Warner Losh
2026-09-18  4:23 ` [PULL 10/41] bsd-user: Move sys/uuid.h defines Warner Losh
2026-09-18  4:23 ` [PULL 11/41] bsd-user: Fix realpathat for FreeBSD 15.0 and newer Warner Losh
2026-09-18  4:23 ` [PULL 12/41] bsd-user: Add os-file.h with chflagsat, close_range, and more Warner Losh
2026-09-18  4:23 ` [PULL 13/41] bsd-user: Add poll, poll2, lseek, pipe, and swap system call shims Warner Losh
2026-09-18  4:23 ` [PULL 14/41] bsd-user: Add FreeBSD socket helpers and sockaddr conversion Warner Losh
2026-09-18  4:23 ` [PULL 15/41] bsd-user: Add bsd-socket.h with bind through getsockname Warner Losh
2026-09-18  4:23 ` [PULL 16/41] bsd-user: Add socket shims socketpair through shutdown Warner Losh
2026-09-18  4:23 ` [PULL 17/41] bsd-user: Commit the generated os-sockopt.h files Warner Losh
2026-09-18  4:23 ` [PULL 18/41] bsd-user: Implement both getsockopt and setsockopt Warner Losh
2026-09-18  4:24 ` [PULL 19/41] bsd-user: Add FreeBSD socket system calls Warner Losh
2026-09-18  4:24 ` [PULL 20/41] bsd-user: Add os-socket.[ch] sendmsg, recvmsg and cmsg Warner Losh
2026-09-18  4:24 ` [PULL 21/41] bsd-user: Add socket system call dispatch Warner Losh
2026-09-18  4:24 ` [PULL 22/41] bsd-user: Add os-time.h with clock and time-of-day functions Warner Losh
2026-09-18  4:24 ` [PULL 23/41] bsd-user: Add utimes, futimes, and ktimer functions to os-time.h Warner Losh
2026-09-18  4:24 ` [PULL 24/41] bsd-user: Add select, pselect, and ppoll " Warner Losh
2026-09-18  4:24 ` [PULL 25/41] bsd-user: Add kqueue and kevent functions " Warner Losh
2026-09-18  4:24 ` [PULL 26/41] bsd-user: Add sigtimedwait, itimer, and futimens " Warner Losh
2026-09-18  4:24 ` [PULL 27/41] bsd-user: Add os-time.c and time-related type definitions Warner Losh
2026-09-18  4:24 ` [PULL 28/41] bsd-user: Add time system call dispatch Warner Losh
2026-09-18  4:24 ` [PULL 29/41] bsd-user: Add cpu_copy and make init_task_state non-static Warner Losh
2026-09-18  4:24 ` [PULL 30/41] bsd-user: Add os-thread.h with thr and context functions Warner Losh
2026-09-18  4:24 ` [PULL 31/41] bsd-user: Add do_freebsd__umtx_op to os-thread.h Warner Losh
2026-09-18  4:24 ` [PULL 32/41] bsd-user: Add thread system call dispatch Warner Losh
2026-09-18  4:24 ` [PULL 33/41] bsd-user: Add os-extattr.h with file and fd extattr functions Warner Losh
2026-09-18  4:24 ` Warner Losh [this message]
2026-09-18  4:24 ` [PULL 35/41] bsd-user: Add ACL system call shims to os-extattr.h Warner Losh
2026-09-18  4:24 ` [PULL 36/41] bsd-user: Add os-extattr.c with ACL conversion functions Warner Losh
2026-09-18  4:24 ` [PULL 37/41] bsd-user: Add extended attribute and ACL system call dispatch Warner Losh
2026-09-18  4:24 ` [PULL 38/41] bsd-user: Add scheduler and cpuset functions to os-misc.h Warner Losh
2026-09-18  4:24 ` [PULL 39/41] bsd-user: Add scheduler, cpuset, kmod, and misc syscall dispatch Warner Losh
2026-09-18  4:24 ` [PULL 40/41] bsd-user: Move qemu_guest_random_seed_main to same as linux-user Warner Losh
2026-09-18  4:24 ` [PULL 41/41] bsd-user Update random_seed on thread creation Warner Losh
2026-09-18 19:19 ` [PULL 00/41] Misc 2026q2 v4 patches Richard Henderson
2026-09-19 16:49   ` Warner Losh
  -- strict thread matches above, loose matches on Subject: below --
2026-09-19 16:47 Warner Losh
2026-09-19 16:48 ` [PULL 34/41] bsd-user: Add link and list extattr functions to os-extattr.h Warner Losh

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=20260918042422.38713-35-imp@bsdimp.com \
    --to=imp@bsdimp.com \
    --cc=kevans@freebsd.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=sson@FreeBSD.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.