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

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



Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
---
 lib/ramfs/ramfs.h        | 10 ++--------
 lib/ramfs/ramfs_vfsops.c |  2 +-
 lib/ramfs/ramfs_vnops.c  | 12 +++++++-----
 3 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/lib/ramfs/ramfs.h b/lib/ramfs/ramfs.h
index 61ff35d2..90cbee20 100644
--- a/lib/ramfs/ramfs.h
+++ b/lib/ramfs/ramfs.h
@@ -36,14 +36,6 @@
 #include <vfscore/prex.h>
 #include <stdbool.h>
 
-/* #define DEBUG_RAMFS 1 */
-
-#ifdef DEBUG_RAMFS
-#define DPRINTF(a)     dprintf a
-#else
-#define DPRINTF(a)    do {} while (0)
-#endif
-
 /*
  * File/directory node for RAMFS
  */
@@ -67,4 +59,6 @@ struct ramfs_node *ramfs_allocate_node(const char *name, int 
type);
 
 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_vfsops.c b/lib/ramfs/ramfs_vfsops.c
index 3b5c075c..5e0ec4b9 100644
--- a/lib/ramfs/ramfs_vfsops.c
+++ b/lib/ramfs/ramfs_vfsops.c
@@ -78,7 +78,7 @@ ramfs_mount(struct mount *mp, const char *dev __unused,
 {
        struct ramfs_node *np;
 
-       DPRINTF(("ramfs_mount: dev=%s\n", dev));
+       uk_pr_debug("ramfs_mount: dev=%s\n", dev);
 
        /* Create a root node */
        np = ramfs_allocate_node("/", VDIR);
diff --git a/lib/ramfs/ramfs_vnops.c b/lib/ramfs/ramfs_vnops.c
index 47614fd3..b166b4a9 100644
--- a/lib/ramfs/ramfs_vnops.c
+++ b/lib/ramfs/ramfs_vnops.c
@@ -260,7 +260,7 @@ ramfs_mkdir(struct vnode *dvp, char *name, mode_t mode)
 {
        struct ramfs_node *np;
 
-       DPRINTF(("mkdir %s\n", name));
+       uk_pr_debug("mkdir %s\n", name);
        if (strlen(name) > NAME_MAX) {
                return ENAMETOOLONG;
        }
@@ -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));
+       uk_pr_debug("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));
+       uk_pr_debug("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));
+       uk_pr_debug("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

 


Rackspace

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