Skip to content

Expose underlying file's SyscallConn method. - #17

Merged
tonistiigi merged 2 commits into
containerd:masterfrom
cpuguy83:add_raw_conn
Jan 16, 2019
Merged

tonistiigi merged 2 commits into
containerd:masterfrom
cpuguy83:add_raw_conn

Conversation

@cpuguy83

Copy link
Copy Markdown
Member

This allows raw access to the underlying FD, enabling things like
in-kernel copy methods such as splice and tee.

This interface was added to *os.File as part of go1.12beta2.

@cpuguy83

Copy link
Copy Markdown
Member Author

ping @tonistiigi

@tonistiigi

Copy link
Copy Markdown
Member

What if the underlying file is not opened yet. Should we return a mock one that unblocks when the opened channel closes?

@cpuguy83

Copy link
Copy Markdown
Member Author

Ah just realized there is the non-blocking open.

This allows raw access to the underlying FD, enabling things like
in-kernel copy methods such as `splice` and `tee`.

This interface was added to `*os.File` as part of go1.12beta2.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@cpuguy83

Copy link
Copy Markdown
Member Author

Updated, added new tests, updated CI to test on tip so that new tests will actually run.

@cpuguy83

Copy link
Copy Markdown
Member Author

From travis run 😄

image

Comment thread raw.go Outdated
default:
}

if !f.block {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if block was true then either closed or opened has to be closed at this point. Otherwise, it wouldn't be possible to get a handle on the *fifo

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed.

Comment thread raw.go Outdated

ready := make(chan struct{})
close(ready)
return &rawConn{f: f, raw: raw, ready: ready}, nil

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why return a rawConn here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Are you saying we should just return f.file.SyscallConn in this case?

At the moment rawConn is doing some of the same things on read/write that *fifo does.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yes, if the file is already open it shouldn't matter and we can just use the file directly.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed.

Makes sure that tests for raw conns are actually run in CI.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@tonistiigi
tonistiigi merged commit 650d792 into containerd:master Jan 16, 2019
@cpuguy83
cpuguy83 deleted the add_raw_conn branch January 16, 2019 00:37
thaJeztah added a commit to thaJeztah/docker that referenced this pull request Apr 14, 2019
- containerd/fifo#17 Expose underlying file's `SyscallConn` method

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
docker-jenkins pushed a commit to docker-archive/docker-ce that referenced this pull request Apr 16, 2019
- containerd/fifo#17 Expose underlying file's `SyscallConn` method

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 9234218c50dbe68e705fe0d48df718994ba97583
Component: engine
thaJeztah added a commit to thaJeztah/cli that referenced this pull request Apr 18, 2019
- containerd/fifo#17 Expose underlying file's `SyscallConn` method

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
docker-jenkins pushed a commit to docker-archive/docker-ce that referenced this pull request Apr 18, 2019
- containerd/fifo#17 Expose underlying file's `SyscallConn` method

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: ac234326a69116c7a311911276cc4df58b2c5e0a
Component: cli
tiborvass pushed a commit to tiborvass/cli that referenced this pull request Apr 23, 2019
- containerd/fifo#17 Expose underlying file's `SyscallConn` method

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants