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

2010-10-09 Thread Amos Shapira
On 10 October 2010 14:24, Zenaan Harkness  wrote:
> On Sun, Oct 10, 2010 at 2:13 PM, Adrian Chadd  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 of doing things.
>
> Think I'll avoid that on principle. Providing a minor # at all seems
> strange to me. Like Linux should do it. Why do I want or need to know
> about these MINOR #s anyway?! All I want is an lo dev; far away from
> this cold nightmare (with apologies to Frederick Loewe).

You need the minor number so the driver knows which instance of the device.

Anyway - just remember that there is a set limit on the maximum number
of loop devices which can be created. The default is usually fairly
low, probably depends on the specific distro, and can be set to a
different limit as a parameter to the module.

--Amos
-- 
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 Adrian Chadd
On Sun, Oct 10, 2010, Zenaan Harkness wrote:
> On Sun, Oct 10, 2010 at 2:13 PM, Adrian Chadd  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 of doing things.
> 
> Think I'll avoid that on principle. Providing a minor # at all seems
> strange to me. Like Linux should do it. Why do I want or need to know
> about these MINOR #s anyway?! All I want is an lo dev; far away from
> this cold nightmare (with apologies to Frederick Loewe).
> 
> At least losetup is an ELF exe, so if it does the anything similar it
> should be a little quicker, non-racy, and debugged than my own shell
> script, notwithstanding statically pre-allocated dev nodes. One can
> hope :)

Well, the binary/kernel may:

* loop over /dev/loopX, hoping you've got them there;
* do some ioctl on a device (eg /dev/loop), be told a device that's been
  created for it, and open that
* clone the device - eg you open /dev/loop, it creates /dev/loopX and
  makes your FD map to that

I know the latter is what FreeBSD's cloning devices do. That way it's
not prone to race conditions.

Don't assume that binaries are debugged and work properly. You may find
it's only assumed to work in certain, low-frequency-of-use situations. :-)
I suggest reading what losetup does to obtain a binary. Pay special
attention to ensure if it is looping over /dev/loopX, it actually -is-
doing some form of locking. :)


2c, 


Adrian

-- 
- Xenion - http://www.xenion.com.au/ - VPS Hosting - Commercial Squid Support -
- $24/pm+GST entry-level VPSes w/ capped bandwidth charges available in WA -
-- 
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 2:13 PM, Adrian Chadd  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 of doing things.

Think I'll avoid that on principle. Providing a minor # at all seems
strange to me. Like Linux should do it. Why do I want or need to know
about these MINOR #s anyway?! All I want is an lo dev; far away from
this cold nightmare (with apologies to Frederick Loewe).

At least losetup is an ELF exe, so if it does the anything similar it
should be a little quicker, non-racy, and debugged than my own shell
script, notwithstanding statically pre-allocated dev nodes. One can
hope :)

ta
zen
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] Re: [activities] SLUG monthly meeting: 29 October 2010

2010-10-09 Thread darrin hodges
Righto, unless somebody comes with some talks, you'll have to listen to me
talk about yum and rpms.

:)

Darrin.

On Sat, Oct 9, 2010 at 9:36 AM, James Polley  wrote:

