interfaces/mount: improve go identifier names of mountinfo, parse optional fields #3187

Merged
merged 3 commits into from Apr 13, 2017

Conversation

Projects
None yet
2 participants
Contributor

zyga commented Apr 13, 2017

No description provided.

zyga added some commits Apr 12, 2017

interfaces/mount: spell Opts as Options
Just a readability tweak. I need to de-C-ify my naming habits.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
interfaces/mount: return pointer from ParseInfoEntry
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
interfaces/mount: parse optional fields
This patch enables "deep" parsing of optional fields. We now store those
as an array and parse individual fields.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

Yup, looks good, thank you!

@@ -53,53 +53,56 @@ func ParseInfoEntry(s string) (InfoEntry, error) {
// 36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue
// (1)(2)(3) (4) (5) (6) (7) (8) (9) (10) (11)
if len(fields) < 10 {
- return e, fmt.Errorf("incorrect number of fields, expected at least 10 but found %d", len(fields))
+ return nil, fmt.Errorf("incorrect number of fields, expected at least 10 but found %d", len(fields))
@stolowski

stolowski Apr 13, 2017

Contributor

Ah, good catch, we apparently missed those in previous PR :}

@zyga

zyga Apr 13, 2017

Contributor

No, before those were not pointers so I returned an empty object. In this branch, because I added an array into the structure, I now return a pointer to entry.

@zyga zyga merged commit a9dc415 into snapcore:master Apr 13, 2017

6 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
xenial-amd64 autopkgtest finished (success)
Details
xenial-i386 autopkgtest finished (success)
Details
xenial-ppc64el autopkgtest finished (success)
Details
yakkety-amd64 autopkgtest finished (success)
Details
zesty-amd64 autopkgtest finished (success)
Details

@zyga zyga deleted the zyga:mountinfo-3 branch Apr 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment