package sysfs

import (
	

	experimentalsys 
)

type ReadFS struct {
	experimentalsys.FS
}

// OpenFile implements the same method as documented on sys.FS
func ( *ReadFS) ( string,  experimentalsys.Oflag,  fs.FileMode) (experimentalsys.File, experimentalsys.Errno) {
	// Mask the mutually exclusive bits as they determine write mode.
	switch  & (experimentalsys.O_RDONLY | experimentalsys.O_WRONLY | experimentalsys.O_RDWR) {
	case experimentalsys.O_WRONLY, experimentalsys.O_RDWR:
		// Return the correct error if a directory was opened for write.
		if &experimentalsys.O_DIRECTORY != 0 {
			return nil, experimentalsys.EISDIR
		}
		return nil, experimentalsys.ENOSYS
	default: // sys.O_RDONLY (integer zero) so we are ok!
	}

	,  := .FS.OpenFile(, , )
	if  != 0 {
		return nil, 
	}
	return &readFile{}, 0
}

// Mkdir implements the same method as documented on sys.FS
func ( *ReadFS) ( string,  fs.FileMode) experimentalsys.Errno {
	return experimentalsys.EROFS
}

// Chmod implements the same method as documented on sys.FS
func ( *ReadFS) ( string,  fs.FileMode) experimentalsys.Errno {
	return experimentalsys.EROFS
}

// Rename implements the same method as documented on sys.FS
func ( *ReadFS) (,  string) experimentalsys.Errno {
	return experimentalsys.EROFS
}

// Rmdir implements the same method as documented on sys.FS
func ( *ReadFS) ( string) experimentalsys.Errno {
	return experimentalsys.EROFS
}

// Link implements the same method as documented on sys.FS
func ( *ReadFS) (,  string) experimentalsys.Errno {
	return experimentalsys.EROFS
}

// Symlink implements the same method as documented on sys.FS
func ( *ReadFS) (,  string) experimentalsys.Errno {
	return experimentalsys.EROFS
}

// Unlink implements the same method as documented on sys.FS
func ( *ReadFS) ( string) experimentalsys.Errno {
	return experimentalsys.EROFS
}

// Utimens implements the same method as documented on sys.FS
func ( *ReadFS) ( string, ,  int64) experimentalsys.Errno {
	return experimentalsys.EROFS
}

// compile-time check to ensure readFile implements api.File.
var _ experimentalsys.File = (*readFile)(nil)

type readFile struct {
	experimentalsys.File
}

// Write implements the same method as documented on sys.File.
func ( *readFile) ([]byte) (int, experimentalsys.Errno) {
	return 0, .writeErr()
}

// Pwrite implements the same method as documented on sys.File.
func ( *readFile) ([]byte, int64) ( int,  experimentalsys.Errno) {
	return 0, .writeErr()
}

// Truncate implements the same method as documented on sys.File.
func ( *readFile) (int64) experimentalsys.Errno {
	return .writeErr()
}

// Sync implements the same method as documented on sys.File.
func ( *readFile) () experimentalsys.Errno {
	return experimentalsys.EBADF
}

// Datasync implements the same method as documented on sys.File.
func ( *readFile) () experimentalsys.Errno {
	return experimentalsys.EBADF
}

// Utimens implements the same method as documented on sys.File.
func ( *readFile) (int64, int64) experimentalsys.Errno {
	return experimentalsys.EBADF
}

func ( *readFile) () experimentalsys.Errno {
	if ,  := .IsDir();  != 0 {
		return 
	} else if  {
		return experimentalsys.EISDIR
	}
	return experimentalsys.EBADF
}