-
Notifications
You must be signed in to change notification settings - Fork 1
/
操作系统内核-实验四.html
586 lines (425 loc) · 30.3 KB
/
操作系统内核-实验四.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.2">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
<link rel="mask-icon" href="/images/logo.svg" color="#222">
<link rel="stylesheet" href="/css/main.css">
<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.css">
<script id="hexo-configurations">
var NexT = window.NexT || {};
var CONFIG = {"hostname":"leeyuxun.github.io","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":true,"style":"mac"},"back2top":{"enable":true,"sidebar":true,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":true,"mediumzoom":false,"lazyload":false,"pangu":true,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"./public/search.xml"};
</script>
<meta name="description" content="实验目的 掌握文件系统的工作机理 理解文件系统的主要数据结构 学习较为复杂的Linux下的编程 了解EXT2文件系统的结构">
<meta property="og:type" content="article">
<meta property="og:title" content="操作系统内核 实验四">
<meta property="og:url" content="https://leeyuxun.github.io/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E5%86%85%E6%A0%B8-%E5%AE%9E%E9%AA%8C%E5%9B%9B.html">
<meta property="og:site_name" content="Leeyuxun の note">
<meta property="og:description" content="实验目的 掌握文件系统的工作机理 理解文件系统的主要数据结构 学习较为复杂的Linux下的编程 了解EXT2文件系统的结构">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191028140351.png">
<meta property="og:image" content="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191028140429.png">
<meta property="og:image" content="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191028140906.png">
<meta property="og:image" content="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191111002748.png">
<meta property="og:image" content="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191111021201.png">
<meta property="og:image" content="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191111021442.png">
<meta property="og:image" content="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191111021630.png">
<meta property="og:image" content="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191111021717.png">
<meta property="og:image" content="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191111022338.png">
<meta property="og:image" content="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191111022446.png">
<meta property="og:image" content="c:/Users/Levi/AppData/Roaming/Typora/typora-user-images/image-20191111022536623.png">
<meta property="og:image" content="c:/Users/Levi/AppData/Roaming/Typora/typora-user-images/image-20191111022608021.png">
<meta property="og:image" content="c:/Users/Levi/AppData/Roaming/Typora/typora-user-images/image-20191111022828188.png">
<meta property="og:image" content="c:/Users/Levi/AppData/Roaming/Typora/typora-user-images/image-20191111022905569.png">
<meta property="article:published_time" content="2019-12-20T14:33:38.000Z">
<meta property="article:modified_time" content="2023-05-07T07:37:53.521Z">
<meta property="article:author" content="李钰璕">
<meta property="article:tag" content="文件系统管理">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191028140351.png">
<link rel="canonical" href="https://leeyuxun.github.io/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E5%86%85%E6%A0%B8-%E5%AE%9E%E9%AA%8C%E5%9B%9B.html">
<script id="page-configurations">
// https://hexo.io/docs/variables.html
CONFIG.page = {
sidebar: "",
isHome : false,
isPost : true,
lang : 'zh-CN'
};
</script>
<title>操作系统内核 实验四 | Leeyuxun の note</title>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-V3499K2XZY"></script>
<script>
if (CONFIG.hostname === location.hostname) {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-V3499K2XZY');
}
</script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?4d72a66931dff6410b32974da2e3df61";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<noscript>
<style>
.use-motion .brand,
.use-motion .menu-item,
.sidebar-inner,
.use-motion .post-block,
.use-motion .pagination,
.use-motion .comments,
.use-motion .post-header,
.use-motion .post-body,
.use-motion .collection-header { opacity: initial; }
.use-motion .site-title,
.use-motion .site-subtitle {
opacity: initial;
top: initial;
}
.use-motion .logo-line-before i { left: initial; }
.use-motion .logo-line-after i { right: initial; }
</style>
</noscript>
</head>
<body itemscope itemtype="http://schema.org/WebPage">
<div class="container use-motion">
<div class="headband"></div>
<header class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-container">
<div class="site-nav-toggle">
<div class="toggle" aria-label="切换导航栏">
<span class="toggle-line toggle-line-first"></span>
<span class="toggle-line toggle-line-middle"></span>
<span class="toggle-line toggle-line-last"></span>
</div>
</div>
<div class="site-meta">
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<h1 class="site-title">Leeyuxun の note</h1>
<span class="logo-line-after"><i></i></span>
</a>
<p class="site-subtitle" itemprop="description">BUPT | SCSS</p>
</div>
<div class="site-nav-right">
<div class="toggle popup-trigger">
<i class="fa fa-search fa-fw fa-lg"></i>
</div>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="main-menu menu">
<li class="menu-item menu-item-home">
<a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>
</li>
<li class="menu-item menu-item-tags">
<a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>
</li>
<li class="menu-item menu-item-categories">
<a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>
</li>
<li class="menu-item menu-item-links">
<a href="/links/" rel="section"><i class="fa fa-link fa-fw"></i>友链</a>
</li>
<li class="menu-item menu-item-search">
<a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
</a>
</li>
</ul>
</nav>
<div class="search-pop-overlay">
<div class="popup search-popup">
<div class="search-header">
<span class="search-icon">
<i class="fa fa-search"></i>
</span>
<div class="search-input-container">
<input autocomplete="off" autocapitalize="off"
placeholder="搜索..." spellcheck="false"
type="search" class="search-input">
</div>
<span class="popup-btn-close">
<i class="fa fa-times-circle"></i>
</span>
</div>
<div id="search-result">
<div id="no-result">
<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
</div>
</div>
</div>
</div>
</div>
</header>
<main class="main">
<div class="main-inner">
<div class="content-wrap">
<div class="content post posts-expand">
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
<link itemprop="mainEntityOfPage" href="https://leeyuxun.github.io/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E5%86%85%E6%A0%B8-%E5%AE%9E%E9%AA%8C%E5%9B%9B.html">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.png">
<meta itemprop="name" content="李钰璕">
<meta itemprop="description" content="安全学习笔记">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Leeyuxun の note">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
操作系统内核 实验四
</h1>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建时间:2019-12-20 22:33:38" itemprop="dateCreated datePublished" datetime="2019-12-20T22:33:38+08:00">2019-12-20</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar-check"></i>
</span>
<span class="post-meta-item-text">更新于</span>
<time title="修改时间:2023-05-07 15:37:53" itemprop="dateModified" datetime="2023-05-07T15:37:53+08:00">2023-05-07</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E5%86%85%E6%A0%B8%E5%AE%9E%E9%AA%8C/" itemprop="url" rel="index"><span itemprop="name">操作系统内核实验</span></a>
</span>
</span>
<span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
<span class="post-meta-item-icon">
<i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">阅读次数:</span>
<span id="busuanzi_value_page_pv"></span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h1 id="实验目的"><a href="#实验目的" class="headerlink" title="实验目的"></a>实验目的</h1><ol>
<li>掌握文件系统的工作机理</li>
<li>理解文件系统的主要数据结构</li>
<li>学习较为复杂的Linux下的编程</li>
<li>了解EXT2文件系统的结构</li>
</ol>
<span id="more"></span>
<h1 id="准备知识"><a href="#准备知识" class="headerlink" title="准备知识"></a>准备知识</h1><h2 id="外存管理"><a href="#外存管理" class="headerlink" title="外存管理"></a>外存管理</h2><p>文件系统层次结构如下</p>
<p><img src="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191028140351.png"></p>
<h2 id="目录管理"><a href="#目录管理" class="headerlink" title="目录管理"></a>目录管理</h2><p><img src="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191028140429.png"></p>
<h2 id="文件系统接口"><a href="#文件系统接口" class="headerlink" title="文件系统接口"></a>文件系统接口</h2><p>命令接口</p>
<p>程序接口</p>
<h2 id="Linux的EXT2文件系统"><a href="#Linux的EXT2文件系统" class="headerlink" title="Linux的EXT2文件系统"></a>Linux的EXT2文件系统</h2><ul>
<li><p>EXT2文件系统结构<br><img src="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191028140906.png"></p>
</li>
<li><p>数据地址安排</p>
<img src="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191111002748.png" style="zoom:10%;" /></li>
</ul>
<h1 id="实验步骤"><a href="#实验步骤" class="headerlink" title="实验步骤"></a>实验步骤</h1><ol>
<li><p>输入命令<code>make</code>编译该文件系统:成功<code>build modules</code>(该实验是在root用户下实现的,不需要输入<code>sudo</code>)<br><img src="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191111021201.png"></p>
</li>
<li><p>输入命令<code>insmod aufs.ko</code>安装模块<br><img src="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191111021442.png"></p>
</li>
<li><p>使用<code>dmesg</code>命令查看模块是否安装成功<br><img src="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191111021630.png"></p>
<p>在使用<code>dmesg</code>命令后,输出了相当多的模块信息</p>
<p><img src="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191111021717.png"></p>
<p>在输出信息的最后,可以发现语句如下,表示模块已经安装成功.</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">[ 1861.402049] create inode cache success</span><br><span class="line">[ 1861.402056] register filesystem success</span><br><span class="line">[ 1861.402059] aufs module loaded</span><br></pre></td></tr></table></figure></li>
<li><p>输入命令<code>mount -o loop -t aufs ./image ./dir</code>挂载设备<br><img src="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191111022338.png"></p>
</li>
<li><p>使用命令<code>dmesg</code>再次打印模块输出,可以查看挂载是否成功.</p>
<p><img src="https://raw.githubusercontent.com/Leeyuxun/pic-storage/main/img/20191111022446.png"></p>
<p>获得了<code>super block</code>的相关信息<code>super block</code>结构是指文件系统在磁盘分区的特殊位置中存储的文件系统参数集,包括:</p>
<ol>
<li><code>magic</code></li>
<li>索引节点块——<code>inode blocks</code></li>
<li>块大小——<code>block size</code></li>
<li>根节点——<code>root inode</code></li>
<li>块中的索引节点数——<code>inodes in block</code></li>
</ol>
</li>
<li><p>卸载模块前必须先卸载已挂载的文件系统,否则会出现以下错误 :<br><img src="C:\Users\Levi\AppData\Roaming\Typora\typora-user-images\image-20191111022536623.png" alt="image-20191111022536623"></p>
</li>
<li><p>输入<code>mount</code>指令查看已挂载的设备,找到挂载的文件系统及其挂载点为<code>/root/桌面/filesystem/image</code>和<code>/root/桌面/filesystem/dir</code><br><img src="C:\Users\Levi\AppData\Roaming\Typora\typora-user-images\image-20191111022608021.png" alt="image-20191111022608021"></p>
</li>
<li><p>卸载系统后,卸载模块。在卸载已挂载的设备时,该设备不能有进程在运行。<br><img src="C:\Users\Levi\AppData\Roaming\Typora\typora-user-images\image-20191111022828188.png" alt="image-20191111022828188"></p>
</li>
<li><p>再输入<code>dmesg</code>命令显示已卸载。<br><img src="C:\Users\Levi\AppData\Roaming\Typora\typora-user-images\image-20191111022905569.png" alt="image-20191111022905569"></p>
</li>
</ol>
<h1 id="核心代码分析"><a href="#核心代码分析" class="headerlink" title="核心代码分析"></a>核心代码分析</h1><p>本次实验代码的核心在<code>inode</code>分配函数</p>
<h2 id="aufs-fill-sb函数"><a href="#aufs-fill-sb函数" class="headerlink" title="aufs_fill_sb函数"></a><code>aufs_fill_sb</code>函数</h2><p>在为根目录创建<code>dentry</code>(目录项)之前,应创建根目录的索引节点(索引节点)。索引节点结构可能是文件系统中最重要的一种。每个文件系统对象(文件,文件夹,特殊文件,杂志等)都用<code>inode</code>标识。</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">static</span> <span class="type">int</span> <span class="title function_">aufs_fill_sb</span><span class="params">(<span class="keyword">struct</span> super_block *sb, <span class="type">void</span> *data, <span class="type">int</span> silent)</span></span><br><span class="line"> {</span><br><span class="line"> <span class="class"><span class="keyword">struct</span> <span class="title">inode</span> *<span class="title">root</span> =</span> <span class="literal">NULL</span>;</span><br><span class="line"></span><br><span class="line"> sb->s_magic = AUFS_MAGIC_NUMBER;</span><br><span class="line"> sb->s_op = &aufs_super_ops;</span><br><span class="line"></span><br><span class="line"> root = new_inode(sb);</span><br><span class="line"> <span class="keyword">if</span> (!root)</span><br><span class="line"> {</span><br><span class="line"> pr_err(<span class="string">"inode allocation failed\n"</span>);</span><br><span class="line"> <span class="keyword">return</span> -ENOMEM;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> root->i_ino = <span class="number">0</span>;</span><br><span class="line"> root->i_sb = sb;</span><br><span class="line"> root->i_atime = root->i_mtime = root->i_ctime = CURRENT_TIME;</span><br><span class="line"> inode_init_owner(root, <span class="literal">NULL</span>, S_IFDIR);</span><br><span class="line"></span><br><span class="line"> sb->s_root = d_make_root(root);</span><br><span class="line"> <span class="keyword">if</span> (!sb->s_root)</span><br><span class="line"> {</span><br><span class="line"> pr_err(<span class="string">"root creation failed\n"</span>);</span><br><span class="line"> <span class="keyword">return</span> -ENOMEM;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
<h2 id="aufs-inode-fill函数"><a href="#aufs-inode-fill函数" class="headerlink" title="aufs_inode_fill函数"></a><code>aufs_inode_fill</code>函数</h2><p>负责填充</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">static</span> <span class="type">void</span> <span class="title function_">aufs_inode_fill</span><span class="params">(<span class="keyword">struct</span> aufs_inode *ai,</span></span><br><span class="line"><span class="params"> <span class="keyword">struct</span> aufs_disk_inode <span class="type">const</span> *di)</span></span><br><span class="line">{</span><br><span class="line"> ai->ai_block = be32_to_cpu(di->di_first);</span><br><span class="line"> ai->ai_inode.i_mode = be32_to_cpu(di->di_mode);</span><br><span class="line"> ai->ai_inode.i_size = be32_to_cpu(di->di_size);</span><br><span class="line"> ai->ai_inode.i_blocks = be32_to_cpu(di->di_blocks);</span><br><span class="line"> ai->ai_inode.i_ctime.tv_sec = be64_to_cpu(di->di_ctime);</span><br><span class="line"> ai->ai_inode.i_mtime.tv_sec = ai->ai_inode.i_atime.tv_sec =</span><br><span class="line"> ai->ai_inode.i_ctime.tv_sec;</span><br><span class="line"> ai->ai_inode.i_mtime.tv_nsec = ai->ai_inode.i_atime.tv_nsec =</span><br><span class="line"> ai->ai_inode.i_ctime.tv_nsec = <span class="number">0</span>;</span><br><span class="line"> i_uid_write(&ai->ai_inode, (<span class="type">uid_t</span>)be32_to_cpu(di->di_uid));</span><br><span class="line"> i_gid_write(&ai->ai_inode, (<span class="type">gid_t</span>)be32_to_cpu(di->di_gid));</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
</div>
<div>
<ul class="post-copyright">
<li class="post-copyright-author">
<strong>本文作者: </strong>李钰璕
</li>
<li class="post-copyright-link">
<strong>本文链接:</strong>
<a href="https://leeyuxun.github.io/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E5%86%85%E6%A0%B8-%E5%AE%9E%E9%AA%8C%E5%9B%9B.html" title="操作系统内核 实验四">https://leeyuxun.github.io/操作系统内核-实验四.html</a>
</li>
<li class="post-copyright-license">
<strong>版权声明: </strong>本博客所有文章除特别声明外,均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/zh-cn" rel="noopener" target="_blank"><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处!
</li>
</ul>
</div>
<footer class="post-footer">
<div class="post-tags">
<a href="/tags/%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F%E7%AE%A1%E7%90%86/" rel="tag"><i class="fa fa-tag"></i> 文件系统管理</a>
</div>
<div class="post-nav">
<div class="post-nav-item">
<a href="/CryptDB%E5%AE%89%E8%A3%85%E4%B8%8E%E4%BD%BF%E7%94%A8.html" rel="prev" title="CryptDB安装与使用">
<i class="fa fa-chevron-left"></i> CryptDB安装与使用
</a></div>
<div class="post-nav-item">
<a href="/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E5%86%85%E6%A0%B8-%E5%AE%9E%E9%AA%8C%E4%BA%94.html" rel="next" title="操作系统内核 实验五">
操作系统内核 实验五 <i class="fa fa-chevron-right"></i>
</a></div>
</div>
</footer>
</article>
</div>
<script>
window.addEventListener('tabs:register', () => {
let { activeClass } = CONFIG.comments;
if (CONFIG.comments.storage) {
activeClass = localStorage.getItem('comments_active') || activeClass;
}
if (activeClass) {
let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
if (activeTab) {
activeTab.click();
}
}
});
if (CONFIG.comments.storage) {
window.addEventListener('tabs:click', event => {
if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
let commentClass = event.target.classList[1];
localStorage.setItem('comments_active', commentClass);
});
}
</script>
</div>
<div class="toggle sidebar-toggle">
<span class="toggle-line toggle-line-first"></span>
<span class="toggle-line toggle-line-middle"></span>
<span class="toggle-line toggle-line-last"></span>
</div>
<aside class="sidebar">
<div class="sidebar-inner">
<ul class="sidebar-nav motion-element">
<li class="sidebar-nav-toc">
文章目录
</li>
<li class="sidebar-nav-overview">
站点概览
</li>
</ul>
<!--noindex-->
<div class="post-toc-wrap sidebar-panel">
<div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%AE%9E%E9%AA%8C%E7%9B%AE%E7%9A%84"><span class="nav-number">1.</span> <span class="nav-text">实验目的</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%87%86%E5%A4%87%E7%9F%A5%E8%AF%86"><span class="nav-number">2.</span> <span class="nav-text">准备知识</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%A4%96%E5%AD%98%E7%AE%A1%E7%90%86"><span class="nav-number">2.1.</span> <span class="nav-text">外存管理</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%9B%AE%E5%BD%95%E7%AE%A1%E7%90%86"><span class="nav-number">2.2.</span> <span class="nav-text">目录管理</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F%E6%8E%A5%E5%8F%A3"><span class="nav-number">2.3.</span> <span class="nav-text">文件系统接口</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Linux%E7%9A%84EXT2%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F"><span class="nav-number">2.4.</span> <span class="nav-text">Linux的EXT2文件系统</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%AE%9E%E9%AA%8C%E6%AD%A5%E9%AA%A4"><span class="nav-number">3.</span> <span class="nav-text">实验步骤</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E6%A0%B8%E5%BF%83%E4%BB%A3%E7%A0%81%E5%88%86%E6%9E%90"><span class="nav-number">4.</span> <span class="nav-text">核心代码分析</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#aufs-fill-sb%E5%87%BD%E6%95%B0"><span class="nav-number">4.1.</span> <span class="nav-text">aufs_fill_sb函数</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#aufs-inode-fill%E5%87%BD%E6%95%B0"><span class="nav-number">4.2.</span> <span class="nav-text">aufs_inode_fill函数</span></a></li></ol></li></ol></div>
</div>
<!--/noindex-->
<div class="site-overview-wrap sidebar-panel">
<div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
<img class="site-author-image" itemprop="image" alt="李钰璕"
src="/images/avatar.png">
<p class="site-author-name" itemprop="name">李钰璕</p>
<div class="site-description" itemprop="description">安全学习笔记</div>
</div>
<div class="site-state-wrap motion-element">
<nav class="site-state">
<div class="site-state-item site-state-posts">
<a href="/archives/">
<span class="site-state-item-count">89</span>
<span class="site-state-item-name">日志</span>
</a>
</div>
<div class="site-state-item site-state-categories">
<a href="/categories/">
<span class="site-state-item-count">17</span>
<span class="site-state-item-name">分类</span></a>
</div>
<div class="site-state-item site-state-tags">
<a href="/tags/">
<span class="site-state-item-count">115</span>
<span class="site-state-item-name">标签</span></a>
</div>
</nav>
</div>
<div class="links-of-author motion-element">
<span class="links-of-author-item">
<a href="https://github.com/Leeyuxun" title="GitHub → https://github.com/Leeyuxun" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i></a>
</span>
<span class="links-of-author-item">
<a href="mailto:leeyuxun@163.com" title="E-Mail → mailto:leeyuxun@163.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i></a>
</span>
</div>
</div>
<div class="back-to-top motion-element">
<i class="fa fa-arrow-up"></i>
<span>0%</span>
</div>
</div>
</aside>
<div id="sidebar-dimmer"></div>
</div>
</main>
<footer class="footer">
<div class="footer-inner">
<!--
<div class="copyright">
©
<span itemprop="copyrightYear">2023</span>
<span class="with-love">
<i class="fa fa-heart"></i>
</span>
<span class="author" itemprop="copyrightHolder">李钰璕</span>
</div>
-->
<div class="busuanzi-count">
<script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
</div>
</div>
</footer>
</div>
<script src="/lib/anime.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
<script src="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/pangu@4/dist/browser/pangu.min.js"></script>
<script src="/lib/velocity/velocity.min.js"></script>
<script src="/lib/velocity/velocity.ui.min.js"></script>
<script src="/js/utils.js"></script>
<script src="/js/motion.js"></script>
<script src="/js/schemes/pisces.js"></script>
<script src="/js/next-boot.js"></script>
<script src="/js/local-search.js"></script>
</body>
</html>