Files
xen/tools/hotplug/Linux/block-drbd-probe
T
Ian Campbell 443701ef0c Replace FSF street address with canonical URL
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>
2015-07-29 11:14:07 +01:00

87 lines
1.9 KiB
Bash
Executable File

#! /bin/bash
#
# Copyright (C) 2014 FUJITSU LIMITED
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; If not, see <http://www.gnu.org/licenses/>.
#
# Usage:
# block-drbd-probe devicename
#
# Return value:
# 0: the device is drbd device
# 1: the device is not drbd device
# 2: unkown error
# 3: the drbd device does not use protocol D
# 4: the drbd device is not ready
set -e
drbd_res=
function get_res_name()
{
local drbd_dev=$1
local drbd_dev_list=($(drbdadm sh-dev all))
local drbd_res_list=($(drbdadm sh-resource all))
local temp_drbd_dev temp_drbd_res
local found=0
for temp_drbd_dev in ${drbd_dev_list[@]}; do
if [[ "$temp_drbd_dev" == "$drbd_dev" ]]; then
found=1
break
fi
done
if [[ $found -eq 0 ]]; then
return 1
fi
for temp_drbd_res in ${drbd_res_list[@]}; do
temp_drbd_dev=$(drbdadm sh-dev $temp_drbd_res)
if [[ "$temp_drbd_dev" == "$drbd_dev" ]]; then
drbd_res="$temp_drbd_res"
return 0
fi
done
# OOPS
return 2
}
get_res_name $1
rc=$?
if [[ $rc -ne 0 ]]; then
exit $rc
fi
# check protocol
drbdsetup $1 show | grep -q "protocol D;"
if [[ $? -ne 0 ]]; then
exit 3
fi
# check connect status
state=$(drbdadm cstate "$drbd_res")
if [[ "$state" != "Connected" ]]; then
exit 4
fi
# check role
role=$(drbdadm role "$drbd_res")
if [[ "$role" != "Primary/Secondary" ]]; then
exit 4
fi
exit 0