On Fri, May 06, 2011 at 04:17:59AM +0200, Alexander Hall wrote: > In the current spirit of making stuff DUID capable i found that > umount(8) was still not so. > > Diff makes use of "unrawname()" from fsck/fsutils.[ch]. Not sure if > this is what and how we want it, so no man page changes included so far. > > Thoughts? OK's? Manpage diffs? ;-)
Alexander, I have tried your diff and it looks and works fine for me, where I was able to successfully unmount using a DUID. I cannot comment on whether using unrawname() from fsck/fsutils.[ch] is the acceptable way of doing it, but I did modify your diff to include your requested manpage changes. :) Lawrence Index: Makefile =================================================================== RCS file: /cvs/src/sbin/umount/Makefile,v retrieving revision 1.3 diff -u -p -r1.3 Makefile --- Makefile 21 Sep 1997 11:38:25 -0000 1.3 +++ Makefile 22 May 2011 01:43:16 -0000 @@ -1,6 +1,11 @@ # $OpenBSD: Makefile,v 1.3 1997/09/21 11:38:25 deraadt Exp $ PROG= umount +SRCS= umount.c fsutil.c +.PATH: ${.CURDIR}/../fsck +CFLAGS+= -I${.CURDIR}/../fsck +DPADD= ${LIBUTIL} +LDADD= -lutil MAN= umount.8 .include <bsd.prog.mk> Index: umount.8 =================================================================== RCS file: /cvs/src/sbin/umount/umount.8,v retrieving revision 1.16 diff -u -p -r1.16 umount.8 --- umount.8 31 May 2007 19:19:48 -0000 1.16 +++ umount.8 22 May 2011 01:43:16 -0000 @@ -65,6 +65,22 @@ nor .Ar node are provided, the appropriate information is taken from the kernel. .Pp +For disk partitions, the +.Ar special +device is either a +.Xr disklabel 8 +UID (DUID) or an entry in +.Pa /dev . +If it is a DUID, +it will be automatically mapped to the appropriate entry in +.Pa /dev . +In either case the partition must be present +in the disklabel loaded from the device. +The partition name is the last letter in the entry name. +For example, /dev/sd0a and 3eb7f9da875cb9ee.a both refer to the +.Sq a +partition. +.Pp The options are as follows: .Bl -tag -width Ds .It Fl a Index: umount.c =================================================================== RCS file: /cvs/src/sbin/umount/umount.c,v retrieving revision 1.21 diff -u -p -r1.21 umount.c --- umount.c 27 Oct 2009 23:59:34 -0000 1.21 +++ umount.c 22 May 2011 01:43:16 -0000 @@ -44,10 +44,14 @@ #include <nfs/rpcv2.h> #include <err.h> +#include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <util.h> + +#include "fsutil.h" typedef enum { MNTON, MNTFROM } mntwhat; @@ -149,7 +153,7 @@ umountfs(char *oname) struct stat sb; struct timeval pertry, try; CLIENT *clp; - int so; + int so, devfd; char *delimp, *hostp, *mntpt; char *name, *newname, rname[MAXPATHLEN], type[MFSNAMELEN]; @@ -172,6 +176,12 @@ umountfs(char *oname) } } + /* Special treatment for DUIDs (and short form device names) */ + if ((devfd = opendev(oname, O_RDONLY, 0, &name)) >= 0) { + close(devfd); + unrawname(name); + } + /* * Look up the name in the mount table. * 99.9% of the time the path in the kernel is the one