/* Audited by: green(2002.06.15) */ item_id item_id_by_coord(const coord_t * coord /* coord to query */ ) { assert("vs-539", coord != NULL); assert("vs-538", coord->node != NULL); assert("vs-537", znode_is_loaded(coord->node)); assert("vs-536", item_plugin_by_coord(coord) != NULL); assert("vs-540", item_id_by_plugin(item_plugin_by_coord(coord)) < LAST_ITEM_ID); return item_id_by_plugin(item_plugin_by_coord(coord)); }
/* return the biggest key contained the unit @coord */ reiser4_key *max_unit_key_by_coord(const coord_t * coord /* coord to query */ , reiser4_key * key /* result */ ) { assert("nikita-772", coord != NULL); assert("nikita-774", coord->node != NULL); assert("nikita-775", znode_is_loaded(coord->node)); if (item_plugin_by_coord(coord)->b.max_unit_key != NULL) return item_plugin_by_coord(coord)->b.max_unit_key(coord, key); else return unit_key_by_coord(coord, key); }
/* mergeable_cde(): implementation of ->mergeable() item method. Two directory items are mergeable iff they are from the same directory. That simple. */ int mergeable_cde(const coord_t * p1 /* coord of first item */ , const coord_t * p2 /* coord of second item */ ) { reiser4_key k1; reiser4_key k2; assert("nikita-1339", p1 != NULL); assert("nikita-1340", p2 != NULL); return (item_plugin_by_coord(p1) == item_plugin_by_coord(p2)) && (extract_dir_id_from_key(item_key_by_coord(p1, &k1)) == extract_dir_id_from_key(item_key_by_coord(p2, &k2))); }
/* @data contains data which are to be put into tree */ int can_contain_key_cde(const coord_t * coord /* coord of item */ , const reiser4_key * key /* key to check */ , const reiser4_item_data * data /* parameters of new * item/unit being * created */ ) { reiser4_key item_key; /* FIXME-VS: do not rely on anything but iplug field of @data. Only data->iplug is initialized */ assert("vs-457", data && data->iplug); /* assert( "vs-553", data -> user == 0 );*/ item_key_by_coord(coord, &item_key); return (item_plugin_by_coord(coord) == data->iplug) && (extract_dir_id_from_key(&item_key) == extract_dir_id_from_key(key)); }
/** * find_start * @inode: * @id: * @offset: * * this is used by tail2extent and extent2tail to detect where previous * uncompleted conversion stopped */ static int find_start(struct inode *inode, reiser4_plugin_id id, __u64 *offset) { int result; lock_handle lh; coord_t coord; struct unix_file_info *ufo; int found; reiser4_key key; ufo = unix_file_inode_data(inode); init_lh(&lh); result = 0; found = 0; inode_file_plugin(inode)->key_by_inode(inode, *offset, &key); do { init_lh(&lh); result = find_file_item_nohint(&coord, &lh, &key, ZNODE_READ_LOCK, inode); if (result == CBK_COORD_FOUND) { if (coord.between == AT_UNIT) { /*coord_clear_iplug(&coord); */ result = zload(coord.node); if (result == 0) { if (item_id_by_coord(&coord) == id) found = 1; else item_plugin_by_coord(&coord)->s. file.append_key(&coord, &key); zrelse(coord.node); } } else result = RETERR(-ENOENT); } done_lh(&lh); } while (result == 0 && !found); *offset = get_key_offset(&key); return result; }