]>
git.ipfire.org Git - thirdparty/util-linux.git/blob - tests/ts/lsfd/lsfd-functions.bash
3 # Copyright (C) 2021 Masatake YAMATO <yamato@redhat.com>
5 # This file is part of util-linux.
7 # This file is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This file is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
18 function lsfd_wait_for_pausing
{
22 until [[ $
(ps
--no-headers -ostat "${PID}") =~ S.
* ]]; do
27 function lsfd_compare_dev
{
34 local MNTID
=$
("${LSFD}" --raw -n -o MNTID
-Q "${EXPR}")
36 local DEV
=$
("${LSFD}" --raw -n -o DEV
-Q "${EXPR}")
38 # "stat -c" %d or "stat -c %D" can be used here instead of "findmnt".
39 # "stat" just prints a device id.
40 # Unlike "stat", "findmnt" can print the major part and minor part
41 # for a given device separately.
42 # We can save the code for extracting the major part and minor part
44 local FINDMNT_MNTID_DEV
=$
("${FINDMNT}" --raw -n -o ID
,MAJ
:MIN |
grep "^${MNTID}")
45 echo 'FINDMNT[RUN]:' $?
46 [ "${MNTID} ${DEV}" == "${FINDMNT_MNTID_DEV}" ]