9front - general discussion about 9front
 help / color / mirror / Atom feed
From: unobe@cpan.org
To: 9front@9front.org
Subject: Re: [9front] [PATCH] Unmount to remove sharp devices.
Date: Thu, 26 May 2022 16:36:33 -0700	[thread overview]
Message-ID: <F67CE959C225099FD668CDFF3114F377@smtp.pobox.com> (raw)
In-Reply-To: <c57bac9f-ca9b-fb7c-7069-d76ea1aeb249@posixcafe.org>

Great work on this moody.  I have some (hopefully helpful) questions
below.


Quoth Jacob Moody <moody@mail.posixcafe.org>:
> Another iteration.
> To state all of what this does:
> 
> A process can remove access to a driver through writing
> 
> chdev [ 0! ] devmask
> 
> to /dev/drivers. This is tied to the processes namegroup,
> and is inherited on both RFCNAMEG and RFNAMEG. In order to provide
> all the knobs RFNOMNT does, blocking 'M' is interpreted to block all mounting.
> 
> Support for this new operation has been added to namespace files,
> along with a matching chdev(1). /lib/namespace.ftp has been updated
> to use chdev.
> ...
> --- /tmp/diff100000711164
> +++ b/rc/bin/chdev
> @@ -1,0 +1,3 @@
> +#!/bin/rc
> +
> +echo chdev $* >> '#c/drivers'
> ...
> --- /tmp/diff100000711170
> +++ b/sys/man/1/chdev
> @@ -1,0 +1,93 @@
> +.TH CHDEV 1
> +.SH NAME
> +chdev \- change kernel driver access
> +.SH SYNOPSIS
> +.B chdev
> +[ 0! ] \f2devmask\fP...

> --- a/sys/src/9/port/dev.c
> +++ b/sys/src/9/port/dev.c
> @@ -31,6 +31,74 @@
>  }
> 
>  void
> +devmask(Pgrp *pgrp, char *devs)
> +{
> +	int i, t, w;
> +	int invert;
> +	char *p;
> +	Rune r;
> +	u64int mask[nelem(pgrp->notallowed)];
> +
> +	
> +	invert = 1;
> +	switch(*devs){
> +	case '!':
> +		memset(mask, 0, sizeof mask);
> +		devs++;
> +		invert--;
> +		break;
> +	case '0':
> +		devs = "";
> +	default:
> +		memset(mask, 0xFF, sizeof mask);
> +		break;
> +	}		
> +
> +	w = sizeof mask[0] * 8;
> +	for(p = devs; *p != '\0';){
> +		p += chartorune(&r, p);
> +		t = devno(r, 1);
> +		if(t == -1)
> +			continue;
> +		if(invert)
> +			mask[t/w] &= ~(1<<t%w);
> +		else
> +			mask[t/w] |= 1<<t%w;
> +	}

What happens if '!!!' is the prefix?  Should the '!' set invert = 0
explicitly instead of invert--?  Does '!0' allow access to all
drivers?


  reply	other threads:[~2022-05-26 23:40 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-04 14:09 Jacob Moody
2022-05-04 15:05 ` ori
2022-05-04 15:31 ` ori
2022-05-04 16:15   ` Stanley Lieber
2022-05-04 17:41   ` Lyndon Nerenberg (VE7TFX/VE6BBM)
2022-05-04 17:55     ` Jacob Moody
2022-05-05  1:59       ` Alex Musolino
2022-05-05 16:07         ` Jacob Moody
2022-05-08  2:55           ` Jacob Moody
2022-05-11 14:47             ` Jacob Moody
2022-05-11 16:11               ` Stanley Lieber
2022-05-12  4:29                 ` Jacob Moody
2022-05-12  3:18             ` ori
2022-05-12  5:10               ` Jacob Moody
2022-05-12 14:21                 ` ori
2022-05-23  5:42                   ` Jacob Moody
2022-05-23 17:06                     ` cinap_lenrek
2022-05-23 17:37                       ` Jacob Moody
2022-05-25 19:03                         ` Jacob Moody
2022-05-25 20:53                           ` hiro
2022-05-25 21:20                             ` Jacob Moody
2022-05-26  5:55                               ` Jacob Moody
2022-05-26 23:36                                 ` unobe [this message]
2022-05-27  0:33                                   ` Jacob Moody
2022-05-27  3:25                                     ` unobe
2022-05-26  3:13                             ` ori
2022-05-27  1:11                           ` Lyndon Nerenberg (VE7TFX/VE6BBM)
2022-05-27  2:25                             ` Frank D. Engel, Jr.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F67CE959C225099FD668CDFF3114F377@smtp.pobox.com \
    --to=unobe@cpan.org \
    --cc=9front@9front.org \
    --subject='Re: [9front] [PATCH] Unmount to remove sharp devices.' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).