mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
As recommended in http://www.gnu.org/licenses/gpl-howto.en.html. This is the result of: $ git grep -El Mass\|Temple\|Franklin | xargs ./fsf.pl Where fsf.pl is: #!/usr/bin/perl -w -pi.bak -0777 my $repl = 'If not, see <http://www.gnu.org/licenses/>.'; my $br = qr/(?:\s*\n\s*(?:[\*\#]|\/\/|\.\\" )?\s*|\s+)/; my $inwt = qr/[Ii]f${br}not,${br}write${br}(?:to${br})?the${br}Free${br}Software${br}Foundation,(?:${br}Inc\.,)?/; my $mass = qr/675${br}Mass${br}Ave,?${br}Cambridge,?${br}MA${br}02139,?${br}USA,?\.?/; my $franklin = qr/51${br}Franklin${br}St(?:reet)?(?:,${br}| - )Fifth${br}Floor,?${br}Boston,?${br}MA,?${br}02110-1301,?${br}USA,?\.?/; my $temple = qr/59${br}Temple${br}Place(?:,${br}| - )Suite${br}330,?${br}Boston,?${br}MA,?${br}021110?-1307,?${br}USA,?\.?/; s|$inwt$br$mass|$repl|m; s|$inwt$br$franklin|$repl|m; s|$inwt$br$temple|$repl|m; The only remaining mentions of these addresses are in COPYING files which I haven't touched. Some of the changed files are imports from elsewhere, however filtering them out is tricky, I think it is tolerable to have these files be modified here and then perhaps reverted on the next sync, since it's only 1-2 lines and obvious what is going on. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
115 lines
3.0 KiB
C
115 lines
3.0 KiB
C
/******************************************************************************
|
|
*
|
|
* Copyright (c) 2009 Citrix Systems, Inc. (Grzegorz Milos)
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* 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, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#ifndef __BIDIR_HASH_H__
|
|
#define __BIDIR_HASH_H__
|
|
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
#include "memshr-priv.h"
|
|
|
|
typedef struct vbdblk {
|
|
uint64_t sec;
|
|
uint16_t disk_id;
|
|
} vbdblk_t;
|
|
|
|
|
|
#if defined FINGERPRINT_MAP || BLOCK_MAP
|
|
#define DEFINE_SINGLE_MAP
|
|
#endif
|
|
|
|
/*******************************************************/
|
|
/* Fingerprint map */
|
|
/*******************************************************/
|
|
#if defined FINGERPRINT_MAP || !defined DEFINE_SINGLE_MAP
|
|
|
|
#undef BIDIR_NAME_PREFIX
|
|
#undef BIDIR_KEY
|
|
#undef BIDIR_VALUE
|
|
#undef BIDIR_KEY_T
|
|
#undef BIDIR_VALUE_T
|
|
static uint32_t fgprtshr_fgprt_hash(uint32_t h)
|
|
{
|
|
return h;
|
|
}
|
|
|
|
static uint32_t fgprtshr_mfn_hash(uint64_t m)
|
|
{
|
|
return (uint32_t)m;
|
|
}
|
|
|
|
static int fgprtshr_fgprt_cmp(uint32_t h1, uint32_t h2)
|
|
{
|
|
return (h1 == h2);
|
|
}
|
|
|
|
static int fgprtshr_mfn_cmp(uint32_t m1, uint32_t m2)
|
|
{
|
|
return (m1 == m2);
|
|
}
|
|
#define BIDIR_NAME_PREFIX fgprtshr
|
|
#define BIDIR_KEY fgprt
|
|
#define BIDIR_VALUE mfn
|
|
#define BIDIR_KEY_T uint32_t
|
|
#define BIDIR_VALUE_T xen_mfn_t
|
|
#include "bidir-namedefs.h"
|
|
|
|
#endif /* FINGERPRINT_MAP */
|
|
|
|
|
|
/*******************************************************/
|
|
/* Block<->Memory sharing handles */
|
|
/*******************************************************/
|
|
#if defined BLOCK_MAP || !defined DEFINE_SINGLE_MAP
|
|
|
|
#undef BIDIR_NAME_PREFIX
|
|
#undef BIDIR_KEY
|
|
#undef BIDIR_VALUE
|
|
#undef BIDIR_KEY_T
|
|
#undef BIDIR_VALUE_T
|
|
|
|
/* TODO better hashes! */
|
|
static inline uint32_t blockshr_block_hash(vbdblk_t block)
|
|
{
|
|
return (uint32_t)(block.sec) ^ (uint32_t)(block.disk_id);
|
|
}
|
|
|
|
static inline uint32_t blockshr_shrhnd_hash(share_tuple_t shrhnd)
|
|
{
|
|
return ((uint32_t) shrhnd.handle);
|
|
}
|
|
|
|
static inline int blockshr_block_cmp(vbdblk_t b1, vbdblk_t b2)
|
|
{
|
|
return (b1.sec == b2.sec) && (b1.disk_id == b2.disk_id);
|
|
}
|
|
|
|
static inline int blockshr_shrhnd_cmp(share_tuple_t h1, share_tuple_t h2)
|
|
{
|
|
return ( !memcmp(&h1, &h2, sizeof(share_tuple_t)) );
|
|
}
|
|
#define BIDIR_NAME_PREFIX blockshr
|
|
#define BIDIR_KEY block
|
|
#define BIDIR_VALUE shrhnd
|
|
#define BIDIR_KEY_T vbdblk_t
|
|
#define BIDIR_VALUE_T share_tuple_t
|
|
#include "bidir-namedefs.h"
|
|
|
|
#endif /* BLOCK_MAP */
|
|
|
|
#endif /* __BIDIR_HASH_H__ */
|