Re: [SLUG] dynamically creating a loop device MINOR numbers?

2010-10-10 Thread Amos Shapira
On 10 October 2010 14:24, Zenaan Harkness zen...@gmail.com wrote: On Sun, Oct 10, 2010 at 2:13 PM, Adrian Chadd adr...@creative.net.au wrote: The horrible, O(n) way is to just to loop over 0 .. n, see if it doesn't exist, if it doesn't then create and use it. It's slow, it's racy (ie, don't

Re: [SLUG] dynamically creating a loop device MINOR numbers?

2010-10-09 Thread John Ferlito
On Sun, Oct 10, 2010 at 09:52:19AM +1100, Zenaan Harkness wrote: How about just using symlinks instead. eg # creation UNIQUE_NAME=unique_login_name MY_LOOP_DEV=/dev/loop/$UNIQUE_NAME # Setup loop device and grab it's name LOOP_DEV=`sudo losetup --show --find /home/$UNIQUE_NAME/source` #

Re: [SLUG] dynamically creating a loop device MINOR numbers?

2010-10-09 Thread Zenaan Harkness
Great! I was unfamiliar with readlink's ability. That'll work well. Thanks Zen -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Re: [SLUG] dynamically creating a loop device MINOR numbers?

2010-10-09 Thread Zenaan Harkness
On Sun, Oct 10, 2010 at 11:27 AM, John Ferlito jo...@inodes.org wrote: How about just using symlinks instead. eg # creation UNIQUE_NAME=unique_login_name MY_LOOP_DEV=/dev/loop/$UNIQUE_NAME # Setup loop device and grab it's name LOOP_DEV=`sudo losetup --show --find

Re: [SLUG] dynamically creating a loop device MINOR numbers?

2010-10-09 Thread Adrian Chadd
The horrible, O(n) way is to just to loop over 0 .. n, see if it doesn't exist, if it doesn't then create and use it. It's slow, it's racy (ie, don't run the script without locking :-) but it's a traditional UNIX way of doing things. PTYs were once allocated that way, fe. :-) Adrian On Sun,

Re: [SLUG] dynamically creating a loop device MINOR numbers?

2010-10-09 Thread Zenaan Harkness
On Sun, Oct 10, 2010 at 2:13 PM, Adrian Chadd adr...@creative.net.au wrote: The horrible, O(n) way is to just to loop over 0 .. n, see if it doesn't exist, if it doesn't then create and use it. It's slow, it's racy (ie, don't run the script without locking :-) but it's a traditional UNIX way

Re: [SLUG] dynamically creating a loop device MINOR numbers?

2010-10-09 Thread Adrian Chadd
On Sun, Oct 10, 2010, Zenaan Harkness wrote: On Sun, Oct 10, 2010 at 2:13 PM, Adrian Chadd adr...@creative.net.au wrote: The horrible, O(n) way is to just to loop over 0 .. n, see if it doesn't exist, if it doesn't then create and use it. It's slow, it's racy (ie, don't run the script