{"id":406,"date":"2023-07-26T14:02:20","date_gmt":"2023-07-26T06:02:20","guid":{"rendered":"https:\/\/blog.taiyang.space\/?p=406"},"modified":"2023-07-26T14:02:20","modified_gmt":"2023-07-26T06:02:20","slug":"l10-%e9%80%9a%e8%bf%87%e6%96%87%e4%bb%b6%e7%b3%bb%e7%bb%9f%e4%bd%bf%e7%94%a8%e7%a3%81%e7%9b%98","status":"publish","type":"post","link":"https:\/\/blog.taiyang.space\/?p=406","title":{"rendered":"L10-\u901a\u8fc7\u6587\u4ef6\u7cfb\u7edf\u4f7f\u7528\u78c1\u76d8"},"content":{"rendered":"<p>Linux0.11 \u901a\u8fc7\u6587\u4ef6\u6765\u4f7f\u7528\u78c1\u76d8\u7684\u8fc7\u7a0b\u6d89\u53ca\u5230\u4e86\u8bb8\u591a\u6982\u5ff5\uff0c\u4ee5\u53ca\u6982\u5ff5\u4e4b\u95f4\u590d\u6742\u9519\u4e71\u7684\u5173\u7cfb\uff0c\u5bb9\u6613\u8ba9\u4eba\u56f0\u60d1\uff0c\u672c\u7ae0\u4e3b\u8981\u662f\u5bf9 Linux0.11 \u901a\u8fc7\u6587\u4ef6\u6765\u4f7f\u7528\u78c1\u76d8\u7684\u8fc7\u7a0b\u8fdb\u884c\u68b3\u7406\u3002\u300aLinux\u5185\u6838\u5b8c\u5168\u5256\u6790\u2014\u2014\u57fa\u4e8e0.12\u5185\u6838\u300b\u7684\u7b2c12\u7ae0\uff1a\u6587\u4ef6\u7cfb\u7edf\uff0c\u5bf9\u8fd9\u4e9b\u6982\u5ff5\u53ca\u5176\u4e4b\u95f4\u7684\u5173\u7cfb\u8fdb\u884c\u4e86\u76f8\u5f53\u7cbe\u5f69\u7684\u5206\u6790\uff0c\u63a8\u8350\u5927\u5bb6\u9605\u8bfb<\/p>\n<h2 id=\"1\u4ece\u751f\u78c1\u76d8\u5230\u6587\u4ef6\">1\u3001\u4ece\u751f\u78c1\u76d8\u5230\u6587\u4ef6<\/h2>\n<p>\u4e0a\u4e00\u7ae0\u5206\u6790\u4e86\u751f\u78c1\u76d8\u7684\u4f7f\u7528\u65b9\u6cd5\uff0c\u5373\u901a\u8fc7\u76d8\u5757\u53f7\u4f7f\u7528\u78c1\u76d8\u3002\u4f46\u8bb8\u591a\u4eba\u8fde\u6247\u533a\u90fd\u4e0d\u77e5\u9053\u662f\u4ec0\u4e48? \u8981\u6c42\u4ed6\u4eec\u6839\u636e\u76d8\u5757\u53f7\u6765\u8bbf\u95ee\u78c1\u76d8\u663e\u7136\u662f\u4e0d\u5408\u9002\u7684\u3002\u6211\u4eec\u9700\u8981\u5728\u76d8\u5757\u4e0a\u5f15\u5165\u66f4\u9ad8\u4e00\u5c42\u6b21\u7684\u62bd\u8c61\u6982\u5ff5\u2014\u2014\u6587\u4ef6\uff0c\u4eba\u4eec\u901a\u8fc7\u6587\u4ef6\u6765\u8bbf\u95ee\u78c1\u76d8\u4e2d\u7684\u5b57\u7b26\u5e8f\u5217\u5c31\u4f1a\u611f\u89c9\u81ea\u7136\u591a\u4e86\u3002\u7528\u6237\u5728\u6253\u5f00\u4e00\u4e2a\u6587\u4ef6\u524d\uff0c\u5148\u5411\u64cd\u4f5c\u7cfb\u7edf\u63d0\u4f9b\u8be5\u6587\u4ef6\u7684\u6587\u4ef6\u540d\uff0c\u7136\u540e\u64cd\u4f5c\u7cfb\u7edf\u6839\u636e\u6587\u4ef6\u540d\u627e\u5230\u6587\u4ef6\u5b58\u653e\u7684\u76d8\u5757\u4f4d\u7f6e\uff0c\u6700\u540e\u64cd\u4f5c\u7cfb\u7edf\u5c06\u6587\u4ef6\u5185\u5bb9\uff08\u5b57\u7b26\u5e8f\u5217\uff09\u663e\u793a\u5728\u7528\u6237\u7684\u773c\u524d\u3002<\/p>\n<p>\u81f3\u6b64\u7528\u6237\u773c\u4e2d\u7684\u6587\u4ef6\u5c31\u53d8\u6210\u4e86\u4e00\u4e32\u5b57\u7b26\u5e8f\u5217\uff0c\u7528\u6237\u53ef\u4ee5\u968f\u610f\u8bbf\u95ee\u4fee\u6539\u8fd9\u4e32\u5b57\u7b26\u5e8f\u5217\uff0c\u5e76\u4e14\u7528\u6237\u4e5f\u4e0d\u7528\u53bb\u5173\u5fc3\u8fd9\u4e32\u5b57\u7b26\u5e8f\u5217\u662f\u600e\u4e48\u5b58\u653e\u7684\u3002\u800c\u64cd\u4f5c\u7cfb\u7edf\u773c\u4e2d\u7684\u6587\u4ef6\u5c31\u53d8\u6210\u4e86\u5b57\u7b26\u5e8f\u5217\u5230\u76d8\u5757\u96c6\u5408\u7684\u6620\u5c04\uff0c\u5373\u6587\u4ef6\u5efa\u7acb\u8d77\u4e86\u5b57\u7b26\u5e8f\u5217\u5230\u76d8\u5757\u96c6\u5408\u7684\u6620\u5c04\u5173\u7cfb\u3002<\/p>\n<h2 id=\"2\u6587\u4ef6\u540d\u4e0e\u76d8\u5757\u7684\u6620\u5c04\">2\u3001\u6587\u4ef6\u540d\u4e0e\u76d8\u5757\u7684\u6620\u5c04<\/h2>\n<p>\u5f15\u5165\u6587\u4ef6\u662f\u5bf9\u4f7f\u7528\u78c1\u76d8\u7684\u62bd\u8c61\u3002\u4e3a\u4e86\u5b9e\u73b0\u8fd9\u5c42\u62bd\u8c61\uff0c\u64cd\u4f5c\u7cfb\u7edf\u9700\u8981\u6839\u636e\u7528\u6237\u63d0\u4f9b\u7684\u6587\u4ef6\u540d\u627e\u5230\u6587\u4ef6\u5b58\u653e\u7684\u76d8\u5757\u4f4d\u7f6e\uff0c\u56e0\u6b64\u64cd\u4f5c\u7cfb\u7edf\u9700\u8981\u5efa\u7acb\u4e00\u4e2a\u80fd\u591f\u5b8c\u6210\u4ece\u6587\u4ef6\u540d\u5230\u76d8\u5757\u6620\u5c04\u7684\u6570\u636e\u7ed3\u6784\u3002\u6682\u4e14\u628a\u8fd9\u4e2a\u6570\u636e\u7ed3\u6784\u53eb\u505a <strong>FCB<\/strong> \u5427\u3002<\/p>\n<h3 id=\"21-\u8fde\u7eed\u7ed3\u6784\">2.1 \u8fde\u7eed\u7ed3\u6784<\/h3>\n<p>\u8fde\u7eed\u7ed3\u6784\u662f\u4e00\u79cd\u6700\u81ea\u7136\u60f3\u5230\u7684\u7ed3\u6784\uff0c\u5c31\u50cf\u9700\u8981\u5b58\u653e\u4e00\u5806\u6570\u636e\u7684\u65f6\u5019\uff0c\u6211\u4eec\u9996\u5148\u4f1a\u60f3\u5230\u7528\u6570\u7ec4\u662f\u4e00\u6837\u7684\u3002\u987a\u5e8f\u7ed3\u6784\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202307261250596.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p>\u4ece\u56fe\u4e2d\u53ef\u4ee5\u770b\u51fa\u7528\u6237\u8981\u6253\u5f00\u6587\u4ef6\u540d\u4e3a test.c \u7684\u6587\u4ef6\uff0c\u8be5\u6587\u4ef6\u5b58\u653e\u57286\u30017\u30018\u53f7\u76d8\u5757\uff0c\u5171\u5360\u75283\u4e2a\u76d8\u5757\u3002\u5efa\u7acb\u8fd9\u6837\u7684\u7ed3\u6784\u4f53\u4e5f\u4e0d\u590d\u6742\uff0c\u8fd9\u91cc\u4e0d\u518d\u591a\u8bf4\u3002<\/p>\n<h3 id=\"22-\u7d22\u5f15\u7ed3\u6784\">2.2 \u7d22\u5f15\u7ed3\u6784<\/h3>\n<p>\u540c\u6837\u662f\u6253\u5f00 test.c \uff0c\u7d22\u5f15\u7ed3\u6784\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202307261250655.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p>\u7d22\u5f15\u7ed3\u6784\u9700\u8981\u5728\u78c1\u76d8\u4e2d\u7559\u51fa\u4e00\u4e2a\u5355\u72ec\u7684\u7d22\u5f15\u5757\uff0c\u7528\u4e8e\u5b58\u653e\u7d22\u5f15\uff0c\u800c\u8fd9\u4e9b\u7d22\u5f15\u6307\u5411\u7684\u5c31\u662f\u6587\u4ef6\u5b58\u653e\u5728\u78c1\u76d8\u4e2d\u7684\u76d8\u5757\u4f4d\u7f6e\u3002\u4ece\u56fe\u4e2d\u53ef\u4ee5\u770b\u51fa test.c \u6587\u4ef6\u6309\u987a\u5e8f\u5b58\u653e\u5728\u78c1\u76d8\u7684\u7b2c9\u53f7\u300117\u53f7\u30011\u53f7\u300110\u53f7\u76d8\u5757\u4e2d\u3002\u5efa\u7acb\u8fd9\u6837\u7684FCB\u7684\u7ed3\u6784\u4f53\u540c\u6837\u4e5f\u4e0d\u590d\u6742\u3002<\/p>\n<h3 id=\"23-\u591a\u7ea7\u7d22\u5f15\u7ed3\u6784\">2.3 \u591a\u7ea7\u7d22\u5f15\u7ed3\u6784<\/h3>\n<p>\u591a\u7ea7\u7d22\u5f15\u7ed3\u6784\u662f Linux0.11 \u5b9e\u9645\u4f7f\u7528\u7684\u4e00\u79cd\u7ed3\u6784\u3002\u8fd9\u91cc\u9996\u5148\u9700\u8981\u4ecb\u7ecd\u4e00\u4e2a\u201c\u9f0e\u9f0e\u5927\u540d\u201d\u7684\u6570\u636e\u7ed3\u6784\u2014\u2014inode\uff08index node\uff09\u3002inode \u662f\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u5b9a\u4e49\u7684\u4e00\u4e2a\u7ed3\u6784\u4f53\uff0cinode \u4e2d\u6709\u4e00\u4e2a\u6570\u7ec4\u6210\u5458 <code>short i_zone[9]<\/code>\u91cc\u9762\u8bb0\u5f55\u4e86\u6587\u4ef6\u6240\u5360\u7528\u7684\u76d8\u5757\u53f7\u7684\u4fe1\u606f\uff0c\u64cd\u4f5c\u7cfb\u7edf\u4f1a\u5c06 inode \u7684\u524d32\u4e2a\u5b57\u8282\u5b58\u653e\u78c1\u76d8\u4e2d, <code>short i_zone[9]<\/code>\u5c31\u5728\u8fd932\u4e2a\u5b57\u8282\u4e4b\u4e2d\uff1a<img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202307261250648.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p>\u4ece\u56fe2.3\u4e2d\u53ef\u4ee5\u770b\u51fa\uff0ci_zone[0 &#8211; 6] \u4e3a\u76f4\u63a5\u5757\u53f7\uff0c\u5b83\u4eec\u76f4\u63a5\u6307\u5411\u6570\u636e\u5757\uff08\u8fd9\u91cc\u6211\u4eec\u6682\u65f6\u628a\u6570\u636e\u5757\u7406\u89e3\u4e3a\u771f\u6b63\u5b58\u653e\u7740\u6587\u4ef6\u6570\u636e\u7684\u76d8\u5757\u5427\uff0c\u628a\u6570\u636e\u5757\u4e0e\u7d22\u5f15\u5757\u533a\u5206\u5f00\u6765\uff09\u3002i_zone[7] \u4e3a\u4e00\u6b21\u95f4\u63a5\u5757\u53f7\uff0c\u5b83\u6307\u5411\u4e86\u4e00\u4e2a\u4e00\u6b21\u95f4\u63a5\u5757\uff08\u6ca1\u9519\u5c31\u662f\u7d22\u5f15\u7ed3\u6784\u4e2d\u7684\u90a3\u4e2a\u7d22\u5f15\u5757\uff09\uff0c\u4e00\u6b21\u95f4\u63a5\u5757\u53c8\u6307\u5411\u4e86\u4e00\u5806\u6570\u636e\u5757\u3002\u53ef\u4ee5\u731c\u4e00\u4e0b\u4e00\u6b21\u95f4\u63a5\u5757\u53ef\u4ee5\u5b58\u653e\u591a\u5c11\u4e2a\u7d22\u5f15\u5462\uff1f\u56e0\u4e3a i_zone[n] \u4e3a short \u7c7b\u578b\u53602\u5b57\u8282\uff0c\u800c\u4e00\u4e2a\u76d8\u5757\u7684\u5927\u5c0f\u4e3a 1kB\uff0c \u56e0\u6b64\u4e00\u6b21\u95f4\u63a5\u5757\u53ef\u4ee5\u5b58\u653e 512 \u4e2a\u7d22\u5f15\u3002i_zone[8] \u4e3a\u4e8c\u6b21\u95f4\u63a5\u5757\u53f7\uff0c\u539f\u7406\u4e0e i_zone[7] \u5dee\u4e0d\u591a\uff0c\u53ea\u4e0d\u8fc7\u591a\u4e86\u4e00\u7ea7\u3002\u5f53\u6587\u4ef6\u7684\u5927\u5c0f\u5c0f\u4e8e7\u4e2a\u76d8\u5757\u65f6\uff0c\u53ea\u9700\u8981\u4f7f\u7528 i_zone[0 &#8211; 6] \u5c31\u597d\uff0c\u82e5\u5927\u4e8e\u5219\u9700\u8981\u4f7f\u7528 i_zone[7] \u751a\u81f3 i_zone[8] \u4e86\u3002\u8fd9\u6837\u6211\u4eec\u5c31\u53ef\u4ee5\u8868\u793a\u5f88\u5927\u7684\u6587\u4ef6\u4e86\uff0c\u5e76\u4e14\u5bf9\u4e8e\u5f88\u5c0f\u7684\u6587\u4ef6\u4e5f\u53ef\u4ee5\u9ad8\u6548\u8bbf\u95ee\uff0c\u5bf9\u4e8e\u4e2d\u7b49\u5927\u5c0f\u7684\u6587\u4ef6\u8bbf\u95ee\u901f\u5ea6\u4e5f\u4e0d\u6162\u3002\u8fd9\u91cc\u53ea\u662f\u7c97\u6d45\u7684\u4ecb\u7ecd\u4e86\u4e00\u4e0b inode \uff0c\u5173\u4e8e inode \u66f4\u591a\u7684\u4ecb\u7ecd\u53ef\u4ee5\u53c2\u8003\u300aLinux\u5185\u6838\u5b8c\u5168\u5256\u6790\u2014\u2014\u57fa\u4e8e0.12\u5185\u6838\u300b\u7684\u7b2c12\u7ae0\uff1a\u6587\u4ef6\u7cfb\u7edf\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u7684\u786e i_zone[ ] \u5c31\u5df2\u7ecf\u5f62\u6210\u591a\u7ea7\u7d22\u5f15\u7ed3\u6784\u4e86\uff0c\u4f46\u6211\u4eec\u9700\u8981\u901a\u8fc7\u6587\u4ef6\u540d\u6765\u83b7\u53d6\u6587\u4ef6\u3002\u6211\u4eec\u7684 FCB \u8fd8\u6ca1\u6709\u5efa\u7acb\u3002\u591a\u7ea7\u7d22\u5f15\u7ed3\u6784\u5df2\u7ecf\u6709\u4e86\uff0c\u6211\u4eec\u53ea\u9700\u8981\u628a\u591a\u7ea7\u7d22\u5f15\u7ed3\u6784\u548c\u6587\u4ef6\u540d\u5173\u8054\u8d77\u6765\uff0c\u6211\u4eec\u7684 FCB \u5c31\u5efa\u597d\u4e86\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202307261250599.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p>\u628a\u4e0a\u56fe\u505a\u6210\u7ed3\u6784\u4f53<\/p>\n<pre><code class=\"language-c\" lang=\"c\">struct dir_entry {\n\tunsigned short inode;     \/\/ i\u8282\u70b9\u53f7\n\tchar name[NAME_LEN];      \/\/ \u6587\u4ef6\u540d\n};\n<\/code><\/pre>\n<p><strong>\u6ca1\u9519\uff0c\u8fd9\u4e2a\u5c31\u662f\u201c\u76ee\u5f55\u9879\u201d\u7ed3\u6784\u4f53\uff01<\/strong><\/p>\n<p>\u518d\u6b21\u56de\u987e\u4e00\u4e0b\u57fa\u4e8e\u591a\u7ea7\u7d22\u5f15\u7ed3\u6784\u901a\u8fc7\u6587\u4ef6\u4f7f\u7528\u78c1\u76d8\u7684\u8fc7\u7a0b\u3002\u7528\u6237\u5728\u6253\u5f00\u4e00\u4e2a\u6587\u4ef6\u524d\uff0c\u5148\u5411\u64cd\u4f5c\u7cfb\u7edf\u63d0\u4f9b\u8be5\u6587\u4ef6\u7684\u6587\u4ef6\u540d\uff0c\u7136\u540e\u64cd\u4f5c\u7cfb\u7edf\u6839\u636e\u6587\u4ef6\u540d\u627e\u6587\u4ef6\u5bf9\u5e94\u7684\u76ee\u5f55\u9879\u3002\u76ee\u5f55\u9879\u4e2d\u5b58\u653e\u7740 i \u8282\u70b9\u53f7\uff0c\u56e0\u6b64\u64cd\u4f5c\u7cfb\u7edf\u53ef\u4ee5\u4ece\u78c1\u76d8\u4e2d\u5c06\u6587\u4ef6\u7684 inode \u8bfb\u5165\u5185\u5b58\uff0c\u7136\u540e\u901a\u8fc7 inode \u4e2d\u7684 i_zone[] \u5b57\u6bb5\u627e\u5230\u6587\u4ef6\u5bf9\u5e94\u7684\u76d8\u5757\u53f7\uff0c\u6700\u540e\u901a\u8fc7\u76d8\u5757\u53f7\u8bbf\u95ee\u78c1\u76d8\uff0c\u83b7\u53d6\u6587\u4ef6\u5185\u5bb9\uff0c\u5e76\u5c06\u6587\u4ef6\u5185\u5bb9\u663e\u793a\u5728\u7528\u6237\u773c\u524d\u3002<\/p>\n<h2 id=\"3\u6587\u4ef6\u78c1\u76d8\u7684\u5b9e\u73b0\">3\u3001\u6587\u4ef6\u78c1\u76d8\u7684\u5b9e\u73b0<\/h2>\n<p>\u672c\u8282\u4ee5\u5bf9\u6587\u4ef6\u8fdb\u884c\u5199\u64cd\u4f5c\u4e3a\u7ebf\u7d22\uff0c\u5206\u6790 Linux0.11 \u901a\u8fc7\u6587\u4ef6\u4f7f\u7528\u78c1\u76d8\u90e8\u5206\u7a0b\u5e8f\u3002<\/p>\n<p><strong>\uff081\uff09\u8c03\u7528 open() \u6253\u5f00\u6587\u4ef6<\/strong><\/p>\n<p>\u5728\u8bfb\u5199\u4e00\u4e2a\u6587\u4ef6\u524d\uff0c\u90fd\u9700\u8981\u5148\u8c03\u7528 open() \u6253\u5f00\u6587\u4ef6\uff0copen() \u7684\u6838\u5fc3\u662f\u6839\u636e\u6587\u4ef6\u540d\uff0c\u627e\u5230\u5bf9\u5e94\u7684 inode \uff0c\u5e76\u8bfb\u5165 inode\u3002<\/p>\n<pre><code class=\"language-c\" lang=\"c\">int open(const char * filename, int flag, ...)\n<\/code><\/pre>\n<p>\u5185\u6838\u4f7f\u7528\u6587\u4ef6\u7ed3\u6784 file \uff0c\u6587\u4ef6\u8868 file_table\uff0c\u548c\u5185\u5b58\u4e2d i \u8282\u70b9\u8868 inode_table \u6765\u7ba1\u7406\u5bf9\u6587\u4ef6\u7684\u8bbf\u95ee\u64cd\u4f5c\u3002open() \u4f1a\u627e\u51fa<code>inode_table[NR_INODE]<\/code>\u7684\u4e00\u4e2a\u7a7a\u95f2\u9879\uff0c\u5e76\u5c06\u8bfb\u5165\u7684 inode \u5b58\u653e\u5728\u7a7a\u95f2\u9879\u4e2d \u3002\u7136\u540e\u5728\u627e\u51fa <code>file_table[NR_FILE]<\/code>\u7684\u7a7a\u95f2\u9879\uff0c\u586b\u5145\u8be5\u7a7a\u95f2\u9879\uff0c\u5e76\u8ba9\u7a7a\u95f2\u9879\u7684 f_inode \u5b57\u6bb5\u6307\u5411\u8bfb\u5165\u7684 inode \u3002\u6700\u540e\u5bfb\u627e <code>filp[NR_OPEN]<\/code>\u4e2d\u7684\u7a7a\u95f2\u9879\uff0c\u5e76\u8ba9\u8be5\u7a7a\u95f2\u9879\u6307\u5411\u524d\u9762\u521a\u586b\u5145\u597d\u7684<code>file_table[NR_FILE]<\/code> \u4e2d\u7684\u90a3\u4e2a\u9879\u3002open() \u7684\u8fd4\u56de\u503c\u5c31\u662f\u521a\u521a\u90a3\u4e2a <code>filp[NR_OPEN]<\/code>\u7684\u7a7a\u95f2\u9879\u7684\u7d22\u5f15\u3002<\/p>\n<pre><code class=\"language-c\" lang=\"c\">struct file {\n\tunsigned short f_mode;\n\tunsigned short f_flags;\n\tunsigned short f_count;\n\tstruct m_inode * f_inode; \/\/ \u6587\u4ef6 inode\n\toff_t f_pos;              \/\/ \u6587\u4ef6\u5f53\u524d\u8bfb\u5199\u6307\u9488\u4f4d\u7f6e\uff08\u6587\u4ef6\u5149\u6807\u4f4d\u7f6e\uff09\n};\nstruct task_struct {\n......\n\tstruct file * filp[NR_OPEN];       \/\/ PCB\u4e2d\u7684\u6587\u4ef6\u6307\u9488\u6570\u7ec4\uff0c\u5176\u4e2d NR_OPEN = 20\n......\n};\nstruct file file_table[NR_FILE];       \/\/ \u6587\u4ef6\u8868\uff0cNR_FILE = 64\nstruct m_inode inode_table[NR_INODE];  \/\/ i \u8282\u70b9\u8868\uff0c NR_INODE = 32\n<\/code><\/pre>\n<p>\u8fdb\u7a0b\u6253\u5f00\u6587\u4ef6\u65f6\u4f7f\u7528\u7684\u5185\u6838\u6570\u636e\u7ed3\u6784\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202307261250666.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p>\u5230\u6b64 open() \u7684\u5de5\u4f5c\u5c31\u7ed3\u675f\u4e86\u3002<\/p>\n<p><strong>\uff082\uff09\u8c03\u7528 write()\u5411\u6587\u4ef6\u5199<\/strong><\/p>\n<p>\u6839\u636e\u7cfb\u7edf\u8c03\u7528\uff0c\u5b9e\u9645\u4e0a write() \u7684\u529f\u80fd\u65f6\u901a\u8fc7 sys_write() \u5b9e\u73b0\u7684\u3002sys_write() \u5c06\u5229\u7528\u524d\u9762 open() \u7684\u8fd4\u56de\u503c\uff0c\u5f97\u5230\u6587\u4ef6\u7684 inode\u3002<\/p>\n<pre><code class=\"language-c\" lang=\"c\">\/\/ \u53c2\u6570 fd \u662f open() \u7684\u8fd4\u56de\u503c\nint sys_write(unsigned int fd,char * buf,int count)\n{\n\tstruct file * file;\n\tstruct m_inode * inode;\n\t\n\tif (fd&gt;=NR_OPEN || count &lt;0 || !(file=current-&gt;filp[fd]))   \/\/\u83b7\u53d6 file\n\t\treturn -EINVAL;\n\tif (!count)\n\t\treturn 0;\n\tinode=file-&gt;f_inode;   \/\/ \u83b7\u53d6\u6587\u4ef6\u7684 inode \n    \n......\n\n\tif (S_ISREG(inode-&gt;i_mode))       \/\/ \u5224\u65ad\u6587\u4ef6\u7c7b\u578b\u662f\u5426\u662f\u666e\u901a\u6587\u4ef6\n\t\treturn file_write(inode,file,buf,count);   \/\/ \u8be5\u6587\u4ef6\u4e3a\u666e\u901a\u6587\u4ef6\uff0c\u8c03\u7528 file_write() \u8fdb\u884c\u5904\u7406\n\tprintk(\"(Write)inode-&gt;i_mode=%06o\\n\\r\",inode-&gt;i_mode);\n\treturn -EINVAL;\n}\n<\/code><\/pre>\n<p>sys_write() \u5e76\u6ca1\u6709\u76f4\u63a5\u5904\u7406\u666e\u901a\u6587\u4ef6\uff0c\u800c\u662f\u4ea4\u7ed9\u4e86 file_write() \u8fdb\u884c\u5904\u7406\u3002<\/p>\n<p><strong>\uff083\uff09\u8c03\u7528 file_write() \u7ee7\u7eed\u89e3\u6790<\/strong><\/p>\n<p>file_write() \u5171\u67094\u4e2a\u53c2\u6570\uff0c\u5176\u4e2d inode \u4e2d\u6709\u6700\u91cd\u8981\u7684\u6587\u4ef6\u6240\u5728\u7684\u76d8\u5757\u4f4d\u7f6e\u4fe1\u606f\uff0cfilp \u4e2d\u5b58\u653e\u7740\u6587\u4ef6\u5149\u6807\u4f4d\u7f6e\uff0c\u901a\u8fc7\u5b83\u53ef\u4ee5\u786e\u5b9a\u6587\u4ef6\u4fee\u6539\u7684\u4f4d\u7f6e\uff0cbuf \u4e3a\u5199\u5165\u7684\u5185\u5bb9\uff0ccount \u4e3a\u5199\u5165\u5185\u5bb9\u7684\u5b57\u8282\u6570\u3002\u901a\u8fc7 filp \u548c count \u53ef\u4ee5\u786e\u8ba4\u6587\u4ef6\u4fee\u6539\u7684\u8303\u56f4\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0cfile_write() \u5e76\u4e0d\u662f\u76f4\u63a5\u5c06\u6570\u636e\u5199\u5165\u76d8\u5757\u4e2d\uff0c\u800c\u662f\u5199\u5165\u7f13\u51b2\u533a\u4e2d\u3002<\/p>\n<pre><code class=\"language-c\" lang=\"c\">int file_write(struct m_inode * inode, struct file * filp, char * buf, int count)\n{\n\toff_t pos;\n\tint block,c;\n\tstruct buffer_head * bh;\/\/ struct buffer_head \u662f\u7f13\u51b2\u5f00\u5934\u7ed3\u6784\u4f53\n\tchar * p;\n\tint i=0;\n\n\tif (filp-&gt;f_flags &amp; O_APPEND)\n\t\tpos = inode-&gt;i_size;     \/\/\u5982\u679c\u662f\u201c\u8ffd\u52a0\u201d \u5219\u4ece\u6587\u4ef6\u7684\u672b\u5c3e\u5f00\u59cb\u5199\u5165\n\telse\n\t\tpos = filp-&gt;f_pos;       \/\/\u5426\u5219\u4ece\u6587\u4ef6\u5149\u6807\u4f4d\u7f6e\u5f00\u59cb\u4fee\u6539\uff0cfilp-&gt;f_pos\u4e2d\u8bb0\u5f55\u4e86\u6587\u4ef6\u5149\u6807\u7684\u4f4d\u7f6e\n\twhile (i&lt;count) {\n        \/\/BLOCK_SIZE = 1024\uff08\u4e00\u4e2a\u76d8\u5757\u7684\u5927\u5c0f\uff09\uff0cpos\/BLOCK_SIZE \u5c31\u662f\u5f53\u524d\u4fee\u6539\u4f4d\u7f6e\u6240\u5728\u7684\u76d8\u5757\u76f8\u5bf9\u4e8e\u6587\u4ef6\u7b2c\u4e00\u4e2a\u76d8\u5757\u7684\u76d8\u5757\u4f4d\u7f6e\n        \/\/create_block() \u7528\u4e8e\u83b7\u53d6\u76d8\u5757\u53f7\uff0ccreate_block() \u7684\u8fd4\u56de\u503c\u662f pos \u6240\u5728\u76d8\u5757\u7684\u76d8\u5757\u53f7\n\t\tif (!(block = create_block(inode,pos\/BLOCK_SIZE)))\n\t\t\tbreak;\n        \/\/ bread() \u4f1a\u8c03\u7528 ll_rw_block(), \u800c ll_rw_block()\u53c8\u4f1a\u8c03\u7528 make_request() ,\u7136\u540e\u5c31\u662f\u4e0a\u7ae0\u8bb2\u7684\u5185\u5bb9\u4e86\u3002\n\t\tif (!(bh=bread(inode-&gt;i_dev,block)))\n\t\t\tbreak;\n\t\tc = pos % BLOCK_SIZE;\/\/\u8ba1\u7b97\u51fa pos \u5728\u76d8\u5757\u4e2d\u7684\u76f8\u5bf9\u4f4d\u7f6e\n\t\tp = c + bh-&gt;b_data;  \/\/p\u6307\u5411\u7f13\u51b2\u5757\u4e2d\u5f00\u59cb\u5199\u5165\u6570\u636e\u7684\u4f4d\u7f6e\n\t\tbh-&gt;b_dirt = 1;\n\t\tc = BLOCK_SIZE-c;\n\t\tif (c &gt; count-i) c = count-i;\n\t\tpos += c;           \/\/\u4fee\u6539 pos\n\t\tif (pos &gt; inode-&gt;i_size) {\n\t\t\tinode-&gt;i_size = pos;\n\t\t\tinode-&gt;i_dirt = 1;\n\t\t}\n\t\ti += c;\n\t\twhile (c--&gt;0)\n\t\t\t*(p++) = get_fs_byte(buf++);  \/\/\u83b7\u53d6\u8981\u5199\u5165\u7684\u5185\u5bb9\n\t\tbrelse(bh);\n\t}\n......\n}\n<\/code><\/pre>\n<p><strong>\uff084\uff09create_block() \u5206\u6790<\/strong><\/p>\n<p>create_block() \u4e2d\u8c03\u7528\u4e86 <em>bmap() \u3002<\/em>bmap() \u7684\u7b2c3\u4e2a\u53c2\u6570\u4e3a 1 \u65f6\u8868\u793a\u6ca1\u6709\u6620\u5c04\u65f6\u5219\u521b\u5efa\u6620\u5c04\uff0c\u8fd9\u91cc\u7684\u6620\u5c04\u662f\u6307\u7f13\u51b2\u533a\u3002<\/p>\n<pre><code class=\"language-c\" lang=\"c\">int create_block(struct m_inode * inode, int block)\n{\n\treturn _bmap(inode,block,1);\n}\nstatic int _bmap(struct m_inode * inode,int block,int create)\n{\n\tstruct buffer_head * bh;\n\tint i;\n\n......\n\tif (block&lt;7) {   \/\/ \u82e5block&lt; 7 \u76f4\u63a5\u83b7\u5f97\u4e00\u4e2a\u6570\u636e\u5757\n\t\tif (create &amp;&amp; !inode-&gt;i_zone[block])\n\t\t\tif ((inode-&gt;i_zone[block]=new_block(inode-&gt;i_dev))) {\n\t\t\t\tinode-&gt;i_ctime=CURRENT_TIME;\n\t\t\t\tinode-&gt;i_dirt=1;\n\t\t\t}\n\t\treturn inode-&gt;i_zone[block];\n\t}\n    \/\/ \u82e5\u51cf\u53bb7\u4e2a\u6570\u636e\u5757\u540e\u5269\u4f59\u7684\u6570\u636e\u5757\u6570\u5c0f\u4e8e512\uff0c\u5219\u8bf4\u660e\u8be5\u6587\u4ef6\u53ea\u6709\u4e00\u6b21\u95f4\u63a5\u5757\u53f7\u3002inode-&gt;i_zone[7]\u662f\u4e00\u6b21\u95f4\u63a5\u5757\u53f7\n\tblock -= 7;\n\tif (block&lt;512) {\n\t\tif (create &amp;&amp; !inode-&gt;i_zone[7])\n\t\t\tif ((inode-&gt;i_zone[7]=new_block(inode-&gt;i_dev))) {\n\t\t\t\tinode-&gt;i_dirt=1;\n\t\t\t\tinode-&gt;i_ctime=CURRENT_TIME;\n\t\t\t}\n            \n......\n\n\t}\n     \/\/ \u5b58\u5728\u4e8c\u6b21\u95f4\u63a5\u5757\u53f7\uff0c\u90a3\u4e48\u7ee7\u7eed\u5904\u7406\n\tblock -= 512;\n\tif (create &amp;&amp; !inode-&gt;i_zone[8])\n        \n......\n\n}\n<\/code><\/pre>\n<p>\u81f3\u6b64\uff0c\u53ef\u80fd\u8fd8\u4f1a\u6709\u4e9b\u7591\u95ee\uff0c\u6bd4\u5982\u64cd\u4f5c\u7cfb\u7edf\u5982\u4f55\u901a\u8fc7 inode \u53f7\u627e\u5230 \u78c1\u76d8\u4e2d\u6587\u4ef6\u7684 inode \u7684\u5462\uff1f\u76ee\u5f55\u9879\u662f\u5b58\u5728\u78c1\u76d8\u4e2d\u8fd8\u662f\u5728\u7cfb\u7edf\u542f\u52a8\u540e\u64cd\u4f5c\u7cfb\u7edf\u5728\u5185\u5b58\u4e2d\u5efa\u7acb\u76ee\u5f55\u9879\u7684\u5462\uff1f\u5982\u679c\u662f\u5728\u5185\u5b58\u4e2d\u5efa\u7acb\u7684\u90a3\u4e48 OS \u542f\u52a8\u65f6\u662f\u600e\u4e48\u77e5\u9053\u78c1\u76d8\u4e2d\u6709\u54ea\u4e9b\u6587\u4ef6\u7684\u5462\uff1f\u8fd8\u6709\u5199\u6587\u4ef6\u65f6\u5199\u5165\u7684\u7f13\u51b2\u533a\u662f\u600e\u4e48\u56de\u4e8b\uff1f\u7b49\u7b49\u4e00\u7cfb\u5217\u7684\u7ec6\u8282\u95ee\u9898\u3002\u5176\u5b9e\u4e0d\u5fc5\u7ea0\u7ed3\u4e8e\u64cd\u4f5c\u7cfb\u7edf\u5bf9\u8fd9\u4e9b\u7ec6\u8282\u662f\u5982\u4f55\u5b9e\u73b0\u7684\uff0c\u6b63\u5982\u674e\u6cbb\u519b\u8001\u5e08\u8bfe\u7a0b\u4e2d\u63d0\u5230\u7684\u4e00\u79cd\u601d\u60f3\uff1a\u6211\u4eec\u80fd\u89e3\u51b3\u8fd9\u4e9b\u7ec6\u8282\u95ee\u9898\u5417\uff1f\u6211\u4eec\u53ef\u4ee5\u731c\u4e00\u4e0b\u64cd\u4f5c\u7cfb\u7edf\u5982\u4f55\u5b9e\u73b0\u8fd9\u4e9b\u7ec6\u8282\u3002<\/p>\n<p>\u4e0b\u4e00\u7ae0\u5c06\u5206\u6790\u76ee\u5f55\u4e0e\u6587\u4ef6\u7cfb\u7edf\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux0.11 \u901a\u8fc7\u6587\u4ef6\u6765\u4f7f\u7528\u78c1\u76d8\u7684\u8fc7\u7a0b\u6d89\u53ca\u5230\u4e86\u8bb8\u591a\u6982\u5ff5\uff0c\u4ee5\u53ca\u6982\u5ff5\u4e4b\u95f4\u590d\u6742\u9519\u4e71\u7684\u5173\u7cfb\uff0c\u5bb9\u6613\u8ba9\u4eba\u56f0\u60d1\uff0c\u672c\u7ae0\u4e3b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[143,144],"class_list":["post-406","post","type-post","status-publish","format-standard","hentry","category-10","tag-inode","tag-144"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>L10-\u901a\u8fc7\u6587\u4ef6\u7cfb\u7edf\u4f7f\u7528\u78c1\u76d8 - #\u762b\u7537\u65e5\u8bb0<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.taiyang.space\/?p=406\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"L10-\u901a\u8fc7\u6587\u4ef6\u7cfb\u7edf\u4f7f\u7528\u78c1\u76d8 - #\u762b\u7537\u65e5\u8bb0\" \/>\n<meta property=\"og:description\" content=\"Linux0.11 \u901a\u8fc7\u6587\u4ef6\u6765\u4f7f\u7528\u78c1\u76d8\u7684\u8fc7\u7a0b\u6d89\u53ca\u5230\u4e86\u8bb8\u591a\u6982\u5ff5\uff0c\u4ee5\u53ca\u6982\u5ff5\u4e4b\u95f4\u590d\u6742\u9519\u4e71\u7684\u5173\u7cfb\uff0c\u5bb9\u6613\u8ba9\u4eba\u56f0\u60d1\uff0c\u672c\u7ae0\u4e3b [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.taiyang.space\/?p=406\" \/>\n<meta property=\"og:site_name\" content=\"#\u762b\u7537\u65e5\u8bb0\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-26T06:02:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/picture.chentaiyang.space\/202307261250596.png\" \/>\n<meta name=\"author\" content=\"taiyang\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"taiyang\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/blog.taiyang.space\/?p=406#article\",\"isPartOf\":{\"@id\":\"https:\/\/blog.taiyang.space\/?p=406\"},\"author\":{\"name\":\"taiyang\",\"@id\":\"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c\"},\"headline\":\"L10-\u901a\u8fc7\u6587\u4ef6\u7cfb\u7edf\u4f7f\u7528\u78c1\u76d8\",\"datePublished\":\"2023-07-26T06:02:20+00:00\",\"dateModified\":\"2023-07-26T06:02:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/blog.taiyang.space\/?p=406\"},\"wordCount\":106,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c\"},\"keywords\":[\"inode\",\"\u6587\u4ef6\u7cfb\u7edf\"],\"articleSection\":[\"\u64cd\u4f5c\u7cfb\u7edf\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/blog.taiyang.space\/?p=406#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.taiyang.space\/?p=406\",\"url\":\"https:\/\/blog.taiyang.space\/?p=406\",\"name\":\"L10-\u901a\u8fc7\u6587\u4ef6\u7cfb\u7edf\u4f7f\u7528\u78c1\u76d8 - #\u762b\u7537\u65e5\u8bb0\",\"isPartOf\":{\"@id\":\"https:\/\/blog.taiyang.space\/#website\"},\"datePublished\":\"2023-07-26T06:02:20+00:00\",\"dateModified\":\"2023-07-26T06:02:20+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/blog.taiyang.space\/?p=406#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.taiyang.space\/?p=406\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.taiyang.space\/?p=406#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/blog.taiyang.space\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"L10-\u901a\u8fc7\u6587\u4ef6\u7cfb\u7edf\u4f7f\u7528\u78c1\u76d8\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.taiyang.space\/#website\",\"url\":\"https:\/\/blog.taiyang.space\/\",\"name\":\"#\u762b\u7537\u65e5\u8bb0\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.taiyang.space\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c\",\"name\":\"taiyang\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/blog.taiyang.space\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/blog.taiyang.space\/wp-content\/uploads\/2022\/10\/touxiang.jpg\",\"contentUrl\":\"https:\/\/blog.taiyang.space\/wp-content\/uploads\/2022\/10\/touxiang.jpg\",\"width\":612,\"height\":640,\"caption\":\"taiyang\"},\"logo\":{\"@id\":\"https:\/\/blog.taiyang.space\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/blog.taiyang.space\"],\"url\":\"https:\/\/blog.taiyang.space\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"L10-\u901a\u8fc7\u6587\u4ef6\u7cfb\u7edf\u4f7f\u7528\u78c1\u76d8 - #\u762b\u7537\u65e5\u8bb0","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.taiyang.space\/?p=406","og_locale":"zh_CN","og_type":"article","og_title":"L10-\u901a\u8fc7\u6587\u4ef6\u7cfb\u7edf\u4f7f\u7528\u78c1\u76d8 - #\u762b\u7537\u65e5\u8bb0","og_description":"Linux0.11 \u901a\u8fc7\u6587\u4ef6\u6765\u4f7f\u7528\u78c1\u76d8\u7684\u8fc7\u7a0b\u6d89\u53ca\u5230\u4e86\u8bb8\u591a\u6982\u5ff5\uff0c\u4ee5\u53ca\u6982\u5ff5\u4e4b\u95f4\u590d\u6742\u9519\u4e71\u7684\u5173\u7cfb\uff0c\u5bb9\u6613\u8ba9\u4eba\u56f0\u60d1\uff0c\u672c\u7ae0\u4e3b [&hellip;]","og_url":"https:\/\/blog.taiyang.space\/?p=406","og_site_name":"#\u762b\u7537\u65e5\u8bb0","article_published_time":"2023-07-26T06:02:20+00:00","og_image":[{"url":"https:\/\/picture.chentaiyang.space\/202307261250596.png"}],"author":"taiyang","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"taiyang","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.taiyang.space\/?p=406#article","isPartOf":{"@id":"https:\/\/blog.taiyang.space\/?p=406"},"author":{"name":"taiyang","@id":"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c"},"headline":"L10-\u901a\u8fc7\u6587\u4ef6\u7cfb\u7edf\u4f7f\u7528\u78c1\u76d8","datePublished":"2023-07-26T06:02:20+00:00","dateModified":"2023-07-26T06:02:20+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.taiyang.space\/?p=406"},"wordCount":106,"commentCount":0,"publisher":{"@id":"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c"},"keywords":["inode","\u6587\u4ef6\u7cfb\u7edf"],"articleSection":["\u64cd\u4f5c\u7cfb\u7edf"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.taiyang.space\/?p=406#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.taiyang.space\/?p=406","url":"https:\/\/blog.taiyang.space\/?p=406","name":"L10-\u901a\u8fc7\u6587\u4ef6\u7cfb\u7edf\u4f7f\u7528\u78c1\u76d8 - #\u762b\u7537\u65e5\u8bb0","isPartOf":{"@id":"https:\/\/blog.taiyang.space\/#website"},"datePublished":"2023-07-26T06:02:20+00:00","dateModified":"2023-07-26T06:02:20+00:00","breadcrumb":{"@id":"https:\/\/blog.taiyang.space\/?p=406#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.taiyang.space\/?p=406"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.taiyang.space\/?p=406#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/blog.taiyang.space\/"},{"@type":"ListItem","position":2,"name":"L10-\u901a\u8fc7\u6587\u4ef6\u7cfb\u7edf\u4f7f\u7528\u78c1\u76d8"}]},{"@type":"WebSite","@id":"https:\/\/blog.taiyang.space\/#website","url":"https:\/\/blog.taiyang.space\/","name":"#\u762b\u7537\u65e5\u8bb0","description":"","publisher":{"@id":"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.taiyang.space\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c","name":"taiyang","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/blog.taiyang.space\/#\/schema\/person\/image\/","url":"https:\/\/blog.taiyang.space\/wp-content\/uploads\/2022\/10\/touxiang.jpg","contentUrl":"https:\/\/blog.taiyang.space\/wp-content\/uploads\/2022\/10\/touxiang.jpg","width":612,"height":640,"caption":"taiyang"},"logo":{"@id":"https:\/\/blog.taiyang.space\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/blog.taiyang.space"],"url":"https:\/\/blog.taiyang.space\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=\/wp\/v2\/posts\/406","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=406"}],"version-history":[{"count":1,"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=\/wp\/v2\/posts\/406\/revisions"}],"predecessor-version":[{"id":407,"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=\/wp\/v2\/posts\/406\/revisions\/407"}],"wp:attachment":[{"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=406"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=406"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}