| 1 | //go:build !unix |
| 2 | |
| 3 | package hostfiles |
| 4 | |
| 5 | import ( |
| 6 | "context" |
| 7 | "errors" |
| 8 | "os" |
| 9 | ) |
| 10 | |
| 11 | // The publisher reads a files directory by descriptor, without following |
| 12 | // links, which needs openat. The agent runs on Linux; elsewhere this |
| 13 | // package builds, restores and reads manifests, and does not publish. |
| 14 | var errNoPublish = errors.New("hostfiles: publishing a directory is not supported on this OS") |
| 15 | |
| 16 | // restoreDirFlags is Restore's directory open off unix, where there is no |
| 17 | // FIFO to wait on. |
| 18 | const restoreDirFlags = os.O_RDONLY |
| 19 | |
| 20 | type dirHandle struct{ f *os.File } |
| 21 | |
| 22 | func openTree(path string) (*dirHandle, error) { return nil, errNoPublish } |
| 23 | func handleOf(f *os.File) (*dirHandle, error) { return nil, errNoPublish } |
| 24 | func (d *dirHandle) Close() error { return nil } |
| 25 | func (d *dirHandle) Name() string { return "" } |
| 26 | |
| 27 | func syncTree(ctx context.Context, d *dirHandle, p *Publisher, skip func(string, bool) bool, visit func(*dirHandle, string, string) error) error { |
| 28 | return errNoPublish |
| 29 | } |
| 30 | |
| 31 | func (d *dirHandle) descend(rel string) (*dirHandle, bool, error) { return nil, false, errNoPublish } |
| 32 | |
| 33 | func readStable(d *dirHandle, name string) ([]byte, uint32, fileState, error) { |
| 34 | return nil, 0, fileUnreadable, errNoPublish |
| 35 | } |
| 36 | |