bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH hurd] MAKEDEV: when creating devices, ensure the underlying f


From: Samuel Thibault
Subject: Re: [PATCH hurd] MAKEDEV: when creating devices, ensure the underlying files are either block/char devices or directories
Date: Wed, 6 Mar 2024 01:24:09 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Hello,

Flavio Cruz, le mar. 05 mars 2024 02:13:57 -0500, a ecrit:
> The perl test suite has a test where it reads all the block or char devices
> under /dev without following the translators. Then it compares it against a
> list of devices that read the translated nodes stat info.
> 
> The patch changes how the the device files are created initially so that the 
> stat information
> is identical and makes the Hurd environment appear more similar to other 
> operating
> systems.

Oh, good, thanks!

> ---
>  sutils/MAKEDEV.sh | 67 +++++++++++++++++++++++++++++++----------------
>  1 file changed, 44 insertions(+), 23 deletions(-)
> 
> diff --git a/sutils/MAKEDEV.sh b/sutils/MAKEDEV.sh
> index 0702663..79757fc 100644
> --- a/sutils/MAKEDEV.sh
> +++ b/sutils/MAKEDEV.sh
> @@ -81,6 +81,27 @@ st() {
>    if [ "$KEEP" ] && showtrans "$NODE" > /dev/null 2>&1 ; then
>      return;
>    fi
> +  local NODE_TYPE="$1"
> +  case "$NODE_TYPE" in
> +    b|c|d|f)
> +      shift 1
> +      ;;
> +    *)
> +      NODE_TYPE="f"
> +      ;;

I'd rather not have differing behavior: better always eat the node
type, and shout out if it is unknown.

> +  esac
> +  if [ ! -e "$NODE" ]; then
> +    case "$NODE_TYPE" in
> +      b|c)
> +        cmd mknod "$NODE" "$NODE_TYPE" 0 0
> +        ;;
> +      d)
> +        cmd mkdir "$NODE"
> +        ;;
> +      *)
> +        ;;

Here as well, better not have a catch-all case.

> @@ -235,7 +256,7 @@ mkdev() {
>        # Linux, we tell tmpfs to set the size to half the physical RAM
>        # in the machine.
>        shm)
> -        st $I root 644 /hurd/tmpfs --mode=1777 50%
> +        st $I root 644 d /hurd/tmpfs --mode=1777 50%
>          ;;
>  
>        pseudo-root)

pseudo-root is a block device too.

> @@ -246,7 +267,7 @@ mkdev() {
>        loop*)
>          # In Linux an inactive "/dev/loopN" device acts like /dev/null.
>       # The `losetup' script changes the translator to "activate" the device.
> -        st $I root 640 /hurd/null
> +        st $I root 640 c /hurd/null
>       ;;
>  
>        *)

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]