Esempio n. 1
0
/*
 * Check whether a key is contained in the tree rooted from a buffer at
 * a path. This works by looking at the left and right delimiting keys
 * for the buffer in the last path_element in the path. These delimiting
 * keys are stored at least one level above that buffer in the tree.
 * If the buffer is the first or last node in the tree order then one
 * of the delimiting keys may be absent, and in this case get_lkey and
 * get_rkey return a special key which is MIN_KEY or MAX_KEY.
 */
static inline int
key_in_buffer(
    struct path *p_s_chk_path,         /* Path which should be checked. */
    const struct cpu_key *p_s_key,     /* Key which should be checked. */
    struct reiserfs_sb_info  *p_s_sbi) /* Super block pointer. */
{

	if (COMP_KEYS(get_lkey(p_s_chk_path, p_s_sbi), p_s_key) == 1)
		/* left delimiting key is bigger, that the key we look for */
		return (0);

	if (COMP_KEYS(get_rkey(p_s_chk_path, p_s_sbi), p_s_key) != 1)
		/* p_s_key must be less than right delimitiing key */
		return (0);

	return (1);
}
Esempio n. 2
0
/* This works by looking at the left and right delimiting keys for the buffer in the last path_element in
   the path.  These delimiting keys are stored at least one level above that buffer in the tree. If the
   buffer is the first or last node in the tree order then one of the delimiting keys may be absent, and in
   this case get_lkey and get_rkey return a special key which is MIN_KEY or MAX_KEY. */
static inline int key_in_buffer(struct treepath *chk_path,	/* Path which should be checked.  */
				const struct cpu_key *key,	/* Key which should be checked.   */
				struct super_block *sb
    )
{

	RFALSE(!key || chk_path->path_length < FIRST_PATH_ELEMENT_OFFSET
	       || chk_path->path_length > MAX_HEIGHT,
	       "PAP-5050: pointer to the key(%p) is NULL or invalid path length(%d)",
	       key, chk_path->path_length);
	RFALSE(!PATH_PLAST_BUFFER(chk_path)->b_bdev,
	       "PAP-5060: device must not be NODEV");

	if (comp_keys(get_lkey(chk_path, sb), key) == 1)
		/* left delimiting key is bigger, that the key we look for */
		return 0;
	/*  if ( comp_keys(key, get_rkey(chk_path, sb)) != -1 ) */
	if (comp_keys(get_rkey(chk_path, sb), key) != 1)
		/* key must be less than right delimitiing key */
		return 0;
	return 1;
}
Esempio n. 3
0
/* Check whether a key is contained in the tree rooted from a buffer at a
   path.  This works by looking at the left and right delimiting keys for the
   buffer in the last path_element in the path.  These delimiting keys are
   stored at least one level above that buffer in the tree. If the buffer is
   the first or last node in the tree order then one of the delimiting keys
   may be absent, and in this case get_lkey and get_rkey return a special key
   which is MIN_KEY or MAX_KEY. */
static  inline  int key_in_buffer (
    struct path         * p_s_chk_path, /* Path which should be checked.  */
    struct key          * p_s_key,      /* Key which should be checked.   */
    struct super_block  * p_s_sb        /* Super block pointer.           */
    ) {

#ifdef CONFIG_REISERFS_CHECK
    if ( ! p_s_key || p_s_chk_path->path_length < FIRST_PATH_ELEMENT_OFFSET ||
	 p_s_chk_path->path_length > MAX_HEIGHT )
	reiserfs_panic(p_s_sb, "PAP-5050: key_in_buffer:  pointer to the key(%p) is NULL or illegal path length(%d)",
		       p_s_key, p_s_chk_path->path_length);
  
    if ( PATH_PLAST_BUFFER(p_s_chk_path)->b_dev == NODEV )
	reiserfs_panic(p_s_sb, "PAP-5060: key_in_buffer: device must not be NODEV");
#endif

    if ( COMP_KEYS(get_lkey(p_s_chk_path, p_s_sb), p_s_key) == 1 )
	return 0;
    if ( COMP_KEYS(p_s_key, get_rkey(p_s_chk_path, p_s_sb)) != -1 )
	return 0;
    return 1;
}