btrfs-progs: libbtrfs: remove max/min macros from API

kerncompat.h header file is part of libbtrfs API. min/max macros cause
conflict while building projects dependant on libbtrfs. Moving those
macros to btrfs-progs internal header file fixes the conflict.

Signed-off-by: Ondrej Kozina <okozina@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.com>
master
Ondrej Kozina 2016-03-04 14:46:11 +01:00 committed by David Sterba
parent 1e8246a058
commit 5d23b6a7b0
9 changed files with 49 additions and 20 deletions

View File

@ -22,6 +22,7 @@
#include "backref.h"
#include "ulist.h"
#include "transaction.h"
#include "internal.h"
#define pr_debug(...) do { } while (0)

View File

@ -20,6 +20,7 @@
#include "transaction.h"
#include "print-tree.h"
#include "repair.h"
#include "internal.h"
static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root
*root, struct btrfs_path *path, int level);

View File

@ -27,6 +27,7 @@
#include "list.h"
#include "ctree.h"
#include "volumes.h"
#include "internal.h"
void extent_io_tree_init(struct extent_io_tree *tree)
{

View File

@ -25,6 +25,7 @@
#include "transaction.h"
#include "print-tree.h"
#include "crc32c.h"
#include "internal.h"
#define MAX_CSUM_ITEMS(r,size) ((((BTRFS_LEAF_DATA_SIZE(r) - \
sizeof(struct btrfs_item) * 2) / \

View File

@ -24,6 +24,7 @@
#include "extent_io.h"
#include "crc32c.h"
#include "bitops.h"
#include "internal.h"
/*
* Kernel always uses PAGE_CACHE_SIZE for sectorsize, but we don't have

View File

@ -19,6 +19,7 @@
#include "ctree.h"
#include "disk-io.h"
#include "transaction.h"
#include "internal.h"
/*
* walks the btree of allocated inodes and find a hole.

42
internal.h 100644
View File

@ -0,0 +1,42 @@
/*
* Copyright (C) 2007 Oracle. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License v2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 021110-1307, USA.
*/
#ifndef __INTERNAL_H__
#define __INTERNAL_H__
/*
* max/min macro
*/
#define min(x,y) ({ \
typeof(x) _x = (x); \
typeof(y) _y = (y); \
(void) (&_x == &_y); \
_x < _y ? _x : _y; })
#define max(x,y) ({ \
typeof(x) _x = (x); \
typeof(y) _y = (y); \
(void) (&_x == &_y); \
_x > _y ? _x : _y; })
#define min_t(type,x,y) \
({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
#define max_t(type,x,y) \
({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
#endif

View File

@ -240,26 +240,6 @@ static inline long IS_ERR(const void *ptr)
return IS_ERR_VALUE((unsigned long)ptr);
}
/*
* max/min macro
*/
#define min(x,y) ({ \
typeof(x) _x = (x); \
typeof(y) _y = (y); \
(void) (&_x == &_y); \
_x < _y ? _x : _y; })
#define max(x,y) ({ \
typeof(x) _x = (x); \
typeof(y) _y = (y); \
(void) (&_x == &_y); \
_x > _y ? _x : _y; })
#define min_t(type,x,y) \
({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
#define max_t(type,x,y) \
({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
/*
* This looks more complex than it should be. But we need to
* get the type for the ~ right in round_down (it needs to be

View File

@ -23,6 +23,7 @@
#include "ctree.h"
#include <dirent.h>
#include <stdarg.h>
#include "internal.h"
#define BTRFS_MKFS_SYSTEM_GROUP_SIZE (4 * 1024 * 1024)
#define BTRFS_MKFS_SMALL_VOLUME_SIZE (1024 * 1024 * 1024)