nic_parse_subopts docs

bridged with qdn.public.ddk.network
Post Reply
John A. Murphy

nic_parse_subopts docs

Post by John A. Murphy » Mon Sep 30, 2002 3:33 pm

Is there any documentation available on nic_parse_subopts and/or
drvr_parse_subopts? In particular, is there any information on error
conditions?
If I set the DRVR_OPT_FLAG_VAL_REQ flag, and then supply (on the command
line) that option without a value, I see a "Malformed argument" message
posted to slogger, but nic_parse_subopts still returns zero! Is there
any way for the driver to find out about the bad command line?

Murf

Chris McKillop

Re: nic_parse_subopts docs

Post by Chris McKillop » Mon Sep 30, 2002 4:58 pm

Please post a the structure as you have it setup.

chris


John A. Murphy <murf@perftech.com> wrote:
Is there any documentation available on nic_parse_subopts and/or
drvr_parse_subopts? In particular, is there any information on error
conditions?
If I set the DRVR_OPT_FLAG_VAL_REQ flag, and then supply (on the command
line) that option without a value, I see a "Malformed argument" message
posted to slogger, but nic_parse_subopts still returns zero! Is there
any way for the driver to find out about the bad command line?

Murf
--
Chris McKillop <cdm@qnx.com> "The faster I go, the behinder I get."
Software Engineer, QSSL -- Lewis Carroll --
http://qnx.wox.org/

John A. Murphy

Re: nic_parse_subopts docs

Post by John A. Murphy » Mon Sep 30, 2002 7:18 pm

Here are the relevant code fragments. I create one private option, "myInt",
just to test the flags.

Murf

typedef struct
{
nic_options_t nic; /* generic nic driver options */
int myInt; /* unique options */
} our_options_t;

our_options_t ourOptions;

static drvr_subopt_tbl_t ourOptionsTable [] = {
{"myInt",
offsetof(our_options_t, myInt),
DRVR_OPT_FLAG_VAL_SINT32 | DRVR_OPT_FLAG_VAL_REQ,
NULL},
};

int detect (void *dll_hdl, io_net_self_t *ion, char *options)
{
drvr_subopt_tbl_chain_t link;

link.next = NULL;
link.table = ourOptionsTable;
link.table_size = sizeof(ourOptionsTable) / sizeof(drvr_subopt_tbl_t);

cc = nic_parse_subopts(&ourOptions, "SiS", options, &link);
if (cc) slogf(_SLOGC_NETWORK, _SLOG_INFO, "nic_parse_subopts returned %d",
cc);

return ENODEV;
}



Chris McKillop wrote:
Please post a the structure as you have it setup.

chris

John A. Murphy <murf@perftech.com> wrote:
Is there any documentation available on nic_parse_subopts and/or
drvr_parse_subopts? In particular, is there any information on error
conditions?
If I set the DRVR_OPT_FLAG_VAL_REQ flag, and then supply (on the command
line) that option without a value, I see a "Malformed argument" message
posted to slogger, but nic_parse_subopts still returns zero! Is there
any way for the driver to find out about the bad command line?

Murf


--
Chris McKillop <cdm@qnx.com> "The faster I go, the behinder I get."
Software Engineer, QSSL -- Lewis Carroll --
http://qnx.wox.org/

Chris McKillop

Re: nic_parse_subopts docs

Post by Chris McKillop » Tue Oct 01, 2002 7:34 am

Well, it probably should have a flag to say if an error for a given value
is critical and, in turn, will return an error from the parse routine.

Can I see the io-net command line you are using that gives the error?
An exact cut-n-paste would be best.

chris

John A. Murphy <murf@perftech.com> wrote:
Here are the relevant code fragments. I create one private option, "myInt",
just to test the flags.

Murf

typedef struct
{
nic_options_t nic; /* generic nic driver options */
int myInt; /* unique options */
} our_options_t;

our_options_t ourOptions;

static drvr_subopt_tbl_t ourOptionsTable [] = {
{"myInt",
offsetof(our_options_t, myInt),
DRVR_OPT_FLAG_VAL_SINT32 | DRVR_OPT_FLAG_VAL_REQ,
NULL},
};

