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

Reply via email to