code:iupdat - ikarishinjieva/unixV6-code-analyze-chs GitHub Wiki
7366
7367 /*
7368 * Check accessed and update flags on
7369 * an inode structure.
7370 * If either is on, update the inode
7371 * with the corresponding dates
7372 * set to the argument tm.
7373 */
7374 iupdat(p, tm)
7375 int *p;
7376 int *tm;
7377 {
7378 register *ip1, *ip2, *rp;
7379 int *bp, i;
7380
7381 rp = p;
7382 if((rp->i_flag&(IUPD|IACC)) != 0) {
7383 if(getfs(rp->i_dev)->s_ronly)
7384 return;
7385 i = rp->i_number+31;
7386 bp = bread(rp->i_dev, ldiv(i,16));
7387 ip1 = bp->b_addr + 32*lrem(i, 16);
7388 ip2 = &rp->i_mode;
7389 while(ip2 < &rp->i_addr[8])
7390 *ip1++ = *ip2++;
7391 if(rp->i_flag&IACC) {
7392 *ip1++ = time[0];
7393 *ip1++ = time[1];
7394 } else
7395 ip1 =+ 2;
7396 if(rp->i_flag&IUPD) {
7397 *ip1++ = *tm++;
7398 *ip1++ = *tm;
7399 }
7400 bwrite(bp);
7401 }
- 将bp写回磁盘
7402 }
7403 /* -------------------------*/