Re: doFS.sh should obey MDDEVICE if available
Since mdconfig can autoallocate the device, why is this needed ? In message <[EMAIL PROTECTED]>, Makoto MATSUSHITA writes: > >src/release/scripts/doFS.sh rev. 1.6 doesn't consider MDDEVICE variable >(formaly, VNDEVICE). Here is a sample fix to use MDDEVICE variable to >configure md -- trivial, add '-u' option if MDDEVICE is already defined. > >-- - >Makoto `MAR' MATSUSHITA > >Index: doFS.sh >=== >RCS file: /pub/cvsup/FreeBSD.cvs/src/release/scripts/doFS.sh,v >retrieving revision 1.29 >diff -c -r1.29 doFS.sh >*** doFS.sh2001/01/31 22:58:39 1.29 >--- doFS.sh2001/02/03 23:16:51 >*** >*** 37,43 > awk 'BEGIN {printf "%c%c", 85, 170}' |\ > dd of=${FSIMG} obs=1 seek=510 conv=notrunc 2>/dev/null > >! MDDEVICE=`mdconfig -a -t vnode -f ${FSIMG}` > if [ ! -c /dev/${MDDEVICE} ] ; then > if [ -f /dev/MAKEDEV ] ; then > ( cd /dev && sh MAKEDEV ${MDDEVICE} ) >--- 37,47 > awk 'BEGIN {printf "%c%c", 85, 170}' |\ > dd of=${FSIMG} obs=1 seek=510 conv=notrunc 2>/dev/null > >! if [ "x${MDDEVICE}" != "x" ] ; then >! mdconfig -a -t vnode -f ${FSIMG} -u ${MDDEVICE} >! else >! MDDEVICE=`mdconfig -a -t vnode -f ${FSIMG}` >! fi > if [ ! -c /dev/${MDDEVICE} ] ; then > if [ -f /dev/MAKEDEV ] ; then > ( cd /dev && sh MAKEDEV ${MDDEVICE} ) > -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 [EMAIL PROTECTED] | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
Re: doFS.sh should obey MDDEVICE if available
> Also, I think that this isn't the right fix to a bigger problem. > Instead, it shouldn't be hard to get a list of configured devices > out of mdconfig via an ioctl on /dev/mdctl. This would be the right > fix, as it would fix the general case problem you describe, not just > one instance of it. mdconfig wont' be able to tell you what file it > is attached to by filename, but it should be able to ask /dev/mdctl > for a list of devices and report at least the type of each device > (swap, file, etc.). I think I can do this, possibly with a little help. md(4) keeps a list of md_s structures. From these, I think you can fill in the majority (if not all) of the fields in an md_ioctl structure. I tried this, and I can successfully return one almost-filled md_ioctl structure. If someone can suggest a method for returning an arbitrary number of md_ioctl's (a list), I think I may be able to implement this. Any pointers? Thanks Dima Dorfman [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
RE: doFS.sh should obey MDDEVICE if available
Oops, sorry that From: address was different from the first email... jhb> Instead, it shouldn't be hard to get a list of configured devices jhb> out of mdconfig via an ioctl on /dev/mdctl. This would be the jhb> right fix, as it would fix the general case problem you describe, jhb> not just one instance of it. Agreed. We can also detect 'umounted, but configured md devices' with the output of mount(8) and a list mentioned above. jhb> mdconfig wont' be able to tell you what file it is attached to by jhb> filename, but it should be able to ask /dev/mdctl for a list of jhb> devices and report at least the type of each device (swap, file, jhb> etc.). It maybe a stupid question (sorry I have few knowledge about kernel internal)... Can't we add a space for filename in the structure of md device? It would be wonderful if 'mdconfig -l' says: unit mountedtypeoption 0/tmp malloc -s=65535,reserve 1none file/home/matusita/fdimage 2none swapnone or something like that. If we have a configulation file for mdconfig(8), this output will be the same of its file format. -- - Makoto `MAR' MATSUSHITA To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
RE: doFS.sh should obey MDDEVICE if available
On 04-Feb-01 Makoto MATSUSHITA wrote: > > jhb> The current method always finds an unused device to use, so the > jhb> old VNDEVICE-style hack is no longer needed. There's no point to > jhb> setting an explicit device to use. > > But I want to ensure that all used md(4) devices is unconfigured after > it is used. > > Imagine you run 'make release' for your own release. If something is > trouble in doFS.sh ('kernel size exceeds 1.44MB floppy size' is a > typical example), make will exit without umounting /mnt and > unconfigureing /dev/mdX, where X is dynamically allocated (and no way > to know what X is outside of doFS.sh). If I can say 'doFS.sh, your md > device number is X', it's obviously easy to umount /mnt and > unconfigure md devices after the script runs. If it is still mounted, you can see the device by just typing 'mount' to get a list of mounted filesystems. You will have something like: /dev/md0 on /mnt (ufs, local) Also, I think that this isn't the right fix to a bigger problem. Instead, it shouldn't be hard to get a list of configured devices out of mdconfig via an ioctl on /dev/mdctl. This would be the right fix, as it would fix the general case problem you describe, not just one instance of it. mdconfig wont' be able to tell you what file it is attached to by filename, but it should be able to ask /dev/mdctl for a list of devices and report at least the type of each device (swap, file, etc.). -- John Baldwin <[EMAIL PROTECTED]> -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
RE: doFS.sh should obey MDDEVICE if available
jhb> The current method always finds an unused device to use, so the jhb> old VNDEVICE-style hack is no longer needed. There's no point to jhb> setting an explicit device to use. But I want to ensure that all used md(4) devices is unconfigured after it is used. Imagine you run 'make release' for your own release. If something is trouble in doFS.sh ('kernel size exceeds 1.44MB floppy size' is a typical example), make will exit without umounting /mnt and unconfigureing /dev/mdX, where X is dynamically allocated (and no way to know what X is outside of doFS.sh). If I can say 'doFS.sh, your md device number is X', it's obviously easy to umount /mnt and unconfigure md devices after the script runs. My mother tolds me that I should put away my toys after I play with them, so I want to do a sure way to unconfigure md device. BTW, how many md devices can we configure at the same time? What's happen if a file of md's backing store is removed? -- - Makoto MATSUSHITA To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
RE: doFS.sh should obey MDDEVICE if available
On 03-Feb-01 Makoto MATSUSHITA wrote: > > src/release/scripts/doFS.sh rev. 1.6 doesn't consider MDDEVICE variable > (formaly, VNDEVICE). Here is a sample fix to use MDDEVICE variable to > configure md -- trivial, add '-u' option if MDDEVICE is already defined. But you shouldn't need this. The only reason for the old VNDEVICE was because the release process couldn't automatically find an unused device to use, so it had to have help if vn0 is used. The current method always finds an unused device to use, so the old VNDEVICE-style hack is no longer needed. There's no point to setting an explicit device to use. -- John Baldwin <[EMAIL PROTECTED]> -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message