nic_parse_subopts docs

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

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/

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/

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/

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
".

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/

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/

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/

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/

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/