kernels/linux-2.4.0/fs/minix/inode.c
/*
 * The minix V1 function to synchronize an inode.
 */
The minix V1 function to synchronize an inode.
The minix V1 function to synchronize an inode .
static struct buffer_head * V1_minix_update_inode(struct inode * inode)
{
	struct buffer_head * bh;
	struct minix_inode * raw_inode;
	int ino, block;
	ino = inode->i_ino;
	if (!ino || ino > inode->i_sb->u.minix_sb.s_ninodes) {
		printk("Bad inode number on dev %s"
		       ": %d is out of range\n",
			kdevname(inode->i_dev), ino);
		return 0;
	}
	block = 2 + inode->i_sb->u.minix_sb.s_imap_blocks + inode->i_sb->u.minix_sb.s_zmap_blocks +
		(ino-1)/MINIX_INODES_PER_BLOCK;
	if (!(bh=bread(inode->i_dev, block, BLOCK_SIZE))) {
		printk("unable to read i-node block\n");
		return 0;
	}
	raw_inode = ((struct minix_inode *)bh->b_data) +
		(ino-1)%MINIX_INODES_PER_BLOCK;
	raw_inode->i_mode = inode->i_mode;
	raw_inode->i_uid = fs_high2lowuid(inode->i_uid);
	raw_inode->i_gid = fs_high2lowgid(inode->i_gid);
	raw_inode->i_nlinks = inode->i_nlink;
	raw_inode->i_size = inode->i_size;
	raw_inode->i_time = inode->i_mtime;
	if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
		raw_inode->i_zone[0] = kdev_t_to_nr(inode->i_rdev);
	else for (block = 0; block < 9; block++)
		raw_inode->i_zone[block] = inode->u.minix_i.u.i1_data[block];
	mark_buffer_dirty(bh);
	return bh;
}
static struct buffer_head * V1_minix_update_inode ( struct inode * inode ) { struct buffer_head * bh ; struct minix_inode * raw_inode ; int ino , block ; ino = inode -> i_ino ; if ( ! ino || ino > inode -> i_sb -> u . minix_sb . s_ninodes ) { printk ( " " " \n " , kdevname ( inode -> i_dev ) , ino ) ; return 0 ; } block = 2 + inode -> i_sb -> u . minix_sb . s_imap_blocks + inode -> i_sb -> u . minix_sb . s_zmap_blocks + ( ino - 1 ) / MINIX_INODES_PER_BLOCK ; if ( ! ( bh = bread ( inode -> i_dev , block , BLOCK_SIZE ) ) ) { printk ( " \n " ) ; return 0 ; } raw_inode = ( ( struct minix_inode * ) bh -> b_data ) + ( ino - 1 ) % MINIX_INODES_PER_BLOCK ; raw_inode -> i_mode = inode -> i_mode ; raw_inode -> i_uid = fs_high2lowuid ( inode -> i_uid ) ; raw_inode -> i_gid = fs_high2lowgid ( inode -> i_gid ) ; raw_inode -> i_nlinks = inode -> i_nlink ; raw_inode -> i_size = inode -> i_size ; raw_inode -> i_time = inode -> i_mtime ; if ( S_ISCHR ( inode -> i_mode ) || S_ISBLK ( inode -> i_mode ) ) raw_inode -> i_zone [ 0 ] = kdev_t_to_nr ( inode -> i_rdev ) ; else for ( block = 0 ; block < 9 ; block ++ ) raw_inode -> i_zone [ block ] = inode -> u . minix_i . u . i1_data [ block ] ; mark_buffer_dirty ( bh ) ; return bh ; }
The minix V1 function to synchronize an inode.
The minix V1 function to synchronize an inode .