Re: Link modules to DYN type

2023-04-26 Thread Jan Martin Mikkelsen


> On 26. Apr 2023, at 13:38, Hans Petter Selasky  wrote:
> 
> On 4/26/23 13:12, Konstantin Belousov wrote:
>> No, in-kernel linker does not behave this way.
>> Modules need to contain explicit reference to all modules they depend upon,
>> using the MODULE_DEPEND() macro.  Only symbols from the dependencies are
>> resolved.
>> All modules get an implicit reference to kernel.
> 
> Hi Konstantin,
> 
> Maybe I wasn't so clear. Trying again:
> 
>> diff --git a/sys/tests/ktest.c b/sys/tests/ktest.c
>> index 495fedf95dde..eb42cf062487 100644
>> --- a/sys/tests/ktest.c
>> +++ b/sys/tests/ktest.c
>> @@ -409,6 +409,12 @@ static moduledata_t ktestmod = {
>> 0
>> };
>> +int
>> +printf(const char *fmt, ...)
>> +{
>> +   return (0);
>> +}
>> +
>> DECLARE_MODULE(ktestmod, ktestmod, SI_SUB_PSEUDO, SI_ORDER_ANY);
>> MODULE_VERSION(ktestmod, 1);
>> MODULE_DEPEND(ktestmod, netlink, 1, 1, 1);
> 
> Then kldload ktest.ko . Which printf() function will be used if ktest.c calls 
> printf() ?
> 
> I would expect a warning from the kernel at least …


Hi,

This looks similar to this:

https://lists.freebsd.org/pipermail/freebsd-stable/2015-July/082751.html

https://lists.freebsd.org/pipermail/freebsd-stable/2015-July/082760.html

The “not knowing” about how symbols are going to be resolved has bothered me 
for a while.

Regards,

Jan M.



Re: ZFS no longer mounted in alphanumerical order

2019-03-12 Thread Jan Martin Mikkelsen

> On 12 Mar 2019, at 12:14, Trond Endrestøl 
>  wrote:
>> An alternative sort approach, which handles df arguments which change the 
>> number of columns, and only invokes df once:
>> 
>> ${DF} "$@" | awk '/^Filesystem/ { print; sort = "sort -k " NF } ! 
>> /^Filesystem/ { print | sort }’
> 
> Well, yes and no, mostly no.
> 
> Why are we feeding each line from df(1) separately to sort(1)?
> It defeats the entire purpose. No sorting takes place.
> 
> We might be better off accumulating the majority of the lines and 
> sorting them in an END block.


That’s not how awk works. It maintains a pipe and feeds each line to the same 
sort process.

There is another bug there, of course. The field number should be (NF - 1) 
because of the space in the “Mounted on” header on the last column. That’s what 
I get for just typing code into an email.

Regards,

Jan M.


___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ZFS no longer mounted in alphanumerical order

2019-03-12 Thread Jan Martin Mikkelsen


> On 12 Mar 2019, at 10:37, Trond Endrestøl 
>  wrote:
> I concocted a shell script, it looks promising:
> 
> #!/bin/sh
> #-
> # Parallel mounting of ZFS filesystems leaves a chaotic listing of
> # mounted filesystems when viewed by df(1).
> # Separating the header from the remaining lines and sorting the
> # latter before recombining is a viable solution.
> #-
> 
> DF=/bin/df
> 
> ${DF} ${@} | grep^Filesystem
> ${DF} ${@} | grep -v ^Filesystem | sort -k 6
> 
> # new-df.sh

An alternative sort approach, which handles df arguments which change the 
number of columns, and only invokes df once:

${DF} "$@" | awk '/^Filesystem/ { print; sort = "sort -k " NF } ! /^Filesystem/ 
{ print | sort }’

Regards,

Jan.
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"