Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Feb 1998 11:49:57 -0800 (PST)
From:      Simon Shapiro <shimon@simon-shapiro.org>
To:        Julian Elischer <julian@whistle.com>
Cc:        current@FreeBSD.ORG
Subject:   Re: devfs persistence
Message-ID:  <XFMail.980217114957.shimon@simon-shapiro.org>
In-Reply-To: <34E9DE3B.284797A9@whistle.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.980217114957.shimon>