This system call to the specified device sends control code and other data.
The appropriate device drivers in accordance with the instructions of the dwIoControlCode control code. For example, use IOCTL_DISK_GET_DRIVE_GEOMETRY can get from a physical drive structure parameters (media type, cylinder, TracksPerCylinder, number of sectors per track, etc.). Can be found on the MSDN Web site for all control codes defined, header files, and other details (see references for related links). Whether you need to input/output buffer, and how they structure and size, depend on the actual ioctl process involves equipment and operations, and invokes the specified by the dwIoControlCode OK. If the overlapped operation of pointer set to NULL, then the DeviceIoControl would block (synchronization). Otherwise, its work asynchronously. Linux function ioctlLinux you can use the ioctl — intioctl (intfildes, intrequest,/* arg */...); — To specify the device to send control information. The first parameter fildes is open () function returns the file descriptor for alleged specific devices. And the corresponding system call DeviceIOControl ioctl, the input parameters list is not fixed. It depends on what ioctl request, as well as the instructions request parameters, just as Windows function DeviceIOControl dwIoControlCode parameter. However, the migration period need to be aware of when choosing the correct request parameters, because the DeviceIOControl ioctl request of dwIoControlCode and have different values. But there is no dwIoControlCode and request explicit mapping list. Usually you can find the associated header file request parameter values defined for the selected parameter value. All control codes defined in/usr/include/{asm, linux}/* .h file. Parameter arg as specific equipment operation provides detailed command information. The data type of the arg depends on the specific control requests. This parameter can be used to send detailed commands and receive returned data. Migration example we see a from Windows to Linux migration example. This example involves from PC main IDE hard drive read SMART log. Step 1-identification device types as mentioned earlier, Linux devices are used as file. It is first necessary to describe the device's file on Linux. Only use this file to get the device control requires a handle to the device. In this example, the object is an IDE hard disk drive. Linux be described as/dev/hdb/dev/hda, etc. This example will be the migration of hard disk device pathname is \\\\.\\PhysicalDrive0. /Dev/hda is the device corresponding to the Linux name of the file. 2. the changes include the header file must # include header files for Linux (see table 3): table 3. # include header filesLinxu Security , the latest breaking news and information on security, linux, open source, firewalls
Wednesday, January 26, 2011
Migration from Windows to Linux device control applications
Labels:
[:]
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment