diff options
author | Fabricio Voznika <fvoznika@google.com> | 2019-12-26 14:42:19 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-12-26 14:45:35 -0800 |
commit | 3c125eb21946e1f6bf8f22f4169baafb7f07bf60 (patch) | |
tree | bb61b4a97a2bdb4f882a8855772d3ab743b7f83b /pkg/sentry/vfs | |
parent | 5b9034cc18cb515f9534b61c7e4fe3c2a12985bc (diff) |
Initial procfs implementation in VFSv2
Updates #1195
PiperOrigin-RevId: 287227722
Diffstat (limited to 'pkg/sentry/vfs')
-rw-r--r-- | 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 100644 --- 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 |