diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-12-26 22:57:46 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-12-26 22:57:46 +0000 |
commit | a69bbf7322da8463898947dce0d9ce840551efa4 (patch) | |
tree | 446d13b4d3258e6454e93617bcd0750ee3038394 /pkg/sentry/vfs | |
parent | 4961ac2da8dc89adc80339420d65b12f6f687aed (diff) | |
parent | 3c125eb21946e1f6bf8f22f4169baafb7f07bf60 (diff) |
Merge release-20191213.0-54-g3c125eb (automated)
Diffstat (limited to 'pkg/sentry/vfs')
-rwxr-xr-x | pkg/sentry/vfs/file_description_impl_util.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/sentry/vfs/file_description_impl_util.go b/pkg/sentry/vfs/file_description_impl_util.go index 3df49991c..de782e577 100755 --- a/pkg/sentry/vfs/file_description_impl_util.go +++ b/pkg/sentry/vfs/file_description_impl_util.go @@ -199,6 +199,17 @@ type DynamicBytesSource interface { Generate(ctx context.Context, buf *bytes.Buffer) error } +// StaticData implements DynamicBytesSource over a static string. +type StaticData struct { + Data string +} + +// Generate implements DynamicBytesSource. +func (s *StaticData) Generate(ctx context.Context, buf *bytes.Buffer) error { + buf.WriteString(s.Data) + return nil +} + // SetDataSource must be called exactly once on fd before first use. func (fd *DynamicBytesFileDescriptionImpl) SetDataSource(data DynamicBytesSource) { fd.data = data |