Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace caps.FileType with caps.BoolFile with required "path" #206

Merged
merged 10 commits into from Dec 3, 2015

Conversation

zyga
Copy link
Collaborator

@zyga zyga commented Dec 2, 2015

This branch depends on #205

This patch kills the early development "file" type and replaces it with
the "bool-file" type that can be used to describe simple GPIO pins.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
This patch ensures, via caps.Type.Validate(), that capabilities have
only attributes that are expected. The actual value of attributes is
not checked, just their presence.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
@zyga
Copy link
Collaborator Author

zyga commented Dec 2, 2015

CI failed because the corresponding part of #205 is not merged, I'll change that in a sec.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
//
// This capability type can be used to describe many boolan flags exposed
// in sysfs, including certain hardware like exported GPIO pins.
BoolFileType = &Type{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is more a question for Gustavo, not sure. But is there anything that enforces that BoolFile is a bool file (or will there be anything)? Right now it seems like I could also use it for other files in sysfs or dev. Will there be a DecimalFileType for files like /proc/sys/vm/swappiness that accept a numeric range of parameters? Just curious to understand the longer term vision better .)

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
This patch kills the early development "file" type and replaces it with
the "bool-file" type that can be used to describe simple GPIO pins.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
@chipaca
Copy link
Contributor

chipaca commented Dec 2, 2015

👍

@niemeyer
Copy link
Contributor

niemeyer commented Dec 3, 2015

This looks good, but pending work on the underlying branch.

@mvo5
Copy link
Contributor

mvo5 commented Dec 3, 2015

One question, how will this look in the future? Will the fact that its a BoolFile with only 0/1 be enforced in some way by snappy? Or is it just a label for the user/developer?

@zyga
Copy link
Collaborator Author

zyga commented Dec 3, 2015

@mvo5 In the future each type will be a standalone entity that is loaded at start-up. Types will be documented (along with the semantics for application developers). Snappy will not enforce what an application does but I hope to have a library for popular languages for working with capabilities with cleaner APIs than the roll-your-own one might look like.

chipaca added a commit that referenced this pull request Dec 3, 2015
Replace caps.FileType with caps.BoolFile with required "path"
@chipaca chipaca merged commit e9a9c95 into snapcore:master Dec 3, 2015
@zyga zyga deleted the caps-bool-type branch December 3, 2015 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants