On 8/7/23 23:08, Karim Taha wrote:
From: Stacey Son <s...@freebsd.org>

Implement the following syscalls:
stat(2)
lstat(2)
fstat(2)
fstatat(2)
nstat
nfstat
nlstat

Signed-off-by: Stacey Son <s...@freebsd.org>
Signed-off-by: Karim Taha <kariem.taha...@gmail.com>

Why are all of these in os-stat.h instead of os-stat.c?
Is this attempting to avoid clang's warning for unused static inline function 
in a c file?

+/* stat(2) */
+static inline abi_long do_freebsd11_stat(abi_long arg1, abi_long arg2)
+{
+    abi_long ret;
+    void *p;
+    struct freebsd11_stat st;
+
+    LOCK_PATH(p, arg1);
+    ret = get_errno(freebsd11_stat(path(p), &st));
+    UNLOCK_PATH(p, arg1);
+    if (!is_error(ret)) {
+        ret = h2t_freebsd11_stat(arg2, &st);
+    }
+    return ret;
+}

The patch ordering is poor, because freebsd11_stat is used here but not introduced until patch 23, and do_freebsd11_stat itself is not used until patch 30.

And yet you delay compilation of os-stat.c until patch 29. Patch 29 is either too early or too late, depending on the viewpoint.

If os-stat.c compilation was enabled earlier, it would require you to order all of the patches such that os-stat.c will always compile.

If os-stat.c compilation was enabled later (indeed last), you would not need to mark this function 'static inline' in order to avoid unused function warnings prior to their use in patches 30-33.

I prefer the ordering in which os-stat.c always compiles. This probably requires patches 23-27 be ordered first, and patches 30-33 be merged with patches 18-22. There is no need for *any* of these functions to be marked inline -- leave that choice to the compiler.


r~

Reply via email to