[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: hdparm script



i read all not-empty lines, not beginning with a #. then i use the line as the options for a function. something like:
 
do_hdparm () {
hdparm -m $2 -c $3 $1 # ...or so, don't remember the options :-)
}
 
for line in lines ; do 
do_hdparm $line
done
 
but look at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=87451&repeatmerged=yes, where i filed a patch.
 
i will change the IFS stuff to use read or so this evening :-)
 
there was a even nicer format like
[Device]
     device=/dev/hda
     dma=on
 
i guess it is uglier to parse but is quite self-describing and nice. but i will write a debconf script today, which should make it even more userfriendly.
 
simon

	-----Ursprüngliche Nachricht----- 
	Von: Boris Duerner [mailto:bduerner@web.de] 
	Gesendet: Do 26.09.2002 13:31 
	An: Hürlimann, Simon 
	Cc: 
	Betreff: Re: hdparm script
	
	

	Hi Simon,
	
	This is better than mine, can I see how you parse this with a shell script?
	
	thanks,
	Marc
	
	
	
	
	On Wednesday 25 September 2002 22:59, Simon Hürlimann wrote:
	> Hi
	>
	> i wrote a little script and posted a patch for the current hdparm-5.2-1
	> source deb to bug #87451.
	>
	> my configuration-file looks like that (had something in mind like
	> fstab...):
	>
	> # usage:
	> # one line per device
	> # <device-file> is something like '/dev/hda'
	> # <dma-mode> is eihter '1' or '0'. with 1=on and 0=off
	> # <io_32-mode> is either '1' or '0'. with 1=on and 0=off
	>
	> # <device-file> <dma-mode>      <io_32-mode>
	>
	> # First IDE-Disk
	> /dev/hda        1               1
	>
	> # Second IDE-Disk
	> /dev/hdb        1               0
	>
	> not very nice, but very easy to parse.
	>
	> look at it if your interested. the script is too verbose and it supports
	> only dma and io32. (multi-sector, but this is automatic get with hdparm -i.
	>
	> i was able to package, and it works fine for me.
	> i'm ready to write the debconf scripts (config and templates...) if your
	> interested. (for my script or a better one :-)
	>
	> simon
	>
	> Am Mittwoch, 25. September 2002 21.42 schrieb Michael Stone:
	> > On Wed, Sep 25, 2002 at 08:40:58PM +0100, Boris Duerner wrote:
	> > ># Configuration file for /etc/init.d/hdparm.
	> > ># Tunes hard drives on boot up.
	> > >#
	> > ># Syntax:
	> > >#[DRIVE]="<hdparm's parameters>"#
	> > >#
	> > ># Example:
	> > ># HDA="-c1 -d1 -m16"
	> > ># this turns 32Bit-I/O and DMA for /dev/hda on and sets
	> > ># multi sector count to 16.
	> > >#
	> > ># Currently only hda, hdb, hdc, hdd are supported
	> > ># To add support for additional devices change /etc/init.d/hdparm
	> > >
	> > >HDA=""
	> > >HDB=""
	> > >HDC=""
	> > >HDD=""
	> >
	> > That's pretty hideous, and also doesn't mesh well with device specific
	> > names (e.g., devfs). Rather than these bandaids, the proper approach
	> > (IMHO) is to just fix the default kernels so they turn on dma if it's
	> > safe.
	> >
	> > Mike Stone
	



Reply to: