inline bool TX_VALIDATE(TX_RESULT result, TX_RESULT falseResult1, TX_RESULT falseResult2) { if(result == falseResult2) return false; return TX_VALIDATE(result, falseResult1); }
inline std::string GetString(TX_RESULT (*pFn)(THandle1, TX_STRING, TX_SIZE*), THandle2 handle, TX_SIZE estimatedLength = 0) { std::string str; TX_VALIDATE(GetString(&str, pFn, handle, estimatedLength)); return str; }
int validate_dentry(struct txobj_thread_list_node * xnode){ struct _dentry * orig = ((struct dentry *)xnode->orig_obj)->d_contents; struct _dentry *checkpoint = xnode->checkpoint_obj; struct _dentry *shadow = xnode->shadow_obj; // Don't bother validating this //TX_VALIDATE_ATOMIC(orig, checkpoint, d_count); TX_VALIDATE(orig, checkpoint, d_flags); // Make sure this hasn't changed. We don't update this, // though, as we are going to have the shadow copy point to // the shadow inode TX_VALIDATE(orig, checkpoint, d_inode); // Ignore d_hash - only used in non-speculative copy //hlist_validate_tx(&orig->d_hash, &checkpoint->d_hash); TX_VALIDATE(orig, checkpoint, d_parent); TX_VALIDATE(orig, checkpoint, d_name.hash); TX_VALIDATE(orig, checkpoint, d_name.len); TX_VALIDATE(orig, checkpoint, d_name.name); // Check the child //list_validate_tx(&orig->d_subdirs, &checkpoint->d_subdirs); //list_validate_tx(&orig->d_child, &checkpoint->d_child); //list_validate_tx(&orig->d_alias, &checkpoint->d_alias); TX_VALIDATE(orig, checkpoint, d_time); TX_VALIDATE(orig, checkpoint, d_op); #ifdef CONFIG_PROFILING TX_VALIDATE(orig, checkpoint, d_cookie); #endif if(strncmp(orig->d_iname, checkpoint->d_iname, DNAME_INLINE_LEN_MIN) != 0){ printk(KERN_ERR "Inconsistent value for %p\n", &orig->d_iname); BUG(); } /* Also validate the shadow */ if(xnode->rw == ACCESS_R){ TX_VALIDATE(orig, shadow, d_flags); if(orig->d_inode != shadow->d_inode) KSTM_BUG_ON(orig->d_inode != shadow->d_inode); //KSTM_BUG_ON(orig->d_inode != shadow(shadow->d_inode)); // Ignore d_hash - only used in non-speculative copy //hlist_validate_tx_ro(&orig->d_hash, &shadow->d_hash); TX_VALIDATE(orig, shadow, d_parent); TX_VALIDATE(orig, shadow, d_name.hash); TX_VALIDATE(orig, shadow, d_name.len); if(shadow->d_name.name == shadow->d_iname) KSTM_BUG_ON(orig->d_name.name != orig->d_iname); else TX_VALIDATE(orig, shadow, d_name.name); // Check the child //list_validate_tx_ro(&orig->d_subdirs, &shadow->d_subdirs); //list_validate_tx_ro(&orig->d_child, &shadow->d_child); //list_validate_tx_ro(&orig->d_alias, &shadow->d_alias); TX_VALIDATE(orig, shadow, d_time); TX_VALIDATE(orig, shadow, d_op); #ifdef CONFIG_PROFILING TX_VALIDATE(orig, shadow, d_cookie); #endif if(strncmp(orig->d_iname, shadow->d_iname, DNAME_INLINE_LEN_MIN) != 0){ printk(KERN_ERR "Inconsistent value for %p\n", &orig->d_iname); BUG(); } } return 0; }