diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/scsi/scsi_logging.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'drivers/scsi/scsi_logging.h')
-rw-r--r-- | drivers/scsi/scsi_logging.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_logging.h b/drivers/scsi/scsi_logging.h new file mode 100644 index 000000000000..e1722ba94586 --- /dev/null +++ b/drivers/scsi/scsi_logging.h | |||
@@ -0,0 +1,82 @@ | |||
1 | #ifndef _SCSI_LOGGING_H | ||
2 | #define _SCSI_LOGGING_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | |||
6 | /* | ||
7 | * This defines the scsi logging feature. It is a means by which the user | ||
8 | * can select how much information they get about various goings on, and it | ||
9 | * can be really useful for fault tracing. The logging word is divided into | ||
10 | * 8 nibbles, each of which describes a loglevel. The division of things is | ||
11 | * somewhat arbitrary, and the division of the word could be changed if it | ||
12 | * were really needed for any reason. The numbers below are the only place | ||
13 | * where these are specified. For a first go-around, 3 bits is more than | ||
14 | * enough, since this gives 8 levels of logging (really 7, since 0 is always | ||
15 | * off). Cutting to 2 bits might be wise at some point. | ||
16 | */ | ||
17 | |||
18 | #define SCSI_LOG_ERROR_SHIFT 0 | ||
19 | #define SCSI_LOG_TIMEOUT_SHIFT 3 | ||
20 | #define SCSI_LOG_SCAN_SHIFT 6 | ||
21 | #define SCSI_LOG_MLQUEUE_SHIFT 9 | ||
22 | #define SCSI_LOG_MLCOMPLETE_SHIFT 12 | ||
23 | #define SCSI_LOG_LLQUEUE_SHIFT 15 | ||
24 | #define SCSI_LOG_LLCOMPLETE_SHIFT 18 | ||
25 | #define SCSI_LOG_HLQUEUE_SHIFT 21 | ||
26 | #define SCSI_LOG_HLCOMPLETE_SHIFT 24 | ||
27 | #define SCSI_LOG_IOCTL_SHIFT 27 | ||
28 | |||
29 | #define SCSI_LOG_ERROR_BITS 3 | ||
30 | #define SCSI_LOG_TIMEOUT_BITS 3 | ||
31 | #define SCSI_LOG_SCAN_BITS 3 | ||
32 | #define SCSI_LOG_MLQUEUE_BITS 3 | ||
33 | #define SCSI_LOG_MLCOMPLETE_BITS 3 | ||
34 | #define SCSI_LOG_LLQUEUE_BITS 3 | ||
35 | #define SCSI_LOG_LLCOMPLETE_BITS 3 | ||
36 | #define SCSI_LOG_HLQUEUE_BITS 3 | ||
37 | #define SCSI_LOG_HLCOMPLETE_BITS 3 | ||
38 | #define SCSI_LOG_IOCTL_BITS 3 | ||
39 | |||
40 | extern unsigned int scsi_logging_level; | ||
41 | |||
42 | #ifdef CONFIG_SCSI_LOGGING | ||
43 | |||
44 | #define SCSI_LOG_LEVEL(SHIFT, BITS) \ | ||
45 | ((scsi_logging_level >> (SHIFT)) & ((1 << (BITS)) - 1)) | ||
46 | |||
47 | #define SCSI_CHECK_LOGGING(SHIFT, BITS, LEVEL, CMD) \ | ||
48 | { \ | ||
49 | if (unlikely((SCSI_LOG_LEVEL(SHIFT, BITS)) > (LEVEL))) \ | ||
50 | (CMD); \ | ||
51 | } | ||
52 | #else | ||
53 | #define SCSI_CHECK_LOGGING(SHIFT, BITS, LEVEL, CMD) | ||
54 | #endif /* CONFIG_SCSI_LOGGING */ | ||
55 | |||
56 | /* | ||
57 | * These are the macros that are actually used throughout the code to | ||
58 | * log events. If logging isn't enabled, they are no-ops and will be | ||
59 | * completely absent from the user's code. | ||
60 | */ | ||
61 | #define SCSI_LOG_ERROR_RECOVERY(LEVEL,CMD) \ | ||
62 | SCSI_CHECK_LOGGING(SCSI_LOG_ERROR_SHIFT, SCSI_LOG_ERROR_BITS, LEVEL,CMD); | ||
63 | #define SCSI_LOG_TIMEOUT(LEVEL,CMD) \ | ||
64 | SCSI_CHECK_LOGGING(SCSI_LOG_TIMEOUT_SHIFT, SCSI_LOG_TIMEOUT_BITS, LEVEL,CMD); | ||
65 | #define SCSI_LOG_SCAN_BUS(LEVEL,CMD) \ | ||
66 | SCSI_CHECK_LOGGING(SCSI_LOG_SCAN_SHIFT, SCSI_LOG_SCAN_BITS, LEVEL,CMD); | ||
67 | #define SCSI_LOG_MLQUEUE(LEVEL,CMD) \ | ||
68 | SCSI_CHECK_LOGGING(SCSI_LOG_MLQUEUE_SHIFT, SCSI_LOG_MLQUEUE_BITS, LEVEL,CMD); | ||
69 | #define SCSI_LOG_MLCOMPLETE(LEVEL,CMD) \ | ||
70 | SCSI_CHECK_LOGGING(SCSI_LOG_MLCOMPLETE_SHIFT, SCSI_LOG_MLCOMPLETE_BITS, LEVEL,CMD); | ||
71 | #define SCSI_LOG_LLQUEUE(LEVEL,CMD) \ | ||
72 | SCSI_CHECK_LOGGING(SCSI_LOG_LLQUEUE_SHIFT, SCSI_LOG_LLQUEUE_BITS, LEVEL,CMD); | ||
73 | #define SCSI_LOG_LLCOMPLETE(LEVEL,CMD) \ | ||
74 | SCSI_CHECK_LOGGING(SCSI_LOG_LLCOMPLETE_SHIFT, SCSI_LOG_LLCOMPLETE_BITS, LEVEL,CMD); | ||
75 | #define SCSI_LOG_HLQUEUE(LEVEL,CMD) \ | ||
76 | SCSI_CHECK_LOGGING(SCSI_LOG_HLQUEUE_SHIFT, SCSI_LOG_HLQUEUE_BITS, LEVEL,CMD); | ||
77 | #define SCSI_LOG_HLCOMPLETE(LEVEL,CMD) \ | ||
78 | SCSI_CHECK_LOGGING(SCSI_LOG_HLCOMPLETE_SHIFT, SCSI_LOG_HLCOMPLETE_BITS, LEVEL,CMD); | ||
79 | #define SCSI_LOG_IOCTL(LEVEL,CMD) \ | ||
80 | SCSI_CHECK_LOGGING(SCSI_LOG_IOCTL_SHIFT, SCSI_LOG_IOCTL_BITS, LEVEL,CMD); | ||
81 | |||
82 | #endif /* _SCSI_LOGGING_H */ | ||