This repository has been archived by the owner on Sep 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fs/sysfs: MIPS: Don't translate all IOCTLs (#402)
Some IOCTLs are fixed, e.g. i2c-dev. There, we must not translate the IOCTLs. Instead, the IOCTLs are generated arch-dependent in the fs package. - fs: add IO() IOR() IOW() IORW() functions for the equivalent linux macros. - videocore: Replace ioctl magic with derived value. Beside being clearer, the comment in the code was incorrect. The message box magic is in fact 'd' = 100 = 0x64, not 0x100. - videocore: Use dynamic pointer size for ioctl.
- Loading branch information
1 parent
6a024e5
commit df7c7a4
Showing
9 changed files
with
103 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2019 The Periph Authors. All rights reserved. | ||
// Use of this source code is governed under the Apache License, Version 2.0 | ||
// that can be found in the LICENSE file. | ||
|
||
package fs | ||
|
||
// These constants, variables and functions are ported from the Linux userland | ||
// API header ioctl.h (commonly packaged at /usr/include/linux/ioctl.h which | ||
// includes /usr/include/asm-generic/ioctl.h). | ||
|
||
const ( | ||
iocNrbits uint = 8 | ||
iocTypebits uint = 8 | ||
|
||
iocNrshift uint = 0 | ||
|
||
iocTypeshift = iocNrshift + iocNrbits | ||
iocSizeshift = iocTypeshift + iocTypebits | ||
iocDirshift = iocSizeshift + iocSizebits | ||
) | ||
|
||
func ioc(dir, typ, nr, size uint) uint { | ||
return (dir << iocDirshift) | | ||
(typ << iocTypeshift) | | ||
(nr << iocNrshift) | | ||
(size << iocSizeshift) | ||
} | ||
|
||
// IO defines an ioctl with no parameters. It corresponds to _IO in the Linux | ||
// userland API. | ||
func IO(typ, nr uint) uint { | ||
return ioc(iocNone, typ, nr, 0) | ||
} | ||
|
||
// IOR defines an ioctl with read (userland perspective) parameters. It | ||
// corresponds to _IOR in the Linux userland API. | ||
func IOR(typ, nr, size uint) uint { | ||
return ioc(iocRead, typ, nr, size) | ||
} | ||
|
||
// IOW defines an ioctl with write (userland perspective) parameters. It | ||
// corresponds to _IOW in the Linux userland API. | ||
func IOW(typ, nr, size uint) uint { | ||
return ioc(iocWrite, typ, nr, size) | ||
} | ||
|
||
// IOWR defines an ioctl with both read and write parameters. It corresponds to | ||
// _IOWR in the Linux userland API. | ||
func IOWR(typ, nr, size uint) uint { | ||
return ioc(iocRead|iocWrite, typ, nr, size) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters