diff mbox series

[3/6] ovl: Break out ovl_entry_path_lowerdata() from ovl_path_lowerdata()

Message ID 69fa1af45ee0f51b50c1ff8a386a57d2842379c9.1681917551.git.alexl@redhat.com (mailing list archive)
State Superseded
Headers show
Series ovl: Add support for fs-verity checking of lowerdata | expand

Commit Message

Alexander Larsson April 20, 2023, 7:44 a.m. UTC
This will be needed later when getting the lowerdata path from the
ovl_entry in ovl_lookup() before the dentry is set up.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
---
 fs/overlayfs/overlayfs.h |  1 +
 fs/overlayfs/util.c      | 11 +++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

Comments

Amir Goldstein April 20, 2023, 12:14 p.m. UTC | #1
On Thu, Apr 20, 2023 at 10:44 AM Alexander Larsson <alexl@redhat.com> wrote:
>
> This will be needed later when getting the lowerdata path from the
> ovl_entry in ovl_lookup() before the dentry is set up.
>
> Signed-off-by: Alexander Larsson <alexl@redhat.com>
> ---
>  fs/overlayfs/overlayfs.h |  1 +
>  fs/overlayfs/util.c      | 11 +++++++++--
>  2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
> index 477008186d18..3d14770dc711 100644
> --- a/fs/overlayfs/overlayfs.h
> +++ b/fs/overlayfs/overlayfs.h
> @@ -395,6 +395,7 @@ void ovl_path_upper(struct dentry *dentry, struct path *path);
>  void ovl_path_lower(struct dentry *dentry, struct path *path);
>  void ovl_path_lowerdata(struct dentry *dentry, struct path *path);
>  void ovl_i_path_real(struct inode *inode, struct path *path);
> +void ovl_entry_path_lowerdata(struct ovl_entry *oe, struct path *path);
>  void ovl_entry_path_real(struct ovl_fs *ofs, struct ovl_entry *oe,
>                          struct dentry *upperdentry, struct path *path);
>  enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path);
> diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
> index 77c954591daa..17eff3e31239 100644
> --- a/fs/overlayfs/util.c
> +++ b/fs/overlayfs/util.c
> @@ -242,9 +242,9 @@ void ovl_path_lower(struct dentry *dentry, struct path *path)
>         }
>  }
>
> -void ovl_path_lowerdata(struct dentry *dentry, struct path *path)
> +void ovl_entry_path_lowerdata(struct ovl_entry *oe,

Nit: I would use ovl_e_ prefix. Not critical.

> +                             struct path *path)
>  {
> -       struct ovl_entry *oe = OVL_E(dentry);
>         struct ovl_path *lowerdata = ovl_lowerdata(oe);
>         struct dentry *lowerdata_dentry = ovl_lowerdata_dentry(oe);
>
> @@ -262,6 +262,13 @@ void ovl_path_lowerdata(struct dentry *dentry, struct path *path)
>         }
>  }
>
> +void ovl_path_lowerdata(struct dentry *dentry, struct path *path)
> +{
> +       struct ovl_entry *oe = OVL_E(dentry);
> +
> +       return ovl_entry_path_lowerdata(oe, path);

Nit: I wouldn't use a helper var here.

Otherwise you may add (also to the previous helper patch):

Reviewed-by: Amir Goldstein <amir73il@gmail.com>

Thanks,
Amir.
diff mbox series

Patch

diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index 477008186d18..3d14770dc711 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -395,6 +395,7 @@  void ovl_path_upper(struct dentry *dentry, struct path *path);
 void ovl_path_lower(struct dentry *dentry, struct path *path);
 void ovl_path_lowerdata(struct dentry *dentry, struct path *path);
 void ovl_i_path_real(struct inode *inode, struct path *path);
+void ovl_entry_path_lowerdata(struct ovl_entry *oe, struct path *path);
 void ovl_entry_path_real(struct ovl_fs *ofs, struct ovl_entry *oe,
 			 struct dentry *upperdentry, struct path *path);
 enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path);
diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index 77c954591daa..17eff3e31239 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -242,9 +242,9 @@  void ovl_path_lower(struct dentry *dentry, struct path *path)
 	}
 }
 
-void ovl_path_lowerdata(struct dentry *dentry, struct path *path)
+void ovl_entry_path_lowerdata(struct ovl_entry *oe,
+			      struct path *path)
 {
-	struct ovl_entry *oe = OVL_E(dentry);
 	struct ovl_path *lowerdata = ovl_lowerdata(oe);
 	struct dentry *lowerdata_dentry = ovl_lowerdata_dentry(oe);
 
@@ -262,6 +262,13 @@  void ovl_path_lowerdata(struct dentry *dentry, struct path *path)
 	}
 }
 
+void ovl_path_lowerdata(struct dentry *dentry, struct path *path)
+{
+	struct ovl_entry *oe = OVL_E(dentry);
+
+	return ovl_entry_path_lowerdata(oe, path);
+}
+
 enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path)
 {
 	enum ovl_path_type type = ovl_path_type(dentry);