[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…

>What do you think of this (untested)?

well, it compiles (with warnings, see below). I’ll know if it links
and loads tomorrow, I guess (unless the other problems are still
there).

/tmp/buildd/linux-2.6-3.2~rc7/debian/build/source_m68k_none/include/linux/aufs_name.h:27:0: warning: "pr_fmt" redefined [enabled by default]
/tmp/buildd/linux-2.6-3.2~rc7/debian/build/source_m68k_none/include/linux/printk.h:152:0: note: this is the location of the previous definition

Version 2 of this patch (attached) fixes this by #undef pr_fmt
before defining it. Please decide whether you want to fix it
like this. Independent of this, I’ve asked the m68k maintainer
to change away from static inline to a cpp macro, to avoid this
issue fully. This should not influence your decision, though.

bye,
//mirabilos
-- 
FWIW, I'm quite impressed with mksh interactively. I thought it was much
*much* more bare bones. But it turns out it beats the living hell out of
ksh93 in that respect. I'd even consider it for my daily use if I hadn't
wasted half my life on my zsh setup. :-) -- Frank Terbeck in #!/bin/mksh
From debdad28232a9c84f135fa1b7aa9d137b72ab4d8 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 |   31 +++++++++++++++++++++++++++++++
 include/linux/aufs_type.h |    2 +-
 4 files changed, 34 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..8c2c494
--- /dev/null
+++ b/include/linux/aufs_name.h
@@ -0,0 +1,31 @@
+/*
+ * 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"
+
+#undef pr_fmt
+#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: