Skip to content

Commit 3341e30

Browse files
author
rsc
committedAug 28, 2007
nit
1 parent a759b8a commit 3341e30

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed
 

‎cat.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
char buf[512];
66

77
void
8-
rfile(int fd)
8+
cat(int fd)
99
{
1010
int n;
1111

@@ -23,7 +23,7 @@ main(int argc, char *argv[])
2323
int fd, i;
2424

2525
if(argc <= 1) {
26-
rfile(0);
26+
cat(0);
2727
exit();
2828
}
2929

@@ -32,7 +32,7 @@ main(int argc, char *argv[])
3232
printf(1, "cat: cannot open %s\n", argv[i]);
3333
exit();
3434
}
35-
rfile(fd);
35+
cat(fd);
3636
close(fd);
3737
}
3838
exit();

‎fcntl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#define O_CREATE 0x200
21
#define O_RDONLY 0x000
32
#define O_WRONLY 0x001
43
#define O_RDWR 0x002
4+
#define O_CREATE 0x200

‎fs.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ ilock(struct inode *ip)
205205

206206
if(!(ip->flags & I_VALID)){
207207
bp = bread(ip->dev, IBLOCK(ip->inum));
208-
dip = &((struct dinode*)(bp->data))[ip->inum % IPB];
208+
dip = (struct dinode*)bp->data + ip->inum%IPB;
209209
ip->type = dip->type;
210210
ip->major = dip->major;
211211
ip->minor = dip->minor;
@@ -275,7 +275,7 @@ ialloc(uint dev, short type)
275275
readsb(dev, &sb);
276276
for(inum = 1; inum < sb.ninodes; inum++) { // loop over inode blocks
277277
bp = bread(dev, IBLOCK(inum));
278-
dip = (struct dinode*)(bp->data) + inum%IPB;
278+
dip = (struct dinode*)bp->data + inum%IPB;
279279
if(dip->type == 0) { // a free inode
280280
memset(dip, 0, sizeof(*dip));
281281
dip->type = type;
@@ -296,7 +296,7 @@ iupdate(struct inode *ip)
296296
struct dinode *dip;
297297

298298
bp = bread(ip->dev, IBLOCK(ip->inum));
299-
dip = (struct dinode*)(bp->data) + ip->inum%IPB;
299+
dip = (struct dinode*)bp->data + ip->inum%IPB;
300300
dip->type = ip->type;
301301
dip->major = ip->major;
302302
dip->minor = ip->minor;

‎main.c

+4-6
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@
55
#include "proc.h"
66
#include "x86.h"
77

8-
extern char edata[], end[];
9-
10-
void bootothers(void);
8+
static void bootothers(void);
119

1210
// Bootstrap processor starts running C code here.
1311
int
1412
main(void)
1513
{
1614
int i;
1715
static volatile int bcpu; // cannot be on stack
16+
extern char edata[], end[];
1817

1918
// clear BSS
2019
memset(edata, 0, end - edata);
@@ -65,7 +64,6 @@ mpmain(void)
6564
idtinit();
6665
lapic_init(cpu());
6766
setupsegs(0);
68-
6967
cpuid(0, 0, 0, 0, 0); // memory barrier
7068
cpus[cpu()].booted = 1;
7169

@@ -76,7 +74,7 @@ mpmain(void)
7674
scheduler();
7775
}
7876

79-
void
77+
static void
8078
bootothers(void)
8179
{
8280
extern uchar _binary_bootother_start[], _binary_bootother_size[];
@@ -91,7 +89,7 @@ bootothers(void)
9189
if(c == cpus+cpu()) // We've started already.
9290
continue;
9391

94-
// Set target %esp, %eip
92+
// Fill in %esp, %eip and start code on cpu.
9593
*(void**)(code-4) = c->mpstack + MPSTACK;
9694
*(void**)(code-8) = mpmain;
9795
lapic_startap(c->apicid, (uint)code);

0 commit comments

Comments
 (0)