Skip to content

Using dtrace to remove automounted lofi devices

April 25, 2005

While having the lofi devices hanging around after they get automounted is perfectly acceptable on a laptop it is still not right. So I have added a call to this dtrace script to the end of the mount command in /usr/lib/fs/isofs. Like this:

: principia IA 3 $; tail -3 /usr/lib/fs/isofs/mount
fi
/usr/local/sbin/lofid $dir $lofidev  &
exit 0
: principia IA 4 $;

Then save this d script as /usr/local/sbin/lofid and make it executable.

#!/usr/sbin/dtrace -s
#pragma D option destructive
#pragma D option quiet  

syscall::umount*:entry
/copyinstr(arg0) == $1/
{
      self->x = 1;
}
syscall::umount*:return
/arg1 == 0 && self->x != 0/
{
       system("/usr/sbin/lofiadm -d %s", $2);
       exit(0);
}

Technorati Tag:

Advertisements

From → Solaris

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: