aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-02-22 09:53:42 -0800
committerJoern Engel <joern@logfs.org>2013-02-22 09:54:55 -0800
commit7590cf02bbf196546f8557f05573c79f4ffddeee (patch)
treea50c4a667c8cb13d9955c6432ea9ca6a7a4837ee
parentc8868d005330bb9b9ccdb6a2cae265fc0109405a (diff)
downloadbcon2-7590cf02bbf196546f8557f05573c79f4ffddeee.tar.gz
blockconsole: Allow to pass a device file path to bcon_tail
... instead of always looking through all devices. Minor tweak: Moved the "CANDIDATES=" line below Takashi's new code. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Joern Engel <joern@logfs.org>
-rwxr-xr-xDocumentation/block/blockconsole/bcon_tail15
1 files changed, 15 insertions, 0 deletions
diff --git a/Documentation/block/blockconsole/bcon_tail b/Documentation/block/blockconsole/bcon_tail
index eb3524be7dc3d2..70926c6eeaea6d 100755
--- a/Documentation/block/blockconsole/bcon_tail
+++ b/Documentation/block/blockconsole/bcon_tail
@@ -58,6 +58,21 @@ end_of_log() {
# HEADER contains a newline, so the funny quoting is necessary
HEADER='
Linux blockconsole version 1.1'
+
+DEV="$1"
+if [ -n "$DEV" ]; then
+ if [ ! -b "$DEV" ]; then
+ echo "bcon_tail: No block device file $DEV"
+ exit 1
+ fi
+ if [ "`head -c32 $DEV`" != "$HEADER" ]; then
+ echo "bcon_tail: Invalid device file $DEV"
+ exit 1
+ fi
+ end_of_log $DEV
+ exit 0
+fi
+
CANDIDATES=`lsscsi |sed 's|.*/dev|/dev|'`
for DEV in $CANDIDATES; do