83 Commits

Author SHA1 Message Date
Miguel Pires
aa623a49ea many: remove unused parameters and returns 2021-09-02 17:44:34 +01:00
Samuele Pedroni
f2cdb6dd92 asserts,interfaces,snap: fix imports order (according to gci) 2021-06-14 20:54:41 +02:00
James Henstridge
fb5370f1cd interfaces/dbus: fix spelling mistake in comment 2020-07-02 18:35:52 +08:00
James Henstridge
e03cf8156e interfaces/dbus: add comments as suggested in review 2020-07-02 15:24:17 +08:00
James Henstridge
69abf76f74 interfaces/dbus: reword and rewrap comment 2020-06-29 16:07:39 +08:00
James Henstridge
4d49b3114f interfaces/dbus: only copy DBus config files if snapd was reexecuted 2020-06-25 09:26:57 +08:00
James Henstridge
e3e9b1b2b5 Merge remote-tracking branch 'upstream/master' into dbus-activation-config 2020-06-22 13:48:33 +08:00
James Henstridge
906241561d interfaces/dbus: install D-Bus configuration when installing core or snapd snap on classic 2020-06-19 18:14:18 +08:00
Samuele Pedroni
7167c71307 many: rename back snap.Info.GetType to Type
to follow again golang naming conventions
2020-06-19 10:23:29 +02:00
James Henstridge
26860a9d2e dirs: add directories for D-Bus service activation files 2020-06-15 17:34:12 +08:00
Pawel Stolowski
befb1a6e74 Pass unnamed interfaces.SecurityBackendOptions argument to Initialize for backends that don't use it. 2020-02-19 09:33:24 +01:00
Pawel Stolowski
b87345b8bb Introduce interfaces.SecurityBackendOptions for passing Preseed mode flag to backends via Initialize(). Change maybeRestart to a method of snap manager. 2020-02-18 10:43:41 +01:00
Zygmunt Krynicki
ac1589cf7f osutil: rename MemoryBlob -> MemoryFileState
Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
2019-09-27 18:32:36 +02:00
Zygmunt Krynicki
7876ce6f1e osutil: generalize SyncDir with FileState interface
The directory synchronization code grew out of the desire to have a set
of files described by a glob and short, in-memory contents be reflected
to the disk in an efficient and predictable way.

Recently this code has started to be used to install icon themes shipped
by snaps. This means it may be used to coerce snapd to read arbitrary
amount of data into memory.

This address this issue by generalizing the directory sync APIs to take
an interface instead of a concrete representation of the desired file.

There are now three concrete implementations, one that keeps the content
in memory, just like before, called MemoryBlob and two new ones:
FileReference and FileContentReference. Those both refer to an existing
file for content, opening up the possibility to refer to large files.
They only differ in the treatment of file mode, either mirroring the
mode of the file being referred or using a fixed mode, respectively.

Behind the scenes the EnsureFileState function will no longer read all
of the file into memory. Instead if will use FileReference to stream it,
chunk by chunk, in an attempt to see if the file is identical to what we
expected.

On top of that, if the file is not the same and the caller has provided
a FileReference or FileContentReference, the logic that writes a new
file and replaces the original is also using streaming, again saving a
in-memory copy.

This way we can now process files of arbitrary size using fixed amount
of memory. This involves the new icon wrapper which has been switched to
use FileContentReference.

The patch contains some verbose automatic changes around the code using
maps of FileState structure to replace them with maps of FileState
interface instead.

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
2019-09-27 13:46:33 +02:00
Michael Vogt
79f121b58c interfaces: replace some "if name == "core"" with TypeOS checks 2019-07-16 14:36:46 +02:00
Pawel Stolowski
becc1c1260 Explicitly define type: snapd in apparmor/dbus backend tests. 2019-07-10 10:42:23 +02:00
Pawel Stolowski
1ba8c5f150 Use snap.TypeSnapd in snap type checks instead of snap name comparisions, where applicable. 2019-07-09 14:07:49 +02:00
Maciej Borzecki
18af6fc44e interfaces/dbus: fix unit tests when default snap mount dir is not /snap
Unit tests assumed that default snap mount directory is /snap, but did not mock
the distro. Stick to whatever is correct for the host, and use proper paths
instead.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2019-05-06 13:11:03 +02:00
Michael Vogt
8baf4809d1 interfaces: add support for the snapd snap in the dbus backend
* interfaces: add support for the snapd snap in the dbus backend

When writing the userd service files we only looked at the core
snap so far. However when we transition to the snapd snap we
also need to look there for the right files.

* interfaces: ensure setupDbusServiceForUserd prefers the snapd snap

When both the core and the snapd snap are installed we need to
prefer the snapd snap or the content of the userd service file
will flip-flop.

* interfaces: add comment about racy setupDbusServiceForUserd
2019-05-02 16:09:27 +02:00
Pawel Stolowski
3d42db9d0c Measurement -> Measurer 2019-03-13 17:19:35 +01:00
Pawel Stolowski
721196b56a Introduce an interface for Span/Timings. 2019-03-13 16:41:12 +01:00
Pawel Stolowski
a5bf6c84e4 Renaming. 2019-03-11 18:03:37 +01:00
Pawel Stolowski
79f3d87b42 Basic timings in interface manager. 2019-03-11 14:16:40 +01:00
Pawel Stolowski
53f11209fd NewConnectedPlug/NewConnectedSlot: take extra argument for static attributes. 2018-09-10 17:18:54 +02:00
Maciej Borzecki
0d78818222 interfaces: take instance name in ifacetest.InstallSnap (#5749) 2018-09-03 21:45:47 +01:00