Re: [PATCH v4 iproute2-next 1/1] tc: add dualpi2 scheduler module

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

 



On Sun, 16 Mar 2025 16:39:17 +0100
chia-yu.chang@xxxxxxxxxxxxxxxxxxx wrote:

> +static int try_get_percentage(int *val, const char *arg, int base)
> +{
> +	long res;
> +	char *ptr;
> +
> +	if (!arg || !*arg)
> +		return -1;
> +	res = strtol(arg, &ptr, base);
> +	if (!ptr || ptr == arg || (*ptr && strcmp(ptr, "%")))
> +		return -1;
> +	if (res == ULONG_MAX && errno == ERANGE)
> +		return -1;
> +	if (res < 0 || res > 100)
> +		return -1;
> +
> +	*val = res;
> +	return 0;
> +}
> +

I wonder if dualpi2 and netem could share some code on handling
scaled percentage values.




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux