The action for devctl()

When I write a io-net module and implement a devctl_func1() which is
registered in
io_net_registrant_funcs_t, then I can call this method by open() and
devctl() from
another application.
But if I also write this module as a resource manager, I’ll also
implement a devctl_func2()
which is registered in iofunc_func_init().
It seems that now the devctl_func2() will always be the function called
by the devctl() of
another application.
Is there any way to decide which function will be call from another
application?

Thanks.

Not sure I understand the question. When you register
with io-net, it creates an entry under /dev/io-net/ for
you. Are you saying you are overlaying this device? If
so, yes the last one in is called.

-seanb

Codante <codantee@hotmail.com> wrote:
: When I write a io-net module and implement a devctl_func1() which is
: registered in
: io_net_registrant_funcs_t, then I can call this method by open() and
: devctl() from
: another application.
: But if I also write this module as a resource manager, I’ll also
: implement a devctl_func2()
: which is registered in iofunc_func_init().
: It seems that now the devctl_func2() will always be the function called
: by the devctl() of
: another application.
: Is there any way to decide which function will be call from another
: application?

: Thanks.

Sorry, I don’t understand what the “overlaying” means?
I write two functions, devctl_func1() and devctl_func2(), in one(the
same) module.
Then I register devctl_func1() in io_net_registrant_funcs_t,
and regiter devctl_func2() in iofunc_func_init().
It seems that only devctl_func2() is called by other program’s devctl().
Is there any way to decide which one will be called,
or the second one always has high priority?


Sean Boudreau wrote:

Not sure I understand the question. When you register
with io-net, it creates an entry under /dev/io-net/ for
you. Are you saying you are overlaying this device? If
so, yes the last one in is called.

-seanb

Codante <> codantee@hotmail.com> > wrote:
: When I write a io-net module and implement a devctl_func1() which is
: registered in
: io_net_registrant_funcs_t, then I can call this method by open() and
: devctl() from
: another application.
: But if I also write this module as a resource manager, I’ll also
: implement a devctl_func2()
: which is registered in iofunc_func_init().
: It seems that now the devctl_func2() will always be the function called
: by the devctl() of
: another application.
: Is there any way to decide which function will be call from another
: application?

: Thanks.

Sorry, this still makes no sense to me. iofunc_func_init()
just initializes a resmgr_io_funcs_t with some default
values. You have to override the default devctl afterwards
and just the fact of filling in the resmgr_io_funcs_t doesn’t
mean the resulting fuctions will ever be called.

You must be doing more than that?

-seanb

Codante <codantee@hotmail.com> wrote:

: Sorry, I don’t understand what the “overlaying” means?
: I write two functions, devctl_func1() and devctl_func2(), in one(the
: same) module.
: Then I register devctl_func1() in io_net_registrant_funcs_t,
: and regiter devctl_func2() in iofunc_func_init().
: It seems that only devctl_func2() is called by other program’s devctl().
: Is there any way to decide which one will be called,
: or the second one always has high priority?


: Sean Boudreau wrote:
:>
:> Not sure I understand the question. When you register
:> with io-net, it creates an entry under /dev/io-net/ for
:> you. Are you saying you are overlaying this device? If
:> so, yes the last one in is called.
:>
:> -seanb
:>
:> Codante <codantee@hotmail.com> wrote:
:> : When I write a io-net module and implement a devctl_func1() which is
:> : registered in
:> : io_net_registrant_funcs_t, then I can call this method by open() and
:> : devctl() from
:> : another application.
:> : But if I also write this module as a resource manager, I’ll also
:> : implement a devctl_func2()
:> : which is registered in iofunc_func_init().
:> : It seems that now the devctl_func2() will always be the function called
:> : by the devctl() of
:> : another application.
:> : Is there any way to decide which function will be call from another
:> : application?
:>
:> : Thanks.

Codante <codantee@hotmail.com> wrote:

Sorry, I don’t understand what the “overlaying” means?
I write two functions, devctl_func1() and devctl_func2(), in one(the
same) module.
Then I register devctl_func1() in io_net_registrant_funcs_t,
and regiter devctl_func2() in iofunc_func_init().
It seems that only devctl_func2() is called by other program’s devctl().
Is there any way to decide which one will be called,
or the second one always has high priority?

iofuncs are boundled with a resource manager, ie the path.
The devctl_func1() you passed in io_net_registrant_funcs_t,
is boundled with /dev/io-net/enX, which created by io-net.
The application have to open("/dev/io-net/enX") first, then
devctl(fd,…) it.

Your own resource manager could regist whatever you want,
“/dev/myresmgr”, and have your devctl_func2() boundle with
that. The application will then open("/dev/myresmgr"), and
devctl(fd,…) to got to your devctl_func2().

The only exception is your resource manager also regist
“/dev/io-net/enX”, in that case, your resmgr would got
the open("/dev/io-net/enX") first. This is what we call
“overlaying namespace”.

-xtang


Sean Boudreau wrote:

Not sure I understand the question. When you register
with io-net, it creates an entry under /dev/io-net/ for
you. Are you saying you are overlaying this device? If
so, yes the last one in is called.

-seanb

Codante <> codantee@hotmail.com> > wrote:
: When I write a io-net module and implement a devctl_func1() which is
: registered in
: io_net_registrant_funcs_t, then I can call this method by open() and
: devctl() from
: another application.
: But if I also write this module as a resource manager, I’ll also
: implement a devctl_func2()
: which is registered in iofunc_func_init().
: It seems that now the devctl_func2() will always be the function called
: by the devctl() of
: another application.
: Is there any way to decide which function will be call from another
: application?

: Thanks.

Thanks for the information.

Xiaodan Tang wrote:

Codante <> codantee@hotmail.com> > wrote:

Sorry, I don’t understand what the “overlaying” means?
I write two functions, devctl_func1() and devctl_func2(), in one(the
same) module.
Then I register devctl_func1() in io_net_registrant_funcs_t,
and regiter devctl_func2() in iofunc_func_init().
It seems that only devctl_func2() is called by other program’s devctl().
Is there any way to decide which one will be called,
or the second one always has high priority?

iofuncs are boundled with a resource manager, ie the path.
The devctl_func1() you passed in io_net_registrant_funcs_t,
is boundled with /dev/io-net/enX, which created by io-net.
The application have to open("/dev/io-net/enX") first, then
devctl(fd,…) it.

Your own resource manager could regist whatever you want,
“/dev/myresmgr”, and have your devctl_func2() boundle with
that. The application will then open("/dev/myresmgr"), and
devctl(fd,…) to got to your devctl_func2().

The only exception is your resource manager also regist
“/dev/io-net/enX”, in that case, your resmgr would got
the open("/dev/io-net/enX") first. This is what we call
“overlaying namespace”.

-xtang

Sean Boudreau wrote:

Not sure I understand the question. When you register
with io-net, it creates an entry under /dev/io-net/ for
you. Are you saying you are overlaying this device? If
so, yes the last one in is called.

-seanb

Codante <> codantee@hotmail.com> > wrote:
: When I write a io-net module and implement a devctl_func1() which is
: registered in
: io_net_registrant_funcs_t, then I can call this method by open() and
: devctl() from
: another application.
: But if I also write this module as a resource manager, I’ll also
: implement a devctl_func2()
: which is registered in iofunc_func_init().
: It seems that now the devctl_func2() will always be the function called
: by the devctl() of
: another application.
: Is there any way to decide which function will be call from another
: application?

: Thanks.