int detect (void *dll_hdl, io_net_self_t *ion, char *options)
{
drvr_subopt_tbl_chain_t link;

link.next = NULL;
link.table = ourOptionsTable;
link.table_size = sizeof(ourOptionsTable) / sizeof(drvr_subopt_tbl_t);

cc = nic_parse_subopts(&ourOptions, "SiS", options, &link);
if (cc) slogf(_SLOGC_NETWORK, _SLOG_INFO, "nic_parse_subopts returned %d",
cc);

return ENODEV;
}



Chris McKillop wrote:

Please post a the structure as you have it setup.

chris

John A. Murphy <murf@perftech.com> wrote:
Is there any documentation available on nic_parse_subopts and/or
drvr_parse_subopts? In particular, is there any information on error
conditions?
If I set the DRVR_OPT_FLAG_VAL_REQ flag, and then supply (on the command
line) that option without a value, I see a "Malformed argument" message
posted to slogger, but nic_parse_subopts still returns zero! Is there
any way for the driver to find out about the bad command line?

Murf


--
Chris McKillop <cdm@qnx.com> "The faster I go, the behinder I get."
Software Engineer, QSSL -- Lewis Carroll --
http://qnx.wox.org/
--
Chris McKillop <cdm@qnx.com> "The faster I go, the behinder I get."
Software Engineer, QSSL -- Lewis Carroll --
http://qnx.wox.org/

John A. Murphy

Re: nic_parse_subopts docs

Post by John A. Murphy » Tue Oct 01, 2002 10:11 am

I stuck this code into an existing driver to do the test, so a cut-n-paste might
be somewhat misleading, but it's basically "mount -Tio-net -o myInt
<driver-name>".

I'd think you'd want to return an error code if ANY of the options was entered
illegally; what would be the point of setting flags indicating that a value was
required (or not allowed) if you didn't want to know about an error?

Also, on the subject of documenting this functions, it would be nice to hae a list
of the options that it "automatically" parses. It is not at all obvious, for
instance, that you can enter "duplex=false" as well as "duplex=0."

Murf

Chris McKillop wrote:
Well, it probably should have a flag to say if an error for a given value
is critical and, in turn, will return an error from the parse routine.

Can I see the io-net command line you are using that gives the error?
An exact cut-n-paste would be best.

chris

John A. Murphy <murf@perftech.com> wrote:
Here are the relevant code fragments. I create one private option, "myInt",
just to test the flags.

Murf

typedef struct
{
nic_options_t nic; /* generic nic driver options */
int myInt; /* unique options */
} our_options_t;

our_options_t ourOptions;

static drvr_subopt_tbl_t ourOptionsTable [] = {
{"myInt",
offsetof(our_options_t, myInt),
DRVR_OPT_FLAG_VAL_SINT32 | DRVR_OPT_FLAG_VAL_REQ,
NULL},
};

int detect (void *dll_hdl, io_net_self_t *ion, char *options)
{
drvr_subopt_tbl_chain_t link;

link.next = NULL;
link.table = ourOptionsTable;
link.table_size = sizeof(ourOptionsTable) / sizeof(drvr_subopt_tbl_t);

cc = nic_parse_subopts(&ourOptions, "SiS", options, &link);
if (cc) slogf(_SLOGC_NETWORK, _SLOG_INFO, "nic_parse_subopts returned %d",
cc);

return ENODEV;
}



Chris McKillop wrote:

Please post a the structure as you have it setup.

chris

John A. Murphy <murf@perftech.com> wrote:
Is there any documentation available on nic_parse_subopts and/or
drvr_parse_subopts? In particular, is there any information on error
conditions?
If I set the DRVR_OPT_FLAG_VAL_REQ flag, and then supply (on the command
line) that option without a value, I see a "Malformed argument" message
posted to slogger, but nic_parse_subopts still returns zero! Is there
any way for the driver to find out about the bad command line?

Murf


--
Chris McKillop <cdm@qnx.com> "The faster I go, the behinder I get."
Software Engineer, QSSL -- Lewis Carroll --
http://qnx.wox.org/


