static int on_node(dirscan_t *d, dirscan_entry_t *entry, void *user) { check_context_t *ctx = (check_context_t *) user; ctx->current_inode = entry->inode; ctx->block = entry->block; ctx->parent = entry->parent; ctx->hash = entry->hindex; return check_inode(ctx); }
void check_dent_int (struct dentry *dentry, int parent) { if (parent) { printk (KERN_DEBUG "* parent(%d) dentry: %.*s\n", parent, (int) dentry->d_name.len, dentry->d_name.name); } else { printk (KERN_DEBUG "* checking dentry: %.*s\n", (int) dentry->d_name.len, dentry->d_name.name); } check_inode (dentry->d_inode); printk (KERN_DEBUG "* d_count=%d", dentry->d_count); check_sb (dentry->d_sb, 'd'); if (dentry->d_op == NULL) { printk (" (d_op is NULL)\n"); } else { printk (" (d_op is UNKNOWN: %p)\n", dentry->d_op); } }
static int dolookup(char *name) { struct inodesc idesc; if (!checkactivedir()) return 0; idesc.id_number = curinum; idesc.id_func = check_findino; idesc.id_name = name; idesc.id_type = DATA; idesc.id_fix = IGNORE; if (check_inode(curinode, &idesc) & FOUND) { curinum = idesc.id_parent; curinode = check_ginode(curinum); printactive(0); return 1; } else { warnx("name `%s' not found in current inode directory", name); return 0; } }
static int inode_callback(sam_perm_inode_t *ip, void *arg) { inode_cb_arg_t *cb_arg = (inode_cb_arg_t *)arg; boolean_t retry_inode; /* Inodes that shouldn't be checked */ if (!IS_DB_INODE(ip->di.id.ino) || !IS_DB_INODE(ip->di.parent_id.ino)) { return (0); } retry: retry_inode = FALSE; if (ip->di.id.ino == cur_check.inode.ino) { if (ip->di.mode == 0 || S_ISEXT(ip->di.mode)) { QUIET_PRINT(stderr, "Inactive inode %d " "found in database.\n", ip->di.id.ino); add_repair_entry(ip->di.id, ip->di.parent_id, TRUE); } else { /* * Check the inode and directory. Repair reason * is printed in the corresponding check method. */ if (check_inode(ip) < 0) { add_repair_entry(ip->di.id, ip->di.parent_id, FALSE); } else if (!fast_scan && S_ISDIR(ip->di.mode)) { if (check_directory(cb_arg->dir_con, cb_arg->dir_stmt, ip) < 0) { add_repair_entry(ip->di.id, ip->di.parent_id, TRUE); } } } } else if (ip->di.id.ino < cur_check.inode.ino) { /* In-use inodes should be in database */ if (!(ip->di.mode == 0 || S_ISEXT(ip->di.mode))) { QUIET_PRINT(stderr, "Inode %d does " "not exist in database.\n", ip->di.id.ino); add_repair_entry(ip->di.id, ip->di.parent_id, TRUE); } return (0); } else { /* ip->di.id.ino > cur_check.inode.ino */ /* Database is incorrect, parent unknown */ QUIET_PRINT(stderr, "Erroneous inode %d " "found in database.\n", cur_check.inode.ino); sam_id_t id = {cur_check.inode.ino, cur_check.inode.gen}; sam_id_t pid = {0, 0}; add_repair_entry(id, pid, TRUE); retry_inode = TRUE; } /* Get next inode to check from database. */ if (next_check_ino(cb_arg->check_stmt) < 0) { fprintf(stderr, "Error getting check value.\n"); return (-1); } if (retry_inode) { goto retry; } return (0); }