> == October 2010 SLUG Meeting ==
>
> Location
> Google Sydney - 48 Pirrama Road, Pyrmont
>
> Summary
>  * Date: Friday October 29 2010
>  * Start time: Arrive at 6pm for a 6:30pm start
>  * Format: Main talk, preceded by social lightning talks
>  * == RSVP at [[http://slug.eventbrite.com]] ==
>  * Suggest or sign up for a talk on the wiki[1]
>
>
>  Details 
> This month we will have one main talk, preceded by some time for
> socialisation and lightning talks. To keep the meeting short, we're
> only asking for two talks, of a 5-7 minute duration. If you are
> interested in talking, please sign up below.
>
> Don't think you can give a talk, but have an idea for a talk you'd
> like to see? Add it to the **Talks I'd like to see** on the wiki page [1]
>
> === Main Talk ===
>
> Chris Collins will be giving a talk on Rails 3 [2], covering the
> differences between Rails 2.x and Rails 3.0 (and possibly more).
>
> Rails (more fully,  Ruby on Rails) is one of the most popular web
> frameworks amongst the hip Web2.0/Agile Development crowd; the upgrade
> to 3.0 is a major step forward, as it sees Rails merging with another
> popular framework, Merb.
>
> === Lightning Talks ===
> See the wiki[1] for details of lightning talks, or to suggest or offer
> for a talk.
>
>
> === Afterwards ===
>
> As with September, we'll be aiming to finish by 8 and will be heading
> to the Pyrmont Bridge Hotel afterwards.
>
>
> [1] http://wiki.slug.org.au/october2010lightningtalks
> [2] http://rubyonrails.org/
> --
> SLUG Activities
> Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
>
-- 
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 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, Oct 10, 2010, Zenaan Harkness wrote:
> If  I want to dynamically create loop devices, how would I dynamically
> create loop device minor numbers in some way, from a shell script,
> eg.:
> 
> # setup:
> UNIQUE_NAME=unique_login_name
> LOOP_DEV=/dev/loop/$UNIQUE_NAME
> MINOR_NUMBER=some_hash_or_what_???
> mknod $LOOP_DEV b 7 $MINOR_NUMBER
> chown root.disk $LOOP_DEV
> losetup $LOOP_DEV /home/$UNIQUE_NAME/source
> mount $LOOP_DEV /home/$UNIQUE_NAME/target
> ...
> # tear down:
> umount /home/$UNIQUE_NAME/target
> losetup -d $LOOP_DEV
> rm $LOOP_DEV
> 
> Each dyn created loop device will have unique lifetime. So they will
> be losetup -d'ed at different times, so eventually, the minor numbers
> will need to be reused.
> Is there any easy way to do this, whilst creating loop devices with
> names which I assign, as in the example above?
> 
> (I began a thread on this a few days ago (and no replies yet), which I
> will update if you just post here on slug, at
> http://forum.kernelnewbies.org/read.php?12,2126
> )
> 
> TIA
> Zen
> -- 
> SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
> Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

-- 
- Xenion - http://www.xenion.com.au/ - VPS Hosting - Commercial Squid Support -
- $24/pm+GST entry-level VPSes w/ capped bandwidth charges available in WA -
-- 
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  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`

This works with pre-created lo devices, which is fine. In my case, I
can pre-create as many as I will need at any one time.

losetup does not provide an auto device node creation mode, to create
additional nodes (loop device special files) on demand if required,
only auto locate an available but existing loop node.

I am still hoping for a fully dynamic solution (the promise of udev),
but this does not seem easy at this point.

Thanks again
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
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 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`

# Create symlink
ln -s $LOOP_DEV $MY_LOOP_DEV

mount $MY_LOOP_DEV /home/$UNIQUE_NAME/target


# tear down: Assuming different script
UNIQUE_NAME=unique_login_name
MY_LOOP_DEV=/dev/loop/$UNIQUE_NAME

umount /home/$UNIQUE_NAME/target
LOOP_DEV=`readlink $MY_LOOP_DEV`

losetup -d $LOOP_DEV
rm $MY_LOOP_DEV


This all works because adding --find to losetup will get it to find
the next available device and --show will print out what it found.

Note: The scripts above aren't tested.

Cheers,
John

-- 
John
Blog http://www.inodes.org
LCA2011  http://www.lca2011.org.au
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] dynamically creating a loop device MINOR numbers?

2010-10-09 Thread Zenaan Harkness
If  I want to dynamically create loop devices, how would I dynamically
create loop device minor numbers in some way, from a shell script,
eg.:

# setup:
UNIQUE_NAME=unique_login_name
LOOP_DEV=/dev/loop/$UNIQUE_NAME
MINOR_NUMBER=some_hash_or_what_???
mknod $LOOP_DEV b 7 $MINOR_NUMBER
chown root.disk $LOOP_DEV
losetup $LOOP_DEV /home/$UNIQUE_NAME/source
mount $LOOP_DEV /home/$UNIQUE_NAME/target
...
# tear down:
umount /home/$UNIQUE_NAME/target
losetup -d $LOOP_DEV
rm $LOOP_DEV

Each dyn created loop device will have unique lifetime. So they will
be losetup -d'ed at different times, so eventually, the minor numbers
will need to be reused.
Is there any easy way to do this, whilst creating loop devices with
names which I assign, as in the example above?

(I began a thread on this a few days ago (and no replies yet), which I
will update if you just post here on slug, at
http://forum.kernelnewbies.org/read.php?12,2126
)

TIA
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: Subject: [SLUG] change to linux and google chrome

2010-10-09 Thread Martin Visser
On Sat, Oct 9, 2010 at 6:30 PM, Brett Mahar  wrote:

>
> You might like to check out SW Iron instead of Chrome, it is the same
> thing but without the many Google tracking devices built-in:
>
> http://www.srware.net/en/software_srware_iron_chrome_vs_iron.php
> --
>

You just gotta love that SRware are obviously down on "Google tracking" yet
are quite willing to take their money by offering Google Ads on both the
side and bottom of their page.

Regards, Martin

martinvisse...@gmail.com
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] Re: blue mountains day excursion with RMS?

2010-10-09 Thread Zenaan Harkness
If you look forward to a day or otherwise meeting with an icon, rms,
you might email him direct given the short notice:

rms -AT- gnu.org

and you may wish to CC myself too, as I expect to speak with him, and
will pass on your request/ intent if so.

regards
zenaan


On Sat, Oct 9, 2010 at 8:50 PM, Zenaan Harkness  wrote:
> Would anyone who is with vehicle, like to cheauffer Richard Stallman
> to the Blue Mountains, from City, tomorrow, or possibly Monday,
> bearing in mind that he is due to speak at UNSW early Monday evening,
> at 5:30 for 6pm start. ?
>
> cheers
> zenaan
>
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] Re: blue mountains day excursion with RMS?

2010-10-09 Thread Zenaan Harkness
I'm now subscribed. Not sure if I had to be, apologies if repeat email.

Would anyone who is with vehicle, like to cheauffer Richard Stallman
to the Blue Mountains, from City, tomorrow, or possibly Monday,
bearing in mind that he is due to speak at UNSW early Monday evening,
at 5:30 for 6pm start. ?

cheers
zenaan
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] blue mountains day excursion with RMS?

2010-10-09 Thread Zenaan Harkness
Would anyone who is with vehicle, like to cheauffer Richard Stallman
to the Blue Mountains, from City, tomorrow, or possibly Monday,
bearing in mind that he is due to speak at UNSW early Monday evening,
at 5:30 for 6pm start. ?

cheers
zenaan
-- 
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] Unrecogniseable disks.

2010-10-09 Thread Chris Donovan
Hi,

A few things come to mind.

> Put a disc in the laptop's DVD reader. No result whatsoever. Went to
> /media. There is something there, but I was refused access.

What does `fdisk -lu` say?  Do you have appropriate access to /media
(ls -ld /media)?

Chris-
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: Subject: [SLUG] change to linux and google chrome

2010-10-09 Thread Brett Mahar
>> I am new to slug, can you do the following, I have a note book with
>> XP, can I remove microsoft and change to linux and use google chrome
>> as the browser

You might like to check out SW Iron instead of Chrome, it is the same
thing but without the many Google tracking devices built-in:

http://www.srware.net/en/software_srware_iron_chrome_vs_iron.php
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html