我需要我的驱动程序通过phys_addr_t
调用返回ioctl
类型值。我需要通过传递arg
的结构返回此值。问题是我在这个结构中使用什么类型?
例如,假设以下结构通过arg
传递struct myStruct {
int input1;
char input2;
<type> physAddr;
} ;
someStruct.physAddr = virt_to_phys(virtAddr);
virt_to_phys
会返回phys_addr_t
,但此类型似乎不存在于任何标准包含中。所以我的问题是我需要在phys_addr_t
的用户空间中使用哪种类型?
答案 0 :(得分:3)
在完整的内核源代码下,include/linux/types.h
我们有:
#ifdef CONFIG_PHYS_ADDR_T_64BIT
typedef u64 phys_addr_t;
#else
typedef u32 phys_addr_t;
#endif
因此,为了安全起见,只需使用u64
。
请注意,此定义已从/usr/include/linux/types.h
中删除。
但是,如果您正在编写与自定义设备及其自定义驱动程序交互的自定义实用程序,则可以跳过/usr/include
版本并直接针对(例如)/usr/src/kernel/...
中的版本进行构建)。
这不适用于常规程序[当然]。但是,如果你正在做一个在实用程序和驱动程序之间有很多东西的混合系统,你可以按照自己喜欢的方式制作它。
例如,我为此编写代码的实时hidef视频编码平台。驱动程序将数据发送到设备。设备发回数据。数据被发送到实用程序/控制程序,该程序修改了数据并将其发回等等。这都是通过自定义ioctl
调用的批次完成的,因此我们可以做任何事情。必需的。
答案 1 :(得分:1)
它是32位或64位,无符号。见这里:http://lxr.free-electrons.com/source/include/linux/types.h#L161
您可能在某种程度上使用<div class="item-wrapper">
<div class="content">
Hello I am content. All that matters for this method to work is that the item wrapper has a fixed size. In my working project, the width is set to a % value, and the height to rem.
</div>
<div class="popup-title">
<span>A title for my content. Height of the content here is irrelevant.</span>
</div>
</div>
<br />
<div class="item-wrapper">
<div class="content">
Hello I am content. All that matters for this method to work is that the item wrapper has a fixed size. In my working project, the width is set to a % value, and the height to rem.
</div>
<div class="popup-title">
<p>The popup div should expand as necessary. Even if there are multiple sentences or paragraphs.</p>
<p>Just dont' make it taller than the wrapper div</p>
</div>
</div>
,但如果您最终在64位硬件上运行32位Linux系统,我会担心。