Introduction
============
pmount is a wrapper around the standard mount program which permits normal
users to mount removable devices without a matching /etc/fstab entry. Together
with hal and gnome-volume-manager (or similar programs) this will lay the
foundation for fully automatic device handling without user intervention.

Usage
=====
$ pmount <device> [<label>]

This will mount <device> to a directory below /media if policy is met (see
below). If <label> is given, the mount point will be /media/<label>, otherwise
it will be /media/<device>.

The device will be mounted with the following flags: 
sync,atime,nodev,exec,noauto,nosuid,user,rw

$ pumount [-l] <device>

This will umount <device> if a similar policy is met. -l does a lazy unmount,
see umount(8).

Policy
======
The mount will succeed if all of the following conditions are met:

- <device> is a block device in /dev/
- <device> is not handled by /etc/fstab (if it is, pmount calls 
  '/bin/mount <device>' to handle this transparently; supplying a label is not
  allowed in this case)
- <device> is not already mounted according to /etc/mtab and /proc/mounts
- if the mount point already exists, there is no device already mounted at it
  and the directory is empty 
- <device> is removable (currently USB and FireWire) TODO: pcmcia

The umount will succeed if all of the following conditions are met:

- <device> is a block device in /dev/ if -l is not supplied
- <device> is not handled by /etc/fstab (if it is, pmount calls
  '/bin/umount <device>' to handle this transparently)
- <device> is mounted according to /etc/mtab and /proc/mounts with the calling
  user's uid
- mount point is in /media

Algorithm
=========
pmount:

1. check if device is already in fstab; if so, drop all privileges (root user
   id) and execute 'mount <device>'
2. check if policy is met
3. determine mount point:
   - label given: check that there are no / in it
   - label not given: label = device name with '/' replaced by '_'
4. if mount point does not exist, create it; if it exists, check that it is
   an empty directory
5. execute mount command with a list of file systems that support specifying
   uid and gid (vfat,udf,iso9660,hfsplus,hfs)
6. if that failed, execute mount command with file systems that don't support
   uid and gid (ext3,ext2,reiserfs,xfs,jfs)

pumount:

1. check if device is already in fstab; if so, drop all privileges (root user
   id) and execute 'umount [-l] <device>'
2. check if policy is met
3. find out the mount point
4. execute umount program
5. delete the mount point

TODO
====
- Disable signals?