--
Chris McKillop <cdm@qnx.com> "The faster I go, the behinder I get."
Software Engineer, QSSL -- Lewis Carroll --
http://qnx.wox.org/

Chris McKillop

Re: nic_parse_subopts docs

Post by Chris McKillop » Tue Oct 01, 2002 7:58 pm

John A. Murphy <murf@perftech.com> wrote:
I stuck this code into an existing driver to do the test, so a cut-n-paste might
be somewhat misleading, but it's basically "mount -Tio-net -o myInt
driver-name>".
So the format would be "mount -Tio-net -o myInt=10 driver-name".
I'd think you'd want to return an error code if ANY of the options was entered
illegally; what would be the point of setting flags indicating that a value was
required (or not allowed) if you didn't want to know about an error?

Also, on the subject of documenting this functions, it would be nice to hae a list
of the options that it "automatically" parses. It is not at all obvious, for
instance, that you can enter "duplex=false" as well as "duplex=0."
Fair enough.

chris

--
Chris McKillop <cdm@qnx.com> "The faster I go, the behinder I get."
Software Engineer, QSSL -- Lewis Carroll --
http://qnx.wox.org/

John A. Murphy

Re: nic_parse_subopts docs

Post by John A. Murphy » Tue Oct 01, 2002 9:10 pm

Right (about the "correct" format); and the question is "How come it doesn't complain if
I don't supply a value?"

Murf

Chris McKillop wrote:
John A. Murphy <murf@perftech.com> wrote:
I stuck this code into an existing driver to do the test, so a cut-n-paste might
be somewhat misleading, but it's basically "mount -Tio-net -o myInt
driver-name>".


So the format would be "mount -Tio-net -o myInt=10 driver-name".


I'd think you'd want to return an error code if ANY of the options was entered
illegally; what would be the point of setting flags indicating that a value was
required (or not allowed) if you didn't want to know about an error?

Also, on the subject of documenting this functions, it would be nice to hae a list
of the options that it "automatically" parses. It is not at all obvious, for
instance, that you can enter "duplex=false" as well as "duplex=0."


Fair enough.

chris

--
Chris McKillop <cdm@qnx.com> "The faster I go, the behinder I get."
Software Engineer, QSSL -- Lewis Carroll --
http://qnx.wox.org/

Chris McKillop

Re: nic_parse_subopts docs

Post by Chris McKillop » Wed Oct 02, 2002 3:15 am

John A. Murphy <murf@perftech.com> wrote:
Right (about the "correct" format); and the question is "How come it doesn't complain if
I don't supply a value?"
Good question. I belive that we do sanity checks if values MUST be set
to something that can't have a sane default. But I agree, it should return
an error on malformed arguments.

chris


--
Chris McKillop <cdm@qnx.com> "The faster I go, the behinder I get."
Software Engineer, QSSL -- Lewis Carroll --
http://qnx.wox.org/

John A. Murphy

Re: nic_parse_subopts docs

Post by John A. Murphy » Wed Oct 02, 2002 11:33 am

While we're on the subject, what's the difference between nic_parse_subopts and
drvr_parse_subopts? There are a number of very useful appearing facilities mentioned in
support.h and mdi.h, but the closest thing to documentation that I've been able to find is
"documentation by example" in the pcnet driver. Now, I LOVE examples, but a few WORDS would
sure be nice. The pcnet code appears to duplicate the (undocumented) caching feature of the
nic_allocator, even though it USES the nic_allocator. Am I missing some vital document?
We've got DDK-6.2.0 and the NetSDK --- is there more that we should have?

Murf

Chris McKillop wrote:
John A. Murphy <murf@perftech.com> wrote:
Right (about the "correct" format); and the question is "How come it doesn't complain if
I don't supply a value?"


Good question. I belive that we do sanity checks if values MUST be set
to something that can't have a sane default. But I agree, it should return
an error on malformed arguments.

chris

--
Chris McKillop <cdm@qnx.com> "The faster I go, the behinder I get."
Software Engineer, QSSL -- Lewis Carroll --
http://qnx.wox.org/

Post Reply

Return to “qdn.public.ddk.network”