More kernel comments: iget

This commit is contained in:
Warren Toomey
2016-03-14 17:40:46 +10:00
parent 77c30047e9
commit 6ffdf4076d
2 changed files with 18 additions and 17 deletions
+17 -16
View File
@@ -86,32 +86,33 @@ namei: 0
sad 8 i sad 8 i
skp skp
jmp 2f jmp 2f
lac d.i lac d.i " Get the i-number into AC
isz namei isz namei " Skip over the argument and return
jmp namei i jmp namei i
2: 2:
isz di isz di
isz 9f+t isz 9f+t
jmp 1b jmp 1b
jmp namei i jmp namei i " Didn't find it, return zero in AC
t = t+2 t = t+2
" Given an i-number in AC, fetch that i-node
" from disk and store it in the inode buffer
iget: 0 iget: 0
dac ii dac ii " Store the i-number in ii
cll; idiv; 5 cll; idiv; 5 " Divide by 5: 5 inodes in a block
dac 9f+t dac 9f+t " Store the remainder in 9f+t: the i-node
lacq lacq " number within the block
tad d2 tad d2 " Add 2 to the quotient to get the block number
dac 9f+t+1 dac 9f+t+1 " and store in 9f+t+1
jms dskrd jms dskrd " Get the block
lac 9f+t lac 9f+t
cll; mul; 12 cll; mul; 12 " Multiply the i-num within the block by 12
lacq lacq " to get the offset into the block
tad dskbufp tad dskbufp " Add on the base of the disk buffer
dac 9f+t dac 9f+t
dac .+2 dac .+2
jms copy; ..; inode; 12 jms copy; ..; inode; 12 " Copy 12 words from buffer to inode
jmp iget i jmp iget i " and return
iput: 0 iput: 0
lac 9f+t+1 lac 9f+t+1
+1 -1
View File
@@ -219,7 +219,7 @@ userdata: " "ustruct" (swappable)
u.dspbuf: 0 u.dspbuf: 0
u.intflg: 1 u.intflg: 1
.=userdata+64 .=userdata+64
ii: .=.+1 " number of i-node in inode: ii: .=.+1 " The current i-node number stored in inode
inode: " disk inode in memory: inode: " disk inode in memory:
i.flags: .=.+1 " inode flags i.flags: .=.+1 " inode flags
" 400000 in use " 400000 in use