/* Convert atom to name */ static int unatom(struct inode *atable, atom_t atom, char *name, unsigned size) { if(DEBUG_MODE_K==1) { printf("\t\t\t\t%25s[K] %25s %4d #in\n",__FILE__,__func__,__LINE__); } struct sb *sb = tux_sb(atable->i_sb); struct buffer_head *buffer; int err; loff_t where = unatom_dict_read(atable, atom); if (where < 0) { err = where; goto error; } buffer = blockread(mapping(atable), where >> sb->blockbits); if (!buffer) { err = -EIO; goto error; } tux_dirent *entry = bufdata(buffer) + (where & sb->blockmask); if (entry_atom(entry) != atom) { tux3_fs_error(sb, "atom %x reverse entry broken", atom); err = -EIO; goto error_blockput; } unsigned len = entry->name_len; if (size) { if (len > size) { err = -ERANGE; goto error_blockput; } memcpy(name, entry->name, len); } blockput(buffer); return len; error_blockput: blockput(buffer); error: return err; }
/* Find atom of name */ static int find_atom(struct inode *atable, const char *name, unsigned len, atom_t *atom) { struct sb *sb = tux_sb(atable->i_sb); struct buffer_head *buffer; struct tux3_dirent *entry; entry = tux_find_entry(atable, name, len, &buffer, sb->atomdictsize); if (IS_ERR(entry)) { int err = PTR_ERR(entry); if (err == -ENOENT) return -ENODATA; return err; } *atom = entry_atom(entry); blockput(buffer); return 0; }
/* Find atom of name */ static int find_atom(struct inode *atable, const char *name, unsigned len, atom_t *atom) { if(DEBUG_MODE_K==1) { printf("\t\t\t\t%25s[K] %25s %4d #in\n",__FILE__,__func__,__LINE__); } struct sb *sb = tux_sb(atable->i_sb); struct buffer_head *buffer; tux_dirent *entry; entry = tux_find_entry(atable, name, len, &buffer, sb->atomdictsize); if (IS_ERR(entry)) { int err = PTR_ERR(entry); if (err == -ENOENT) return -ENODATA; return err; } *atom = entry_atom(entry); blockput(buffer); return 0; }