From owner-freebsd-current Tue Feb 17 11:44:26 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA04508 for freebsd-current-outgoing; Tue, 17 Feb 1998 11:44:26 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from sendero.simon-shapiro.org (sendero-fxp0.Simon-Shapiro.ORG [206.190.148.34]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id LAA04412 for ; Tue, 17 Feb 1998 11:44:07 -0800 (PST) (envelope-from shimon@sendero-fxp0.simon-shapiro.org) Received: (qmail 18327 invoked by uid 1000); 17 Feb 1998 19:49:57 -0000 Message-ID: X-Mailer: XFMail 1.3-alpha-020998 [p0] on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <34E9DE3B.284797A9@whistle.com> Date: Tue, 17 Feb 1998 11:49:57 -0800 (PST) Reply-To: shimon@simon-shapiro.org Organization: The Simon Shapiro Foundation From: Simon Shapiro To: Julian Elischer Subject: Re: devfs persistence Cc: current@FreeBSD.ORG Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 17-Feb-98 Julian Elischer wrote: > Simon Shapiro wrote: >> >> >> The only thing not clear to me (I know this is obvious), is; With an >> all >> DEVFS, can I still do ``mkdir -p /a/b/c/d;cd /a/b/c/d;mknod foo c 123 >> 456, >> or its equivalent? If not, then symbolic links are fine too. > > > you cannot mknod. only the drivers can make nodes. > (though there are ways to solve some problems you might normally > try use mknod for) Ah, too bad. This means I cannot make stupid mistakes anymore? >> Oh, a /dev DEVFS mounted, can it create links and/or symlinks? >> Why not? > > The user can use ln (with or without -s) Can the user do mkdir in /dev? So, if I create a file /etc/devfs.conf with something like : # Sample /etc/devfs.conf sd33s1a rdbms-PartA 0660 pgsql.DBA cuaa00 mouse 0666 bin.bin sd64s2g nil 0600 nil and in /etc/rc put something like: if [ -f /etc/devfs.conf ] then line_no=0 cat /etc/devfs.conf | grep -v '^#" | grep -v '^$' | while read line do orig=`echo ${line} | awk '{ print $1 }'` link=`echo ${line} | awk '{ print $2 }'` perms=`echo ${line} | awk '{ print $3 }'` owner=`echo ${line} | awk '{ print $3 }'` if [ -f /dev/${orig} ] then if [ ${orig:-x} != x -a ${link:-x} != x -a ! -f /dev/{link} ] then if [ ${link} != nil ] then ln ${orig} ${link} fi else echo -c "Link Name Error in logical line ${line_no} of " echo "/etc/devfs.conf" fi if [ ${perms:-x} != x ] then if [ ${perms} != nil ] then chmod ${perms} /dev/${orig} fi else echo "Error in logical line ${line_no} of /etc/devfs.conf" fi if [ ${owner:-x} != x ] then if [ ${owner} != nil ] then chown ${owner} ${orig} fi fi fi done fi ... I will have a perfectly persistant DEVFS, without touching any kernel code. Yes? BTW, the above pretend code is NOT a formal patch proposal. It took all of three minutes to do, and is abviously flawed in more than one place. But the concept should be clear. ---------- Sincerely Yours, Simon Shapiro Shimon@Simon-Shapiro.ORG Voice: 503.708.7858 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message