<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>printk &#8211; richliu&#039;s blog</title>
	<atom:link href="https://blog.richliu.com/tag/printk/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.richliu.com</link>
	<description>Linux, 工作, 生活, 家人</description>
	<lastBuildDate>Tue, 09 Mar 2010 05:56:14 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>
	<item>
		<title>Linux kernel printk 參數.</title>
		<link>https://blog.richliu.com/2010/03/09/874/linux-kernel-printk-%e5%8f%83%e6%95%b8/</link>
					<comments>https://blog.richliu.com/2010/03/09/874/linux-kernel-printk-%e5%8f%83%e6%95%b8/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Tue, 09 Mar 2010 05:56:14 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[linux kernel]]></category>
		<category><![CDATA[printk]]></category>
		<guid isPermaLink="false">http://blog.richliu.com/?p=874</guid>

					<description><![CDATA[<p>Kernek printk 參數預設如下 If variable is of Type, use printk [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2010/03/09/874/linux-kernel-printk-%e5%8f%83%e6%95%b8/">Linux kernel printk 參數.</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Kernek printk 參數預設如下</p>
<p><span id="more-874"></span></p>
<blockquote><p>If variable is of Type,         use printk format specifier:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
                int                     %d or %x<br />
                unsigned int            %u or %x<br />
                long                    %ld or %lx<br />
                unsigned long           %lu or %lx<br />
                long long               %lld or %llx<br />
                unsigned long long      %llu or %llx<br />
                size_t                  %zu or %zx<br />
                ssize_t                 %zd or %zx<br />
Raw pointer value SHOULD be printed with %p.</p>
<p>u64 SHOULD be printed with %llu/%llx, (unsigned long long):<br />
        printk(&#8220;%llu&#8221;, (unsigned long long)u64_var);<br />
s64 SHOULD be printed with %lld/%llx, (long long):<br />
        printk(&#8220;%lld&#8221;, (long long)s64_var);</p></blockquote>
<p>追了一下 kernel </p>
<p>難道就這樣了嗎?<br />
2.26.29 發現有加一個新參數<br />
%pM : 印出 MAC Address<br />
仔細看了一下, printk 用 %p 做為 extension </p>
<blockquote><p>&#8216;F&#8217; For symbolic function descriptor pointers with offset<br />
&#8216;f&#8217; For simple symbolic function names without offset<br />
&#8216;S&#8217; For symbolic direct pointers with offset<br />
&#8216;s&#8217; For symbolic direct pointers without offset<br />
&#8216;R&#8217; For decoded struct resource, e.g., [mem 0x0-0x1f 64bit pref]<br />
&#8216;r&#8217; For raw struct resource, e.g., [mem 0x0-0x1f flags 0x201]<br />
&#8216;M&#8217; For a 6-byte MAC address, it prints the address in the<br />
    usual colon-separated hex notation<br />
&#8216;m&#8217; For a 6-byte MAC address, it prints the hex address without colons<br />
&#8216;MF&#8217; For a 6-byte MAC FDDI address, it prints the address<br />
    with a dash-separated hex notation<br />
&#8216;I&#8217; [46] for IPv4/IPv6 addresses printed in the usual way<br />
    IPv4 uses dot-separated decimal without leading 0&#8217;s (1.2.3.4)<br />
    IPv6 uses colon separated network-order 16 bit hex with leading 0&#8217;s<br />
&#8216;i&#8217; [46] for &#8216;raw&#8217; IPv4/IPv6 addresses<br />
    IPv6 omits the colons (01020304&#8230;0f)<br />
    IPv4 uses dot-separated decimal with leading 0&#8217;s (010.123.045.006)<br />
&#8216;[Ii]4[hnbl]&#8217; IPv4 addresses in host, network, big or little endian order<br />
&#8216;I6c&#8217; for IPv6 addresses printed as specified by<br />
    http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-00<br />
&#8216;U&#8217; For a 16 byte UUID/GUID, it prints the UUID/GUID in the form<br />
    &#8220;xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&#8221;<br />
    Options for %pU are:<br />
      b big endian lower case hex (default)<br />
      B big endian UPPER case hex<br />
      l little endian lower case hex<br />
      L little endian UPPER case hex<br />
        big endian output byte order is:<br />
          [0][1][2][3]-[4][5]-[6][7]-[8][9]-[10][11][12][13][14][15]<br />
        little endian output byte order is:<br />
          [3][2][1][0]-[5][4]-[7][6]-[8][9]-[10][11][12][13][14][15]<br />
Note: The difference between &#8216;S&#8217; and &#8216;F&#8217; is that on ia64 and ppc64<br />
function pointers are really function descriptors, which contain a<br />
pointer to the real address.
</p></blockquote>
<p>還不錯用. 以後可以直接用了&#8230;..</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2010/03/09/874/linux-kernel-printk-%e5%8f%83%e6%95%b8/">Linux kernel printk 參數.</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2010/03/09/874/linux-kernel-printk-%e5%8f%83%e6%95%b8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
