[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: kdeeject - unmouting media patch



Hi all interested users,
I sat down and patched eject 2.0.13 which comes with debian woody. 
Now, eject does not follow any symlinks to device files, but uses the 
original command line argument to look up the mount point and tries 
to unmount the device. You have to use the same device file name 
(either a real file or a symlink) to eject as to mount the media. 
This is quite a quick'n'dirty patch, but both eject and kdeeject 
works for me now :-)

Tobias

Am Mittwoch, 11. Juni 2003 23:17 schrieb David Pye:
> Hmm - here's a thought perhaps?
>
> the piece of main page you quoted says:
> > ... Eject may not always be able to determine if the device is
> > mounted (e.g. if it has several names). If the device name is a
> > symbolic link, eject will follow the link and use the device that
> > it points to. ...
>
> Could we not work around this?
>
> If I read that right, eject behaves by following the link and
> trying to umount the link destination as a device rather than a
> mount point if it was passed a symbolic link.
>
> Couldn't we make kdeeject simply dereference the symbolic link and
> call eject with the parameter of the link DESTINATION?
>
> So if you tried to eject /mnt/cdrom via kdeeject and it's a symlink
> to /cdrom, couldn't kdeeject run eject /mnt/cdrom?
>
> Assuming kdeeject works on mount points not devices, then is there
> a downside to this I haven't yet seen? :)
>
> David

-- 
/"\ ASCII Ribbon Campaign - against HTML mail
\ / No proprietary formats in attachments without request
 X  i.e. *NO* WORD, POWERPOINT or EXCEL documents
/ \ Respect Open Standards
    http://www.fsf.org/philosophy/no-word-attachments.html
    http://www.goldmark.org/netrants/no-word/attach.html

Registered Linux User #293344
31a32,54
> /********************************************************************
>  *
>  *              You Are Using An Quick'n'Dirty-Patch !!!
>  *
>  ********************************************************************
>  *
>  * With this patch it _should_ be possible to use symlinks on device
>  * files in /etc/fstab and using this version of eject (with the 
>  * symlink as parameter) to unmount the device and eject the 
>  * respective media. In the original version eject followed the
>  * symlinks and used the 'real' files to look up the mount point.
>  * The result was (where /dev/cdrom -> sr1 -> scd1):
>  *
>  * # eject /dev/cdrom
>  * eject: unable to eject, last error: Invalid argument
>  *
>  * as eject tried to unmount /dev/scd1 while /dev/cdrom is used
>  * in /etc/fstab.
>  *
>  * No other file (esp. man-page 'eject.1') has been updated!
>  *
>  */
>  
114a138
> "With quick'n'dirty patch to use symlinks on device files of mounted devices\n"
813a838
> 	char *fullName2;
866c891
< 		free(fullName);
---
> 		fullName2=fullName;
879c904
< 	mounted = MountedDevice(fullName, &mountName, &deviceName);
---
> 	mounted = MountedDevice(fullName2, &mountName, &deviceName);
892c917
< 		mountable = MountableDevice(fullName, &mountName, &deviceName);
---
> 		mountable = MountableDevice(fullName2, &mountName, &deviceName);
897c922
< 				printf(_("%s: `%s' is not a mount point\n"), programName, fullName);
---
> 				printf(_("%s: `%s' is not a mount point\n"), programName, fullName2);

Reply to: