Re: [PATCH 1/1] tty: n_gsm: make n_gsm line number configurable

From: Greg KH
Date: Wed Oct 12 2022 - 02:49:46 EST


On Wed, Oct 12, 2022 at 08:17:15AM +0200, D. Starke wrote:
> From: Daniel Starke <daniel.starke@xxxxxxxxxxx>
>
> Currently, the n_gsm line number and its derived virtual ttys are assigned
> in the order of allocations with no means to change this.

Which is fine, why do you need this to be changed? What relies on
specific line numbers in userspace that can not handle things correctly
with the normal userspace tools we have for this type of thing?

> Introduce additional ioctl parameters numValid and num to configure the
> line number to allow predictable virtual tty allocation and numbering.
> Especially when using multiple n_gsm instances at the same time.

Ick, please no. That should never be needed, the kernel number and name
can be anything random (and people have suggested that we do make them
random at times). Don't hard-code numbers in your userspace tools, that
is just wrong.

> --- a/include/uapi/linux/gsmmux.h
> +++ b/include/uapi/linux/gsmmux.h
> @@ -19,7 +19,9 @@ struct gsm_config
> unsigned int mtu;
> unsigned int k;
> unsigned int i;
> - unsigned int unused[8]; /* Padding for expansion without
> + unsigned short numValid;
> + unsigned short num;

This would never work anyway (hint "short" is not a valid uapi data
type...)

thanks,

greg k-h