git: 802cf4ab0ee9 - main - namei: add NDPREINIT() macro
Konstantin Belousov
kib at FreeBSD.org
Wed Jun 23 20:47:23 UTC 2021
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=802cf4ab0ee9cae7af523cfcf1221febd2143210
commit 802cf4ab0ee9cae7af523cfcf1221febd2143210
Author: Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-06-14 19:03:41 +0000
Commit: Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-06-23 20:46:15 +0000
namei: add NDPREINIT() macro
Its intent is to do the initialization of the future part of struct nameidata
which should be used across several namei() and VOPs. Right now it is NOP.
Reviewed by: mckusick
Discussed with: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30041
---
sys/kern/vfs_syscalls.c | 9 +++++++++
sys/sys/namei.h | 3 +++
2 files changed, 12 insertions(+)
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 2f4a6036ef88..0b80faa5a27d 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1328,6 +1328,7 @@ kern_mknodat(struct thread *td, int fd, const char *path, enum uio_seg pathseg,
}
if (error != 0)
return (error);
+ NDPREINIT(&nd);
restart:
bwillwrite();
NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 |
@@ -1436,6 +1437,7 @@ kern_mkfifoat(struct thread *td, int fd, const char *path,
int error;
AUDIT_ARG_MODE(mode);
+ NDPREINIT(&nd);
restart:
bwillwrite();
NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 |
@@ -1566,6 +1568,7 @@ kern_linkat(struct thread *td, int fd1, int fd2, const char *path1,
struct nameidata nd;
int error;
+ NDPREINIT(&nd);
do {
bwillwrite();
NDINIT_ATRIGHTS(&nd, LOOKUP, AUDITVNODE1 | at2cnpflags(flag,
@@ -1714,6 +1717,7 @@ kern_symlinkat(struct thread *td, const char *path1, int fd, const char *path2,
syspath = tmppath;
}
AUDIT_ARG_TEXT(syspath);
+ NDPREINIT(&nd);
restart:
bwillwrite();
NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 |
@@ -1778,6 +1782,7 @@ sys_undelete(struct thread *td, struct undelete_args *uap)
struct nameidata nd;
int error;
+ NDPREINIT(&nd);
restart:
bwillwrite();
NDINIT(&nd, DELETE, LOCKPARENT | DOWHITEOUT | AUDITVNODE1,
@@ -1891,6 +1896,7 @@ kern_funlinkat(struct thread *td, int dfd, const char *path, int fd,
return (error);
}
+ NDPREINIT(&nd);
restart:
bwillwrite();
NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF | AUDITVNODE1 |
@@ -3422,6 +3428,7 @@ kern_truncate(struct thread *td, const char *path, enum uio_seg pathseg,
if (length < 0)
return (EINVAL);
+ NDPREINIT(&nd);
retry:
NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, td);
if ((error = namei(&nd)) != 0)
@@ -3789,6 +3796,7 @@ kern_mkdirat(struct thread *td, int fd, const char *path, enum uio_seg segflg,
int error;
AUDIT_ARG_MODE(mode);
+ NDPREINIT(&nd);
restart:
bwillwrite();
NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 |
@@ -3859,6 +3867,7 @@ kern_frmdirat(struct thread *td, int dfd, const char *path, int fd,
return (error);
}
+ NDPREINIT(&nd);
restart:
bwillwrite();
NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF | AUDITVNODE1 |
diff --git a/sys/sys/namei.h b/sys/sys/namei.h
index 5f3d917083a5..b4db0e758e2b 100644
--- a/sys/sys/namei.h
+++ b/sys/sys/namei.h
@@ -265,6 +265,9 @@ do { \
_ndp->ni_startdir = NULL; \
} while (0)
+#define NDPREINIT(ndp) do { \
+} while (0)
+
#define NDF_NO_DVP_RELE 0x00000001
#define NDF_NO_DVP_UNLOCK 0x00000002
#define NDF_NO_DVP_PUT 0x00000003
More information about the dev-commits-src-main
mailing list