[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH v2 5/6] lib/ramfs: fix debug printouts



> On 8. Feb 2019, at 15:31, Yuri Volchkov <yuri.volchkov@xxxxxxxxx> wrote:
> 
> Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
> ---
> lib/ramfs/ramfs.h       |  4 +++-
> lib/ramfs/ramfs_vnops.c | 10 ++++++----
> 2 files changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/ramfs/ramfs.h b/lib/ramfs/ramfs.h
> index 91fb579c..43f2f36b 100644
> --- a/lib/ramfs/ramfs.h
> +++ b/lib/ramfs/ramfs.h
> @@ -38,7 +38,7 @@
> /* #define DEBUG_RAMFS 1 */
> 
> #ifdef DEBUG_RAMFS
> -#define DPRINTF(a)   dprintf a
> +#define DPRINTF(a)   uk_pr_debug a
> #else
> #define DPRINTF(a)    do {} while (0)
> #endif
> @@ -68,4 +68,6 @@ struct ramfs_node *ramfs_allocate_node(const char *name, 
> int type);

I am wondering if we could get rid of this ifdef statement completely because 
uk_pr_debug is doing enabling/disabling already for us. I saw that you had this 
on vfscore, too. I would also prefer if we remove the equivalent if statement 
there, too.
Just do: #define DPRINTF(a) uk_pr_debug a

> 
> void ramfs_free_node(struct ramfs_node *node);
> 
> +#define RAMFS_NODE(vnode) ((struct ramfs_node *) vnode->v_data)
> +
> #endif /* !_RAMFS_H */
> diff --git a/lib/ramfs/ramfs_vnops.c b/lib/ramfs/ramfs_vnops.c
> index 66ab8a64..1faded05 100644
> --- a/lib/ramfs/ramfs_vnops.c
> +++ b/lib/ramfs/ramfs_vnops.c
> @@ -328,9 +328,10 @@ ramfs_rmdir(struct vnode *dvp, struct vnode *vp, char 
> *name __unused)
> 
> /* Remove a file */
> static int
> -ramfs_remove(struct vnode *dvp, struct vnode *vp, char *name __unused)
> +ramfs_remove(struct vnode *dvp, struct vnode *vp, char *name __maybe_unused)
> {
> -     DPRINTF(("remove %s in %s\n", name, dvp->v_path));
> +     DPRINTF(("remove %s in %s\n", name,
> +              RAMFS_NODE(dvp)->rn_name));
>       return ramfs_remove_node(dvp->v_data, vp->v_data);
> }
> 
> @@ -342,7 +343,8 @@ ramfs_truncate(struct vnode *vp, off_t length)
>       void *new_buf;
>       size_t new_size;
> 
> -     DPRINTF(("truncate %s length=%d\n", vp->v_path, length));
> +     DPRINTF(("truncate %s length=%lld\n", RAMFS_NODE(vp)->rn_name,
> +              (long long) length));
>       np = vp->v_data;
> 
>       if (length == 0) {
> @@ -385,7 +387,7 @@ ramfs_create(struct vnode *dvp, char *name, mode_t mode)
>               return ENAMETOOLONG;
>       }
> 
> -     DPRINTF(("create %s in %s\n", name, dvp->v_path));
> +     DPRINTF(("create %s in %s\n", name, RAMFS_NODE(dvp)->rn_name));
>       if (!S_ISREG(mode))
>               return EINVAL;
> 
> -- 
> 2.19.2
> 
> 
> _______________________________________________
> Minios-devel mailing list
> Minios-devel@xxxxxxxxxxxxxxxxxxxx
> https://lists.xenproject.org/mailman/listinfo/minios-devel


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.