Skip to contentSkip to conversation

Add mount option parsing facility to text-based mount.nfs

PATCH In review Chuck Lever 2 participants 4 messages Sep 25, 2007 – Sep 27, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Add mount option parsing facility to text-based mount.nfs

Hi Neil-

Seven more patches for text-based mount.nfs.

I found that it is necessary to do some rather advanced lexical parsing of the mount option string in order to handle version/protocol fallback. So I've implemented a data structure that can handle the parsing requirements, and some wrapper logic to convert the mount option string to the new data structure and then convert it back to a string before calling mount(2).

This series introduces the new facility and makes use of it for existing text- based mount option processing (like adding "addr=" and so on). In subsequent patches I will make more use of the new facility.

Signature · 9 lines
corporate:    <chuck dot lever at oracle dot com>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NFS maillist  -  [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
#1 lore raw
Quoted 10 lines · On Tuesday September 25, [email protected] wrote:

Hi Neil-

Seven more patches for text-based mount.nfs.

I found that it is necessary to do some rather advanced lexical parsing of the mount option string in order to handle version/protocol fallback. So I've implemented a data structure that can handle the parsing requirements, and some wrapper logic to convert the mount option string to the new data structure and then convert it back to a string before calling mount(2).

Quoted 3 lines

This series introduces the new facility and makes use of it for existing text- based mount option processing (like adding "addr=" and so on). In subsequent patches I will make more use of the new facility.

Nice.

However: The current parsing of mount options (parse_opts, parse_options) allows for "quotes" around options so that an option can contain a comma (Gumble SELinux Grumble context=foo,bar Grumble). Your mount option parsing doesn't allow for this. Should it?

NeilBrown

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#2 lore raw
Quoted 15 lines · Neil Brown
Quoted 10 lines · On Tuesday September 25, [email protected] wrote:

Hi Neil-

Seven more patches for text-based mount.nfs.

I found that it is necessary to do some rather advanced lexical parsing of the mount option string in order to handle version/protocol fallback. So I've implemented a data structure that can handle the parsing requirements, and some wrapper logic to convert the mount option string to the new data structure and then convert it back to a string before calling mount(2).

Quoted 3 lines

This series introduces the new facility and makes use of it for existing text- based mount option processing (like adding "addr=" and so on). In subsequent patches I will make more use of the new facility.

Quoted 6 lines

Nice.

However: The current parsing of mount options (parse_opts, parse_options) allows for "quotes" around options so that an option can contain a comma (Gumble SELinux Grumble context=foo,bar Grumble). Your mount option parsing doesn't allow for this. Should it?

I thought it did, but I didn't test this explicitly. It uses the same tokenization logic that legacy NFSv4 does, so I assumed quoting would work correctly.

Should I copy the ugly logic from nfsmount.c ?

(At this point, not sure the kernel option parser would support quoting either...)

begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture: Linux Projects Group adr:;;1015 Granger Avenue;Ann Arbor;MI;48104;USA email;internet:chuck dot lever at nospam oracle dot com title:Principal Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
version:2.1
end:vcard

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#3 lore raw
In reply to Neil Brown
Quoted 15 lines · Neil Brown
Quoted 10 lines · On Tuesday September 25, [email protected] wrote:

Hi Neil-

Seven more patches for text-based mount.nfs.

I found that it is necessary to do some rather advanced lexical parsing of the mount option string in order to handle version/protocol fallback. So I've implemented a data structure that can handle the parsing requirements, and some wrapper logic to convert the mount option string to the new data structure and then convert it back to a string before calling mount(2).

Quoted 3 lines

This series introduces the new facility and makes use of it for existing text- based mount option processing (like adding "addr=" and so on). In subsequent patches I will make more use of the new facility.

Quoted 6 lines

Nice.

However: The current parsing of mount options (parse_opts, parse_options) allows for "quotes" around options so that an option can contain a comma (Gumble SELinux Grumble context=foo,bar Grumble). Your mount option parsing doesn't allow for this. Should it?

Well, amusingly, the strtok(3) man page states this in its BUGS section:
"Avoid using these functions."

The mount option parser should definitely be aware of quotes. I'll rework po_split() to handle quotes correctly, and resubmit the patches.

begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture: Linux Projects Group adr:;;1015 Granger Avenue;Ann Arbor;MI;48104;USA email;internet:chuck dot lever at nospam oracle dot com title:Principal Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
version:2.1
end:vcard

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs