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

Re: [PATCH] aufs: Do not refer to AUFS_NAME in pr_fmt



Dixi quod…

>go on. I can try a patch based on yours, but probably the best fix

What do you think of this (untested)? I omitted the Documentation/**
patch as that part it not present in the Debian Linux kernel.

Please do not commit this anywhere until I say I have tested it.

bye,
//mirabilos
-- 
I believe no one can invent an algorithm. One just happens to hit upon it
when God enlightens him. Or only God invents algorithms, we merely copy them.
If you don't believe in God, just consider God as Nature if you won't deny
existence.		-- Coywolf Qi Hunt
From 7431e1ffad6aafa36fa8dd0459c066fada25e1d6 Mon Sep 17 00:00:00 2001
From: Thorsten Glaser <tg@mirbsd.org>
Date: Sat, 31 Dec 2011 22:27:15 +0000
Subject: [PATCH] =?UTF-8?q?move=20AUFS=5FNAME=20and=20aufs=E2=80=99=20pr=5Ff?=
 =?UTF-8?q?mt=20into=20their=20own=20header?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

based on a patch from sfjro@users.sourceforge.net
in <[🔎] 9569.1325306817@jrobl> but changed to also move
the pr_fmt definition off the Makefile and into the
header, and include the definition of current and
the header which details its structure so it can be
dereferenced, which may or may not be safe though…
see <[🔎] Pine.BSM.4.64L.1112312202120.14351@herc.mirbsd.org>

Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
---
 fs/aufs/Makefile          |    3 +--
 include/linux/Kbuild      |    1 +
 include/linux/aufs_name.h |   29 +++++++++++++++++++++++++++++
 include/linux/aufs_type.h |    2 +-
 4 files changed, 32 insertions(+), 3 deletions(-)
 create mode 100644 include/linux/aufs_name.h

diff --git a/fs/aufs/Makefile b/fs/aufs/Makefile
index 46615fe..63b8a72 100644
--- a/fs/aufs/Makefile
+++ b/fs/aufs/Makefile
@@ -8,8 +8,7 @@ endif
 # cf. include/linux/kernel.h
 # enable pr_debug
 ccflags-y += -DDEBUG
-# sparse doesn't allow spaces
-ccflags-y += -D'pr_fmt(fmt)=AUFS_NAME"\040%s:%d:%s[%d]:\040"fmt,__func__,__LINE__,current->comm,current->pid'
+ccflags-y += -include linux/aufs_name.h
 
 obj-$(CONFIG_AUFS_FS) += aufs.o
 aufs-y := module.o sbinfo.o super.o branch.o xino.o sysaufs.o opts.o \
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 29f386b..fc6d2d2 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -65,6 +65,7 @@ header-y += atmppp.h
 header-y += atmsap.h
 header-y += atmsvc.h
 header-y += audit.h
+header-y += aufs_name.h
 header-y += aufs_type.h
 header-y += auto_fs.h
 header-y += auto_fs4.h
diff --git a/include/linux/aufs_name.h b/include/linux/aufs_name.h
new file mode 100644
index 0000000..fda7f5c
--- /dev/null
+++ b/include/linux/aufs_name.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2011 Junjiro R. Okajima
+ * Copyright (c) 2011 Thorsten Glaser
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef __AUFS_NAME_H__
+#define __AUFS_NAME_H__
+
+/* includes <asm/current.h> and defines struct task_struct */
+#include <linux/sched.h>
+
+#define AUFS_NAME		"aufs"
+#define pr_fmt(fmt)		AUFS_NAME"\040%s:%d:%s[%d]:\040"fmt,__func__,__LINE__,current->comm,current->pid
+
+#endif /* __AUFS_NAME_H__ */
diff --git a/include/linux/aufs_type.h b/include/linux/aufs_type.h
index 9443906..16b0bf8 100644
--- a/include/linux/aufs_type.h
+++ b/include/linux/aufs_type.h
@@ -28,6 +28,7 @@
 #include <stdint.h>
 #include <sys/types.h>
 #endif
+#include <linux/aufs_name.h>
 
 #define AUFS_VERSION	"3.x-rcN-20111114"
 
@@ -58,7 +59,6 @@ typedef int16_t aufs_bindex_t;
 
 /* ---------------------------------------------------------------------- */
 
-#define AUFS_NAME		"aufs"
 #define AUFS_FSTYPE		AUFS_NAME
 
 #define AUFS_ROOT_INO		2
-- 
1.7.7.3


Reply to: