Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jul 2022 18:04:02 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: a99d47bcaaf6 - main - kboot: Implement mkdir(2)
Message-ID:  <202207151804.26FI423O060311@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=a99d47bcaaf61eb869f5f04fa51fe38b19504ac4

commit a99d47bcaaf61eb869f5f04fa51fe38b19504ac4
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-06-30 18:09:26 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-07-15 18:00:50 +0000

    kboot: Implement mkdir(2)
    
    mkdir() may be needed early in boot to create missing
    directories. Provide a syscall wrapper for it.
    
    Sponsored by:           Netflix
---
 stand/kboot/arch/amd64/syscall_nr.h     | 1 +
 stand/kboot/arch/powerpc64/syscall_nr.h | 1 +
 stand/kboot/host_syscall.h              | 1 +
 stand/kboot/host_syscalls.c             | 6 ++++++
 4 files changed, 9 insertions(+)

diff --git a/stand/kboot/arch/amd64/syscall_nr.h b/stand/kboot/arch/amd64/syscall_nr.h
index 62deefe73539..b847b21efa88 100644
--- a/stand/kboot/arch/amd64/syscall_nr.h
+++ b/stand/kboot/arch/amd64/syscall_nr.h
@@ -5,6 +5,7 @@
 #define SYS_gettimeofday	 96
 #define SYS_kexec_load		246
 #define SYS_lseek		  8
+#define	SYS_mkdirat		258
 #define SYS_mmap		  9
 #define	SYS_munmap		 11
 #define SYS_newfstat		  5
diff --git a/stand/kboot/arch/powerpc64/syscall_nr.h b/stand/kboot/arch/powerpc64/syscall_nr.h
index d6678d9044d9..b86874b92e76 100644
--- a/stand/kboot/arch/powerpc64/syscall_nr.h
+++ b/stand/kboot/arch/powerpc64/syscall_nr.h
@@ -6,6 +6,7 @@
 #define SYS_gettimeofday	 78
 #define SYS_kexec_load		268
 #define SYS_llseek		140
+#define	SYS_mkdirat		287
 #define SYS_mmap		 90
 #define	SYS_munmap		 91
 #define SYS_newfstat		SYS_fstat
diff --git a/stand/kboot/host_syscall.h b/stand/kboot/host_syscall.h
index 10d4166514b9..76a5efb0a091 100644
--- a/stand/kboot/host_syscall.h
+++ b/stand/kboot/host_syscall.h
@@ -99,6 +99,7 @@ int host_getpid(void);
 int host_gettimeofday(struct host_timeval *a, void *b);
 int host_kexec_load(uint32_t start, int nsegs, uint32_t segs, uint32_t flags);
 ssize_t host_llseek(int fd, int32_t offset_high, int32_t offset_lo, uint64_t *result, int whence);
+int host_mkdir(const char *, host_mode_t);
 void *host_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off);
 int host_munmap(void *addr, size_t len);
 int host_open(const char *path, int flags, int mode);
diff --git a/stand/kboot/host_syscalls.c b/stand/kboot/host_syscalls.c
index 2fe4c599df82..99f5444eb469 100644
--- a/stand/kboot/host_syscalls.c
+++ b/stand/kboot/host_syscalls.c
@@ -63,6 +63,12 @@ host_llseek(int fd, int32_t offset_high, int32_t offset_lo, uint64_t *result, in
 #endif
 }
 
+int
+host_mkdir(const char *path, host_mode_t mode)
+{
+	return host_syscall(SYS_mkdirat, HOST_AT_FDCWD, (uintptr_t)path, mode);
+}
+
 void *
 host_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207151804.26FI423O060311>