aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_error.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-12-17 12:27:36 -0500
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-12-22 02:02:01 -0500
commitefc557570dc99b46e46a7be51c3c7402b485e829 (patch)
treefaba8c63e6bcf798ab76f7da1fcb035ece445700 /fs/xfs/xfs_error.h
parent9f6c92b9cc2fd41d6c7b493be5637cc5b5659880 (diff)
[XFS] avoid memory allocations in xfs_fs_vcmn_err
xfs_fs_vcmn_err can be called under a spinlock, but does a sleeping memory allocation to create buffer for it's internal sprintf. Fortunately it's the only caller of icmn_err, so we can merge the two and have one single static buffer and spinlock protecting it. While we're at it make sure we proper __attribute__ format annotations so that the compiler can detect mismatched format strings. Reported-by: Alexander Beregalov <a.beregalov@gmail.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Eric Sandeen <sandeen@sandeen.net> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_error.h')
-rw-r--r--fs/xfs/xfs_error.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
index 11543f10b0c6..0c93051c4651 100644
--- a/fs/xfs/xfs_error.h
+++ b/fs/xfs/xfs_error.h
@@ -159,11 +159,15 @@ extern int xfs_errortag_clearall(xfs_mount_t *mp, int loud);
159#define XFS_PTAG_FSBLOCK_ZERO 0x00000080 159#define XFS_PTAG_FSBLOCK_ZERO 0x00000080
160 160
161struct xfs_mount; 161struct xfs_mount;
162/* PRINTFLIKE4 */ 162
163extern void xfs_fs_vcmn_err(int level, struct xfs_mount *mp,
164 char *fmt, va_list ap)
165 __attribute__ ((format (printf, 3, 0)));
163extern void xfs_cmn_err(int panic_tag, int level, struct xfs_mount *mp, 166extern void xfs_cmn_err(int panic_tag, int level, struct xfs_mount *mp,
164 char *fmt, ...); 167 char *fmt, ...)
165/* PRINTFLIKE3 */ 168 __attribute__ ((format (printf, 4, 5)));
166extern void xfs_fs_cmn_err(int level, struct xfs_mount *mp, char *fmt, ...); 169extern void xfs_fs_cmn_err(int level, struct xfs_mount *mp, char *fmt, ...)
170 __attribute__ ((format (printf, 3, 4)));
167 171
168extern void xfs_hex_dump(void *p, int length); 172extern void xfs_hex_dump(void *p, int length);
169 173