Hoho,

Nice, really, thanks. Is there any chance this being accepted into any
future kernel version?

Radek Vlacil

-----Original Message-----
From: Linux on 390 Port [mailto:[email protected]] On Behalf Of
Martin Schwidefsky
Sent: Tuesday, September 07, 2010 09:56
To: [email protected]
Subject: Re: Tapes 34xx detection

On Mon, 6 Sep 2010 12:52:39 +0100
"Vlacil, Radek" <[email protected]> wrote:

> Wouldn't it be possible to implement an enhancement that would
generate
> an uevent with ACTION="change" for this "tape loaded" kind of events?
If
> there is a massage for that generated in the system log, it shouldn't
be
> that hard :-).

That should be rather straightforward. Like this:

diff -urpN linux-2.6/drivers/s390/char/tape_core.c
linux-2.6-patched/drivers/s390/char/tape_core.c
--- linux-2.6/drivers/s390/char/tape_core.c     2010-08-02
00:11:14.000000000 +0200
+++ linux-2.6-patched/drivers/s390/char/tape_core.c     2010-09-07
09:53:05.000000000 +0200
@@ -217,15 +217,19 @@ tape_med_state_set(struct tape_device *d
        switch(newstate){
        case MS_UNLOADED:
                device->tape_generic_status |= GMT_DR_OPEN(~0);
-               if (device->medium_state == MS_LOADED)
+               if (device->medium_state == MS_LOADED) {
                        pr_info("%s: The tape cartridge has been
successfully "
                                "unloaded\n",
dev_name(&device->cdev->dev));
+                       kobject_uevent(&device->cdev->dev.kobj,
KOBJ_CHANGE);
+               }
                break;
        case MS_LOADED:
                device->tape_generic_status &= ~GMT_DR_OPEN(~0);
-               if (device->medium_state == MS_UNLOADED)
+               if (device->medium_state == MS_UNLOADED) {
                        pr_info("%s: A tape cartridge has been
mounted\n",
                                dev_name(&device->cdev->dev));
+                       kobject_uevent(&device->cdev->dev.kobj,
KOBJ_CHANGE);
+               }
                break;
        default:
                // print nothing

--
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or
visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/

Reply via email to