fallocate for FFS

2023-10-23 Thread Bruno Melo
Hi guys,

Is this project https://wiki.netbsd.org/projects/project/ffs-fallocate/ easy 
they way it seems to be?

Basically, it is just create a ffs_fallocate function in 
sys/ufs/ffs/ffs_alloc.c. Inside this function I make a loop calling the 
ffs_alloc function. During the loop I should check for signals to pause or 
continue the fallocate loop.

Is that analysis correct?

Thanks.


Re: Porting amdgpio driver from OpenBSD

2022-12-14 Thread Bruno Melo
Here it is: https://github.com/brunomaximom/NetBSD-src


Sent from ProtonMail, Swiss-based encrypted email.


> --- Original Message ---
> On segunda-feira, 12 de dezembro de 2022 às 8:59 AM, Taylor R Campbell 
> riastr...@netbsd.org wrote:
> 
> 
> 
> > > Date: Mon, 12 Dec 2022 02:57:27 +
> > > From: Bruno Melo bm...@protonmail.com
> > > 
> > > No progress yet.
> > > 
> > > I can see 2 things:
> > > First one, I put the following code inside acpi_res_irq function to
> > > check how setted is the data passed to SIMPLEQ_FOREACH:
> > > [...]
> > 
> > Can you share your current code?
> > 
> > (At this point I would recommend you create a git repository for it --
> > maybe just for the .c/.h file in the driver, maybe a branch in a clone
> > of your NetBSD reposoitory if you have any other changes outside the
> > driver's .c/.h file.)


Re: Porting amdgpio driver from OpenBSD

2022-12-11 Thread Bruno Melo
No progress yet.

I can see 2 things:
First one, I put the following code inside acpi_res_irq function to check how 
setted is the data passed to SIMPLEQ_FOREACH:

if (>ar_irq != NULL)
{
printf(" >ar_irq != NULL\n");
}
else
{
printf(" >ar_irq == NULL\n");
}

if ((>ar_irq)->sqh_first != NULL)
{
printf(" (>ar_irq)->sqh_first != NULL\n");
}
else
{
printf(" (>ar_irq)->sqh_first == NULL\n");
}

and what I see is during boot many devices print the messages >ar_irq != 
NULL *and* (>ar_irq)->sqh_first != NULL, but ihidev device print printf(" 
>ar_irq != NULL *and* (>ar_irq)->sqh_first == NULL.

Second one, i put a print placed inside if (ops->fini) of acpi_resource_parse 
function, and ihidev never runs that print, but runs the print inside the if 
(ops->init).

Any guidance on this?

Sent from ProtonMail, Swiss-based encrypted email.


--- Original Message ---
On sexta-feira, 9 de dezembro de 2022 às 11:39 AM, Bruno Melo 
 wrote:


> I'm putting printf everywhere and I identified the struct acpi_resources res 
> variable is not valid condition to SIMPLEQ_FOREACH(ar, >ar_irq, ar_list) 
> in acpi_res_irq(). Trying to identify why.
> 
> 
> In acpi_resource_parse() called by ihidev_intr_init() I see the if condition 
> in if (ops->init) is valid and I can see my printf being printed inside this 
> if, so the res should be allocated correctly, but when res is passed in 
> acpi_res_irq() my printf is not printed inside that SIMPLEQ_FOREACH. Stucked 
> here. I put printf everywhere else and got things printed correctly, except 
> in SIMPLEQ_FOREACH when ihidev code calls acpi_res_irq().
> 
> 
> When I compare the attach functions of the new amdgpio_acpi driver and other 
> *_acpi code I can't find any relevant difference for this be happening. Any 
> idea?
> 
> 
> 
> Sent from ProtonMail, Swiss-based encrypted email.
> 
> 
> 
> 
> --- Original Message ---
> On terça-feira, 6 de dezembro de 2022 às 00:35, Bruno Melo 
> bm...@protonmail.com wrote:
> 
> 
> 
> > I finished the port of OpenBSD driver and now I have these lines at boot 
> > time:
> > 
> > MEM (PNP0C01) at acpi0 not configured
> > VPC0 (VPC2004) at acpi0 not configured
> > ITSD (IDEA2004) at acpi0 not configured
> > HKDV (LKH2019) at acpi0 not configured
> > acpiwmibus at acpiwmi1 not configured
> > 
> > What should I do with them? How to fix them? Anyway to make them 
> > configurable?
> > 
> > Sent from ProtonMail, Swiss-based encrypted email.
> > 
> > --- Original Message ---
> > On segunda-feira, 28 de novembro de 2022 às 11:11 PM, Bruno Melo 
> > bm...@protonmail.com wrote:
> > 
> > > Hi folks,
> > > 
> > > I'm trying to port amdgpio.c from OpenBSD (/sys/dev/acpi) to NetBSD then 
> > > I can use my trackpad hopefully.
> > > I made some progress. The code is building but not crashing when the 
> > > system boots (as expected). But now I can see new devices as 'not 
> > > configured' message they did not exist before.
> > > 
> > > MEM (PNP0C01) at acpi0 not configured
> > > VPC0 (VPC2004) at acpi0 not configured
> > > ITSD (IDEA2004) at acpi0 not configured
> > > HKDV (LKH2019) at acpi0 not configured
> > > acpiwmibus at acpiwmi1 not configured
> > > 
> > > and then the crash happens in my bus_space_unmap(). Please, do you have 
> > > any idea what could be the problem or how i can investigate it? Picture 
> > > attached and code below:
> > > 
> > > #include 
> > > 
> > > #include 
> > > 
> > > #include 
> > > 
> > > #include 
> > > 
> > > #include 
> > > 
> > > #include 
> > > 
> > > #include 
> > > 
> > > #include 
> > > 
> > > #include 
> > > 
> > > #include 
> > > 
> > > #include 
> > > 
> > > #include 
> > > 
> > > #define LR_GPIO_POLARITY (3L << 1)
> > > #define LR_GPIO_ACTHI (0L << 1)
> > > #define LR_GPIO_ACTLO (1L << 1)
> > > #define LR_GPIO_ACTBOTH (2L << 1)
> > > #define LR_GPIO_MODE (1L << 0)
> > > #define LR_GPIO_LEVEL (0L << 0)
> > > 
> > > #define AMDGPIO_CONF_LEVEL 0x0100
> > > #define AMDGPIO_CONF_ACTLO 0x0200
> > > #define AMDGPIO_CONF_ACTBOTH 0x0400
> > > #define AMDGPIO_CONF_MASK 0x0600
> > > #define AMDGPIO_CONF_INT_EN 0x0800
> > > 

Re: Porting amdgpio driver from OpenBSD

2022-12-09 Thread Bruno Melo
I'm putting printf everywhere and I identified the struct acpi_resources res 
variable is not valid condition to SIMPLEQ_FOREACH(ar, >ar_irq, ar_list) 
in acpi_res_irq(). Trying to identify why.

In acpi_resource_parse() called by ihidev_intr_init() I see the if condition in 
if (ops->init) is valid and I can see my printf being printed inside this if, 
so the res should be allocated correctly, but when res is passed in 
acpi_res_irq() my printf is not printed inside that SIMPLEQ_FOREACH. Stucked 
here. I put printf everywhere else and got things printed correctly, except in 
SIMPLEQ_FOREACH when ihidev code calls acpi_res_irq(). 

When I compare the attach functions of the new amdgpio_acpi driver and other 
*_acpi code I can't find any relevant difference for this be happening. Any 
idea?



Sent from ProtonMail, Swiss-based encrypted email.


--- Original Message ---
On terça-feira, 6 de dezembro de 2022 às 00:35, Bruno Melo 
 wrote:


> I finished the port of OpenBSD driver and now I have these lines at boot time:
> 
> MEM (PNP0C01) at acpi0 not configured
> VPC0 (VPC2004) at acpi0 not configured
> ITSD (IDEA2004) at acpi0 not configured
> HKDV (LKH2019) at acpi0 not configured
> acpiwmibus at acpiwmi1 not configured
> 
> What should I do with them? How to fix them? Anyway to make them configurable?
> 
> Sent from ProtonMail, Swiss-based encrypted email.
> 
> 
> 
> 
> --- Original Message ---
> On segunda-feira, 28 de novembro de 2022 às 11:11 PM, Bruno Melo 
> bm...@protonmail.com wrote:
> 
> 
> 
> > Hi folks,
> > 
> > I'm trying to port amdgpio.c from OpenBSD (/sys/dev/acpi) to NetBSD then I 
> > can use my trackpad hopefully.
> > I made some progress. The code is building but not crashing when the system 
> > boots (as expected). But now I can see new devices as 'not configured' 
> > message they did not exist before.
> > 
> > MEM (PNP0C01) at acpi0 not configured
> > VPC0 (VPC2004) at acpi0 not configured
> > ITSD (IDEA2004) at acpi0 not configured
> > HKDV (LKH2019) at acpi0 not configured
> > acpiwmibus at acpiwmi1 not configured
> > 
> > and then the crash happens in my bus_space_unmap(). Please, do you have any 
> > idea what could be the problem or how i can investigate it? Picture 
> > attached and code below:
> > 
> > #include 
> > 
> > #include 
> > 
> > #include 
> > 
> > #include 
> > 
> > #include 
> > 
> > #include 
> > 
> > #include 
> > 
> > #include 
> > 
> > #include 
> > 
> > #include 
> > 
> > #include 
> > 
> > #include 
> > 
> > #define LR_GPIO_POLARITY (3L << 1)
> > #define LR_GPIO_ACTHI (0L << 1)
> > #define LR_GPIO_ACTLO (1L << 1)
> > #define LR_GPIO_ACTBOTH (2L << 1)
> > #define LR_GPIO_MODE (1L << 0)
> > #define LR_GPIO_LEVEL (0L << 0)
> > 
> > #define AMDGPIO_CONF_LEVEL 0x0100
> > #define AMDGPIO_CONF_ACTLO 0x0200
> > #define AMDGPIO_CONF_ACTBOTH 0x0400
> > #define AMDGPIO_CONF_MASK 0x0600
> > #define AMDGPIO_CONF_INT_EN 0x0800
> > #define AMDGPIO_CONF_INT_MASK 0x1000
> > #define AMDGPIO_CONF_RXSTATE 0x0001
> > #define AMDGPIO_CONF_TXSTATE 0x0040
> > #define AMDGPIO_CONF_TXSTATE_EN 0x0080
> > #define AMDGPIO_CONF_INT_STS 0x1000
> > #define AMDGPIO_IRQ_MASTER_EOI 0x2000
> > #define AMDGPIO_IRQ_BITS 46
> > #define AMDGPIO_IRQ_PINS 4
> > 
> > #define AMDGPIO_IRQ_MASTER 0xfc
> > #define AMDGPIO_IRQ_STS 0x2f8
> > 
> > struct amdgpio_intrhand {
> > int (*ih_func)(void *);
> > void ih_arg;
> > };
> > 
> > struct amdgpio_pincfg {
> > / Modeled after pchgpio but we only have one value to
> > save/restore */
> > uint32_t pin_cfg;
> > };
> > 
> > struct amdgpio_softc {
> > device_t sc_dev;
> > struct acpi_softc *sc_acpi;
> > ACPI_HANDLE sc_handle;
> > 
> > bus_space_tag_t sc_memt;
> > bus_space_handle_t sc_memh;
> > bus_size_t sc_size;
> > void *sc_ih;
> > 
> > int sc_npins;
> > int sc_pmf;
> > struct amdgpio_pincfg *sc_pin_cfg;
> > struct amdgpio_intrhand *sc_pin_ih;
> > 
> > struct gpio_chipset_tag sc_gpio;
> > };
> > 
> > int amdgpio_match(device_t, cfdata_t, void *);
> > void amdgpio_attach(device_t, device_t, void *);
> > int amdgpio_activate(device_t, int);
> > 
> > CFATTACH_DECL_NEW(amdgpio_acpi, sizeof(struct amdgpio_softc), 
> > amdgpio_match, amdgpio_attach, NULL, NULL);
> > 
> > static const struct 

Re: Porting amdgpio driver from OpenBSD

2022-12-05 Thread Bruno Melo
I finished the port of OpenBSD driver and now I have these lines at boot time:

MEM (PNP0C01) at acpi0 not configured
VPC0 (VPC2004) at acpi0 not configured
ITSD (IDEA2004) at acpi0 not configured
HKDV (LKH2019) at acpi0 not configured
acpiwmibus at acpiwmi1 not configured

What should I do with them? How to fix them? Anyway to make them configurable?

Sent from ProtonMail, Swiss-based encrypted email.


--- Original Message ---
On segunda-feira, 28 de novembro de 2022 às 11:11 PM, Bruno Melo 
 wrote:


> Hi folks,
> 
> I'm trying to port amdgpio.c from OpenBSD (/sys/dev/acpi) to NetBSD then I 
> can use my trackpad hopefully.
> I made some progress. The code is building but not crashing when the system 
> boots (as expected). But now I can see new devices as 'not configured' 
> message they did not exist before.
> 
> MEM (PNP0C01) at acpi0 not configured
> VPC0 (VPC2004) at acpi0 not configured
> ITSD (IDEA2004) at acpi0 not configured
> HKDV (LKH2019) at acpi0 not configured
> acpiwmibus at acpiwmi1 not configured
> 
> and then the crash happens in my bus_space_unmap(). Please, do you have any 
> idea what could be the problem or how i can investigate it? Picture attached 
> and code below:
> 
> #include 
> 
> #include 
> 
> #include 
> 
> #include 
> 
> #include 
> 
> #include 
> 
> #include 
> 
> 
> #include 
> 
> #include 
> 
> #include 
> 
> #include 
> 
> 
> #include 
> 
> 
> #define LR_GPIO_POLARITY (3L << 1)
> #define LR_GPIO_ACTHI (0L << 1)
> #define LR_GPIO_ACTLO (1L << 1)
> #define LR_GPIO_ACTBOTH (2L << 1)
> #define LR_GPIO_MODE (1L << 0)
> #define LR_GPIO_LEVEL (0L << 0)
> 
> #define AMDGPIO_CONF_LEVEL 0x0100
> #define AMDGPIO_CONF_ACTLO 0x0200
> #define AMDGPIO_CONF_ACTBOTH 0x0400
> #define AMDGPIO_CONF_MASK 0x0600
> #define AMDGPIO_CONF_INT_EN 0x0800
> #define AMDGPIO_CONF_INT_MASK 0x1000
> #define AMDGPIO_CONF_RXSTATE 0x0001
> #define AMDGPIO_CONF_TXSTATE 0x0040
> #define AMDGPIO_CONF_TXSTATE_EN 0x0080
> #define AMDGPIO_CONF_INT_STS 0x1000
> #define AMDGPIO_IRQ_MASTER_EOI 0x2000
> #define AMDGPIO_IRQ_BITS 46
> #define AMDGPIO_IRQ_PINS 4
> 
> #define AMDGPIO_IRQ_MASTER 0xfc
> #define AMDGPIO_IRQ_STS 0x2f8
> 
> struct amdgpio_intrhand {
> int (*ih_func)(void *);
> void ih_arg;
> };
> 
> struct amdgpio_pincfg {
> / Modeled after pchgpio but we only have one value to
> save/restore */
> uint32_t pin_cfg;
> };
> 
> struct amdgpio_softc {
> device_t sc_dev;
> struct acpi_softc *sc_acpi;
> ACPI_HANDLE sc_handle;
> 
> bus_space_tag_t sc_memt;
> bus_space_handle_t sc_memh;
> bus_size_t sc_size;
> void *sc_ih;
> 
> int sc_npins;
> int sc_pmf;
> struct amdgpio_pincfg *sc_pin_cfg;
> struct amdgpio_intrhand *sc_pin_ih;
> 
> struct gpio_chipset_tag sc_gpio;
> };
> 
> int amdgpio_match(device_t, cfdata_t, void *);
> void amdgpio_attach(device_t, device_t, void *);
> int amdgpio_activate(device_t, int);
> 
> CFATTACH_DECL_NEW(amdgpio_acpi, sizeof(struct amdgpio_softc), amdgpio_match, 
> amdgpio_attach, NULL, NULL);
> 
> static const struct device_compatible_entry compat_data[] = {
> { .compat = "AMDI0030" },
> { .compat = "AMD0030" },
> DEVICE_COMPAT_EOL
> };
> 
> int amdgpio_read_pin(void *, int);
> void amdgpio_write_pin(void *, int, int);
> void * amdgpio_intr_establish(void , int, int, int, int ()(void *), void *);
> void amdgpio_intr_enable(void *, int);
> void amdgpio_intr_disable(void *, void *);
> int amdgpio_pin_intr(struct amdgpio_softc *, int);
> int amdgpio_intr(void *);
> void amdgpio_save_pin(struct amdgpio_softc *, int pin);
> bool amdgpio_save(device_t self, const pmf_qual_t *qual);
> void amdgpio_restore_pin(struct amdgpio_softc *, int pin);
> bool amdgpio_restore(device_t self, const pmf_qual_t *qual);
> 
> int
> amdgpio_match(device_t parent, cfdata_t cf, void *aux)
> {
> struct acpi_attach_args *aa = aux;
> 
> return acpi_compatible_match(aa, compat_data);
> }
> 
> void
> amdgpio_attach(device_t parent, device_t self, void *aux)
> {
> struct acpi_attach_args *aa = aux;
> struct amdgpio_softc *sc = device_private(self);
> struct gpiobus_attach_args gba;
> struct acpi_resources res;
> struct acpi_mem *mem;
> struct acpi_irq *irq;
> ACPI_STATUS rv;
> int64_t uid;
> 
> sc->sc_dev = self;
> 
> sc->sc_acpi = (struct acpi_softc *)parent;
> 
> //sc->sc_node = aa->aa_node;
> 
> 
> if (acpi_eval_integer(aa->aa_node->ad_handle, "_UID", )) {
> 
> printf(": can't find uid\n");
> return;
> 

Re: Porting amdgpio driver from OpenBSD

2022-11-29 Thread Bruno Melo
It prints the line 

printf(", %d pins\n", sc->sc_npins);

That means, its not reaching the cannot establish interrupt error branch and 
going right to the sc->sc_gpio.gp_* lines. So I think I am passing wrong 
argument to the bus_space_map function, but not sure what is the wrong data.



Sent from ProtonMail, Swiss-based encrypted email.


--- Original Message ---
On terça-feira, 29 de novembro de 2022 às 11:35 AM, Taylor R Campbell 
 wrote:


> > Date: Tue, 29 Nov 2022 02:11:15 +0000
> > From: Bruno Melo bm...@protonmail.com
> > 
> > and then the crash happens in my bus_space_unmap(). Please, do you
> > have any idea what could be the problem or how i can investigate it?
> > Picture attached and code below:
> 
> 
> There's only one call to bus_space_unmap in your driver. It happens
> here:
> 
> printf(", %d pins\n", sc->sc_npins);
> 
> 
> #if NGPIO > 0
> 
> config_found(sc->sc_dev, , gpiobus_print, CFARGS_NONE);
> 
> #endif
> 
> unmap:
> kmem_free(sc->sc_pin_ih, sc->sc_npins * sizeof(*sc->sc_pin_ih));
> 
> bus_space_unmap(sc->sc_memt, sc->sc_memh, sc->sc_size);
> 
> sc->sc_size = 0;
> 
> printf(" DOIS");
> 
> There are two ways to reach this:
> 
> 1. The error branch when acpi_intr_establish fails, which will first
> print a message (`can't establish interrupt') so you can tell
> whether this happened.
> 
> 2. Fall through after config_found. This is the case where everything
> succeeded, so you probably meant to return here instead of falling
> through to cleanup!


Emulating linux timer.. syscalls

2022-01-31 Thread Bruno Melo
Hello,
Do you know what's the status of Emulating linux timer.. syscalls project? 
Seems like finished. Is it remaining some implementation?

Thanks.

Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted email.

Re: Trying to write a kernel module for (un)mounting tmpfs

2020-10-11 Thread Bruno Melo
Hi,

When I call the namei_simple_user function it always return errno 14. It calls 
the nameiat_simple_user who calls the pathbuf_copyin function. I set a bp in 
pathbuf_copyin and i compare what happens when I use mount command vs my 
module. basically it calls the pathbuf_create_raw() who does all the magic, 
when use the mount command it sets pb->pb_path to "/tmp" and when i load my 
module it sets to the "./mount.kmod" (my module's name), that's why namei 
always returns a bad address errno.
The pathbuf_create_raw() calls the PNBUF_GET() who is a macro for
pool_cache_get(pnbuf_cache, PR_WAITOK). My question is how can I pass "/tmp" 
string to pnbuf_cache argument? Will I need to reimplement all these functions 
inside my code?

Thanks for the help.

Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted email.

‐‐‐ Original Message ‐‐‐
Em domingo, 13 de setembro de 2020 às 23:57, Maciej  
escreveu:

> Hi Bruno,
>
> The reason why it is hard to map VFS operations inside the kernel is due to 
> the way how POSIX filesystems are designed.
> Most of the operations are made to run in the context of some process where 
> we have information about things such mount point,
> some file structures or path. This information is later translated to 
> concrete kernel structures.
>
> From the other side kernel module code when executed would need to get 
> somehow such information like mount point and mount options.
> If you take a look on the man-page of mount(2) you will notice that there are 
> couple arguments like flags
> (Filesystem independent - or at least meant to be independent), and mount 
> data which is filesystem-specific.
>
> The first design question that should ask yourself is how this information 
> would be provided to the kernel module?
> Probably they can be hardcoded in the module; however, if you decide to 
> trigger this operation from userspace
> (by using any US to kernel interface), you can provide some structure that 
> contains more information about current filesystem to make things easier.
>
> A good starting point to understand how things are working would be 
> implementation in VFS layer of mount system call:
>
> `do_sys_mount()` inside: kern/vfs_syscalls.c
>
> You can notice that in order to get vnode (structure needed for mount: the 
> mount point)
> you need to translate file path to find a vnode using `namei` operation
>
> Next thing is mount operation itself, as you realized each filesystem has its 
> own `struct vfsops` that contains filesystem operations.
> Kernel contains the global list `struct vfs_list_head vfs_list ` build inside 
> `kern/vfs_init.c`
> this list contains all filesystems availavble on NetBSD with their operations.
> To get filesystem specific structure you can use `mount_get_vfsops()`.
>
> When finished with the preparation (probably you will need to prepare 
> arguments according to man page mentioned before),
> you can call your favourite FS mount operation by `mount_domount()`.
>
> Hope that quick walkthrough will help you understand how mount operation 
> works inside the kernel.
> Maciej
>
> ‐‐‐ Original Message ‐‐‐
> On Thursday, September 10, 2020 12:51 PM, Bruno Melo  
> wrote:
>
>> Hi,
>>
>> I'm trying to write a kernel module as example for mounting and unmounting 
>> tmpfs. For that, I read the mount_tmpfs code and in line 247 I found the 
>> call for mount() syscall here:
>> https://nxr.netbsd.org/xref/src/sbin/mount_tmpfs/mount_tmpfs.c#247
>>
>> Then I looked for how the kernel mounts file systems and found there are 
>> _mount() function for every file system:
>> https://nxr.netbsd.org/xref/src/sys/sys/mount.h#254
>>
>> Now, I just needed to know how to use tmpfs_mount() and find it here:
>> https://nxr.netbsd.org/xref/src/sys/fs/tmpfs/tmpfs_vfsops.c#86
>> but I still don't know how to use it. I created the struct 
>> [tmpfs_args](https://nxr.netbsd.org/source/s?defs=tmpfs_args=src) 
>> [args](https://nxr.netbsd.org/source/s?refs=args=src) and size_t 
>> args_len = sizeof args variables to pass to data and data_len arguments in 
>> tmpfs_mount(). And the directory I'm mounting is "/tmp". So, I have 3 of 4 
>> arguments needed to tmpfs_mount(), the last one is the struct mount *mp.
>>
>> I know the mount() syscall takes 
>> [MOUNT_TMPFS](https://nxr.netbsd.org/source/s?defs=MOUNT_TMPFS=src) 
>> as first argument, but I'm not understanding the magic behind struct mount 
>> mp and what I need to assign to the struct mount variable to pass it to that 
>> argument. Any hint?
>>
>> Thanks for the help,
>>
>> Bruno Melo.

Trying to write a kernel module for (un)mounting tmpfs

2020-09-10 Thread Bruno Melo
Hi,

I'm trying to write a kernel module as example for mounting and unmounting 
tmpfs. For that, I read the mount_tmpfs code and in line 247 I found the call 
for mount() syscall here:
https://nxr.netbsd.org/xref/src/sbin/mount_tmpfs/mount_tmpfs.c#247

Then I looked for how the kernel mounts file systems and found there are 
_mount() function for every file system:
https://nxr.netbsd.org/xref/src/sys/sys/mount.h#254

Now, I just needed to know how to use tmpfs_mount() and find it here:
https://nxr.netbsd.org/xref/src/sys/fs/tmpfs/tmpfs_vfsops.c#86
but I still don't know how to use it. I created the struct 
[tmpfs_args](https://nxr.netbsd.org/source/s?defs=tmpfs_args=src) 
[args](https://nxr.netbsd.org/source/s?refs=args=src) and size_t 
args_len = sizeof args variables to pass to data and data_len arguments in 
tmpfs_mount(). And the directory I'm mounting is "/tmp". So, I have 3 of 4 
arguments needed to tmpfs_mount(), the last one is the struct mount *mp.

I know the mount() syscall takes 
[MOUNT_TMPFS](https://nxr.netbsd.org/source/s?defs=MOUNT_TMPFS=src) as 
first argument, but I'm not understanding the magic behind struct mount mp and 
what I need to assign to the struct mount variable to pass it to that argument. 
Any hint?

Thanks for the help,

Bruno Melo.