本文整理汇总了C++中reiserfs_warning函数的典型用法代码示例。如果您正苦于以下问题:C++ reiserfs_warning函数的具体用法?C++ reiserfs_warning怎么用?C++ reiserfs_warning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了reiserfs_warning函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: is_internal
/* returns 1 if buf looks like an internal node, 0 otherwise */
static int is_internal(char *buf, int blocksize, struct buffer_head *bh)
{
struct block_head *blkh;
int nr;
int used_space;
blkh = (struct block_head *)buf;
nr = blkh_level(blkh);
if (nr <= DISK_LEAF_NODE_LEVEL || nr > MAX_HEIGHT) {
/* this level is not possible for internal nodes */
reiserfs_warning(NULL, "reiserfs-5087",
"this should be caught earlier");
return 0;
}
nr = blkh_nr_item(blkh);
if (nr > (blocksize - BLKH_SIZE - DC_SIZE) / (KEY_SIZE + DC_SIZE)) {
/* for internal which is not root we might check min number of keys */
reiserfs_warning(NULL, "reiserfs-5088",
"number of key seems wrong: %z", bh);
return 0;
}
used_space = BLKH_SIZE + KEY_SIZE * nr + DC_SIZE * (nr + 1);
if (used_space != blocksize - blkh_free_space(blkh)) {
reiserfs_warning(NULL, "reiserfs-5089",
"free space seems wrong: %z", bh);
return 0;
}
// one may imagine much more checks
return 1;
}
示例2: find_hash_out
// if root directory is empty - we set default - Yura's - hash and
// warn about it
// FIXME: we look for only one name in a directory. If tea and yura
// bith have the same value - we ask user to send report to the
// mailing list
__u32 find_hash_out (struct super_block * s)
{
int retval;
struct inode * inode;
struct cpu_key key;
INITIALIZE_PATH (path);
struct reiserfs_dir_entry de;
__u32 hash = DEFAULT_HASH;
inode = s->s_root->d_inode;
do { // Some serious "goto"-hater was there ;)
u32 teahash, r5hash, yurahash;
make_cpu_key (&key, inode, ~0, TYPE_DIRENTRY, 3);
retval = search_by_entry_key (s, &key, &path, &de);
if (retval == IO_ERROR) {
pathrelse (&path);
return UNSET_HASH ;
}
if (retval == NAME_NOT_FOUND)
de.de_entry_num --;
set_de_name_and_namelen (&de);
if (deh_offset( &(de.de_deh[de.de_entry_num]) ) == DOT_DOT_OFFSET) {
/* allow override in this case */
if (reiserfs_rupasov_hash(s)) {
hash = YURA_HASH ;
}
reiserfs_warning("reiserfs: FS seems to be empty, autodetect "
"is using the default hash\n");
break;
}
r5hash=GET_HASH_VALUE (r5_hash (de.de_name, de.de_namelen));
teahash=GET_HASH_VALUE (keyed_hash (de.de_name, de.de_namelen));
yurahash=GET_HASH_VALUE (yura_hash (de.de_name, de.de_namelen));
if ( ( (teahash == r5hash) && (GET_HASH_VALUE( deh_offset(&(de.de_deh[de.de_entry_num]))) == r5hash) ) ||
( (teahash == yurahash) && (yurahash == GET_HASH_VALUE( deh_offset(&(de.de_deh[de.de_entry_num])))) ) ||
( (r5hash == yurahash) && (yurahash == GET_HASH_VALUE( deh_offset(&(de.de_deh[de.de_entry_num])))) ) ) {
reiserfs_warning("reiserfs: Unable to automatically detect hash"
"function for device %s\n"
"please mount with -o hash={tea,rupasov,r5}\n", kdevname (s->s_dev));
hash = UNSET_HASH;
break;
}
if (GET_HASH_VALUE( deh_offset(&(de.de_deh[de.de_entry_num])) ) == yurahash)
hash = YURA_HASH;
else if (GET_HASH_VALUE( deh_offset(&(de.de_deh[de.de_entry_num])) ) == teahash)
hash = TEA_HASH;
else if (GET_HASH_VALUE( deh_offset(&(de.de_deh[de.de_entry_num])) ) == r5hash)
hash = R5_HASH;
else {
reiserfs_warning("reiserfs: Unrecognised hash function for "
"device %s\n", kdevname (s->s_dev));
hash = UNSET_HASH;
}
} while (0);
pathrelse (&path);
return hash;
}
示例3: reiserfs_open
/* read super block and bitmaps. fixme: only 4k blocks, pre-journaled format
is refused */
reiserfs_filsys_t reiserfs_open (char * filename, int flags, int *error, void * vp)
{
reiserfs_filsys_t fs;
struct buffer_head * bh;
struct reiserfs_super_block * rs;
int fd, i;
fd = open (filename, flags | O_LARGEFILE);
if (fd == -1) {
if (error)
*error = errno;
return 0;
}
fs = getmem (sizeof (*fs));
fs->s_dev = fd;
fs->s_vp = vp;
asprintf (&fs->file_name, "%s", filename);
/* reiserfs super block is either in 16-th or in 2-nd 4k block of the
device */
for (i = 16; i > 0; i -= 14) {
bh = bread (fd, i, 4096);
if (!bh) {
reiserfs_warning (stderr, "reiserfs_open: bread failed reading block %d\n", i);
} else {
rs = (struct reiserfs_super_block *)bh->b_data;
if (is_reiser2fs_magic_string (rs) || is_reiserfs_magic_string (rs))
goto found;
/* reiserfs signature is not found at the i-th 4k block */
brelse (bh);
}
}
reiserfs_warning (stderr, "reiserfs_open: neither new nor old reiserfs format "
"found on %s\n", filename);
if (error)
*error = 0;
return fs;
found:
/* fixme: we could make some check to make sure that super block looks
correctly */
fs->s_version = is_reiser2fs_magic_string (rs) ? REISERFS_VERSION_2 :
REISERFS_VERSION_1;
fs->s_blocksize = rs_blocksize (rs);
fs->s_hash_function = code2func (rs_hash (rs));
SB_BUFFER_WITH_SB (fs) = bh;
fs->s_rs = rs;
fs->s_flags = flags; /* O_RDONLY or O_RDWR */
fs->s_vp = vp;
reiserfs_read_bitmap_blocks(fs);
return fs;
}
示例4: print_internal
/* this prints internal nodes (4 keys/items in line) (dc_number,
dc_size)[k_dirid, k_objectid, k_offset, k_uniqueness](dc_number,
dc_size)...*/
static int print_internal (struct buffer_head * bh, int first, int last)
{
struct key * key;
struct disk_child * dc;
int i;
int from, to;
if (!B_IS_KEYS_LEVEL (bh))
return 1;
check_internal (bh);
if (first == -1) {
from = 0;
to = B_NR_ITEMS (bh);
} else {
from = first;
to = last < B_NR_ITEMS (bh) ? last : B_NR_ITEMS (bh);
}
reiserfs_warning ("INTERNAL NODE (%ld) contains %z\n", bh->b_blocknr, bh);
dc = B_N_CHILD (bh, from);
reiserfs_warning ("PTR %d: %y ", from, dc);
for (i = from, key = B_N_PDELIM_KEY (bh, from), dc ++; i < to; i ++, key ++, dc ++) {
reiserfs_warning ("KEY %d: %k PTR %d: %y ", i, key, i + 1, dc);
if (i && i % 4 == 0)
printk ("\n");
}
printk ("\n");
return 0;
}
示例5: search_by_entry_key
/* The function is NOT SCHEDULE-SAFE! */
int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
struct path *path, struct reiserfs_dir_entry *de)
{
int retval;
retval = search_item(sb, key, path);
switch (retval) {
case ITEM_NOT_FOUND:
if (!PATH_LAST_POSITION(path)) {
reiserfs_warning(sb,
"vs-7000: search_by_entry_key: search_by_key returned item position == 0");
pathrelse(path);
return IO_ERROR;
}
PATH_LAST_POSITION(path)--;
case ITEM_FOUND:
break;
case IO_ERROR:
return retval;
default:
pathrelse(path);
reiserfs_warning(sb,
"vs-7002: search_by_entry_key: no path to here");
return IO_ERROR;
}
set_de_item_location(de, path);
#ifdef CONFIG_REISERFS_CHECK
if (!is_direntry_le_ih(de->de_ih) ||
COMP_SHORT_KEYS(&(de->de_ih->ih_key), key)) {
print_block(de->de_bh, 0, -1, -1);
reiserfs_panic(sb,
"vs-7005: search_by_entry_key: found item %h is not directory item or "
"does not belong to the same directory as key %K",
de->de_ih, key);
}
#endif /* CONFIG_REISERFS_CHECK */
/* binary search in directory item by third componen t of the
key. sets de->de_entry_num of de */
retval = bin_search_in_dir_item(de, cpu_key_k_offset(key));
path->pos_in_item = de->de_entry_num;
if (retval != NAME_NOT_FOUND) {
// ugly, but rename needs de_bh, de_deh, de_name, de_namelen, de_objectid set
set_de_name_and_namelen(de);
set_de_object_key(de);
}
return retval;
}
示例6: print_leaf
static int print_leaf (struct buffer_head * bh, int print_mode, int first, int last)
{
struct block_head * blkh;
struct item_head * ih;
int i, nr;
int from, to;
if (!B_IS_ITEMS_LEVEL (bh))
return 1;
check_leaf (bh);
blkh = B_BLK_HEAD (bh);
ih = B_N_PITEM_HEAD (bh,0);
nr = blkh_nr_item(blkh);
printk ("\n===================================================================\n");
reiserfs_warning ("LEAF NODE (%ld) contains %z\n", bh->b_blocknr, bh);
if (!(print_mode & PRINT_LEAF_ITEMS)) {
reiserfs_warning ("FIRST ITEM_KEY: %k, LAST ITEM KEY: %k\n",
&(ih->ih_key), &((ih + nr - 1)->ih_key));
return 0;
}
if (first < 0 || first > nr - 1)
from = 0;
else
from = first;
if (last < 0 || last > nr )
to = nr;
else
to = last;
ih += from;
printk ("-------------------------------------------------------------------------------\n");
printk ("|##| type | key | ilen | free_space | version | loc |\n");
for (i = from; i < to; i++, ih ++) {
printk ("-------------------------------------------------------------------------------\n");
reiserfs_warning ("|%2d| %h |\n", i, ih);
if (print_mode & PRINT_LEAF_ITEMS)
op_print_item (ih, B_I_PITEM (bh, ih));
}
printk ("===================================================================\n");
return 0;
}
示例7: hash_function
// return pointer to appropriate function
static hashf_t hash_function (struct super_block * s)
{
switch (what_hash (s)) {
case TEA_HASH:
reiserfs_warning ("Using tea hash to sort names\n");
return keyed_hash;
case YURA_HASH:
reiserfs_warning ("Using rupasov hash to sort names\n");
return yura_hash;
case R5_HASH:
reiserfs_warning ("Using r5 hash to sort names\n");
return r5_hash;
}
return NULL;
}
示例8: reiserfs_proc_info_init
int reiserfs_proc_info_init(struct super_block *sb)
{
char b[BDEVNAME_SIZE];
char *s;
/* Some block devices use /'s */
strlcpy(b, reiserfs_bdevname(sb), BDEVNAME_SIZE);
s = strchr(b, '/');
if (s)
*s = '!';
spin_lock_init(&__PINFO(sb).lock);
REISERFS_SB(sb)->procdir = proc_mkdir_data(b, 0, proc_info_root, sb);
if (REISERFS_SB(sb)->procdir) {
add_file(sb, "version", show_version);
add_file(sb, "super", show_super);
add_file(sb, "per-level", show_per_level);
add_file(sb, "bitmap", show_bitmap);
add_file(sb, "on-disk-super", show_on_disk_super);
add_file(sb, "oidmap", show_oidmap);
add_file(sb, "journal", show_journal);
return 0;
}
reiserfs_warning(sb, "cannot create /proc/%s/%s",
proc_info_root_name, b);
return 1;
}
示例9: read_bitmaps
static int read_bitmaps (struct super_block * s)
{
int i, bmp;
SB_AP_BITMAP (s) = vmalloc (sizeof (struct reiserfs_bitmap_info) * SB_BMAP_NR(s));
if (SB_AP_BITMAP (s) == 0)
return 1;
memset (SB_AP_BITMAP (s), 0, sizeof (struct reiserfs_bitmap_info) * SB_BMAP_NR(s));
for (i = 0, bmp = REISERFS_DISK_OFFSET_IN_BYTES / s->s_blocksize + 1;
i < SB_BMAP_NR(s); i++, bmp = s->s_blocksize * 8 * i) {
SB_AP_BITMAP (s)[i].bh = sb_getblk (s, bmp);
if (!buffer_uptodate(SB_AP_BITMAP(s)[i].bh))
ll_rw_block(READ, 1, &SB_AP_BITMAP(s)[i].bh);
}
for (i = 0; i < SB_BMAP_NR(s); i++) {
wait_on_buffer(SB_AP_BITMAP (s)[i].bh);
if (!buffer_uptodate(SB_AP_BITMAP(s)[i].bh)) {
reiserfs_warning("sh-2029: reiserfs read_bitmaps: "
"bitmap block (#%lu) reading failed\n",
SB_AP_BITMAP(s)[i].bh->b_blocknr);
for (i = 0; i < SB_BMAP_NR(s); i++)
brelse(SB_AP_BITMAP(s)[i].bh);
vfree(SB_AP_BITMAP(s));
SB_AP_BITMAP(s) = NULL;
return 1;
}
load_bitmap_info_data (s, SB_AP_BITMAP (s) + i);
}
return 0;
}
示例10: read_bitmaps
static int read_bitmaps (struct super_block * s)
{
int i, bmp;
SB_AP_BITMAP (s) = reiserfs_kmalloc (sizeof (struct buffer_head *) * SB_BMAP_NR(s), GFP_NOFS, s);
if (SB_AP_BITMAP (s) == 0)
return 1;
for (i = 0, bmp = REISERFS_DISK_OFFSET_IN_BYTES / s->s_blocksize + 1;
i < SB_BMAP_NR(s); i++, bmp = s->s_blocksize * 8 * i) {
SB_AP_BITMAP (s)[i] = getblk (s->s_dev, bmp, s->s_blocksize);
if (!buffer_uptodate(SB_AP_BITMAP(s)[i]))
ll_rw_block(READ, 1, SB_AP_BITMAP(s) + i);
}
for (i = 0; i < SB_BMAP_NR(s); i++) {
wait_on_buffer(SB_AP_BITMAP (s)[i]);
if (!buffer_uptodate(SB_AP_BITMAP(s)[i])) {
reiserfs_warning("sh-2029: reiserfs read_bitmaps: "
"bitmap block (#%lu) reading failed\n",
SB_AP_BITMAP(s)[i]->b_blocknr);
for (i = 0; i < SB_BMAP_NR(s); i++)
brelse(SB_AP_BITMAP(s)[i]);
reiserfs_kfree(SB_AP_BITMAP(s), sizeof(struct buffer_head *) * SB_BMAP_NR(s), s);
SB_AP_BITMAP(s) = NULL;
return 1;
}
}
return 0;
}
示例11: reiserfs_put_super
static void reiserfs_put_super (struct super_block * s)
{
int i;
struct reiserfs_transaction_handle th ;
/* change file system state to current state if it was mounted with read-write permissions */
if (!(s->s_flags & MS_RDONLY)) {
journal_begin(&th, s, 10) ;
reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1) ;
set_sb_state( SB_DISK_SUPER_BLOCK(s), s->u.reiserfs_sb.s_mount_state );
journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB (s));
}
/* note, journal_release checks for readonly mount, and can decide not
** to do a journal_end
*/
journal_release(&th, s) ;
for (i = 0; i < SB_BMAP_NR (s); i ++)
brelse (SB_AP_BITMAP (s)[i].bh);
vfree (SB_AP_BITMAP (s));
brelse (SB_BUFFER_WITH_SB (s));
print_statistics (s);
if (s->u.reiserfs_sb.s_kmallocs != 0) {
reiserfs_warning ("vs-2004: reiserfs_put_super: allocated memory left %d\n",
s->u.reiserfs_sb.s_kmallocs);
}
if (s->u.reiserfs_sb.reserved_blocks != 0) {
reiserfs_warning ("green-2005: reiserfs_put_super: reserved blocks left %d\n",
s->u.reiserfs_sb.reserved_blocks);
}
reiserfs_proc_unregister( s, "journal" );
reiserfs_proc_unregister( s, "oidmap" );
reiserfs_proc_unregister( s, "on-disk-super" );
reiserfs_proc_unregister( s, "bitmap" );
reiserfs_proc_unregister( s, "per-level" );
reiserfs_proc_unregister( s, "super" );
reiserfs_proc_unregister( s, "version" );
reiserfs_proc_info_done( s );
return;
}
示例12: reiserfs_listxattr
/*
* Inode operation listxattr()
*
* We totally ignore the generic listxattr here because it would be stupid
* not to. Since the xattrs are organized in a directory, we can just
* readdir to find them.
*/
ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
{
struct dentry *dir;
int err = 0;
loff_t pos = 0;
struct listxattr_buf buf = {
.dentry = dentry,
.buf = buffer,
.size = buffer ? size : 0,
};
if (!dentry->d_inode)
return -EINVAL;
if (!dentry->d_sb->s_xattr ||
get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1)
return -EOPNOTSUPP;
dir = open_xa_dir(dentry->d_inode, XATTR_REPLACE);
if (IS_ERR(dir)) {
err = PTR_ERR(dir);
if (err == -ENODATA)
err = 0; /* Not an error if there aren't any xattrs */
goto out;
}
mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_XATTR);
err = reiserfs_readdir_dentry(dir, &buf, listxattr_filler, &pos);
mutex_unlock(&dir->d_inode->i_mutex);
if (!err)
err = buf.pos;
dput(dir);
out:
return err;
}
static int create_privroot(struct dentry *dentry)
{
int err;
struct inode *inode = dentry->d_parent->d_inode;
WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex));
err = xattr_mkdir(inode, dentry, 0700);
if (err || !dentry->d_inode) {
reiserfs_warning(dentry->d_sb, "jdm-20006",
"xattrs/ACLs enabled and couldn't "
"find/create .reiserfs_priv. "
"Failing mount.");
return -EOPNOTSUPP;
}
dentry->d_inode->i_flags |= S_PRIVATE;
reiserfs_info(dentry->d_sb, "Created %s - reserved for xattr "
"storage.\n", PRIVROOT_NAME);
return 0;
}
示例13: is_reusable
int is_reusable (struct super_block * s, b_blocknr_t block, int bit_value)
{
int i, j;
if (block == 0 || block >= SB_BLOCK_COUNT (s)) {
reiserfs_warning (s, "vs-4010: is_reusable: block number is out of range %lu (%u)",
block, SB_BLOCK_COUNT (s));
return 0;
}
/* it can't be one of the bitmap blocks */
for (i = 0; i < SB_BMAP_NR (s); i ++)
if (block == SB_AP_BITMAP (s)[i].bh->b_blocknr) {
reiserfs_warning (s, "vs: 4020: is_reusable: "
"bitmap block %lu(%u) can't be freed or reused",
block, SB_BMAP_NR (s));
return 0;
}
get_bit_address (s, block, &i, &j);
if (i >= SB_BMAP_NR (s)) {
reiserfs_warning (s, "vs-4030: is_reusable: there is no so many bitmap blocks: "
"block=%lu, bitmap_nr=%d", block, i);
return 0;
}
if ((bit_value == 0 &&
reiserfs_test_le_bit(j, SB_AP_BITMAP(s)[i].bh->b_data)) ||
(bit_value == 1 &&
reiserfs_test_le_bit(j, SB_AP_BITMAP (s)[i].bh->b_data) == 0)) {
reiserfs_warning (s, "vs-4040: is_reusable: corresponding bit of block %lu does not "
"match required value (i==%d, j==%d) test_bit==%d",
block, i, j, reiserfs_test_le_bit (j, SB_AP_BITMAP (s)[i].bh->b_data));
return 0;
}
if (bit_value == 0 && block == SB_ROOT_BLOCK (s)) {
reiserfs_warning (s, "vs-4050: is_reusable: this is root block (%u), "
"it must be busy", SB_ROOT_BLOCK (s));
return 0;
}
return 1;
}
示例14: reiserfs_chown_xattrs
/* inode->i_mutex: down */
int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs)
{
int err = reiserfs_for_each_xattr(inode, chown_one_xattr, attrs);
if (err)
reiserfs_warning(inode->i_sb, "jdm-20007",
"Couldn't chown all xattrs (%d)\n", err);
return err;
}
示例15: _reiserfs_free_block
static void _reiserfs_free_block (struct reiserfs_transaction_handle *th,
struct inode *inode, b_blocknr_t block,
int for_unformatted)
{
struct super_block * s = th->t_super;
struct reiserfs_super_block * rs;
struct buffer_head * sbh;
struct reiserfs_bitmap_info *apbi;
int nr, offset;
BUG_ON (!th->t_trans_id);
PROC_INFO_INC( s, free_block );
rs = SB_DISK_SUPER_BLOCK (s);
sbh = SB_BUFFER_WITH_SB (s);
apbi = SB_AP_BITMAP(s);
get_bit_address (s, block, &nr, &offset);
if (nr >= sb_bmap_nr (rs)) {
reiserfs_warning (s, "vs-4075: reiserfs_free_block: "
"block %lu is out of range on %s",
block, reiserfs_bdevname (s));
return;
}
reiserfs_prepare_for_journal(s, apbi[nr].bh, 1 ) ;
/* clear bit for the given block in bit map */
if (!reiserfs_test_and_clear_le_bit (offset, apbi[nr].bh->b_data)) {
reiserfs_warning (s, "vs-4080: reiserfs_free_block: "
"free_block (%s:%lu)[dev:blocknr]: bit already cleared",
reiserfs_bdevname (s), block);
}
apbi[nr].free_count ++;
journal_mark_dirty (th, s, apbi[nr].bh);
reiserfs_prepare_for_journal(s, sbh, 1) ;
/* update super block */
set_sb_free_blocks( rs, sb_free_blocks(rs) + 1 );
journal_mark_dirty (th, s, sbh);
if (for_unformatted)
DQUOT_FREE_BLOCK_NODIRTY(inode, 1);
}