/* Inode_init * Called when a fresh slave has just heard how many inodes there are. * It sets all its inodes to owner `unknown'. * This inode table is written to disk. * This Routine intializes the incore tables, like inode_init. */ void set_inodes() { register Inode * ip; register Inode * lim; disk_addr inodeblks; inodeblks= in_alloc() ; lim = Limit; /* First set all entries to zero */ memset((_VOIDSTAR)Inode_table,0, (size_t)inodeblks*Superblock.s_blksize) ; /* * Go through the inodes and mark all as unknown. */ for (ip = Inode_table + 1; ip < lim; ip++) { ip->i_owner=S_UNKNOWN_ID ; } write_inodetab(inodeblks); /* * Need to have last_free pointing at the first usable inode ! */ Last_free = Inode_table + 1; bs_local_inodes_free= 0 ; bs_init_irw() ; gs_init_ttl() ; }
void *out_alloc(oskit_size_t size, lmm_flags_t flags) { void* r; mem_lock(); r = in_alloc(size,flags); mem_unlock(); return r; }
void inode_init() { disk_addr inodeblks; register Inode * ip; register Inode * lim; register peer_bits * rep_ip ; register peer_bits my_mask ; inodeblks= in_alloc() ; read_inodetab(inodeblks); lim = Limit; bs_local_inodes_free = 0 ; my_mask= 1<<Superblock.s_member ; /* * Go through the inodes and mark those that are allocated (in use). * Remember the first free inode. */ for (ip =Inode_table+1, rep_ip=Inode_reptab+1; ip < lim; ip++, rep_ip++) { if ( ip->i_flags & I_INTENT ) { bwarn("Inode %8ld: alloced intent",ip-Inode_table) ; } /* Clear in-core only flags */ ip->i_flags &= ~(I_ALLOCED); if ( ip->i_flags&(I_INUSE|I_DESTROY) ) { ip->i_flags |= I_ALLOCED ; if ( ip->i_flags&I_PRESENT ) *rep_ip= my_mask ; } else { if ( ip->i_flags & I_NOT_INUSE ) { bwarn("Inode %8ld: status %x",ip-Inode_table,ip->i_flags) ; ip->i_flags &= ~I_NOT_INUSE ; } if ( ip->i_owner == Superblock.s_member ) { bs_local_inodes_free++ ; if ( Last_free == 0 ) { Last_free = ip; } } } } /* * See if there are any inodes. * If not then we still need to have last_free pointing at the inode table! */ if (Last_free == 0) { Last_free = Inode_table + 1 ; bwarn("no free inodes!"); } bs_init_irw() ; gs_init_ttl() ; }
void *out_alloc(oskit_size_t size, lmm_flags_t flags) { void* r; r = in_alloc(size + 2*GUARD_SIZE,flags); if (r) { set_guard(r); r += GUARD_SIZE; set_guard(r+size); } return r; }