Add XFS/ACL support
[xfstests-dev.git] / common.dump
1 ##/bin/sh
2
3 #
4 # Functions useful for xfsdump/xfsrestore tests
5 #
6 # Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
7
8 # This program is free software; you can redistribute it and/or modify it
9 # under the terms of version 2 of the GNU General Public License as
10 # published by the Free Software Foundation.
11
12 # This program is distributed in the hope that it would be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
16 # Further, this software is distributed without any warranty that it is
17 # free of the rightful claim of any third person regarding infringement
18 # or the like.  Any license provided herein, whether implied or
19 # otherwise, applies only to this software file.  Patent licenses, if
20 # any, provided herein do not apply to combinations of this program with
21 # other software, or any other product whatsoever.
22
23 # You should have received a copy of the GNU General Public License along
24 # with this program; if not, write the Free Software Foundation, Inc., 59
25 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
26
27 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
28 # Mountain View, CA  94043, or:
29
30 # http://www.sgi.com 
31
32 # For further information regarding this notice, see: 
33
34 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
35 #
36
37 # --- initializations ---
38 rm -f $seq.full
39
40 if [ -n "$DEBUGDUMP" ]; then
41   _dump_debug=-v5
42   _restore_debug=-v5
43   _invutil_debug=-d
44 fi
45  
46 # Use dump/restore out of workareas
47 PATH="../dump/dump:../dump/restore:../dump/invutil:$PATH"
48 export PATH
49
50 # status returned for not run tests
51 NOTRUNSTS=2
52
53 # name those directories
54 dump_dir=$SCRATCH_MNT/dump.$$
55 dump_file=$tmp.dumpfile
56 dump_sdir=dump.$$
57 restore_dir=$SCRATCH_MNT/restore.$$
58 restore_sdir=restore.$$
59
60 dumptape=$TAPE_DEV
61 media_label="stress_tape_media"
62 session_label="stress_$seq"
63
64 nobody=4 # define this uid/gid as a number
65
66 _need_to_be_root
67
68 # install our cleaner
69 trap "_cleanup; exit \$status" 0 1 2 3 15
70
71 # start inventory from a known base - move it aside for test
72 if [ -d /var/xfsdump/inventory ]; then
73     if [ -d /var/xfsdump/inventory.$seq ]; then    
74         rm -rf /var/xfsdump/inventory.$seq
75     fi
76     mv /var/xfsdump/inventory /var/xfsdump/inventory.$seq
77 fi
78
79
80 #
81 # do a remote/local mt
82 #
83 _mt()
84 {
85     op=$1
86     if _isrmt; then  
87         # REMOTE
88         _rmthost=`echo $dumptape | awk -F: '{print $1}'`
89         _rmtdev=`echo $dumptape | awk -F: '{print $2}'`
90         rsh -n $_rmthost "mt -t $_rmtdev $op"
91         # Would have used src/testrmt but get
92         # permission denied from linux to linux for erase !?! 
93     else
94         #LOCAL
95         mt -t $dumptape $op
96     fi
97 }
98
99 _check_onl()
100 {
101     _limit=10
102     i=0
103     while [ $i -lt $_limit ]; do  
104         echo "Checking online..." >>$seq.full
105         if _mt status >$tmp.status 2>&1; then
106             break; 
107         else
108             sleep 2 
109         fi
110         i=`expr $i + 1`
111     done
112
113
114     if [ $i -eq $_limit ]; then
115         echo "ERROR: mt -f $dumptape failed"
116         cat $tmp.status
117
118         echo "mt -f $dumptape failed" >$seq.notrun 
119         status=$NOTRUNSTS
120         exit
121     fi 
122
123
124     if egrep -i 'onl|ready' $tmp.status | grep -iv 'not ready' >/dev/null; then
125         :
126     else
127         echo "ERROR: $dumptape is not online"
128         cat $tmp.status
129
130         echo "dumptape, $dumptape, is not online" >$seq.notrun 
131         status=$NOTRUNSTS
132         exit
133     fi
134 }
135
136 _wait_tape()
137 {
138     echo "Wait for tape, $dumptape, ..." >>$seq.full
139
140     i=0
141     while [ $i -lt 20 ]; do  
142         echo "Checking status..." >>$seq.full
143         if _mt status 2>&1 | tee -a $seq.full | egrep -i "onl|ready" >/dev/null; then
144             break; 
145         else
146             sleep 2 
147         fi
148         i=`expr $i + 1`
149     done
150 }
151
152 #
153 # Keep trying so we know we really have rewound
154 #
155 _rewind()
156 {
157     echo "Initiate rewind..." >>$seq.full
158     _wait_tape
159     _mt rewind >/dev/null
160     _wait_tape
161 }
162
163 #
164 # Do a custom erase because: 
165 # (i) some machines don't support it
166 # (ii) some machines take forever to do it
167 #
168 _erase_soft()
169 {
170     echo "Erasing tape" | tee -a $seq.full
171     _rewind
172     _mt weof 3
173 #   src/testrmt -f $dumptape write
174     _rewind
175 }
176
177 _erase_hard()
178 {
179     echo "Erasing tape" | tee -a $seq.full
180     _mt erase
181 }
182
183 _isrmt()
184 {
185     echo $dumptape | grep ':' >/dev/null
186 }
187
188 #
189 # Get tape ready
190 #
191 _set_variable()
192 {
193     if _isrmt; then
194         :
195     else
196         # LOCAL
197         echo "Put scsi tape driver into variable block size mode"
198         mt -f $dumptape setblk 0
199     fi  
200 }
201
202 _require_tape()
203 {
204     if [ $# -eq 0 ]; then
205         dumptape=$TAPE_DEV
206     else
207         dumptape=$1
208     fi
209
210     if [ -z "$dumptape" ]; then
211         echo "This test requires a dump tape - none was specified"
212         echo "No dump tape specified" >$seq.notrun 
213         status=$NOTRUNSTS
214         exit
215     fi
216
217     _check_onl
218     _set_variable
219 }
220
221 _error()
222 {
223     echo "Error: $*" | tee -a $seq.full
224     echo "(see $seq.full for details)"
225     status=1
226     exit
227 }
228
229 _wipe_fs()
230 {
231     _require_scratch
232
233     mkfs -t xfs -f $SCRATCH_DEV >>$seq.full  ||\
234         _error "mkfs failed"
235       
236     mount -t xfs $SCRATCH_DEV $SCRATCH_MNT >>$seq.full ||\
237         _error "mount failed"
238 }
239
240
241 # Cleanup created dirs and files
242 # Called by trap
243 #
244 _cleanup()
245 {
246     cd $here
247     rm -f $tmp.*
248
249     if [ -n "$DEBUGDUMP" ]; then
250         # save it for inspection
251         tar -zcvf $seq.inventory.tgz /var/xfsdump/inventory
252         ls -lR /var/xfsdump/inventory >$seq.inventory.ls
253     fi
254
255     # put inventory dir back
256     if [ -d /var/xfsdump/inventory.$seq ]; then
257         rm -rf /var/xfsdump/inventory # get rid of new one
258         mv /var/xfsdump/inventory.$seq /var/xfsdump/inventory
259     fi
260
261     if [ $status -ne $NOTRUNSTS ]; then
262         # Sleep added to stop _check_fs from complaining that the
263         # scratch_dev is still busy
264         sleep 10
265
266         _check_fs $SCRATCH_DEV
267     fi
268 }
269
270 _stable_fs()
271 {
272 #    umount $SCRATCH_MNT >/dev/null 
273 #    mount $SCRATCH_MNT >/dev/null
274     sync; sync; sleep 15
275 }
276
277 #
278 # Run stress/src/fsstress to create a mixture of 
279 # files,dirs,links,symlinks
280 #
281 # Pinched from stress/013.
282 #
283 _create_dumpdir_stress()
284 {
285     echo "Creating directory system to dump using src/fsstress."
286
287     _wipe_fs
288
289     _param="-f link=10 -f creat=10 -f mkdir=10 -f truncate=5 -f symlink=10"
290     _count=200
291     rm -rf $dump_dir
292     if ! mkdir $dump_dir; then
293         echo "    failed to mkdir $dump_dir"
294         status=1
295         exit
296     fi
297     echo ""
298     echo "-----------------------------------------------"
299     echo "fsstress : $_param"
300     echo "-----------------------------------------------"
301     if ! $here/src/fsstress $_param $FSSTRESS_AVOID -n $_count -d $dump_dir >$tmp.out 2>&1
302     then
303         echo "    fsstress (count=$_count) returned $? - see $seq.full"
304         
305         echo "--------------------------------------"       >>$here/$seq.full
306         echo "output from fsstress:"                        >>$here/$seq.full
307         echo "--------------------------------------"       >>$here/$seq.full
308         cat $tmp.out                                        >>$here/$seq.full
309         status=1
310     fi
311
312     _stable_fs
313 }
314
315 _mk_fillconfig1()
316 {
317     cat <<End-of-File >$tmp.config
318 # pathname      size in bytes   owner   group
319 #
320 small           10      $nobody $nobody
321 big             102400  daemon  sys
322 sub/small       10      bin     bin
323 sub/big         102400  $nobody sys
324 #
325 sub/a           1       $nobody $nobody
326 sub/b           2       $nobody $nobody
327 sub/c           4       $nobody $nobody
328 sub/d           8       $nobody $nobody
329 sub/e           16      $nobody $nobody
330 sub/f           32      $nobody $nobody
331 sub/g           64      $nobody $nobody
332 sub/h           128     $nobody $nobody
333 sub/i           256     $nobody $nobody
334 sub/j           512     $nobody $nobody
335 sub/k           1024    $nobody $nobody
336 sub/l           2048    $nobody $nobody
337 sub/m           4096    $nobody $nobody
338 sub/n           8192    $nobody $nobody
339 #
340 sub/a00         100     $nobody $nobody
341 sub/b00         200     $nobody $nobody
342 sub/c00         400     $nobody $nobody
343 sub/d00         800     $nobody $nobody
344 sub/e00         1600    $nobody $nobody
345 sub/f00         3200    $nobody $nobody
346 sub/g00         6400    $nobody $nobody
347 sub/h00         12800   $nobody $nobody
348 sub/i00         25600   $nobody $nobody
349 sub/j00         51200   $nobody $nobody
350 sub/k00         102400  $nobody $nobody
351 sub/l00         204800  $nobody $nobody
352 sub/m00         409600  $nobody $nobody
353 sub/n00         819200  $nobody $nobody
354 #
355 sub/a000        1000    $nobody $nobody
356 sub/e000        16000   $nobody $nobody
357 sub/h000        128000  $nobody $nobody
358 sub/k000        1024000 $nobody $nobody
359 End-of-File
360 }
361
362 _mk_fillconfig2()
363 {
364     cat <<End-of-File >$tmp.config
365 # pathname      size in bytes
366 #
367 smalll          10      $nobody $nobody
368 biggg           102400  $nobody $nobody
369 sub/smalll      10      $nobody $nobody
370 sub/biggg       102400  $nobody $nobody
371 End-of-File
372 }
373
374 #
375 # Create a bunch of directories/files of different sizes
376 # filled with data.
377 #
378 # Pinched from stress/001.
379 #
380 _do_create_dumpdir_fill()
381 {
382     echo "Creating directory system to dump using src/fill."
383
384     if mkdir -p $dump_dir
385     then
386         :
387     else
388         echo "Error: cannot mkdir \"$dump_dir\""
389         exit 1
390     fi
391     cd $dump_dir
392
393     $verbose && echo -n "Setup "
394     sed -e '/^#/d' $tmp.config \
395     | while read file nbytes owner group perms
396     do
397         dir=`dirname $file`
398         if [ "$dir" != "." ]
399         then
400             if [ ! -d $dir ]
401             then
402                 if mkdir $dir
403                 then
404                     :
405                 else
406                     $verbose && echo
407                     echo "Error: cannot mkdir \"$dir\""
408                     exit 1
409                 fi
410             fi
411         fi
412         rm -f $file
413         if $here/src/fill $file $file $nbytes
414         then
415             :
416         else
417             $verbose && echo
418             echo "Error: cannot create \"$file\""
419             exit 1
420         fi
421         if [ -n "$owner" -a -n "$group" ]; then
422             chown $owner.$group $file
423         fi
424         if [ -n "$perms" ]; then
425             chmod $perms $file
426         fi
427         $verbose && echo -n "."
428     done
429     $verbose && echo
430
431     cd $here
432 }
433
434
435 _create_dumpdir_fill()
436 {
437     _wipe_fs
438     _mk_fillconfig1
439     _do_create_dumpdir_fill
440     _stable_fs
441 }       
442
443 _create_dumpdir_fill2()
444 {
445     _wipe_fs
446     _mk_fillconfig2
447     _do_create_dumpdir_fill
448     _stable_fs
449 }       
450
451
452
453 #
454 # Append a subset of the fill'ed files
455 # So we can see if just these get dumped on an incremental
456 #
457 _append_dumpdir_fill()
458 {
459     cd $dump_dir
460     cat <<End-of-File >$tmp.config
461 # pathname
462 #
463 small   
464 sub/big 
465 #
466 sub/a
467 sub/c
468 sub/e
469 End-of-File
470     sed -e '/^#/d' $tmp.config \
471     | while read file
472     do
473         echo 'Extra text' >>$file
474     done
475
476     cd $here
477 }
478
479 _do_create_dump_symlinks()
480 {
481     echo "Creating directory system of symlinks to dump."
482
483     if mkdir -p $dump_dir
484     then
485         :
486     else
487         echo "Error: cannot mkdir \"$dump_dir\""
488         exit 1
489     fi
490     cd $dump_dir
491
492     $verbose && echo -n "Setup "
493     sed -e '/^#/d' $tmp.config \
494     | while read file nbytes owner group owner2 group2 perms perms2
495     do
496         dir=`dirname $file`
497         if [ "$dir" != "." ]
498         then
499             if [ ! -d $dir ]
500             then
501                 if mkdir $dir
502                 then
503                     :
504                 else
505                     $verbose && echo
506                     echo "Error: cannot mkdir \"$dir\""
507                     exit 1
508                 fi
509             fi
510         fi
511         rm -f $file
512         touch $file
513
514         # Do chmod on symlink using umask.
515         # This won't do the right thing as it subtracts permissions.
516         # However, I don't care, as long as I get some different perms
517         # for testing.
518         if [ -n "$perms2" ]; then
519             omask=`umask`
520             umask $perms2
521         fi
522         ln -s $file $file-link
523         if [ -n "$perms2" ]; then
524             umask $omask        
525         fi
526
527         if [ -n "$owner" -a -n "$group" ]; then
528             chown $owner.$group $file
529         fi
530         if [ -n "$owner" -a -n "$group" ]; then
531             chown -h $owner.$group $file-link
532         fi
533         if [ -n "$perms" ]; then
534             chmod $perms $file
535         fi
536         $verbose && echo -n "."
537     done
538     $verbose && echo
539
540     cd $here
541 }
542
543 _mk_symlink_config()
544 {
545     cat <<End-of-File >$tmp.config
546 # path  size    owner1  group1  owner2  group2  perm1   perm2 
547 #
548 a       0       $nobody $nobody daemon  sys     124     421
549 b       0       daemon  sys     bin     bin     347     743
550 sub/a   0       bin     bin     $nobody sys     777     777
551 sub/b   0       $nobody sys     $nobody $nobody 367     763
552 End-of-File
553 }
554
555 _create_dumpdir_symlinks()
556 {
557     _wipe_fs
558     _mk_symlink_config
559     _do_create_dump_symlinks
560     _stable_fs
561 }       
562
563 #
564 # Filter for ls
565 # Filter out dates on symlinks
566 #
567 _ls_filter()
568 {
569   $AWK_PROG '/^l/ { date = $8; sub(date,"DATE"); print}
570         {print}' \
571   | sed -e 's/total [0-9][0-9]*/total TOTAL/'
572 }
573
574
575
576 # Filter out the non-deterministic dump msgs from
577 # xfsdump and xfsrestore
578 #
579 _dump_filter()
580 {
581   sed \
582       -e "s/`hostname`/HOSTNAME/"   \
583       -e "s#$SCRATCH_DEV#SCRATCH_DEV#"    \
584       -e "s#$dumptape#TAPE_DEV#"    \
585       -e "s#$SCRATCH_MNT#SCRATCH_MNT#"    \
586       -e "s#$dump_file#DUMP_FILE#"  \
587       -e 's/id:[        ]*[0-9a-f-]*/id: ID/'  \
588       -e 's/time:[      ].*/time: TIME/'       \
589       -e 's/date:[      ].*/date: DATE/'       \
590       -e 's/dump begun .*/dump begun DATE/'    \
591       -e 's/[0-9][0-9]* seconds/SECS seconds/' \
592       -e '/: dump size/s/[1-9][0-9]*/NUM/'     \
593       -e '/dump size:/s/[1-9][0-9]*/NUM/'      \
594       -e '/media file size/s/[1-9][0-9]*/NUM/' \
595       -e '/\/dev\/tty/d' \
596       -e '/inventory session uuid/d' \
597
598 }
599
600 _invutil_filter()
601 {
602   _dump_filter \
603   | sed \
604         -e 's/UUID[     ]*:[    ][0-9a-f-]*/UUID                :       ID/' \
605         -e 's/TIME OF DUMP[     ]*:.*/TIME OF DUMP      :       TIME/' \
606         -e 's/HOSTNAME:SCRATCH_MNT.*/HOSTNAME:SCRATCH_MNT/' \
607         -e 's#inventory/[0-9a-f-]*#inventory/UUID#' \
608
609 }
610
611 _dir_filter()
612 {
613   sed \
614     -e "s#$dump_file#DUMP_FILE#"      \
615     -e "s#$SCRATCH_DEV#SCRATCH_DEV#"        \
616     -e "s#$dumptape#TAPE_DEV#"         \
617     -e "s#$dump_dir#DUMP_DIR#g"       \
618     -e "s#$restore_dir#RESTORE_DIR#g" \
619     -e "s#$SCRATCH_MNT#SCRATCH_MNT#g"       \
620     -e "s#$dump_sdir#DUMP_SUBDIR#g"   \
621     -e "s#$restore_sdir#RESTORE_SUBDIR#g" \
622
623 }
624
625 _parse_args()
626 {
627     OPTIND=0
628     dump_args=""
629     while getopts "f:FL:o" c $*
630     do
631         case $c
632         in
633         f)
634             [ -z "$OPTARG" ] && _error "missing argument for -f"
635             dumptape=$OPTARG    
636             ;;
637         L)
638             [ -z "$OPTARG" ] && _error "missing argument for -L"
639             session_label=$OPTARG       
640             ;;
641         o)
642             dump_args="$dump_args -o"
643             ;;
644         F)
645             dump_args="$dump_args -F"
646             ;;
647         \?)
648             _error "invalid argument"
649             ;;
650         esac
651     done
652 }
653
654
655 #
656 # Dump a subdir
657 #
658 _do_dump_sub()
659 {
660     _parse_args $*
661
662     echo "Dumping to tape..."
663     opts="$_dump_debug$dump_args -s $dump_sdir -f $dumptape -M $media_label -L $session_label $SCRATCH_MNT"
664     echo "xfsdump $opts" | _dir_filter  
665     xfsdump $opts 2>&1 | tee -a $seq.full | _dump_filter
666 }
667
668 #
669 # Do full level 0 dump
670 #
671 _do_dump()
672 {
673     _parse_args $*
674
675     echo "Dumping to tape..."
676     opts="$_dump_debug$dump_args -l0 -f $dumptape -M $media_label -L $session_label $SCRATCH_MNT"
677     echo "xfsdump $opts" | _dir_filter  
678     xfsdump $opts 2>&1 | tee -a $seq.full | _dump_filter
679 }
680
681
682 #
683 # Do full dump with -m
684 #
685 _do_dump_min()
686 {
687     _parse_args $*
688
689     echo "Dumping to tape..."
690     onemeg=1048576
691     opts="$_dump_debug$dump_args -m -b $onemeg -l0 -f $dumptape -M $media_label -L $session_label $SCRATCH_MNT"
692     echo "xfsdump $opts" | _dir_filter  
693     xfsdump $opts 2>&1 | tee -a $seq.full | _dump_filter
694 }
695
696 #
697 # Do level 1 incremental dump
698 #
699 _do_dump_incremental()
700 {
701     _parse_args $*
702
703     echo "Dumping incrementally to tape..."
704     opts="$_dump_debug$dump_args -l1 -f $dumptape -M $media_label -L $session_label $SCRATCH_MNT"
705     echo "xfsdump $opts" | _dir_filter  
706     xfsdump $opts 2>&1 | tee -a $seq.full | _dump_filter
707 }
708
709 #
710 # Do full dump to file
711 #
712 _do_dump_file()
713 {
714     _parse_args $*
715
716     echo "Dumping to file..."
717     opts="$_dump_debug$dump_args -f $dump_file -M $media_label -L $session_label $SCRATCH_MNT"
718     echo "xfsdump $opts" | _dir_filter  
719     xfsdump $opts 2>&1 | tee -a $seq.full | _dump_filter
720 }
721
722
723 _prepare_restore_dir()
724 {
725     rm -rf $restore_dir
726     if ! mkdir $restore_dir; then
727         echo "    failed to mkdir $restore_dir"
728         status=1
729         exit
730     fi
731 }
732
733
734 #
735 # Get tape ready and restore dir
736 #
737 _prepare_restore()
738 {
739     _prepare_restore_dir
740
741     echo "Rewinding tape"
742     _rewind
743 }
744
745 #
746 # Restore the tape into $restore_dir
747 #
748 _do_restore()
749 {
750     _parse_args $*
751     _prepare_restore
752
753
754     echo "Restoring from tape..."
755     opts="$_restore_debug$dump_args -f $dumptape  -L $session_label $restore_dir"
756     echo "xfsrestore $opts" | _dir_filter  
757     xfsrestore $opts 2>&1 | tee -a $seq.full | _dump_filter
758 }
759
760 #
761 # Restore the tape into $restore_dir using -m
762 #
763 _do_restore_min()
764 {
765     _parse_args $*
766     _prepare_restore
767
768     echo "Restoring from tape..."
769     onemeg=1048576
770     opts="$_restore_debug$dump_args -m -b $onemeg -f $dumptape  -L $session_label $restore_dir"
771     echo "xfsrestore $opts" | _dir_filter  
772     xfsrestore $opts 2>&1 | tee -a $seq.full | _dump_filter
773 }
774
775 #
776 # Restore the tape from a dump file
777 #
778 _do_restore_file()
779 {
780     _parse_args $*
781     _prepare_restore_dir
782
783     echo "Restoring from file..."
784     opts="$_restore_debug$dumpargs -f $dump_file  -L $session_label $restore_dir"
785     echo "xfsrestore $opts" | _dir_filter  
786     xfsrestore $opts 2>&1 | tee -a $seq.full | _dump_filter
787 }
788
789 #
790 # Do xfsdump piped into xfsrestore - xfsdump | xfsrestore
791 #
792 # Use -s as we want to dump and restore to the same xfs partition
793 #
794 _do_dump_restore()
795 {
796     _parse_args $*
797     _prepare_restore_dir
798     echo "xfsdump|xfsrestore ..."
799     restore_opts="$_restore_debug - $restore_dir"
800     dump_opts="$_dump_debug$dump_args -s $dump_sdir - $SCRATCH_MNT"
801     echo "xfsdump $dump_opts | xfsrestore $restore_opts" | _dir_filter  
802     xfsdump $dump_opts 2>$tmp.dump.mlog | xfsrestore $restore_opts 2>&1 | tee -a $seq.full | _dump_filter
803     _dump_filter <$tmp.dump.mlog
804 }
805
806 #
807 # Compare dumped subdirectory with restored dir
808 # using ls -lR.
809 # Thus no contents are compared but permissions, sizes,
810 # owners, etc... are.
811 #
812 _ls_compare_sub()
813 {
814     #
815     # verify we got back what we dumped
816     #
817     echo "Comparing listing of dump directory with restore directory"
818     ls -lR $dump_dir | tee -a $seq.full | _ls_filter >$tmp.dump_dir
819     ls -lR $restore_dir/$dump_sdir | tee -a $seq.full | _ls_filter \
820     | sed -e "s#$restore_sdir\/##" >$tmp.restore_dir
821
822     diff -cs $tmp.dump_dir $tmp.restore_dir | sed -e "s#$tmp#TMP#g"
823 }
824
825
826 #
827 # Compare using recursive diff the files of the dumped
828 # subdirectory.
829 # This one will compare the contents.
830 #
831 _diff_compare_sub()
832 {
833     echo "Comparing dump directory with restore directory"
834     diff -rs $dump_dir $restore_dir/$dump_sdir | _dir_filter
835 }
836
837 #
838 # Compare using recursive diff the files of the dumped
839 # filesystem
840 #
841 _diff_compare()
842 {
843     echo "Comparing dump directory with restore directory"
844     diff -rs $SCRATCH_MNT $restore_dir | _dir_filter
845 }
846
847 #
848 # Check out the dump inventory
849 #
850 _dump_inventory()
851 {
852     xfsdump $_dump_debug -I | tee -a $seq.full | _dump_filter 
853 }
854
855 #
856 # Do the xfsinvutil cmd with debug and filters
857 # Need to set variable: "$middate" to the invutil date 
858 #
859 _do_invutil()
860 {
861     host=`hostname`
862     echo "xfsinvutil $_invutil_debug -M $host:$SCRATCH_MNT \"$middate\" $*" >$seq.full
863     xfsinvutil $_invutil_debug -M $host:$SCRATCH_MNT "$middate" $* \
864     | tee -a $seq.full | _invutil_filter
865 }
866
867 # make sure this script returns success
868 /bin/true