Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 50660
Collapse All | Expand All

(-)parted-1.6.9.orig/configure (-128 / +220 lines)
Lines 1167-1173 Link Here
1167
    else
1167
    else
1168
      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
1168
      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
1169
    fi
1169
    fi
1170
    cd "$ac_popdir"
1170
    cd $ac_popdir
1171
  done
1171
  done
1172
fi
1172
fi
1173
1173
Lines 2804-2810 Link Here
2804
  cat conftest.err >&5
2804
  cat conftest.err >&5
2805
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
2805
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
2806
  (exit $ac_status); } &&
2806
  (exit $ac_status); } &&
2807
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
2807
	 { ac_try='test -z "$ac_c_werror_flag"
2808
			 || test ! -s conftest.err'
2808
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2809
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2809
  (eval $ac_try) 2>&5
2810
  (eval $ac_try) 2>&5
2810
  ac_status=$?
2811
  ac_status=$?
Lines 2862-2868 Link Here
2862
  cat conftest.err >&5
2863
  cat conftest.err >&5
2863
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
2864
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
2864
  (exit $ac_status); } &&
2865
  (exit $ac_status); } &&
2865
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
2866
	 { ac_try='test -z "$ac_c_werror_flag"
2867
			 || test ! -s conftest.err'
2866
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2868
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2867
  (eval $ac_try) 2>&5
2869
  (eval $ac_try) 2>&5
2868
  ac_status=$?
2870
  ac_status=$?
Lines 2978-2984 Link Here
2978
  cat conftest.err >&5
2980
  cat conftest.err >&5
2979
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
2981
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
2980
  (exit $ac_status); } &&
2982
  (exit $ac_status); } &&
2981
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
2983
	 { ac_try='test -z "$ac_c_werror_flag"
2984
			 || test ! -s conftest.err'
2982
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2985
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2983
  (eval $ac_try) 2>&5
2986
  (eval $ac_try) 2>&5
2984
  ac_status=$?
2987
  ac_status=$?
Lines 3032-3038 Link Here
3032
  cat conftest.err >&5
3035
  cat conftest.err >&5
3033
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3036
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3034
  (exit $ac_status); } &&
3037
  (exit $ac_status); } &&
3035
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
3038
	 { ac_try='test -z "$ac_c_werror_flag"
3039
			 || test ! -s conftest.err'
3036
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3040
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3037
  (eval $ac_try) 2>&5
3041
  (eval $ac_try) 2>&5
3038
  ac_status=$?
3042
  ac_status=$?
Lines 3077-3083 Link Here
3077
  cat conftest.err >&5
3081
  cat conftest.err >&5
3078
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3082
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3079
  (exit $ac_status); } &&
3083
  (exit $ac_status); } &&
3080
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
3084
	 { ac_try='test -z "$ac_c_werror_flag"
3085
			 || test ! -s conftest.err'
3081
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3086
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3082
  (eval $ac_try) 2>&5
3087
  (eval $ac_try) 2>&5
3083
  ac_status=$?
3088
  ac_status=$?
Lines 3121-3127 Link Here
3121
  cat conftest.err >&5
3126
  cat conftest.err >&5
3122
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3127
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3123
  (exit $ac_status); } &&
3128
  (exit $ac_status); } &&
3124
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
3129
	 { ac_try='test -z "$ac_c_werror_flag"
3130
			 || test ! -s conftest.err'
3125
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3131
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3126
  (eval $ac_try) 2>&5
3132
  (eval $ac_try) 2>&5
3127
  ac_status=$?
3133
  ac_status=$?
Lines 3302-3308 Link Here
3302
  cat conftest.err >&5
3308
  cat conftest.err >&5
3303
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3309
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3304
  (exit $ac_status); } &&
3310
  (exit $ac_status); } &&
3305
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
3311
	 { ac_try='test -z "$ac_c_werror_flag"
3312
			 || test ! -s conftest.err'
3306
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3313
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3307
  (eval $ac_try) 2>&5
3314
  (eval $ac_try) 2>&5
3308
  ac_status=$?
3315
  ac_status=$?
Lines 3700-3706 Link Here
3700
  cat conftest.err >&5
3707
  cat conftest.err >&5
3701
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3708
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3702
  (exit $ac_status); } &&
3709
  (exit $ac_status); } &&
3703
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
3710
	 { ac_try='test -z "$ac_c_werror_flag"
3711
			 || test ! -s conftest.err'
3704
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3712
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3705
  (eval $ac_try) 2>&5
3713
  (eval $ac_try) 2>&5
3706
  ac_status=$?
3714
  ac_status=$?
Lines 3758-3764 Link Here
3758
  cat conftest.err >&5
3766
  cat conftest.err >&5
3759
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3767
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3760
  (exit $ac_status); } &&
3768
  (exit $ac_status); } &&
3761
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
3769
	 { ac_try='test -z "$ac_c_werror_flag"
3770
			 || test ! -s conftest.err'
3762
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3771
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3763
  (eval $ac_try) 2>&5
3772
  (eval $ac_try) 2>&5
3764
  ac_status=$?
3773
  ac_status=$?
Lines 3874-3880 Link Here
3874
  cat conftest.err >&5
3883
  cat conftest.err >&5
3875
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3884
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3876
  (exit $ac_status); } &&
3885
  (exit $ac_status); } &&
3877
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
3886
	 { ac_try='test -z "$ac_c_werror_flag"
3887
			 || test ! -s conftest.err'
3878
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3888
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3879
  (eval $ac_try) 2>&5
3889
  (eval $ac_try) 2>&5
3880
  ac_status=$?
3890
  ac_status=$?
Lines 3928-3934 Link Here
3928
  cat conftest.err >&5
3938
  cat conftest.err >&5
3929
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3939
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3930
  (exit $ac_status); } &&
3940
  (exit $ac_status); } &&
3931
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
3941
	 { ac_try='test -z "$ac_c_werror_flag"
3942
			 || test ! -s conftest.err'
3932
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3943
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3933
  (eval $ac_try) 2>&5
3944
  (eval $ac_try) 2>&5
3934
  ac_status=$?
3945
  ac_status=$?
Lines 3973-3979 Link Here
3973
  cat conftest.err >&5
3984
  cat conftest.err >&5
3974
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3985
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3975
  (exit $ac_status); } &&
3986
  (exit $ac_status); } &&
3976
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
3987
	 { ac_try='test -z "$ac_c_werror_flag"
3988
			 || test ! -s conftest.err'
3977
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3989
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3978
  (eval $ac_try) 2>&5
3990
  (eval $ac_try) 2>&5
3979
  ac_status=$?
3991
  ac_status=$?
Lines 4017-4023 Link Here
4017
  cat conftest.err >&5
4029
  cat conftest.err >&5
4018
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4030
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4019
  (exit $ac_status); } &&
4031
  (exit $ac_status); } &&
4020
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
4032
	 { ac_try='test -z "$ac_c_werror_flag"
4033
			 || test ! -s conftest.err'
4021
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4034
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4022
  (eval $ac_try) 2>&5
4035
  (eval $ac_try) 2>&5
4023
  ac_status=$?
4036
  ac_status=$?
Lines 4509-4515 Link Here
4509
  cat conftest.err >&5
4522
  cat conftest.err >&5
4510
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4523
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4511
  (exit $ac_status); } &&
4524
  (exit $ac_status); } &&
4512
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
4525
	 { ac_try='test -z "$ac_c_werror_flag"
4526
			 || test ! -s conftest.err'
4513
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4527
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4514
  (eval $ac_try) 2>&5
4528
  (eval $ac_try) 2>&5
4515
  ac_status=$?
4529
  ac_status=$?
Lines 4538-4544 Link Here
4538
  cat conftest.err >&5
4552
  cat conftest.err >&5
4539
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4553
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4540
  (exit $ac_status); } &&
4554
  (exit $ac_status); } &&
4541
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
4555
	 { ac_try='test -z "$ac_c_werror_flag"
4556
			 || test ! -s conftest.err'
4542
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4557
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4543
  (eval $ac_try) 2>&5
4558
  (eval $ac_try) 2>&5
4544
  ac_status=$?
4559
  ac_status=$?
Lines 4608-4614 Link Here
4608
  cat conftest.err >&5
4623
  cat conftest.err >&5
4609
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4624
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4610
  (exit $ac_status); } &&
4625
  (exit $ac_status); } &&
4611
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
4626
	 { ac_try='test -z "$ac_c_werror_flag"
4627
			 || test ! -s conftest.err'
4612
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4628
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4613
  (eval $ac_try) 2>&5
4629
  (eval $ac_try) 2>&5
4614
  ac_status=$?
4630
  ac_status=$?
Lines 4660-4666 Link Here
4660
  cat conftest.err >&5
4676
  cat conftest.err >&5
4661
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4677
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4662
  (exit $ac_status); } &&
4678
  (exit $ac_status); } &&
4663
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
4679
	 { ac_try='test -z "$ac_c_werror_flag"
4680
			 || test ! -s conftest.err'
4664
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4681
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4665
  (eval $ac_try) 2>&5
4682
  (eval $ac_try) 2>&5
4666
  ac_status=$?
4683
  ac_status=$?
Lines 4731-4737 Link Here
4731
  cat conftest.err >&5
4748
  cat conftest.err >&5
4732
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4749
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4733
  (exit $ac_status); } &&
4750
  (exit $ac_status); } &&
4734
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
4751
	 { ac_try='test -z "$ac_c_werror_flag"
4752
			 || test ! -s conftest.err'
4735
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4753
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4736
  (eval $ac_try) 2>&5
4754
  (eval $ac_try) 2>&5
4737
  ac_status=$?
4755
  ac_status=$?
Lines 4783-4789 Link Here
4783
  cat conftest.err >&5
4801
  cat conftest.err >&5
4784
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4802
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4785
  (exit $ac_status); } &&
4803
  (exit $ac_status); } &&
4786
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
4804
	 { ac_try='test -z "$ac_c_werror_flag"
4805
			 || test ! -s conftest.err'
4787
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4806
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4788
  (eval $ac_try) 2>&5
4807
  (eval $ac_try) 2>&5
4789
  ac_status=$?
4808
  ac_status=$?
Lines 4856-4862 Link Here
4856
  cat conftest.err >&5
4875
  cat conftest.err >&5
4857
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4876
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4858
  (exit $ac_status); } &&
4877
  (exit $ac_status); } &&
4859
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
4878
	 { ac_try='test -z "$ac_c_werror_flag"
4879
			 || test ! -s conftest.err'
4860
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4880
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4861
  (eval $ac_try) 2>&5
4881
  (eval $ac_try) 2>&5
4862
  ac_status=$?
4882
  ac_status=$?
Lines 4923-4929 Link Here
4923
  cat conftest.err >&5
4943
  cat conftest.err >&5
4924
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4944
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4925
  (exit $ac_status); } &&
4945
  (exit $ac_status); } &&
4926
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
4946
	 { ac_try='test -z "$ac_c_werror_flag"
4947
			 || test ! -s conftest.err'
4927
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4948
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4928
  (eval $ac_try) 2>&5
4949
  (eval $ac_try) 2>&5
4929
  ac_status=$?
4950
  ac_status=$?
Lines 4968-4974 Link Here
4968
  cat conftest.err >&5
4989
  cat conftest.err >&5
4969
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4990
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
4970
  (exit $ac_status); } &&
4991
  (exit $ac_status); } &&
4971
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
4992
	 { ac_try='test -z "$ac_c_werror_flag"
4993
			 || test ! -s conftest.err'
4972
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4994
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4973
  (eval $ac_try) 2>&5
4995
  (eval $ac_try) 2>&5
4974
  ac_status=$?
4996
  ac_status=$?
Lines 5029-5035 Link Here
5029
  cat conftest.err >&5
5051
  cat conftest.err >&5
5030
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
5052
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
5031
  (exit $ac_status); } &&
5053
  (exit $ac_status); } &&
5032
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
5054
	 { ac_try='test -z "$ac_c_werror_flag"
5055
			 || test ! -s conftest.err'
5033
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
5056
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
5034
  (eval $ac_try) 2>&5
5057
  (eval $ac_try) 2>&5
5035
  ac_status=$?
5058
  ac_status=$?
Lines 5074-5080 Link Here
5074
  cat conftest.err >&5
5097
  cat conftest.err >&5
5075
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
5098
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
5076
  (exit $ac_status); } &&
5099
  (exit $ac_status); } &&
5077
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
5100
	 { ac_try='test -z "$ac_c_werror_flag"
5101
			 || test ! -s conftest.err'
5078
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
5102
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
5079
  (eval $ac_try) 2>&5
5103
  (eval $ac_try) 2>&5
5080
  ac_status=$?
5104
  ac_status=$?
Lines 5143-5149 Link Here
5143
  cat conftest.err >&5
5167
  cat conftest.err >&5
5144
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
5168
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
5145
  (exit $ac_status); } &&
5169
  (exit $ac_status); } &&
5146
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
5170
	 { ac_try='test -z "$ac_c_werror_flag"
5171
			 || test ! -s conftest.err'
5147
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
5172
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
5148
  (eval $ac_try) 2>&5
5173
  (eval $ac_try) 2>&5
5149
  ac_status=$?
5174
  ac_status=$?
Lines 5174-5181 Link Here
5174
esac
5199
esac
5175
else
5200
else
5176
  if test "$cross_compiling" = yes; then
5201
  if test "$cross_compiling" = yes; then
5177
  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
5202
  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
5178
echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
5203
See \`config.log' for more details." >&5
5204
echo "$as_me: error: cannot run test program while cross compiling
5205
See \`config.log' for more details." >&2;}
5179
   { (exit 1); exit 1; }; }
5206
   { (exit 1); exit 1; }; }
5180
else
5207
else
5181
  cat >conftest.$ac_ext <<_ACEOF
5208
  cat >conftest.$ac_ext <<_ACEOF
Lines 5819-5825 Link Here
5819
  ;;
5846
  ;;
5820
*-*-irix6*)
5847
*-*-irix6*)
5821
  # Find out which ABI we are using.
5848
  # Find out which ABI we are using.
5822
  echo '#line 5822 "configure"' > conftest.$ac_ext
5849
  echo '#line 5849 "configure"' > conftest.$ac_ext
5823
  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
5850
  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
5824
  (eval $ac_compile) 2>&5
5851
  (eval $ac_compile) 2>&5
5825
  ac_status=$?
5852
  ac_status=$?
Lines 5939-5945 Link Here
5939
  cat conftest.err >&5
5966
  cat conftest.err >&5
5940
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
5967
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
5941
  (exit $ac_status); } &&
5968
  (exit $ac_status); } &&
5942
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
5969
	 { ac_try='test -z "$ac_c_werror_flag"
5970
			 || test ! -s conftest.err'
5943
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
5971
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
5944
  (eval $ac_try) 2>&5
5972
  (eval $ac_try) 2>&5
5945
  ac_status=$?
5973
  ac_status=$?
Lines 6013-6019 Link Here
6013
  cat conftest.err >&5
6041
  cat conftest.err >&5
6014
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6042
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6015
  (exit $ac_status); } &&
6043
  (exit $ac_status); } &&
6016
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
6044
	 { ac_try='test -z "$ac_c_werror_flag"
6045
			 || test ! -s conftest.err'
6017
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6046
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6018
  (eval $ac_try) 2>&5
6047
  (eval $ac_try) 2>&5
6019
  ac_status=$?
6048
  ac_status=$?
Lines 6183-6189 Link Here
6183
  cat conftest.err >&5
6212
  cat conftest.err >&5
6184
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6213
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6185
  (exit $ac_status); } &&
6214
  (exit $ac_status); } &&
6186
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
6215
	 { ac_try='test -z "$ac_c_werror_flag"
6216
			 || test ! -s conftest.err'
6187
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6217
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6188
  (eval $ac_try) 2>&5
6218
  (eval $ac_try) 2>&5
6189
  ac_status=$?
6219
  ac_status=$?
Lines 6250-6256 Link Here
6250
  cat conftest.err >&5
6280
  cat conftest.err >&5
6251
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6281
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6252
  (exit $ac_status); } &&
6282
  (exit $ac_status); } &&
6253
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
6283
	 { ac_try='test -z "$ac_c_werror_flag"
6284
			 || test ! -s conftest.err'
6254
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6285
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6255
  (eval $ac_try) 2>&5
6286
  (eval $ac_try) 2>&5
6256
  ac_status=$?
6287
  ac_status=$?
Lines 6510-6516 Link Here
6510
  cat conftest.err >&5
6541
  cat conftest.err >&5
6511
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6542
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6512
  (exit $ac_status); } &&
6543
  (exit $ac_status); } &&
6513
	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
6544
	 { ac_try='test -z "$ac_cxx_werror_flag"
6545
			 || test ! -s conftest.err'
6514
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6546
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6515
  (eval $ac_try) 2>&5
6547
  (eval $ac_try) 2>&5
6516
  ac_status=$?
6548
  ac_status=$?
Lines 6568-6574 Link Here
6568
  cat conftest.err >&5
6600
  cat conftest.err >&5
6569
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6601
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6570
  (exit $ac_status); } &&
6602
  (exit $ac_status); } &&
6571
	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
6603
	 { ac_try='test -z "$ac_cxx_werror_flag"
6604
			 || test ! -s conftest.err'
6572
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6605
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6573
  (eval $ac_try) 2>&5
6606
  (eval $ac_try) 2>&5
6574
  ac_status=$?
6607
  ac_status=$?
Lines 6639-6645 Link Here
6639
  cat conftest.err >&5
6672
  cat conftest.err >&5
6640
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6673
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6641
  (exit $ac_status); } &&
6674
  (exit $ac_status); } &&
6642
	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
6675
	 { ac_try='test -z "$ac_cxx_werror_flag"
6676
			 || test ! -s conftest.err'
6643
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6677
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6644
  (eval $ac_try) 2>&5
6678
  (eval $ac_try) 2>&5
6645
  ac_status=$?
6679
  ac_status=$?
Lines 6683-6689 Link Here
6683
  cat conftest.err >&5
6717
  cat conftest.err >&5
6684
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6718
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6685
  (exit $ac_status); } &&
6719
  (exit $ac_status); } &&
6686
	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
6720
	 { ac_try='test -z "$ac_cxx_werror_flag"
6721
			 || test ! -s conftest.err'
6687
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6722
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6688
  (eval $ac_try) 2>&5
6723
  (eval $ac_try) 2>&5
6689
  ac_status=$?
6724
  ac_status=$?
Lines 7141-7147 Link Here
7141
7176
7142
7177
7143
# Provide some information about the compiler.
7178
# Provide some information about the compiler.
7144
echo "$as_me:7144:" \
7179
echo "$as_me:7179:" \
7145
     "checking for Fortran 77 compiler version" >&5
7180
     "checking for Fortran 77 compiler version" >&5
7146
ac_compiler=`set X $ac_compile; echo $2`
7181
ac_compiler=`set X $ac_compile; echo $2`
7147
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
7182
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
Lines 7187-7193 Link Here
7187
  cat conftest.err >&5
7222
  cat conftest.err >&5
7188
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7223
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7189
  (exit $ac_status); } &&
7224
  (exit $ac_status); } &&
7190
	 { ac_try='test -z "$ac_f77_werror_flag"			 || test ! -s conftest.err'
7225
	 { ac_try='test -z "$ac_f77_werror_flag"
7226
			 || test ! -s conftest.err'
7191
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7227
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7192
  (eval $ac_try) 2>&5
7228
  (eval $ac_try) 2>&5
7193
  ac_status=$?
7229
  ac_status=$?
Lines 7236-7242 Link Here
7236
  cat conftest.err >&5
7272
  cat conftest.err >&5
7237
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7273
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7238
  (exit $ac_status); } &&
7274
  (exit $ac_status); } &&
7239
	 { ac_try='test -z "$ac_f77_werror_flag"			 || test ! -s conftest.err'
7275
	 { ac_try='test -z "$ac_f77_werror_flag"
7276
			 || test ! -s conftest.err'
7240
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7277
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7241
  (eval $ac_try) 2>&5
7278
  (eval $ac_try) 2>&5
7242
  ac_status=$?
7279
  ac_status=$?
Lines 8173-8183 Link Here
8173
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
8210
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
8174
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
8211
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
8175
   -e 's:$: $lt_compiler_flag:'`
8212
   -e 's:$: $lt_compiler_flag:'`
8176
   (eval echo "\"\$as_me:8176: $lt_compile\"" >&5)
8213
   (eval echo "\"\$as_me:8213: $lt_compile\"" >&5)
8177
   (eval "$lt_compile" 2>conftest.err)
8214
   (eval "$lt_compile" 2>conftest.err)
8178
   ac_status=$?
8215
   ac_status=$?
8179
   cat conftest.err >&5
8216
   cat conftest.err >&5
8180
   echo "$as_me:8180: \$? = $ac_status" >&5
8217
   echo "$as_me:8217: \$? = $ac_status" >&5
8181
   if (exit $ac_status) && test -s "$ac_outfile"; then
8218
   if (exit $ac_status) && test -s "$ac_outfile"; then
8182
     # The compiler can only warn and ignore the option if not recognized
8219
     # The compiler can only warn and ignore the option if not recognized
8183
     # So say no if there are warnings
8220
     # So say no if there are warnings
Lines 8406-8416 Link Here
8406
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
8443
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
8407
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
8444
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
8408
   -e 's:$: $lt_compiler_flag:'`
8445
   -e 's:$: $lt_compiler_flag:'`
8409
   (eval echo "\"\$as_me:8409: $lt_compile\"" >&5)
8446
   (eval echo "\"\$as_me:8446: $lt_compile\"" >&5)
8410
   (eval "$lt_compile" 2>conftest.err)
8447
   (eval "$lt_compile" 2>conftest.err)
8411
   ac_status=$?
8448
   ac_status=$?
8412
   cat conftest.err >&5
8449
   cat conftest.err >&5
8413
   echo "$as_me:8413: \$? = $ac_status" >&5
8450
   echo "$as_me:8450: \$? = $ac_status" >&5
8414
   if (exit $ac_status) && test -s "$ac_outfile"; then
8451
   if (exit $ac_status) && test -s "$ac_outfile"; then
8415
     # The compiler can only warn and ignore the option if not recognized
8452
     # The compiler can only warn and ignore the option if not recognized
8416
     # So say no if there are warnings
8453
     # So say no if there are warnings
Lines 8466-8476 Link Here
8466
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
8503
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
8467
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
8504
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
8468
   -e 's:$: $lt_compiler_flag:'`
8505
   -e 's:$: $lt_compiler_flag:'`
8469
   (eval echo "\"\$as_me:8469: $lt_compile\"" >&5)
8506
   (eval echo "\"\$as_me:8506: $lt_compile\"" >&5)
8470
   (eval "$lt_compile" 2>out/conftest.err)
8507
   (eval "$lt_compile" 2>out/conftest.err)
8471
   ac_status=$?
8508
   ac_status=$?
8472
   cat out/conftest.err >&5
8509
   cat out/conftest.err >&5
8473
   echo "$as_me:8473: \$? = $ac_status" >&5
8510
   echo "$as_me:8510: \$? = $ac_status" >&5
8474
   if (exit $ac_status) && test -s out/conftest2.$ac_objext
8511
   if (exit $ac_status) && test -s out/conftest2.$ac_objext
8475
   then
8512
   then
8476
     # The compiler can only warn and ignore the option if not recognized
8513
     # The compiler can only warn and ignore the option if not recognized
Lines 8857-8863 Link Here
8857
  cat conftest.err >&5
8894
  cat conftest.err >&5
8858
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
8895
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
8859
  (exit $ac_status); } &&
8896
  (exit $ac_status); } &&
8860
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
8897
	 { ac_try='test -z "$ac_c_werror_flag"
8898
			 || test ! -s conftest.err'
8861
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8899
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8862
  (eval $ac_try) 2>&5
8900
  (eval $ac_try) 2>&5
8863
  ac_status=$?
8901
  ac_status=$?
Lines 8917-8923 Link Here
8917
  cat conftest.err >&5
8955
  cat conftest.err >&5
8918
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
8956
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
8919
  (exit $ac_status); } &&
8957
  (exit $ac_status); } &&
8920
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
8958
	 { ac_try='test -z "$ac_c_werror_flag"
8959
			 || test ! -s conftest.err'
8921
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8960
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8922
  (eval $ac_try) 2>&5
8961
  (eval $ac_try) 2>&5
8923
  ac_status=$?
8962
  ac_status=$?
Lines 10108-10114 Link Here
10108
  cat conftest.err >&5
10147
  cat conftest.err >&5
10109
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10148
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10110
  (exit $ac_status); } &&
10149
  (exit $ac_status); } &&
10111
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
10150
	 { ac_try='test -z "$ac_c_werror_flag"
10151
			 || test ! -s conftest.err'
10112
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10152
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10113
  (eval $ac_try) 2>&5
10153
  (eval $ac_try) 2>&5
10114
  ac_status=$?
10154
  ac_status=$?
Lines 10211-10217 Link Here
10211
  cat conftest.err >&5
10251
  cat conftest.err >&5
10212
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10252
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10213
  (exit $ac_status); } &&
10253
  (exit $ac_status); } &&
10214
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
10254
	 { ac_try='test -z "$ac_c_werror_flag"
10255
			 || test ! -s conftest.err'
10215
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10256
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10216
  (eval $ac_try) 2>&5
10257
  (eval $ac_try) 2>&5
10217
  ac_status=$?
10258
  ac_status=$?
Lines 10276-10282 Link Here
10276
  cat conftest.err >&5
10317
  cat conftest.err >&5
10277
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10318
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10278
  (exit $ac_status); } &&
10319
  (exit $ac_status); } &&
10279
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
10320
	 { ac_try='test -z "$ac_c_werror_flag"
10321
			 || test ! -s conftest.err'
10280
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10322
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10281
  (eval $ac_try) 2>&5
10323
  (eval $ac_try) 2>&5
10282
  ac_status=$?
10324
  ac_status=$?
Lines 10369-10375 Link Here
10369
  cat conftest.err >&5
10411
  cat conftest.err >&5
10370
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10412
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10371
  (exit $ac_status); } &&
10413
  (exit $ac_status); } &&
10372
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
10414
	 { ac_try='test -z "$ac_c_werror_flag"
10415
			 || test ! -s conftest.err'
10373
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10416
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10374
  (eval $ac_try) 2>&5
10417
  (eval $ac_try) 2>&5
10375
  ac_status=$?
10418
  ac_status=$?
Lines 10434-10440 Link Here
10434
  cat conftest.err >&5
10477
  cat conftest.err >&5
10435
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10478
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10436
  (exit $ac_status); } &&
10479
  (exit $ac_status); } &&
10437
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
10480
	 { ac_try='test -z "$ac_c_werror_flag"
10481
			 || test ! -s conftest.err'
10438
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10482
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10439
  (eval $ac_try) 2>&5
10483
  (eval $ac_try) 2>&5
10440
  ac_status=$?
10484
  ac_status=$?
Lines 10500-10506 Link Here
10500
  cat conftest.err >&5
10544
  cat conftest.err >&5
10501
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10545
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10502
  (exit $ac_status); } &&
10546
  (exit $ac_status); } &&
10503
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
10547
	 { ac_try='test -z "$ac_c_werror_flag"
10548
			 || test ! -s conftest.err'
10504
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10549
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10505
  (eval $ac_try) 2>&5
10550
  (eval $ac_try) 2>&5
10506
  ac_status=$?
10551
  ac_status=$?
Lines 10566-10572 Link Here
10566
  cat conftest.err >&5
10611
  cat conftest.err >&5
10567
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10612
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10568
  (exit $ac_status); } &&
10613
  (exit $ac_status); } &&
10569
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
10614
	 { ac_try='test -z "$ac_c_werror_flag"
10615
			 || test ! -s conftest.err'
10570
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10616
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10571
  (eval $ac_try) 2>&5
10617
  (eval $ac_try) 2>&5
10572
  ac_status=$?
10618
  ac_status=$?
Lines 10641-10647 Link Here
10641
  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
10687
  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
10642
  lt_status=$lt_dlunknown
10688
  lt_status=$lt_dlunknown
10643
  cat > conftest.$ac_ext <<EOF
10689
  cat > conftest.$ac_ext <<EOF
10644
#line 10644 "configure"
10690
#line 10690 "configure"
10645
#include "confdefs.h"
10691
#include "confdefs.h"
10646
10692
10647
#if HAVE_DLFCN_H
10693
#if HAVE_DLFCN_H
Lines 10739-10745 Link Here
10739
  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
10785
  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
10740
  lt_status=$lt_dlunknown
10786
  lt_status=$lt_dlunknown
10741
  cat > conftest.$ac_ext <<EOF
10787
  cat > conftest.$ac_ext <<EOF
10742
#line 10742 "configure"
10788
#line 10788 "configure"
10743
#include "confdefs.h"
10789
#include "confdefs.h"
10744
10790
10745
#if HAVE_DLFCN_H
10791
#if HAVE_DLFCN_H
Lines 11811-11817 Link Here
11811
  cat conftest.err >&5
11857
  cat conftest.err >&5
11812
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11858
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11813
  (exit $ac_status); } &&
11859
  (exit $ac_status); } &&
11814
	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
11860
	 { ac_try='test -z "$ac_cxx_werror_flag"
11861
			 || test ! -s conftest.err'
11815
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11862
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11816
  (eval $ac_try) 2>&5
11863
  (eval $ac_try) 2>&5
11817
  ac_status=$?
11864
  ac_status=$?
Lines 11872-11878 Link Here
11872
  cat conftest.err >&5
11919
  cat conftest.err >&5
11873
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11920
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11874
  (exit $ac_status); } &&
11921
  (exit $ac_status); } &&
11875
	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
11922
	 { ac_try='test -z "$ac_cxx_werror_flag"
11923
			 || test ! -s conftest.err'
11876
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11924
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11877
  (eval $ac_try) 2>&5
11925
  (eval $ac_try) 2>&5
11878
  ac_status=$?
11926
  ac_status=$?
Lines 12916-12926 Link Here
12916
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
12964
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
12917
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
12965
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
12918
   -e 's:$: $lt_compiler_flag:'`
12966
   -e 's:$: $lt_compiler_flag:'`
12919
   (eval echo "\"\$as_me:12919: $lt_compile\"" >&5)
12967
   (eval echo "\"\$as_me:12967: $lt_compile\"" >&5)
12920
   (eval "$lt_compile" 2>conftest.err)
12968
   (eval "$lt_compile" 2>conftest.err)
12921
   ac_status=$?
12969
   ac_status=$?
12922
   cat conftest.err >&5
12970
   cat conftest.err >&5
12923
   echo "$as_me:12923: \$? = $ac_status" >&5
12971
   echo "$as_me:12971: \$? = $ac_status" >&5
12924
   if (exit $ac_status) && test -s "$ac_outfile"; then
12972
   if (exit $ac_status) && test -s "$ac_outfile"; then
12925
     # The compiler can only warn and ignore the option if not recognized
12973
     # The compiler can only warn and ignore the option if not recognized
12926
     # So say no if there are warnings
12974
     # So say no if there are warnings
Lines 12976-12986 Link Here
12976
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
13024
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
12977
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
13025
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
12978
   -e 's:$: $lt_compiler_flag:'`
13026
   -e 's:$: $lt_compiler_flag:'`
12979
   (eval echo "\"\$as_me:12979: $lt_compile\"" >&5)
13027
   (eval echo "\"\$as_me:13027: $lt_compile\"" >&5)
12980
   (eval "$lt_compile" 2>out/conftest.err)
13028
   (eval "$lt_compile" 2>out/conftest.err)
12981
   ac_status=$?
13029
   ac_status=$?
12982
   cat out/conftest.err >&5
13030
   cat out/conftest.err >&5
12983
   echo "$as_me:12983: \$? = $ac_status" >&5
13031
   echo "$as_me:13031: \$? = $ac_status" >&5
12984
   if (exit $ac_status) && test -s out/conftest2.$ac_objext
13032
   if (exit $ac_status) && test -s out/conftest2.$ac_objext
12985
   then
13033
   then
12986
     # The compiler can only warn and ignore the option if not recognized
13034
     # The compiler can only warn and ignore the option if not recognized
Lines 13797-13803 Link Here
13797
  cat conftest.err >&5
13845
  cat conftest.err >&5
13798
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
13846
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
13799
  (exit $ac_status); } &&
13847
  (exit $ac_status); } &&
13800
	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
13848
	 { ac_try='test -z "$ac_cxx_werror_flag"
13849
			 || test ! -s conftest.err'
13801
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
13850
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
13802
  (eval $ac_try) 2>&5
13851
  (eval $ac_try) 2>&5
13803
  ac_status=$?
13852
  ac_status=$?
Lines 13900-13906 Link Here
13900
  cat conftest.err >&5
13949
  cat conftest.err >&5
13901
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
13950
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
13902
  (exit $ac_status); } &&
13951
  (exit $ac_status); } &&
13903
	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
13952
	 { ac_try='test -z "$ac_cxx_werror_flag"
13953
			 || test ! -s conftest.err'
13904
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
13954
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
13905
  (eval $ac_try) 2>&5
13955
  (eval $ac_try) 2>&5
13906
  ac_status=$?
13956
  ac_status=$?
Lines 13965-13971 Link Here
13965
  cat conftest.err >&5
14015
  cat conftest.err >&5
13966
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
14016
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
13967
  (exit $ac_status); } &&
14017
  (exit $ac_status); } &&
13968
	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
14018
	 { ac_try='test -z "$ac_cxx_werror_flag"
14019
			 || test ! -s conftest.err'
13969
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
14020
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
13970
  (eval $ac_try) 2>&5
14021
  (eval $ac_try) 2>&5
13971
  ac_status=$?
14022
  ac_status=$?
Lines 14058-14064 Link Here
14058
  cat conftest.err >&5
14109
  cat conftest.err >&5
14059
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
14110
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
14060
  (exit $ac_status); } &&
14111
  (exit $ac_status); } &&
14061
	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
14112
	 { ac_try='test -z "$ac_cxx_werror_flag"
14113
			 || test ! -s conftest.err'
14062
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
14114
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
14063
  (eval $ac_try) 2>&5
14115
  (eval $ac_try) 2>&5
14064
  ac_status=$?
14116
  ac_status=$?
Lines 14123-14129 Link Here
14123
  cat conftest.err >&5
14175
  cat conftest.err >&5
14124
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
14176
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
14125
  (exit $ac_status); } &&
14177
  (exit $ac_status); } &&
14126
	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
14178
	 { ac_try='test -z "$ac_cxx_werror_flag"
14179
			 || test ! -s conftest.err'
14127
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
14180
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
14128
  (eval $ac_try) 2>&5
14181
  (eval $ac_try) 2>&5
14129
  ac_status=$?
14182
  ac_status=$?
Lines 14189-14195 Link Here
14189
  cat conftest.err >&5
14242
  cat conftest.err >&5
14190
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
14243
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
14191
  (exit $ac_status); } &&
14244
  (exit $ac_status); } &&
14192
	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
14245
	 { ac_try='test -z "$ac_cxx_werror_flag"
14246
			 || test ! -s conftest.err'
14193
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
14247
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
14194
  (eval $ac_try) 2>&5
14248
  (eval $ac_try) 2>&5
14195
  ac_status=$?
14249
  ac_status=$?
Lines 14255-14261 Link Here
14255
  cat conftest.err >&5
14309
  cat conftest.err >&5
14256
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
14310
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
14257
  (exit $ac_status); } &&
14311
  (exit $ac_status); } &&
14258
	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
14312
	 { ac_try='test -z "$ac_cxx_werror_flag"
14313
			 || test ! -s conftest.err'
14259
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
14314
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
14260
  (eval $ac_try) 2>&5
14315
  (eval $ac_try) 2>&5
14261
  ac_status=$?
14316
  ac_status=$?
Lines 14330-14336 Link Here
14330
  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
14385
  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
14331
  lt_status=$lt_dlunknown
14386
  lt_status=$lt_dlunknown
14332
  cat > conftest.$ac_ext <<EOF
14387
  cat > conftest.$ac_ext <<EOF
14333
#line 14333 "configure"
14388
#line 14388 "configure"
14334
#include "confdefs.h"
14389
#include "confdefs.h"
14335
14390
14336
#if HAVE_DLFCN_H
14391
#if HAVE_DLFCN_H
Lines 14428-14434 Link Here
14428
  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
14483
  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
14429
  lt_status=$lt_dlunknown
14484
  lt_status=$lt_dlunknown
14430
  cat > conftest.$ac_ext <<EOF
14485
  cat > conftest.$ac_ext <<EOF
14431
#line 14431 "configure"
14486
#line 14486 "configure"
14432
#include "confdefs.h"
14487
#include "confdefs.h"
14433
14488
14434
#if HAVE_DLFCN_H
14489
#if HAVE_DLFCN_H
Lines 15255-15265 Link Here
15255
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
15310
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
15256
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
15311
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
15257
   -e 's:$: $lt_compiler_flag:'`
15312
   -e 's:$: $lt_compiler_flag:'`
15258
   (eval echo "\"\$as_me:15258: $lt_compile\"" >&5)
15313
   (eval echo "\"\$as_me:15313: $lt_compile\"" >&5)
15259
   (eval "$lt_compile" 2>conftest.err)
15314
   (eval "$lt_compile" 2>conftest.err)
15260
   ac_status=$?
15315
   ac_status=$?
15261
   cat conftest.err >&5
15316
   cat conftest.err >&5
15262
   echo "$as_me:15262: \$? = $ac_status" >&5
15317
   echo "$as_me:15317: \$? = $ac_status" >&5
15263
   if (exit $ac_status) && test -s "$ac_outfile"; then
15318
   if (exit $ac_status) && test -s "$ac_outfile"; then
15264
     # The compiler can only warn and ignore the option if not recognized
15319
     # The compiler can only warn and ignore the option if not recognized
15265
     # So say no if there are warnings
15320
     # So say no if there are warnings
Lines 15315-15325 Link Here
15315
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
15370
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
15316
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
15371
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
15317
   -e 's:$: $lt_compiler_flag:'`
15372
   -e 's:$: $lt_compiler_flag:'`
15318
   (eval echo "\"\$as_me:15318: $lt_compile\"" >&5)
15373
   (eval echo "\"\$as_me:15373: $lt_compile\"" >&5)
15319
   (eval "$lt_compile" 2>out/conftest.err)
15374
   (eval "$lt_compile" 2>out/conftest.err)
15320
   ac_status=$?
15375
   ac_status=$?
15321
   cat out/conftest.err >&5
15376
   cat out/conftest.err >&5
15322
   echo "$as_me:15322: \$? = $ac_status" >&5
15377
   echo "$as_me:15377: \$? = $ac_status" >&5
15323
   if (exit $ac_status) && test -s out/conftest2.$ac_objext
15378
   if (exit $ac_status) && test -s out/conftest2.$ac_objext
15324
   then
15379
   then
15325
     # The compiler can only warn and ignore the option if not recognized
15380
     # The compiler can only warn and ignore the option if not recognized
Lines 15696-15702 Link Here
15696
  cat conftest.err >&5
15751
  cat conftest.err >&5
15697
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
15752
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
15698
  (exit $ac_status); } &&
15753
  (exit $ac_status); } &&
15699
	 { ac_try='test -z "$ac_f77_werror_flag"			 || test ! -s conftest.err'
15754
	 { ac_try='test -z "$ac_f77_werror_flag"
15755
			 || test ! -s conftest.err'
15700
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
15756
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
15701
  (eval $ac_try) 2>&5
15757
  (eval $ac_try) 2>&5
15702
  ac_status=$?
15758
  ac_status=$?
Lines 15746-15752 Link Here
15746
  cat conftest.err >&5
15802
  cat conftest.err >&5
15747
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
15803
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
15748
  (exit $ac_status); } &&
15804
  (exit $ac_status); } &&
15749
	 { ac_try='test -z "$ac_f77_werror_flag"			 || test ! -s conftest.err'
15805
	 { ac_try='test -z "$ac_f77_werror_flag"
15806
			 || test ! -s conftest.err'
15750
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
15807
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
15751
  (eval $ac_try) 2>&5
15808
  (eval $ac_try) 2>&5
15752
  ac_status=$?
15809
  ac_status=$?
Lines 17347-17357 Link Here
17347
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
17404
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
17348
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
17405
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
17349
   -e 's:$: $lt_compiler_flag:'`
17406
   -e 's:$: $lt_compiler_flag:'`
17350
   (eval echo "\"\$as_me:17350: $lt_compile\"" >&5)
17407
   (eval echo "\"\$as_me:17407: $lt_compile\"" >&5)
17351
   (eval "$lt_compile" 2>conftest.err)
17408
   (eval "$lt_compile" 2>conftest.err)
17352
   ac_status=$?
17409
   ac_status=$?
17353
   cat conftest.err >&5
17410
   cat conftest.err >&5
17354
   echo "$as_me:17354: \$? = $ac_status" >&5
17411
   echo "$as_me:17411: \$? = $ac_status" >&5
17355
   if (exit $ac_status) && test -s "$ac_outfile"; then
17412
   if (exit $ac_status) && test -s "$ac_outfile"; then
17356
     # The compiler can only warn and ignore the option if not recognized
17413
     # The compiler can only warn and ignore the option if not recognized
17357
     # So say no if there are warnings
17414
     # So say no if there are warnings
Lines 17580-17590 Link Here
17580
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
17637
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
17581
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
17638
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
17582
   -e 's:$: $lt_compiler_flag:'`
17639
   -e 's:$: $lt_compiler_flag:'`
17583
   (eval echo "\"\$as_me:17583: $lt_compile\"" >&5)
17640
   (eval echo "\"\$as_me:17640: $lt_compile\"" >&5)
17584
   (eval "$lt_compile" 2>conftest.err)
17641
   (eval "$lt_compile" 2>conftest.err)
17585
   ac_status=$?
17642
   ac_status=$?
17586
   cat conftest.err >&5
17643
   cat conftest.err >&5
17587
   echo "$as_me:17587: \$? = $ac_status" >&5
17644
   echo "$as_me:17644: \$? = $ac_status" >&5
17588
   if (exit $ac_status) && test -s "$ac_outfile"; then
17645
   if (exit $ac_status) && test -s "$ac_outfile"; then
17589
     # The compiler can only warn and ignore the option if not recognized
17646
     # The compiler can only warn and ignore the option if not recognized
17590
     # So say no if there are warnings
17647
     # So say no if there are warnings
Lines 17640-17650 Link Here
17640
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
17697
   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
17641
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
17698
   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
17642
   -e 's:$: $lt_compiler_flag:'`
17699
   -e 's:$: $lt_compiler_flag:'`
17643
   (eval echo "\"\$as_me:17643: $lt_compile\"" >&5)
17700
   (eval echo "\"\$as_me:17700: $lt_compile\"" >&5)
17644
   (eval "$lt_compile" 2>out/conftest.err)
17701
   (eval "$lt_compile" 2>out/conftest.err)
17645
   ac_status=$?
17702
   ac_status=$?
17646
   cat out/conftest.err >&5
17703
   cat out/conftest.err >&5
17647
   echo "$as_me:17647: \$? = $ac_status" >&5
17704
   echo "$as_me:17704: \$? = $ac_status" >&5
17648
   if (exit $ac_status) && test -s out/conftest2.$ac_objext
17705
   if (exit $ac_status) && test -s out/conftest2.$ac_objext
17649
   then
17706
   then
17650
     # The compiler can only warn and ignore the option if not recognized
17707
     # The compiler can only warn and ignore the option if not recognized
Lines 18031-18037 Link Here
18031
  cat conftest.err >&5
18088
  cat conftest.err >&5
18032
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
18089
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
18033
  (exit $ac_status); } &&
18090
  (exit $ac_status); } &&
18034
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
18091
	 { ac_try='test -z "$ac_c_werror_flag"
18092
			 || test ! -s conftest.err'
18035
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
18093
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
18036
  (eval $ac_try) 2>&5
18094
  (eval $ac_try) 2>&5
18037
  ac_status=$?
18095
  ac_status=$?
Lines 18091-18097 Link Here
18091
  cat conftest.err >&5
18149
  cat conftest.err >&5
18092
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
18150
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
18093
  (exit $ac_status); } &&
18151
  (exit $ac_status); } &&
18094
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
18152
	 { ac_try='test -z "$ac_c_werror_flag"
18153
			 || test ! -s conftest.err'
18095
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
18154
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
18096
  (eval $ac_try) 2>&5
18155
  (eval $ac_try) 2>&5
18097
  ac_status=$?
18156
  ac_status=$?
Lines 19282-19288 Link Here
19282
  cat conftest.err >&5
19341
  cat conftest.err >&5
19283
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
19342
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
19284
  (exit $ac_status); } &&
19343
  (exit $ac_status); } &&
19285
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
19344
	 { ac_try='test -z "$ac_c_werror_flag"
19345
			 || test ! -s conftest.err'
19286
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
19346
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
19287
  (eval $ac_try) 2>&5
19347
  (eval $ac_try) 2>&5
19288
  ac_status=$?
19348
  ac_status=$?
Lines 19385-19391 Link Here
19385
  cat conftest.err >&5
19445
  cat conftest.err >&5
19386
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
19446
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
19387
  (exit $ac_status); } &&
19447
  (exit $ac_status); } &&
19388
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
19448
	 { ac_try='test -z "$ac_c_werror_flag"
19449
			 || test ! -s conftest.err'
19389
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
19450
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
19390
  (eval $ac_try) 2>&5
19451
  (eval $ac_try) 2>&5
19391
  ac_status=$?
19452
  ac_status=$?
Lines 19450-19456 Link Here
19450
  cat conftest.err >&5
19511
  cat conftest.err >&5
19451
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
19512
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
19452
  (exit $ac_status); } &&
19513
  (exit $ac_status); } &&
19453
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
19514
	 { ac_try='test -z "$ac_c_werror_flag"
19515
			 || test ! -s conftest.err'
19454
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
19516
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
19455
  (eval $ac_try) 2>&5
19517
  (eval $ac_try) 2>&5
19456
  ac_status=$?
19518
  ac_status=$?
Lines 19543-19549 Link Here
19543
  cat conftest.err >&5
19605
  cat conftest.err >&5
19544
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
19606
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
19545
  (exit $ac_status); } &&
19607
  (exit $ac_status); } &&
19546
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
19608
	 { ac_try='test -z "$ac_c_werror_flag"
19609
			 || test ! -s conftest.err'
19547
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
19610
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
19548
  (eval $ac_try) 2>&5
19611
  (eval $ac_try) 2>&5
19549
  ac_status=$?
19612
  ac_status=$?
Lines 19608-19614 Link Here
19608
  cat conftest.err >&5
19671
  cat conftest.err >&5
19609
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
19672
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
19610
  (exit $ac_status); } &&
19673
  (exit $ac_status); } &&
19611
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
19674
	 { ac_try='test -z "$ac_c_werror_flag"
19675
			 || test ! -s conftest.err'
19612
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
19676
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
19613
  (eval $ac_try) 2>&5
19677
  (eval $ac_try) 2>&5
19614
  ac_status=$?
19678
  ac_status=$?
Lines 19674-19680 Link Here
19674
  cat conftest.err >&5
19738
  cat conftest.err >&5
19675
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
19739
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
19676
  (exit $ac_status); } &&
19740
  (exit $ac_status); } &&
19677
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
19741
	 { ac_try='test -z "$ac_c_werror_flag"
19742
			 || test ! -s conftest.err'
19678
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
19743
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
19679
  (eval $ac_try) 2>&5
19744
  (eval $ac_try) 2>&5
19680
  ac_status=$?
19745
  ac_status=$?
Lines 19740-19746 Link Here
19740
  cat conftest.err >&5
19805
  cat conftest.err >&5
19741
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
19806
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
19742
  (exit $ac_status); } &&
19807
  (exit $ac_status); } &&
19743
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
19808
	 { ac_try='test -z "$ac_c_werror_flag"
19809
			 || test ! -s conftest.err'
19744
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
19810
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
19745
  (eval $ac_try) 2>&5
19811
  (eval $ac_try) 2>&5
19746
  ac_status=$?
19812
  ac_status=$?
Lines 19815-19821 Link Here
19815
  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
19881
  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
19816
  lt_status=$lt_dlunknown
19882
  lt_status=$lt_dlunknown
19817
  cat > conftest.$ac_ext <<EOF
19883
  cat > conftest.$ac_ext <<EOF
19818
#line 19818 "configure"
19884
#line 19884 "configure"
19819
#include "confdefs.h"
19885
#include "confdefs.h"
19820
19886
19821
#if HAVE_DLFCN_H
19887
#if HAVE_DLFCN_H
Lines 19913-19919 Link Here
19913
  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
19979
  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
19914
  lt_status=$lt_dlunknown
19980
  lt_status=$lt_dlunknown
19915
  cat > conftest.$ac_ext <<EOF
19981
  cat > conftest.$ac_ext <<EOF
19916
#line 19916 "configure"
19982
#line 19982 "configure"
19917
#include "confdefs.h"
19983
#include "confdefs.h"
19918
19984
19919
#if HAVE_DLFCN_H
19985
#if HAVE_DLFCN_H
Lines 21856-21862 Link Here
21856
  cat conftest.err >&5
21922
  cat conftest.err >&5
21857
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
21923
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
21858
  (exit $ac_status); } &&
21924
  (exit $ac_status); } &&
21859
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
21925
	 { ac_try='test -z "$ac_c_werror_flag"
21926
			 || test ! -s conftest.err'
21860
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
21927
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
21861
  (eval $ac_try) 2>&5
21928
  (eval $ac_try) 2>&5
21862
  ac_status=$?
21929
  ac_status=$?
Lines 21947-21953 Link Here
21947
  cat conftest.err >&5
22014
  cat conftest.err >&5
21948
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
22015
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
21949
  (exit $ac_status); } &&
22016
  (exit $ac_status); } &&
21950
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
22017
	 { ac_try='test -z "$ac_c_werror_flag"
22018
			 || test ! -s conftest.err'
21951
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
22019
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
21952
  (eval $ac_try) 2>&5
22020
  (eval $ac_try) 2>&5
21953
  ac_status=$?
22021
  ac_status=$?
Lines 21997-22003 Link Here
21997
  cat conftest.err >&5
22065
  cat conftest.err >&5
21998
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
22066
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
21999
  (exit $ac_status); } &&
22067
  (exit $ac_status); } &&
22000
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
22068
	 { ac_try='test -z "$ac_c_werror_flag"
22069
			 || test ! -s conftest.err'
22001
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
22070
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
22002
  (eval $ac_try) 2>&5
22071
  (eval $ac_try) 2>&5
22003
  ac_status=$?
22072
  ac_status=$?
Lines 22463-22469 Link Here
22463
  cat conftest.err >&5
22532
  cat conftest.err >&5
22464
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
22533
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
22465
  (exit $ac_status); } &&
22534
  (exit $ac_status); } &&
22466
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
22535
	 { ac_try='test -z "$ac_c_werror_flag"
22536
			 || test ! -s conftest.err'
22467
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
22537
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
22468
  (eval $ac_try) 2>&5
22538
  (eval $ac_try) 2>&5
22469
  ac_status=$?
22539
  ac_status=$?
Lines 22517-22523 Link Here
22517
  cat conftest.err >&5
22587
  cat conftest.err >&5
22518
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
22588
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
22519
  (exit $ac_status); } &&
22589
  (exit $ac_status); } &&
22520
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
22590
	 { ac_try='test -z "$ac_c_werror_flag"
22591
			 || test ! -s conftest.err'
22521
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
22592
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
22522
  (eval $ac_try) 2>&5
22593
  (eval $ac_try) 2>&5
22523
  ac_status=$?
22594
  ac_status=$?
Lines 22710-22716 Link Here
22710
  cat conftest.err >&5
22781
  cat conftest.err >&5
22711
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
22782
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
22712
  (exit $ac_status); } &&
22783
  (exit $ac_status); } &&
22713
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
22784
	 { ac_try='test -z "$ac_c_werror_flag"
22785
			 || test ! -s conftest.err'
22714
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
22786
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
22715
  (eval $ac_try) 2>&5
22787
  (eval $ac_try) 2>&5
22716
  ac_status=$?
22788
  ac_status=$?
Lines 22793-22799 Link Here
22793
  cat conftest.err >&5
22865
  cat conftest.err >&5
22794
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
22866
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
22795
  (exit $ac_status); } &&
22867
  (exit $ac_status); } &&
22796
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
22868
	 { ac_try='test -z "$ac_c_werror_flag"
22869
			 || test ! -s conftest.err'
22797
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
22870
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
22798
  (eval $ac_try) 2>&5
22871
  (eval $ac_try) 2>&5
22799
  ac_status=$?
22872
  ac_status=$?
Lines 22887-22893 Link Here
22887
  cat conftest.err >&5
22960
  cat conftest.err >&5
22888
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
22961
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
22889
  (exit $ac_status); } &&
22962
  (exit $ac_status); } &&
22890
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
22963
	 { ac_try='test -z "$ac_c_werror_flag"
22964
			 || test ! -s conftest.err'
22891
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
22965
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
22892
  (eval $ac_try) 2>&5
22966
  (eval $ac_try) 2>&5
22893
  ac_status=$?
22967
  ac_status=$?
Lines 22952-22958 Link Here
22952
  cat conftest.err >&5
23026
  cat conftest.err >&5
22953
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23027
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
22954
  (exit $ac_status); } &&
23028
  (exit $ac_status); } &&
22955
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
23029
	 { ac_try='test -z "$ac_c_werror_flag"
23030
			 || test ! -s conftest.err'
22956
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23031
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
22957
  (eval $ac_try) 2>&5
23032
  (eval $ac_try) 2>&5
22958
  ac_status=$?
23033
  ac_status=$?
Lines 23035-23041 Link Here
23035
  cat conftest.err >&5
23110
  cat conftest.err >&5
23036
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23111
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23037
  (exit $ac_status); } &&
23112
  (exit $ac_status); } &&
23038
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
23113
	 { ac_try='test -z "$ac_c_werror_flag"
23114
			 || test ! -s conftest.err'
23039
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23115
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23040
  (eval $ac_try) 2>&5
23116
  (eval $ac_try) 2>&5
23041
  ac_status=$?
23117
  ac_status=$?
Lines 23089-23095 Link Here
23089
  cat conftest.err >&5
23165
  cat conftest.err >&5
23090
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23166
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23091
  (exit $ac_status); } &&
23167
  (exit $ac_status); } &&
23092
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
23168
	 { ac_try='test -z "$ac_c_werror_flag"
23169
			 || test ! -s conftest.err'
23093
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23170
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23094
  (eval $ac_try) 2>&5
23171
  (eval $ac_try) 2>&5
23095
  ac_status=$?
23172
  ac_status=$?
Lines 23188-23194 Link Here
23188
  cat conftest.err >&5
23265
  cat conftest.err >&5
23189
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23266
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23190
  (exit $ac_status); } &&
23267
  (exit $ac_status); } &&
23191
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
23268
	 { ac_try='test -z "$ac_c_werror_flag"
23269
			 || test ! -s conftest.err'
23192
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23270
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23193
  (eval $ac_try) 2>&5
23271
  (eval $ac_try) 2>&5
23194
  ac_status=$?
23272
  ac_status=$?
Lines 23286-23292 Link Here
23286
  cat conftest.err >&5
23364
  cat conftest.err >&5
23287
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23365
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23288
  (exit $ac_status); } &&
23366
  (exit $ac_status); } &&
23289
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
23367
	 { ac_try='test -z "$ac_c_werror_flag"
23368
			 || test ! -s conftest.err'
23290
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23369
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23291
  (eval $ac_try) 2>&5
23370
  (eval $ac_try) 2>&5
23292
  ac_status=$?
23371
  ac_status=$?
Lines 23368-23374 Link Here
23368
  cat conftest.err >&5
23447
  cat conftest.err >&5
23369
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23448
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23370
  (exit $ac_status); } &&
23449
  (exit $ac_status); } &&
23371
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
23450
	 { ac_try='test -z "$ac_c_werror_flag"
23451
			 || test ! -s conftest.err'
23372
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23452
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23373
  (eval $ac_try) 2>&5
23453
  (eval $ac_try) 2>&5
23374
  ac_status=$?
23454
  ac_status=$?
Lines 23442-23448 Link Here
23442
  cat conftest.err >&5
23522
  cat conftest.err >&5
23443
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23523
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23444
  (exit $ac_status); } &&
23524
  (exit $ac_status); } &&
23445
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
23525
	 { ac_try='test -z "$ac_c_werror_flag"
23526
			 || test ! -s conftest.err'
23446
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23527
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23447
  (eval $ac_try) 2>&5
23528
  (eval $ac_try) 2>&5
23448
  ac_status=$?
23529
  ac_status=$?
Lines 23518-23524 Link Here
23518
  cat conftest.err >&5
23599
  cat conftest.err >&5
23519
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23600
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23520
  (exit $ac_status); } &&
23601
  (exit $ac_status); } &&
23521
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
23602
	 { ac_try='test -z "$ac_c_werror_flag"
23603
			 || test ! -s conftest.err'
23522
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23604
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23523
  (eval $ac_try) 2>&5
23605
  (eval $ac_try) 2>&5
23524
  ac_status=$?
23606
  ac_status=$?
Lines 23680-23686 Link Here
23680
  cat conftest.err >&5
23762
  cat conftest.err >&5
23681
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23763
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23682
  (exit $ac_status); } &&
23764
  (exit $ac_status); } &&
23683
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
23765
	 { ac_try='test -z "$ac_c_werror_flag"
23766
			 || test ! -s conftest.err'
23684
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23767
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23685
  (eval $ac_try) 2>&5
23768
  (eval $ac_try) 2>&5
23686
  ac_status=$?
23769
  ac_status=$?
Lines 23827-23833 Link Here
23827
  cat conftest.err >&5
23910
  cat conftest.err >&5
23828
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23911
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23829
  (exit $ac_status); } &&
23912
  (exit $ac_status); } &&
23830
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
23913
	 { ac_try='test -z "$ac_c_werror_flag"
23914
			 || test ! -s conftest.err'
23831
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23915
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23832
  (eval $ac_try) 2>&5
23916
  (eval $ac_try) 2>&5
23833
  ac_status=$?
23917
  ac_status=$?
Lines 23973-23979 Link Here
23973
  cat conftest.err >&5
24057
  cat conftest.err >&5
23974
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
24058
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
23975
  (exit $ac_status); } &&
24059
  (exit $ac_status); } &&
23976
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
24060
	 { ac_try='test -z "$ac_c_werror_flag"
24061
			 || test ! -s conftest.err'
23977
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
24062
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
23978
  (eval $ac_try) 2>&5
24063
  (eval $ac_try) 2>&5
23979
  ac_status=$?
24064
  ac_status=$?
Lines 24144-24150 Link Here
24144
  cat conftest.err >&5
24229
  cat conftest.err >&5
24145
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
24230
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
24146
  (exit $ac_status); } &&
24231
  (exit $ac_status); } &&
24147
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
24232
	 { ac_try='test -z "$ac_c_werror_flag"
24233
			 || test ! -s conftest.err'
24148
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
24234
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
24149
  (eval $ac_try) 2>&5
24235
  (eval $ac_try) 2>&5
24150
  ac_status=$?
24236
  ac_status=$?
Lines 24295-24301 Link Here
24295
  cat conftest.err >&5
24381
  cat conftest.err >&5
24296
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
24382
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
24297
  (exit $ac_status); } &&
24383
  (exit $ac_status); } &&
24298
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
24384
	 { ac_try='test -z "$ac_c_werror_flag"
24385
			 || test ! -s conftest.err'
24299
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
24386
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
24300
  (eval $ac_try) 2>&5
24387
  (eval $ac_try) 2>&5
24301
  ac_status=$?
24388
  ac_status=$?
Lines 24463-24469 Link Here
24463
  cat conftest.err >&5
24550
  cat conftest.err >&5
24464
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
24551
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
24465
  (exit $ac_status); } &&
24552
  (exit $ac_status); } &&
24466
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
24553
	 { ac_try='test -z "$ac_c_werror_flag"
24554
			 || test ! -s conftest.err'
24467
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
24555
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
24468
  (eval $ac_try) 2>&5
24556
  (eval $ac_try) 2>&5
24469
  ac_status=$?
24557
  ac_status=$?
Lines 24505-24511 Link Here
24505
  cat conftest.err >&5
24593
  cat conftest.err >&5
24506
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
24594
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
24507
  (exit $ac_status); } &&
24595
  (exit $ac_status); } &&
24508
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
24596
	 { ac_try='test -z "$ac_c_werror_flag"
24597
			 || test ! -s conftest.err'
24509
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
24598
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
24510
  (eval $ac_try) 2>&5
24599
  (eval $ac_try) 2>&5
24511
  ac_status=$?
24600
  ac_status=$?
Lines 24562-24568 Link Here
24562
  cat conftest.err >&5
24651
  cat conftest.err >&5
24563
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
24652
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
24564
  (exit $ac_status); } &&
24653
  (exit $ac_status); } &&
24565
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
24654
	 { ac_try='test -z "$ac_c_werror_flag"
24655
			 || test ! -s conftest.err'
24566
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
24656
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
24567
  (eval $ac_try) 2>&5
24657
  (eval $ac_try) 2>&5
24568
  ac_status=$?
24658
  ac_status=$?
Lines 24728-24734 Link Here
24728
  cat conftest.err >&5
24818
  cat conftest.err >&5
24729
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
24819
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
24730
  (exit $ac_status); } &&
24820
  (exit $ac_status); } &&
24731
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
24821
	 { ac_try='test -z "$ac_c_werror_flag"
24822
			 || test ! -s conftest.err'
24732
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
24823
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
24733
  (eval $ac_try) 2>&5
24824
  (eval $ac_try) 2>&5
24734
  ac_status=$?
24825
  ac_status=$?
Lines 24834-24840 Link Here
24834
  cat conftest.err >&5
24925
  cat conftest.err >&5
24835
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
24926
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
24836
  (exit $ac_status); } &&
24927
  (exit $ac_status); } &&
24837
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
24928
	 { ac_try='test -z "$ac_c_werror_flag"
24929
			 || test ! -s conftest.err'
24838
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
24930
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
24839
  (eval $ac_try) 2>&5
24931
  (eval $ac_try) 2>&5
24840
  ac_status=$?
24932
  ac_status=$?
Lines 24873-24879 Link Here
24873
	CFLAGS="$CFLAGS -Werror"
24965
	CFLAGS="$CFLAGS -Werror"
24874
fi
24966
fi
24875
24967
24876
                                                                                                                                                                                                                            ac_config_files="$ac_config_files Makefile include/Makefile include/parted/Makefile libparted/Makefile libparted/fs_ext2/Makefile libparted/fs_fat/Makefile libparted/fs_hfs/Makefile libparted/fs_jfs/Makefile libparted/fs_linux_swap/Makefile libparted/fs_ntfs/Makefile libparted/fs_reiserfs/Makefile libparted/fs_ufs/Makefile libparted/fs_xfs/Makefile m4/Makefile parted/Makefile partprobe/Makefile doc/Makefile debug/Makefile debug/clearfat/Makefile debug/test/Makefile po/Makefile.in parted.spec"
24968
                                                                                                                                                                                                                                      ac_config_files="$ac_config_files Makefile include/Makefile include/parted/Makefile libparted/Makefile libparted/fs_ext2/Makefile libparted/fs_fat/Makefile libparted/fs_hfs/Makefile libparted/fs_jfs/Makefile libparted/fs_linux_swap/Makefile libparted/fs_ntfs/Makefile libparted/fs_reiserfs/Makefile libparted/fs_ufs/Makefile libparted/fs_xfs/Makefile libparted/fs_amiga/Makefile m4/Makefile parted/Makefile partprobe/Makefile doc/Makefile debug/Makefile debug/clearfat/Makefile debug/test/Makefile po/Makefile.in parted.spec"
24877
cat >confcache <<\_ACEOF
24969
cat >confcache <<\_ACEOF
24878
# This file is a shell script that caches the results of configure
24970
# This file is a shell script that caches the results of configure
24879
# tests run on this system so they can be shared between configure
24971
# tests run on this system so they can be shared between configure
Lines 25457-25462 Link Here
25457
  "libparted/fs_reiserfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES libparted/fs_reiserfs/Makefile" ;;
25549
  "libparted/fs_reiserfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES libparted/fs_reiserfs/Makefile" ;;
25458
  "libparted/fs_ufs/Makefile" ) CONFIG_FILES="$CONFIG_FILES libparted/fs_ufs/Makefile" ;;
25550
  "libparted/fs_ufs/Makefile" ) CONFIG_FILES="$CONFIG_FILES libparted/fs_ufs/Makefile" ;;
25459
  "libparted/fs_xfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES libparted/fs_xfs/Makefile" ;;
25551
  "libparted/fs_xfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES libparted/fs_xfs/Makefile" ;;
25552
  "libparted/fs_amiga/Makefile" ) CONFIG_FILES="$CONFIG_FILES libparted/fs_amiga/Makefile" ;;
25460
  "m4/Makefile" ) CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;;
25553
  "m4/Makefile" ) CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;;
25461
  "parted/Makefile" ) CONFIG_FILES="$CONFIG_FILES parted/Makefile" ;;
25554
  "parted/Makefile" ) CONFIG_FILES="$CONFIG_FILES parted/Makefile" ;;
25462
  "partprobe/Makefile" ) CONFIG_FILES="$CONFIG_FILES partprobe/Makefile" ;;
25555
  "partprobe/Makefile" ) CONFIG_FILES="$CONFIG_FILES partprobe/Makefile" ;;
Lines 25807-25812 Link Here
25807
  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
25900
  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
25808
  esac
25901
  esac
25809
25902
25903
  if test x"$ac_file" != x-; then
25904
    { echo "$as_me:$LINENO: creating $ac_file" >&5
25905
echo "$as_me: creating $ac_file" >&6;}
25906
    rm -f "$ac_file"
25907
  fi
25810
  # Let's still pretend it is `configure' which instantiates (i.e., don't
25908
  # Let's still pretend it is `configure' which instantiates (i.e., don't
25811
  # use $as_me), people would be surprised to read:
25909
  # use $as_me), people would be surprised to read:
25812
  #    /* config.h.  Generated by config.status.  */
25910
  #    /* config.h.  Generated by config.status.  */
Lines 25845-25856 Link Here
25845
	 fi;;
25943
	 fi;;
25846
      esac
25944
      esac
25847
    done` || { (exit 1); exit 1; }
25945
    done` || { (exit 1); exit 1; }
25848
25849
  if test x"$ac_file" != x-; then
25850
    { echo "$as_me:$LINENO: creating $ac_file" >&5
25851
echo "$as_me: creating $ac_file" >&6;}
25852
    rm -f "$ac_file"
25853
  fi
25854
_ACEOF
25946
_ACEOF
25855
cat >>$CONFIG_STATUS <<_ACEOF
25947
cat >>$CONFIG_STATUS <<_ACEOF
25856
  sed "$ac_vpsub
25948
  sed "$ac_vpsub
(-)parted-1.6.9.orig/configure.in (+1 lines)
Lines 417-422 Link Here
417
libparted/fs_reiserfs/Makefile
417
libparted/fs_reiserfs/Makefile
418
libparted/fs_ufs/Makefile
418
libparted/fs_ufs/Makefile
419
libparted/fs_xfs/Makefile
419
libparted/fs_xfs/Makefile
420
libparted/fs_amiga/Makefile
420
m4/Makefile 
421
m4/Makefile 
421
parted/Makefile
422
parted/Makefile
422
partprobe/Makefile
423
partprobe/Makefile
(-)parted-1.6.9.orig/libparted/Makefile.am (-2 / +5 lines)
Lines 11-17 Link Here
11
		fs_ntfs			\
11
		fs_ntfs			\
12
		fs_reiserfs		\
12
		fs_reiserfs		\
13
		fs_ufs			\
13
		fs_ufs			\
14
		fs_xfs
14
		fs_xfs			\
15
		fs_amiga
15
16
16
LIBS = @INTLLIBS@ @LIBS@
17
LIBS = @INTLLIBS@ @LIBS@
17
18
Lines 41-46 Link Here
41
			disk_dvh.c		\
42
			disk_dvh.c		\
42
			disk_pc98.c		\
43
			disk_pc98.c		\
43
			disk_sun.c		\
44
			disk_sun.c		\
45
			disk_amiga.c		\
44
			@OS@.c
46
			@OS@.c
45
47
46
EXTRA_libparted_la_SOURCES    = linux.c		\
48
EXTRA_libparted_la_SOURCES    = linux.c		\
Lines 57-63 Link Here
57
			fs_ntfs/libntfs.la		\
59
			fs_ntfs/libntfs.la		\
58
			fs_reiserfs/libreiserfs.la	\
60
			fs_reiserfs/libreiserfs.la	\
59
			fs_ufs/libufs.la		\
61
			fs_ufs/libufs.la		\
60
			fs_xfs/libxfs.la
62
			fs_xfs/libxfs.la		\
63
			fs_amiga/libamigafs.la
61
64
62
EXTRA_DIST	      = mbr.s
65
EXTRA_DIST	      = mbr.s
63
66
(-)parted-1.6.9.orig/libparted/Makefile.in (-12 / +17 lines)
Lines 167-173 Link Here
167
		fs_ntfs			\
167
		fs_ntfs			\
168
		fs_reiserfs		\
168
		fs_reiserfs		\
169
		fs_ufs			\
169
		fs_ufs			\
170
		fs_xfs
170
		fs_xfs			\
171
		fs_amiga
171
172
172
173
173
partedincludedir = -I$(top_srcdir)/include
174
partedincludedir = -I$(top_srcdir)/include
Lines 197-202 Link Here
197
			disk_dvh.c		\
198
			disk_dvh.c		\
198
			disk_pc98.c		\
199
			disk_pc98.c		\
199
			disk_sun.c		\
200
			disk_sun.c		\
201
			disk_amiga.c		\
200
			@OS@.c
202
			@OS@.c
201
203
202
204
Lines 215-221 Link Here
215
			fs_ntfs/libntfs.la		\
217
			fs_ntfs/libntfs.la		\
216
			fs_reiserfs/libreiserfs.la	\
218
			fs_reiserfs/libreiserfs.la	\
217
			fs_ufs/libufs.la		\
219
			fs_ufs/libufs.la		\
218
			fs_xfs/libxfs.la
220
			fs_xfs/libxfs.la		\
221
			fs_amiga/libamigafs.la
219
222
220
223
221
EXTRA_DIST = mbr.s
224
EXTRA_DIST = mbr.s
Lines 231-242 Link Here
231
libparted_la_DEPENDENCIES = fs_ext2/libext2.la fs_fat/libfat.la \
234
libparted_la_DEPENDENCIES = fs_ext2/libext2.la fs_fat/libfat.la \
232
	fs_hfs/libhfs.la fs_jfs/libjfs.la fs_linux_swap/liblinuxswap.la \
235
	fs_hfs/libhfs.la fs_jfs/libjfs.la fs_linux_swap/liblinuxswap.la \
233
	fs_ntfs/libntfs.la fs_reiserfs/libreiserfs.la fs_ufs/libufs.la \
236
	fs_ntfs/libntfs.la fs_reiserfs/libreiserfs.la fs_ufs/libufs.la \
234
	fs_xfs/libxfs.la
237
	fs_xfs/libxfs.la fs_amiga/libamigafs.la
235
am_libparted_la_OBJECTS = crc32.lo constraint.lo debug.lo device.lo \
238
am_libparted_la_OBJECTS = crc32.lo constraint.lo debug.lo device.lo \
236
	exception.lo filesys.lo geom.lo libparted.lo natmath.lo \
239
	exception.lo filesys.lo geom.lo libparted.lo natmath.lo \
237
	timer.lo disk.lo disk_bsd.lo disk_dos.lo disk_gpt.lo \
240
	timer.lo disk.lo disk_bsd.lo disk_dos.lo disk_gpt.lo \
238
	disk_loop.lo disk_mac.lo disk_dvh.lo disk_pc98.lo disk_sun.lo \
241
	disk_loop.lo disk_mac.lo disk_dvh.lo disk_pc98.lo disk_sun.lo \
239
	@OS@.lo
242
	disk_amiga.lo @OS@.lo
240
libparted_la_OBJECTS = $(am_libparted_la_OBJECTS)
243
libparted_la_OBJECTS = $(am_libparted_la_OBJECTS)
241
244
242
DEFAULT_INCLUDES =  -I. -I$(srcdir) -I$(top_builddir)
245
DEFAULT_INCLUDES =  -I. -I$(srcdir) -I$(top_builddir)
Lines 245-258 Link Here
245
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/@OS@.Plo ./$(DEPDIR)/constraint.Plo \
248
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/@OS@.Plo ./$(DEPDIR)/constraint.Plo \
246
@AMDEP_TRUE@	./$(DEPDIR)/crc32.Plo ./$(DEPDIR)/debug.Plo \
249
@AMDEP_TRUE@	./$(DEPDIR)/crc32.Plo ./$(DEPDIR)/debug.Plo \
247
@AMDEP_TRUE@	./$(DEPDIR)/device.Plo ./$(DEPDIR)/disk.Plo \
250
@AMDEP_TRUE@	./$(DEPDIR)/device.Plo ./$(DEPDIR)/disk.Plo \
248
@AMDEP_TRUE@	./$(DEPDIR)/disk_bsd.Plo ./$(DEPDIR)/disk_dos.Plo \
251
@AMDEP_TRUE@	./$(DEPDIR)/disk_amiga.Plo ./$(DEPDIR)/disk_bsd.Plo \
249
@AMDEP_TRUE@	./$(DEPDIR)/disk_dvh.Plo ./$(DEPDIR)/disk_gpt.Plo \
252
@AMDEP_TRUE@	./$(DEPDIR)/disk_dos.Plo ./$(DEPDIR)/disk_dvh.Plo \
250
@AMDEP_TRUE@	./$(DEPDIR)/disk_loop.Plo ./$(DEPDIR)/disk_mac.Plo \
253
@AMDEP_TRUE@	./$(DEPDIR)/disk_gpt.Plo ./$(DEPDIR)/disk_loop.Plo \
251
@AMDEP_TRUE@	./$(DEPDIR)/disk_pc98.Plo ./$(DEPDIR)/disk_sun.Plo \
254
@AMDEP_TRUE@	./$(DEPDIR)/disk_mac.Plo ./$(DEPDIR)/disk_pc98.Plo \
252
@AMDEP_TRUE@	./$(DEPDIR)/exception.Plo ./$(DEPDIR)/filesys.Plo \
255
@AMDEP_TRUE@	./$(DEPDIR)/disk_sun.Plo ./$(DEPDIR)/exception.Plo \
253
@AMDEP_TRUE@	./$(DEPDIR)/geom.Plo ./$(DEPDIR)/gnu.Plo \
256
@AMDEP_TRUE@	./$(DEPDIR)/filesys.Plo ./$(DEPDIR)/geom.Plo \
254
@AMDEP_TRUE@	./$(DEPDIR)/libparted.Plo ./$(DEPDIR)/linux.Plo \
257
@AMDEP_TRUE@	./$(DEPDIR)/gnu.Plo ./$(DEPDIR)/libparted.Plo \
255
@AMDEP_TRUE@	./$(DEPDIR)/natmath.Plo ./$(DEPDIR)/timer.Plo
258
@AMDEP_TRUE@	./$(DEPDIR)/linux.Plo ./$(DEPDIR)/natmath.Plo \
259
@AMDEP_TRUE@	./$(DEPDIR)/timer.Plo
256
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
260
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
257
	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
261
	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
258
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
262
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
Lines 323-328 Link Here
323
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Plo@am__quote@
327
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Plo@am__quote@
324
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device.Plo@am__quote@
328
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device.Plo@am__quote@
325
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disk.Plo@am__quote@
329
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disk.Plo@am__quote@
330
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disk_amiga.Plo@am__quote@
326
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disk_bsd.Plo@am__quote@
331
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disk_bsd.Plo@am__quote@
327
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disk_dos.Plo@am__quote@
332
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disk_dos.Plo@am__quote@
328
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disk_dvh.Plo@am__quote@
333
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disk_dvh.Plo@am__quote@
(-)parted-1.6.9.orig/libparted/disk_amiga.c (+1260 lines)
Line 0 Link Here
1
/* -*- Mode: c; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2
3
    libparted - a library for manipulating disk partitions
4
    disk_amiga.c - libparted module to manipulate amiga RDB partition tables.
5
    Copyright (C) 2000, 2001 Free Software Foundation, Inc.
6
7
    This program 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.
11
12
    This program 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.
16
17
    You should have received a copy of the GNU General Public License
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
21
    Contributor:  Sven Luther <luther@debian.org>
22
*/
23
24
#include "config.h"
25
26
#include <string.h>
27
28
#include <parted/parted.h>
29
#include <parted/debug.h>
30
#include <parted/endian.h>
31
32
#if ENABLE_NLS
33
#  include <libintl.h>
34
#  define _(String) dgettext (PACKAGE, String)
35
#else
36
#  define _(String) (String)
37
#endif /* ENABLE_NLS */
38
39
/* String manipulation */
40
static void _amiga_set_bstr (const char *cstr, char *bstr, int maxsize) {
41
	int size = strlen (cstr);
42
	int i;
43
44
	if (size >= maxsize) return;
45
	bstr[0] = size;
46
	for (i = 0; i<size; i++) bstr[i+1] = cstr[i];
47
}
48
static const char * _amiga_get_bstr (char * bstr) {
49
	char * cstr = bstr + 1;
50
	int size = bstr[0];
51
	
52
	cstr[size] = '\0';
53
	return cstr;
54
}
55
56
#define	IDNAME_RIGIDDISK	0x5244534B	/* 'RDSK' */
57
#define IDNAME_BADBLOCK		0x42414442	/* 'BADB' */
58
#define	IDNAME_PARTITION	0x50415254	/* 'PART' */
59
#define IDNAME_FILESYSHEADER	0x46534844	/* 'FSHD' */
60
#define IDNAME_LOADSEG		0x4C534547	/* 'LSEG' */
61
#define IDNAME_BOOT		0x424f4f54	/* 'BOOT' */
62
#define IDNAME_FREE		0xffffffff	
63
64
static const char *
65
_amiga_block_id (uint32_t id) {
66
	switch (id) {
67
		case IDNAME_RIGIDDISK :
68
			return "RDSK";
69
		case IDNAME_BADBLOCK :
70
			return "BADB";
71
		case IDNAME_PARTITION :
72
			return "PART";
73
		case IDNAME_FILESYSHEADER :
74
			return "FSHD";
75
		case IDNAME_LOADSEG :
76
			return "LSEG";
77
		case IDNAME_BOOT :
78
			return "BOOT";
79
		case IDNAME_FREE :
80
			return "<free>";
81
		default :
82
			return "<unknown>";
83
	}
84
}
85
static int
86
_amiga_valid_block_id (uint32_t id) {
87
	switch (id) {
88
		case IDNAME_RIGIDDISK :
89
		case IDNAME_BADBLOCK :
90
		case IDNAME_PARTITION :
91
		case IDNAME_FILESYSHEADER :
92
		case IDNAME_LOADSEG :
93
		case IDNAME_BOOT :
94
			return 1;
95
		case IDNAME_FREE :
96
		default :
97
			return 0;
98
	}
99
}
100
101
struct AmigaIds {
102
	uint32_t ID;
103
	struct AmigaIds *next;
104
};
105
106
static struct AmigaIds *
107
_amiga_add_id (uint32_t id, struct AmigaIds *ids) {
108
	struct AmigaIds *newid;
109
110
	if ((newid=ped_malloc(sizeof (struct AmigaIds)))==NULL) {
111
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
112
			_("%s : Failed to allocate id list element\n"), __func__);
113
		return 0;
114
	}
115
	newid->ID = id;
116
	newid->next = ids;
117
	return newid;
118
}
119
120
static void
121
_amiga_free_ids (struct AmigaIds *ids) {
122
	struct AmigaIds *current, *next;
123
124
	for (current = ids; current != NULL; current = next) {
125
		next = current->next;
126
		ped_free (current);
127
	}
128
}
129
static int
130
_amiga_id_in_list (uint32_t id, struct AmigaIds *ids) {
131
	struct AmigaIds *current;
132
133
	for (current = ids; current != NULL; current = current->next) {
134
		if (id == current->ID)
135
			return 1;
136
	}
137
	return 0;
138
}
139
140
struct AmigaBlock {
141
	uint32_t	amiga_ID;		/* Identifier 32 bit word */
142
	uint32_t	amiga_SummedLongss;	/* Size of the structure for checksums */
143
	int32_t		amiga_ChkSum;		/* Checksum of the structure */
144
};
145
#define AMIGA(pos) ((struct AmigaBlock *)(pos)) 
146
147
static int
148
_amiga_checksum (struct AmigaBlock *blk) {
149
	uint32_t *rdb = (uint32_t *) blk;
150
	uint32_t sum;
151
	int i, end;
152
153
	sum = PED_BE32_TO_CPU (rdb[0]);
154
	end = PED_BE32_TO_CPU (rdb[1]);
155
156
	if (end > PED_SECTOR_SIZE) end = PED_SECTOR_SIZE;
157
158
	for (i = 1; i < end; i++) sum += PED_BE32_TO_CPU (rdb[i]);
159
160
	return sum;
161
}
162
163
static void
164
_amiga_calculate_checksum (struct AmigaBlock *blk) {
165
	blk->amiga_ChkSum = PED_CPU_TO_BE32(
166
		PED_BE32_TO_CPU(blk->amiga_ChkSum) -
167
		_amiga_checksum((struct AmigaBlock *) blk));
168
	return;	
169
}
170
171
static struct AmigaBlock *
172
_amiga_read_block (PedDevice *dev, struct AmigaBlock *blk, PedSector block, struct AmigaIds *ids) {
173
	if (!ped_device_read (dev, blk, block, 1)) {
174
		ped_exception_throw(PED_EXCEPTION_ERROR,
175
			PED_EXCEPTION_CANCEL,
176
			_("%s : Couldn't read block %llu\n"), __func__, block);
177
		return NULL;
178
	}
179
	if (ids && !_amiga_id_in_list(PED_BE32_TO_CPU(blk->amiga_ID), ids))
180
		return NULL;
181
	if (_amiga_checksum (blk) != 0) {
182
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
183
			PED_EXCEPTION_FIX | PED_EXCEPTION_IGNORE | PED_EXCEPTION_CANCEL,
184
			_("%s : Bad checksum on block %llu of type %s\n"),
185
			__func__, block, _amiga_block_id(PED_BE32_TO_CPU(blk->amiga_ID))))
186
		{
187
			case PED_EXCEPTION_CANCEL :
188
				return NULL;
189
			case PED_EXCEPTION_FIX :
190
				_amiga_calculate_checksum(AMIGA(blk));
191
				if (!ped_device_write (dev, blk, block, 1)) {
192
					ped_exception_throw(PED_EXCEPTION_FATAL, PED_EXCEPTION_CANCEL,
193
						_("%s : Couldn't write block %d\n"), __func__, block);
194
					return NULL;
195
				}
196
			case PED_EXCEPTION_IGNORE :
197
			case PED_EXCEPTION_UNHANDLED :
198
			default : 
199
				return blk;
200
		}
201
	}
202
	return blk;
203
}
204
205
struct RigidDiskBlock {
206
    uint32_t	rdb_ID;			/* Identifier 32 bit word : 'RDSK' */
207
    uint32_t	rdb_SummedLongs;	/* Size of the structure for checksums */
208
    int32_t	rdb_ChkSum;		/* Checksum of the structure */
209
    uint32_t	rdb_HostID;		/* SCSI Target ID of host, not really used */
210
    uint32_t	rdb_BlockBytes;		/* Size of disk blocks */
211
    uint32_t	rdb_Flags;		/* RDB Flags */
212
    /* block list heads */
213
    uint32_t	rdb_BadBlockList;	/* Bad block list */
214
    uint32_t	rdb_PartitionList;	/* Partition list */
215
    uint32_t	rdb_FileSysHeaderList;	/* File system header list */
216
    uint32_t	rdb_DriveInit;		/* Drive specific init code */
217
    uint32_t	rdb_BootBlockList;	/* Amiga OS 4 Boot Blocks */
218
    uint32_t	rdb_Reserved1[5];	/* Unused word, need to be set to $ffffffff */
219
    /* physical drive characteristics */
220
    uint32_t	rdb_Cylinders;		/* Number of the cylinders of the drive */
221
    uint32_t	rdb_Sectors;		/* Number of sectors of the drive */
222
    uint32_t	rdb_Heads;		/* Number of heads of the drive */
223
    uint32_t	rdb_Interleave;		/* Interleave */
224
    uint32_t	rdb_Park;		/* Head parking cylinder */
225
    uint32_t	rdb_Reserved2[3];	/* Unused word, need to be set to $ffffffff */
226
    uint32_t	rdb_WritePreComp;	/* Starting cylinder of write precompensation */
227
    uint32_t	rdb_ReducedWrite;	/* Starting cylinder of reduced write current */
228
    uint32_t	rdb_StepRate;		/* Step rate of the drive */
229
    uint32_t	rdb_Reserved3[5];	/* Unused word, need to be set to $ffffffff */
230
    /* logical drive characteristics */
231
    uint32_t	rdb_RDBBlocksLo;	/* low block of range reserved for hardblocks */
232
    uint32_t	rdb_RDBBlocksHi;	/* high block of range for these hardblocks */
233
    uint32_t	rdb_LoCylinder;		/* low cylinder of partitionable disk area */
234
    uint32_t	rdb_HiCylinder;		/* high cylinder of partitionable data area */
235
    uint32_t	rdb_CylBlocks;		/* number of blocks available per cylinder */
236
    uint32_t	rdb_AutoParkSeconds;	/* zero for no auto park */
237
    uint32_t	rdb_HighRDSKBlock;	/* highest block used by RDSK */
238
					/* (not including replacement bad blocks) */
239
    uint32_t	rdb_Reserved4;
240
    /* drive identification */
241
    char	rdb_DiskVendor[8];
242
    char	rdb_DiskProduct[16];
243
    char	rdb_DiskRevision[4];
244
    char	rdb_ControllerVendor[8];
245
    char	rdb_ControllerProduct[16];
246
    char	rdb_ControllerRevision[4];
247
    uint32_t	rdb_Reserved5[10];
248
};
249
250
#define RDSK(pos) ((struct RigidDiskBlock *)(pos)) 
251
252
#define AMIGA_RDB_NOT_FOUND ((uint32_t)0xffffffff)
253
#define	RDB_LOCATION_LIMIT	16
254
#define AMIGA_MAX_PARTITIONS 128
255
#define MAX_RDB_BLOCK (RDB_LOCATION_LIMIT + 2 * AMIGA_MAX_PARTITIONS + 2)
256
257
static uint32_t
258
_amiga_find_rdb (PedDevice *dev, struct RigidDiskBlock *rdb) {
259
	int i;
260
	struct AmigaIds *ids;
261
262
	ids = _amiga_add_id (IDNAME_RIGIDDISK, NULL);
263
264
	for (i = 0; i<RDB_LOCATION_LIMIT; i++) {
265
		if (!_amiga_read_block (dev, AMIGA(rdb), i, ids)) {
266
			continue;
267
		}
268
		if (PED_BE32_TO_CPU (rdb->rdb_ID) == IDNAME_RIGIDDISK) {
269
			_amiga_free_ids (ids);
270
			return i;
271
		}
272
	}
273
	_amiga_free_ids (ids);
274
	return AMIGA_RDB_NOT_FOUND;
275
}
276
277
struct PartitionBlock {
278
    uint32_t	pb_ID;			/* Identifier 32 bit word : 'PART' */
279
    uint32_t	pb_SummedLongs;		/* Size of the structure for checksums */
280
    int32_t	pb_ChkSum;		/* Checksum of the structure */
281
    uint32_t	pb_HostID;		/* SCSI Target ID of host, not really used */
282
    uint32_t	pb_Next;		/* Block number of the next PartitionBlock */
283
    uint32_t	pb_Flags;		/* Part Flags (NOMOUNT and BOOTABLE) */
284
    uint32_t	pb_Reserved1[2];
285
    uint32_t	pb_DevFlags;		/* Preferred flags for OpenDevice */
286
    uint8_t	pb_DriveName[32];	/* Preferred DOS device name: BSTR form */
287
    uint32_t	pb_Reserved2[15];
288
    uint32_t	de_TableSize;		/* Size of Environment vector */
289
    uint32_t	de_SizeBlock;		/* Size of the blocks in 32 bit words, usually 128 */
290
    uint32_t	de_SecOrg;	     	/* Not used; must be 0 */
291
    uint32_t	de_Surfaces;		/* Number of heads (surfaces) */
292
    uint32_t	de_SectorPerBlock;	/* Disk sectors per block, used with SizeBlock, usually 1 */
293
    uint32_t	de_BlocksPerTrack;	/* Blocks per track. drive specific */
294
    uint32_t	de_Reserved;		/* DOS reserved blocks at start of partition. */
295
    uint32_t	de_PreAlloc;		/* DOS reserved blocks at end of partition */
296
    uint32_t	de_Interleave;		/* Not used, usually 0 */
297
    uint32_t	de_LowCyl;		/* First cylinder of the partition */
298
    uint32_t	de_HighCyl;		/* Last cylinder of the partition */
299
    uint32_t	de_NumBuffers;		/* Initial # DOS of buffers.  */
300
    uint32_t	de_BufMemType;		/* Type of mem to allocate for buffers */
301
    uint32_t	de_MaxTransfer;		/* Max number of bytes to transfer at a time */
302
    uint32_t	de_Mask;		/* Address Mask to block out certain memory */
303
    int32_t	de_BootPri;		/* Boot priority for autoboot */
304
    uint32_t	de_DosType;		/* Dostype of the filesystem */
305
    uint32_t	de_Baud;		/* Baud rate for serial handler */
306
    uint32_t	de_Control;		/* Control word for handler/filesystem */
307
    uint32_t	de_BootBlocks;		/* Number of blocks containing boot code */
308
    uint32_t	pb_EReserved[12];
309
};
310
311
#define PART(pos) ((struct PartitionBlock *)(pos))
312
313
#define	PBFB_BOOTABLE	0	/* this partition is intended to be bootable */
314
#define	PBFF_BOOTABLE	1L	/*   (expected directories and files exist) */
315
#define	PBFB_NOMOUNT	1	/* do not mount this partition (e.g. manually */
316
#define	PBFF_NOMOUNT	2L	/*   mounted, but space reserved here) */
317
318
319
struct LinkedBlock {
320
    uint32_t	lk_ID;			/* Identifier 32 bit word */
321
    uint32_t	lk_SummedLongs;		/* Size of the structure for checksums */
322
    int32_t	lk_ChkSum;		/* Checksum of the structure */
323
    uint32_t	pb_HostID;		/* SCSI Target ID of host, not really used */
324
    uint32_t	lk_Next;		/* Block number of the next PartitionBlock */
325
};
326
struct Linked2Block {
327
    uint32_t	lk2_ID;			/* Identifier 32 bit word */
328
    uint32_t	lk2_SummedLongs;		/* Size of the structure for checksums */
329
    int32_t	lk2_ChkSum;		/* Checksum of the structure */
330
    uint32_t	lk2_Next;		/* Block number of the next PartitionBlock */
331
    uint32_t	lk2_Reverved[13];
332
    uint32_t	lk2_Linked;		/* Secondary linked list */
333
};
334
#define LINK_END	0xffffffff
335
#define LNK(pos)	((struct LinkedBlock *)(pos))
336
#define LNK2(pos)	((struct Linked2Block *)(pos))
337
338
339
static PedDiskType amiga_disk_type;
340
341
static int
342
amiga_probe (PedDevice *dev)
343
{
344
	struct RigidDiskBlock *rdb;
345
	uint32_t found;
346
	PED_ASSERT(dev!= NULL, return 0);
347
348
	if ((rdb=RDSK(ped_malloc(PED_SECTOR_SIZE)))==NULL) {
349
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
350
			_("%s : Failed to allocate rdb block\n"), __func__);
351
		return 0;
352
	}
353
	found = _amiga_find_rdb (dev, rdb);
354
	ped_free (rdb);
355
356
	return (found == AMIGA_RDB_NOT_FOUND ? 0 : 1);
357
}
358
		
359
static PedDisk*
360
amiga_alloc (PedDevice* dev)
361
{
362
	PedDisk *disk;
363
	struct AmigaDisk *adsk;
364
	struct RigidDiskBlock *rdb;
365
	int highest_cylinder, highest_block;
366
	PED_ASSERT(dev!= NULL, return NULL);
367
368
	if (!(disk = _ped_disk_alloc (dev, &amiga_disk_type))) {
369
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
370
			_("%s : Failed to allocate disk structure\n"), __func__);
371
		return NULL;
372
	}
373
374
	if (!(disk->disk_specific = ped_malloc (PED_SECTOR_SIZE))) {
375
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
376
			_("%s : Failed to allocate disk_specific rdb block\n"), __func__);
377
		ped_free (disk);
378
		return NULL;
379
	}
380
	rdb = disk->disk_specific;
381
382
	memset(rdb, -1, sizeof(struct RigidDiskBlock));
383
384
	rdb->rdb_ID = PED_CPU_TO_BE32 (IDNAME_RIGIDDISK);
385
	rdb->rdb_SummedLongs = PED_CPU_TO_BE32 (64);
386
	rdb->rdb_HostID = PED_CPU_TO_BE32 (0);
387
	rdb->rdb_BlockBytes = PED_CPU_TO_BE32 (PED_SECTOR_SIZE);
388
	rdb->rdb_Flags = PED_CPU_TO_BE32 (0);
389
390
	/* Block lists */
391
	rdb->rdb_BadBlockList = PED_CPU_TO_BE32 (LINK_END);
392
	rdb->rdb_PartitionList = PED_CPU_TO_BE32 (LINK_END);
393
	rdb->rdb_FileSysHeaderList = PED_CPU_TO_BE32 (LINK_END);
394
	rdb->rdb_DriveInit = PED_CPU_TO_BE32 (LINK_END);
395
	rdb->rdb_BootBlockList = PED_CPU_TO_BE32 (LINK_END);
396
	
397
	/* Physical drive characteristics */
398
	rdb->rdb_Cylinders = PED_CPU_TO_BE32 (dev->cylinders);
399
	rdb->rdb_Sectors = PED_CPU_TO_BE32 (dev->sectors);
400
	rdb->rdb_Heads = PED_CPU_TO_BE32 (dev->heads);
401
	rdb->rdb_Interleave = PED_CPU_TO_BE32 (0);
402
	rdb->rdb_Park = PED_CPU_TO_BE32 (dev->cylinders);
403
	rdb->rdb_WritePreComp = PED_CPU_TO_BE32 (dev->cylinders);
404
	rdb->rdb_ReducedWrite = PED_CPU_TO_BE32 (dev->cylinders);
405
	rdb->rdb_StepRate = PED_CPU_TO_BE32 (0);
406
407
	highest_cylinder = MAX_RDB_BLOCK / (dev->sectors * dev->heads) + 1;
408
	highest_block = highest_cylinder * dev->sectors * dev->heads - 1;
409
410
	/* Logical driver characteristics */
411
	rdb->rdb_RDBBlocksLo = PED_CPU_TO_BE32 (0);
412
	rdb->rdb_RDBBlocksHi = PED_CPU_TO_BE32 (highest_block);
413
	rdb->rdb_LoCylinder = PED_CPU_TO_BE32 (highest_cylinder);
414
	rdb->rdb_HiCylinder = PED_CPU_TO_BE32 (dev->cylinders -1);
415
	rdb->rdb_CylBlocks = PED_CPU_TO_BE32 (dev->sectors * dev->heads);
416
	rdb->rdb_AutoParkSeconds = PED_CPU_TO_BE32 (0);
417
	/* rdb_HighRDSKBlock will only be set when writing */
418
	rdb->rdb_HighRDSKBlock = PED_CPU_TO_BE32 (0);
419
420
	/* Driver identification */
421
	_amiga_set_bstr("", rdb->rdb_DiskVendor, 8);
422
	_amiga_set_bstr(dev->model, rdb->rdb_DiskProduct, 16);
423
	_amiga_set_bstr("", rdb->rdb_DiskRevision, 4);
424
	_amiga_set_bstr("", rdb->rdb_ControllerVendor, 8);
425
	_amiga_set_bstr("", rdb->rdb_ControllerProduct, 16);
426
	_amiga_set_bstr("", rdb->rdb_ControllerRevision, 4);
427
428
	/* And calculate the checksum */
429
	_amiga_calculate_checksum ((struct AmigaBlock *) rdb);
430
	
431
	return disk;
432
}
433
434
static PedDisk*
435
amiga_duplicate (const PedDisk* disk)
436
{
437
	PedDisk*	new_disk;
438
	struct RigidDiskBlock *	new_rdb;
439
	struct RigidDiskBlock * old_rdb;
440
	PED_ASSERT(disk!= NULL, return NULL);
441
	PED_ASSERT(disk->dev!= NULL, return NULL);
442
	PED_ASSERT(disk->disk_specific!= NULL, return NULL);
443
444
	old_rdb = (struct RigidDiskBlock *) disk->disk_specific;
445
       
446
	if (!(new_disk = ped_disk_new_fresh (disk->dev, &amiga_disk_type))) {
447
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
448
			_("%s : Failed to allocate a new disk structure\n"), __func__);
449
		return NULL;
450
	}
451
452
	new_rdb = (struct RigidDiskBlock *) new_disk->disk_specific;
453
	memcpy (new_rdb, old_rdb, 256);
454
	return new_disk;
455
}
456
457
static void
458
amiga_free (PedDisk* disk)
459
{
460
	PED_ASSERT(disk!= NULL, return);
461
	PED_ASSERT(disk->disk_specific!= NULL, return);
462
463
	ped_free (disk->disk_specific);
464
	_ped_disk_free (disk);
465
}
466
467
#ifndef DISCOVER_ONLY
468
static int
469
amiga_clobber (PedDevice* dev)
470
{
471
	struct RigidDiskBlock *rdb;
472
	uint32_t i;
473
	int result = 0;
474
	PED_ASSERT(dev!= NULL, return 0);
475
476
	if ((rdb=RDSK(ped_malloc(PED_SECTOR_SIZE)))==NULL) {
477
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
478
			_("%s : Failed to allocate rdb block\n"), __func__);
479
		return 0;
480
	}
481
482
	while ((i = _amiga_find_rdb (dev, rdb)) != AMIGA_RDB_NOT_FOUND) {
483
		rdb->rdb_ID = PED_CPU_TO_BE32 (0);
484
		result = ped_device_write (dev, (void*) rdb, i, 1);
485
	}
486
487
	ped_free (rdb);
488
489
	return result;
490
}
491
#endif /* !DISCOVER_ONLY */
492
493
static int
494
_amiga_loop_check (uint32_t block, uint32_t * blocklist, uint32_t max)
495
{
496
	uint32_t i;
497
498
	for (i = 0; i < max; i++)
499
		if (block == blocklist[i]) {
500
			/* We are looping, let's stop.  */
501
			return 1;
502
		}
503
	blocklist[max] = block;
504
	return 0;
505
}
506
507
/* We have already allocated a rdb, we are now reading it from the disk */
508
static int
509
amiga_read (PedDisk* disk)
510
{
511
	struct RigidDiskBlock *rdb;
512
	struct PartitionBlock *partition;
513
	uint32_t partblock;
514
	uint32_t partlist[AMIGA_MAX_PARTITIONS];
515
	PedSector cylblocks;
516
	int i;
517
518
	PED_ASSERT(disk!= NULL, return 0);
519
	PED_ASSERT(disk->dev!= NULL, return 0);
520
	PED_ASSERT(disk->disk_specific!= NULL, return 0);
521
	rdb = RDSK(disk->disk_specific);
522
523
	if (_amiga_find_rdb (disk->dev, rdb) == AMIGA_RDB_NOT_FOUND) {
524
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
525
			_("%s : Didn't find rdb block, should never happen\n"), __func__);
526
		return 0;
527
	}
528
529
	/* Let's copy the rdb read geometry to the dev */
530
	disk->dev->cylinders = PED_BE32_TO_CPU (rdb->rdb_Cylinders);
531
	disk->dev->heads = PED_BE32_TO_CPU (rdb->rdb_Heads);
532
	disk->dev->sectors = PED_BE32_TO_CPU (rdb->rdb_Sectors);
533
	cylblocks = (PedSector) PED_BE32_TO_CPU (rdb->rdb_Heads) *
534
		(PedSector) PED_BE32_TO_CPU (rdb->rdb_Sectors);
535
536
	/* Remove all partitions in the former in memory table */
537
	ped_disk_delete_all (disk);
538
539
	/* Let's allocate a partition block */
540
	if (!(partition = ped_malloc (PED_SECTOR_SIZE))) {
541
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
542
			_("%s : Failed to allocate partition block\n"), __func__);
543
		return 0;
544
	}
545
546
	/* We initialize the hardblock free list to detect loops */
547
	for (i = 0; i < AMIGA_MAX_PARTITIONS; i++) partlist[i] = LINK_END;
548
549
	for (i = 1, partblock = PED_BE32_TO_CPU(rdb->rdb_PartitionList);
550
		i < AMIGA_MAX_PARTITIONS && partblock != LINK_END;
551
		i++, partblock = PED_BE32_TO_CPU(partition->pb_Next))
552
	{
553
		PedPartition *part;
554
		PedSector start, end;
555
		struct DosEnvec *de;
556
		PedConstraint *constraint_exact;
557
		int j; 
558
559
		/* Let's look for loops in the partition table */
560
		if (_amiga_loop_check(partblock, partlist, i)) {
561
			break;
562
		}
563
564
		/* Let's allocate and read a partition block to get its geometry*/
565
		if (!_amiga_read_block (disk->dev, AMIGA(partition), (PedSector)partblock, NULL)) {
566
			ped_free(partition);
567
			return 0;
568
		}
569
570
		start = ((PedSector) PED_BE32_TO_CPU (partition->de_LowCyl)) * cylblocks;
571
		end = ((((PedSector) PED_BE32_TO_CPU (partition->de_HighCyl))+1) * (cylblocks))-1;
572
573
		/* We can now construct a new partition */
574
		if (!(part = ped_partition_new (disk, 0, NULL, start, end))) {
575
			ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
576
				_("%s : Failed to allocate new partition (%llu -> %llu)\n"),
577
				__func__, start, end);
578
			ped_free(partition);
579
			return 0;
580
		}
581
		/* And copy over the partition block */
582
		memcpy(part->disk_specific, partition, 256);
583
584
		part->num = i;
585
		part->type = 0;
586
		/* Let's probe what filesystem is present on the disk */
587
		part->fs_type = ped_file_system_probe (&part->geom);
588
		
589
		constraint_exact = ped_constraint_exact (&part->geom);
590
		if (!ped_disk_add_partition (disk, part, constraint_exact)) {
591
			ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
592
				_("%s : Failed to add new partition\n"), __func__);
593
			ped_free(partition);
594
			return 0;
595
		}
596
		ped_constraint_destroy (constraint_exact);
597
	}
598
	return 1;
599
}
600
601
static int
602
_amiga_find_free_blocks(PedDisk *disk, uint32_t *table,
603
	struct LinkedBlock *block, uint32_t first, uint32_t type)
604
{
605
	PedSector next;
606
607
	PED_ASSERT(disk!= NULL, return 0);
608
	PED_ASSERT(disk->dev!= NULL, return 0);
609
610
	for (next = first; next != LINK_END; next = PED_BE32_TO_CPU(block->lk_Next)) {
611
		if (table[next] != IDNAME_FREE) {
612
			switch (ped_exception_throw(PED_EXCEPTION_ERROR,
613
				PED_EXCEPTION_FIX | PED_EXCEPTION_IGNORE | PED_EXCEPTION_CANCEL,
614
				_("%s : Loop detected at block %d\n"), __func__, next))
615
			{
616
				case PED_EXCEPTION_CANCEL :
617
					return 0;
618
				case PED_EXCEPTION_FIX :
619
					/* TODO : Need to add fixing code */
620
				case PED_EXCEPTION_IGNORE :
621
				case PED_EXCEPTION_UNHANDLED :
622
				default : 
623
					return 1;
624
			}
625
		}
626
627
		if (!_amiga_read_block (disk->dev, AMIGA(block), next, NULL)) {
628
			return 0;
629
		}
630
		if (PED_BE32_TO_CPU(block->lk_ID) != type) {
631
			switch (ped_exception_throw(PED_EXCEPTION_ERROR,
632
				PED_EXCEPTION_CANCEL,
633
				_("%s : The %s list seems bad at block %s\n"),
634
				__func__, _amiga_block_id(PED_BE32_TO_CPU(block->lk_ID)), next))
635
			{
636
				/* TODO : to more subtile things here */
637
				case PED_EXCEPTION_CANCEL :
638
				case PED_EXCEPTION_UNHANDLED :
639
				default : 
640
					return 0;
641
			}
642
		}
643
		table[next] = type;
644
		if (PED_BE32_TO_CPU(block->lk_ID) == IDNAME_FILESYSHEADER) {
645
			if (_amiga_find_free_blocks(disk, table, block,
646
				PED_BE32_TO_CPU(LNK2(block)->lk2_Linked),
647
				IDNAME_LOADSEG) == 0) return 0;
648
		}
649
	}
650
	return 1;
651
}
652
static uint32_t
653
_amiga_next_free_block(uint32_t *table, uint32_t start, uint32_t type) {
654
	int i;
655
656
	for (i = start; table[i] != type && table[i] != IDNAME_FREE; i++);
657
	return i;
658
}
659
static PedPartition *
660
_amiga_next_real_partition(PedDisk *disk, PedPartition *part) {
661
	PedPartition *next;
662
663
	for (next = ped_disk_next_partition (disk, part);
664
		next != NULL && !ped_partition_is_active (next);
665
		next = ped_disk_next_partition (disk, next));
666
	return next;
667
}
668
#ifndef DISCOVER_ONLY
669
static int
670
amiga_write (PedDisk* disk)
671
{
672
	struct RigidDiskBlock *rdb;
673
	struct LinkedBlock *block;
674
	struct PartitionBlock *partition;
675
	PedPartition *part, *next_part;
676
	PedSector cylblocks, first_hb, last_hb, last_used_hb;
677
	uint32_t * table;
678
	uint32_t i, rdb_block, max_part;
679
	uint32_t rdb_num, part_num, block_num, next_num;
680
681
	PED_ASSERT (disk != NULL, return 0;);
682
	PED_ASSERT (disk->dev != NULL, return 0;);
683
	PED_ASSERT (disk->disk_specific != NULL, return 0;);
684
685
	if (!(rdb = ped_malloc (PED_SECTOR_SIZE))) {
686
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
687
			_("%s : Failed to allocate rdb block\n"), __func__);
688
		return 0;
689
	}
690
	/* Let's read the rdb */
691
	if ((rdb_num = _amiga_find_rdb (disk->dev, rdb)) == AMIGA_RDB_NOT_FOUND) {
692
		rdb_num = 2;
693
	} else {
694
		memcpy (RDSK(disk->disk_specific), rdb, PED_SECTOR_SIZE);
695
	}
696
	ped_free (rdb);
697
	rdb = RDSK(disk->disk_specific);
698
699
	/* Let's copy the rdb read geometry to the dev */
700
	disk->dev->cylinders = PED_BE32_TO_CPU (rdb->rdb_Cylinders);
701
	disk->dev->heads = PED_BE32_TO_CPU (rdb->rdb_Heads);
702
	disk->dev->sectors = PED_BE32_TO_CPU (rdb->rdb_Sectors);
703
	cylblocks = (PedSector) PED_BE32_TO_CPU (rdb->rdb_Heads) *
704
		(PedSector) PED_BE32_TO_CPU (rdb->rdb_Sectors);
705
	first_hb = (PedSector) PED_BE32_TO_CPU (rdb->rdb_RDBBlocksLo);
706
	last_hb = (PedSector) PED_BE32_TO_CPU (rdb->rdb_RDBBlocksHi);
707
	last_used_hb = (PedSector) PED_BE32_TO_CPU (rdb->rdb_HighRDSKBlock);
708
709
	/* let's allocate a free block table and initialize it */
710
	if (!(table = ped_malloc ((last_hb - first_hb + 1) * sizeof(uint32_t)))) {
711
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
712
			_("%s : Failed to allocate free block table\n"), __func__);
713
		return 0;
714
	}
715
	memset(table, 0xff, (last_hb - first_hb + 1) * sizeof(uint32_t));
716
	for (i = 0; i<=rdb_num; i++) table[i] = IDNAME_RIGIDDISK;
717
	
718
	/* Let's allocate a partition block */
719
	if (!(block = ped_malloc (PED_SECTOR_SIZE))) {
720
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
721
			_("%s : Failed to allocate partition block\n"), __func__);
722
		ped_free (table);
723
		return 0;
724
	}
725
726
	/* And fill the free block table */
727
	if (_amiga_find_free_blocks(disk, table, block,
728
		PED_BE32_TO_CPU (rdb->rdb_BadBlockList), IDNAME_BADBLOCK) == 0)
729
	{
730
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
731
			PED_EXCEPTION_CANCEL,
732
			_("%s : Failed to list badblocks\n"), __func__))
733
		{
734
			case PED_EXCEPTION_CANCEL :
735
			case PED_EXCEPTION_UNHANDLED :
736
			default : 
737
				ped_free (table);
738
				ped_free (block);
739
				return 0;
740
		}
741
	}
742
	if (_amiga_find_free_blocks(disk, table, block,
743
		PED_BE32_TO_CPU (rdb->rdb_PartitionList), IDNAME_PARTITION) == 0)
744
	{
745
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
746
			PED_EXCEPTION_CANCEL,
747
			_("%s : Failed to list partitionblocks\n"), __func__))
748
		{
749
			case PED_EXCEPTION_CANCEL :
750
			case PED_EXCEPTION_UNHANDLED :
751
			default : 
752
				ped_free (table);
753
				ped_free (block);
754
				return 0;
755
		}
756
	}
757
	if (_amiga_find_free_blocks(disk, table, block,
758
		PED_BE32_TO_CPU (rdb->rdb_FileSysHeaderList), IDNAME_FILESYSHEADER) == 0)
759
	{
760
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
761
			PED_EXCEPTION_CANCEL,
762
			_("%s : Failed to list filesystemblocks\n"), __func__))
763
		{
764
			case PED_EXCEPTION_CANCEL :
765
			case PED_EXCEPTION_UNHANDLED :
766
			default : 
767
				ped_free (table);
768
				ped_free (block);
769
				return 0;
770
		}
771
	}
772
	if (_amiga_find_free_blocks(disk, table, block,
773
		PED_BE32_TO_CPU (rdb->rdb_BootBlockList), IDNAME_BOOT) == 0)
774
	{
775
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
776
			PED_EXCEPTION_CANCEL,
777
			_("%s : Failed to list bootblocks\n"), __func__))
778
		{
779
			case PED_EXCEPTION_CANCEL :
780
			case PED_EXCEPTION_UNHANDLED :
781
			default : 
782
				ped_free (table);
783
				ped_free (block);
784
				return 0;
785
		}
786
	}
787
788
	block_num = next_num = part_num = _amiga_next_free_block(table, rdb_num+1, IDNAME_PARTITION);
789
	part = _amiga_next_real_partition(disk, NULL);
790
	if (part == NULL) {
791
		rdb->rdb_PartitionList = PED_CPU_TO_BE32(LINK_END);
792
	} else {
793
		rdb->rdb_PartitionList = PED_CPU_TO_BE32(part_num);
794
		while (part != NULL) {
795
			PED_ASSERT(part->disk_specific!=NULL, return 0);
796
			next_part = _amiga_next_real_partition(disk, part);
797
			block_num = next_num;
798
			next_num = _amiga_next_free_block(table, block_num+1, IDNAME_PARTITION);
799
			partition = PART(part->disk_specific);
800
			partition->pb_Next = next_part==NULL ? PED_CPU_TO_BE32(LINK_END):PED_CPU_TO_BE32(next_num);
801
			partition->de_LowCyl = PED_CPU_TO_BE32(part->geom.start/cylblocks);
802
			partition->de_HighCyl = PED_CPU_TO_BE32((part->geom.end+1)/cylblocks-1);
803
			_amiga_calculate_checksum(AMIGA(partition));
804
			if (!ped_device_write (disk->dev, (void*) partition, block_num, 1)) {
805
				switch (ped_exception_throw(PED_EXCEPTION_ERROR,
806
					PED_EXCEPTION_CANCEL,
807
					_("%s : Failed to write partition block at\n"), __func__, block_num))
808
				{
809
					case PED_EXCEPTION_CANCEL :
810
					case PED_EXCEPTION_UNHANDLED :
811
					default : 
812
						ped_free (table);
813
						ped_free (block);
814
						/* WARNING : If we fail here, we stop everything,
815
						 * and the partition table is lost. A Better
816
						 * solution should be found, using the second
817
						 * half of the hardblocks to not overwrite the
818
						 * old partition table. It becomes problematic
819
						 * if we use more than half of the hardblocks. */
820
						return 0;
821
				}
822
			}
823
			part = next_part;
824
		}
825
	}
826
	if (block_num >PED_BE32_TO_CPU (rdb->rdb_HighRDSKBlock)) {
827
		rdb->rdb_HighRDSKBlock = PED_CPU_TO_BE32(block_num);
828
	}
829
	_amiga_calculate_checksum(AMIGA(rdb));
830
	if (!ped_device_write (disk->dev, (void*) disk->disk_specific, rdb_num, 1)) {
831
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
832
			PED_EXCEPTION_CANCEL,
833
			_("%s : Failed to write rdb block at\n"), __func__, rdb_num))
834
		{
835
			case PED_EXCEPTION_CANCEL :
836
			case PED_EXCEPTION_UNHANDLED :
837
			default : 
838
				ped_free (table);
839
				ped_free (block);
840
				return 0;
841
		}
842
	}
843
			
844
	ped_free (table);
845
	ped_free (block);
846
	return ped_device_sync (disk->dev);
847
}
848
#endif /* !DISCOVER_ONLY */
849
850
static PedPartition*
851
amiga_partition_new (const PedDisk* disk, PedPartitionType part_type,
852
		   const PedFileSystemType* fs_type,
853
		   PedSector start, PedSector end)
854
{
855
	PedPartition *part;
856
	PedDevice *dev;
857
	PedSector cyl;
858
	struct PartitionBlock *partition;
859
	struct RigidDiskBlock *rdb;
860
861
	PED_ASSERT(disk!= NULL, return NULL);
862
	PED_ASSERT(disk->dev!= NULL, return NULL);
863
	PED_ASSERT(disk->disk_specific!= NULL, return NULL);
864
	dev = disk->dev;
865
	cyl = (PedSector) (dev->sectors * dev->heads);
866
	rdb = RDSK(disk->disk_specific);
867
868
	if (!(part = _ped_partition_alloc (disk, part_type, fs_type, start, end))) {
869
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
870
			_("%s : Failed to allocate a partition structure (%llu, %llu)"),
871
			__func__, start, end);
872
		return NULL;
873
	}
874
	
875
876
	if (ped_partition_is_active (part)) {
877
		if (!(part->disk_specific = ped_malloc (PED_SECTOR_SIZE))) {
878
			ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
879
				_("%s : Failed to allocate a partition disk_specific block\n"), __func__);
880
			ped_free (part);
881
			return NULL;
882
		}
883
		partition = PART(part->disk_specific);
884
		memset(partition, -1, sizeof(struct PartitionBlock));
885
886
		partition->pb_ID = PED_CPU_TO_BE32(IDNAME_PARTITION);
887
		partition->pb_SummedLongs = PED_CPU_TO_BE32(64);
888
		partition->pb_HostID = rdb->rdb_HostID;
889
		partition->pb_Flags = PED_CPU_TO_BE32(0);
890
		/* TODO : use a scheme including the device name and the
891
		 * partition number, if it is possible */
892
		_amiga_set_bstr("dhx", partition->pb_DriveName, 32);
893
894
		partition->de_TableSize = PED_CPU_TO_BE32(19);
895
		partition->de_SizeBlock = PED_CPU_TO_BE32(128);
896
		partition->de_SecOrg = PED_CPU_TO_BE32(0);
897
		partition->de_Surfaces = PED_CPU_TO_BE32(dev->heads);
898
		partition->de_SectorPerBlock = PED_CPU_TO_BE32(1);
899
		partition->de_BlocksPerTrack = PED_CPU_TO_BE32(dev->sectors);
900
		partition->de_Reserved = PED_CPU_TO_BE32(2);
901
		partition->de_PreAlloc = PED_CPU_TO_BE32(0);
902
		partition->de_Interleave = PED_CPU_TO_BE32(0);
903
		partition->de_LowCyl = PED_CPU_TO_BE32(start/cyl);
904
		partition->de_HighCyl = PED_CPU_TO_BE32((end+1)/cyl-1);
905
		partition->de_NumBuffers = PED_CPU_TO_BE32(30);
906
		partition->de_BufMemType = PED_CPU_TO_BE32(0);
907
		partition->de_MaxTransfer = PED_CPU_TO_BE32(0x7fffffff);
908
		partition->de_Mask = PED_CPU_TO_BE32(0xffffffff);
909
		partition->de_BootPri = PED_CPU_TO_BE32(0);
910
		partition->de_DosType = PED_CPU_TO_BE32(0x4c4e5800);
911
		partition->de_Baud = PED_CPU_TO_BE32(0);
912
		partition->de_Control = PED_CPU_TO_BE32(0);
913
		partition->de_BootBlocks = PED_CPU_TO_BE32(0);
914
915
	} else {
916
		part->disk_specific = NULL;
917
	}
918
	return part;
919
}
920
921
static PedPartition*
922
amiga_partition_duplicate (const PedPartition* part)
923
{
924
	PedPartition *new_part;
925
	struct PartitionBlock *new_amiga_part;
926
	struct PartitionBlock *old_amiga_part;
927
928
	PED_ASSERT(part!= NULL, return NULL);
929
	PED_ASSERT(part->disk!= NULL, return NULL);
930
	PED_ASSERT(part->disk_specific!= NULL, return NULL);
931
	old_amiga_part = (struct PartitionBlock *) part->disk_specific;
932
933
	new_part = ped_partition_new (part->disk, part->type,
934
				      part->fs_type, part->geom.start,
935
				      part->geom.end);
936
	if (!new_part) {
937
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
938
			_("%s : Failed to allocate a new partition structure\n"), __func__);
939
		return NULL;
940
	}
941
942
	new_amiga_part = (struct PartitionBlock *) new_part->disk_specific;
943
	memcpy (new_amiga_part, old_amiga_part, 256);
944
945
	return new_part;
946
}
947
948
static void
949
amiga_partition_destroy (PedPartition* part)
950
{
951
	PED_ASSERT (part != NULL, return);
952
953
	if (ped_partition_is_active (part)) {
954
		PED_ASSERT (part->disk_specific!= NULL, return);
955
		ped_free (part->disk_specific);
956
	}
957
	_ped_partition_free (part);
958
}
959
960
static int
961
amiga_partition_set_system (PedPartition* part, const PedFileSystemType* fs_type)
962
{
963
	struct PartitionBlock *partition;
964
965
	PED_ASSERT (part != NULL, return 0);
966
	PED_ASSERT (part->disk_specific != NULL, return 0);
967
	partition = PART(part->disk_specific);
968
969
	part->fs_type = fs_type;
970
971
	if (!fs_type)
972
		partition->de_DosType = PED_CPU_TO_BE32(0x4c4e5800); /* 'LNX\0' */
973
	else if (!strcmp (fs_type->name, "ext2"))
974
		partition->de_DosType = PED_CPU_TO_BE32(0x4c4e5800); /* 'LNX\0' */
975
	else if (!strcmp (fs_type->name, "ext3"))
976
		partition->de_DosType = PED_CPU_TO_BE32(0x45585403); /* 'EXT\3' */
977
	else if (!strcmp (fs_type->name, "linux-swap"))
978
		partition->de_DosType = PED_CPU_TO_BE32(0x53575000); /* 'SWP\0' */
979
	else if (!strcmp (fs_type->name, "fat16"))
980
		partition->de_DosType = PED_CPU_TO_BE32(0x46415400); /* 'FAT\0' */
981
	else if (!strcmp (fs_type->name, "fat32"))
982
		partition->de_DosType = PED_CPU_TO_BE32(0x46415401); /* 'FAT\1'*/
983
	else if (!strcmp (fs_type->name, "hfs"))
984
		partition->de_DosType = PED_CPU_TO_BE32(0x48465300); /* 'HFS\0' */
985
	else if (!strcmp (fs_type->name, "jfs"))
986
		partition->de_DosType = PED_CPU_TO_BE32(0x4a465300); /* 'JFS\0' */
987
	else if (!strcmp (fs_type->name, "ntfs"))
988
		partition->de_DosType = PED_CPU_TO_BE32(0x4e544653); /* 'NTFS' */
989
	else if (!strcmp (fs_type->name, "reiserfs"))
990
		partition->de_DosType = PED_CPU_TO_BE32(0x52465300); /* 'RFS\0' */
991
	else if (!strcmp (fs_type->name, "sun-ufs"))
992
		partition->de_DosType = PED_CPU_TO_BE32(0x53554653); /* 'SUFS' */
993
	else if (!strcmp (fs_type->name, "hp-ufs"))
994
		partition->de_DosType = PED_CPU_TO_BE32(0x48554653); /* 'HUFS' */
995
	else if (!strcmp (fs_type->name, "xfs"))
996
		partition->de_DosType = PED_CPU_TO_BE32(0x58465300); /* 'XFS\0' */
997
	else
998
		partition->de_DosType = PED_CPU_TO_BE32(0x00000000); /* unknown */
999
	return 1;
1000
}
1001
1002
static int
1003
amiga_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
1004
{
1005
	struct PartitionBlock *partition;
1006
1007
	PED_ASSERT (part != NULL, return 0);
1008
	PED_ASSERT (part->disk_specific != NULL, return 0);
1009
1010
	partition = PART(part->disk_specific);
1011
1012
	switch (flag) {
1013
		case PED_PARTITION_BOOT:
1014
			if (state) partition->pb_Flags |= PED_CPU_TO_BE32(PBFF_BOOTABLE);
1015
			else partition->pb_Flags &= ~(PED_CPU_TO_BE32(PBFF_BOOTABLE));
1016
			return 1;
1017
		case PED_PARTITION_HIDDEN:
1018
			if (state) partition->pb_Flags |= PED_CPU_TO_BE32(PBFF_NOMOUNT);
1019
			else partition->pb_Flags &= ~(PED_CPU_TO_BE32(PBFF_NOMOUNT));
1020
			return 1;
1021
		default:
1022
			return 0;
1023
	}
1024
}
1025
1026
static int
1027
amiga_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
1028
{
1029
	struct PartitionBlock *partition;
1030
1031
	PED_ASSERT (part != NULL, return 0);
1032
	PED_ASSERT (part->disk_specific != NULL, return 0);
1033
1034
	partition = PART(part->disk_specific);
1035
1036
	switch (flag) {
1037
		case PED_PARTITION_BOOT:
1038
			return (partition->pb_Flags & PED_CPU_TO_BE32(PBFF_BOOTABLE));
1039
		case PED_PARTITION_HIDDEN:
1040
			return (partition->pb_Flags & PED_CPU_TO_BE32(PBFF_NOMOUNT));
1041
		default:
1042
			return 0;
1043
	}
1044
}
1045
1046
static int
1047
amiga_partition_is_flag_available (const PedPartition* part,
1048
				 PedPartitionFlag flag)
1049
{
1050
	switch (flag) {
1051
	case PED_PARTITION_BOOT:
1052
	case PED_PARTITION_HIDDEN:
1053
		return 1;
1054
	default:
1055
		return 0;
1056
	}
1057
}
1058
1059
static void             
1060
amiga_partition_set_name (PedPartition* part, const char* name)
1061
{               
1062
	struct PartitionBlock *partition;
1063
1064
	PED_ASSERT (part != NULL, return);
1065
	PED_ASSERT (part->disk_specific != NULL, return);
1066
1067
	partition = PART(part->disk_specific);
1068
	_amiga_set_bstr(name, partition->pb_DriveName, 32);
1069
}
1070
static const char*
1071
amiga_partition_get_name (const PedPartition* part)
1072
{
1073
	struct PartitionBlock *partition;
1074
1075
	PED_ASSERT (part != NULL, return 0);
1076
	PED_ASSERT (part->disk_specific != NULL, return 0);
1077
1078
	partition = PART(part->disk_specific);
1079
1080
	return _amiga_get_bstr(partition->pb_DriveName);
1081
}
1082
1083
static PedConstraint*
1084
_amiga_get_constraint (const PedDisk *disk)
1085
{
1086
	PedDevice *dev = disk->dev;
1087
	PedAlignment start_align, end_align;
1088
	PedGeometry max_geom;
1089
	struct RigidDiskBlock *rdb = RDSK(disk->disk_specific);
1090
	PedSector cyl = (PedSector) PED_BE32_TO_CPU(rdb->rdb_Sectors) *
1091
		PED_BE32_TO_CPU(rdb->rdb_Heads);
1092
	PedSector start = ((273 / cyl) + 1) * cyl;
1093
	PedSector length = dev->length - start;
1094
	PedSector max_part = (length / cyl) * cyl;
1095
1096
	if (!ped_alignment_init(&start_align, 0, cyl)) {
1097
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
1098
			_("%s : Failed to initialize the start constraint\n"), __func__);
1099
		return NULL;
1100
	}
1101
	if (!ped_alignment_init(&end_align, -1, cyl)) {
1102
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
1103
			_("%s : Failed to initialize the end constraint\n"), __func__);
1104
		return NULL;
1105
	}
1106
	if (!ped_geometry_init(&max_geom, dev, start, length)) {
1107
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
1108
			_("%s : Failed to initialize the max constraint\n"), __func__);
1109
		return NULL;
1110
	}
1111
1112
	return ped_constraint_new (&start_align, &end_align,
1113
		&max_geom, &max_geom, cyl, max_part);
1114
}
1115
1116
static int
1117
amiga_partition_align (PedPartition* part, const PedConstraint* constraint)
1118
{
1119
1120
	PED_ASSERT (part != NULL, return 0);
1121
	PED_ASSERT (part->disk != NULL, return 0);
1122
	
1123
	if (_ped_partition_attempt_align (part, constraint,
1124
					  _amiga_get_constraint (part->disk)))
1125
	{
1126
	       	return 1;
1127
	}
1128
1129
#ifndef DISCOVER_ONLY
1130
	ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
1131
		_("%s : Unable to satisfy all constraints on the partition."), __func__);
1132
#endif
1133
	return 0;
1134
}
1135
1136
static int
1137
amiga_partition_enumerate (PedPartition* part)
1138
{
1139
	
1140
	int i;
1141
	PedPartition* p;
1142
	
1143
	PED_ASSERT (part != NULL, return 0);
1144
	PED_ASSERT (part->disk != NULL, return 0);
1145
1146
	/* never change the partition numbers */
1147
	if (part->num != -1)
1148
		return 1;
1149
	for (i = 1; i <= AMIGA_MAX_PARTITIONS; i++) {
1150
		p = ped_disk_get_partition (part->disk, i);
1151
		if (!p) {
1152
			part->num = i;
1153
			return 1;
1154
		}
1155
	}
1156
1157
	/* failed to allocate a number */
1158
#ifndef DISCOVER_ONLY
1159
	ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
1160
		_("%s : Unable to allocate a partition"), __func__);
1161
#endif
1162
	return 0;
1163
}
1164
1165
static int
1166
amiga_alloc_metadata (PedDisk* disk)
1167
{
1168
	PedPartition*		new_part;
1169
	PedConstraint*		constraint_any = NULL;
1170
	PedSector		highest_block;
1171
1172
	PED_ASSERT (disk != NULL, goto error);
1173
	PED_ASSERT (disk->dev != NULL, goto error);
1174
1175
	constraint_any = ped_constraint_any (disk->dev);
1176
1177
	/* Allocate space for the RDB */
1178
	new_part = ped_partition_new (disk, PED_PARTITION_METADATA, NULL, 0, MAX_RDB_BLOCK);
1179
	if (!new_part)
1180
		goto error;
1181
1182
	if (!ped_disk_add_partition (disk, new_part, constraint_any)) {
1183
		ped_partition_destroy (new_part);
1184
		goto error;
1185
	}
1186
1187
	ped_constraint_destroy (constraint_any);
1188
	return 1;
1189
error:
1190
	ped_constraint_destroy (constraint_any);
1191
	return 0;
1192
}
1193
1194
static int
1195
amiga_get_max_primary_partition_count (const PedDisk* disk)
1196
{
1197
	return AMIGA_MAX_PARTITIONS;
1198
}
1199
1200
static PedDiskOps amiga_disk_ops = {
1201
	probe:			amiga_probe,
1202
#ifndef DISCOVER_ONLY
1203
	clobber:		amiga_clobber,
1204
#else
1205
	clobber:		NULL,
1206
#endif
1207
	alloc:			amiga_alloc,
1208
	duplicate:		amiga_duplicate,
1209
	free:			amiga_free,
1210
	read:			amiga_read,
1211
#ifndef DISCOVER_ONLY
1212
	write:			amiga_write,
1213
#else
1214
	write:			NULL,
1215
#endif
1216
1217
	partition_new:		amiga_partition_new,
1218
	partition_duplicate:	amiga_partition_duplicate,
1219
	partition_destroy:	amiga_partition_destroy,
1220
	partition_set_system:	amiga_partition_set_system,
1221
	partition_set_flag:	amiga_partition_set_flag,
1222
	partition_get_flag:	amiga_partition_get_flag,
1223
	partition_is_flag_available:
1224
				amiga_partition_is_flag_available,
1225
	partition_set_name:	amiga_partition_set_name,
1226
	partition_get_name:	amiga_partition_get_name,
1227
	partition_align:	amiga_partition_align,
1228
	partition_enumerate:	amiga_partition_enumerate,
1229
1230
1231
	alloc_metadata:		amiga_alloc_metadata,
1232
	get_max_primary_partition_count:
1233
				amiga_get_max_primary_partition_count
1234
};
1235
1236
static PedDiskType amiga_disk_type = {
1237
	next:		NULL,
1238
	name:		"amiga",
1239
	ops:		&amiga_disk_ops,
1240
	features:	PED_DISK_TYPE_PARTITION_NAME
1241
};
1242
1243
void
1244
ped_disk_amiga_init ()
1245
{
1246
	PED_ASSERT(sizeof(struct AmigaBlock) != 3, return);
1247
	PED_ASSERT(sizeof(struct RigidDiskBlock) != 64, return);
1248
	PED_ASSERT(sizeof(struct PartitionBlock) != 64, return);
1249
	PED_ASSERT(sizeof(struct LinkedBlock) != 5, return);
1250
	PED_ASSERT(sizeof(struct Linked2Block) != 18, return);
1251
1252
	ped_register_disk_type (&amiga_disk_type);
1253
}
1254
1255
void
1256
ped_disk_amiga_done ()
1257
{
1258
1259
	ped_unregister_disk_type (&amiga_disk_type);
1260
}
(-)parted-1.6.9.orig/libparted/disk_amiga.c.2 (+1524 lines)
Line 0 Link Here
1
/* -*- Mode: c; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2
3
    libparted - a library for manipulating disk partitions
4
    Copyright (C) 2000, 2001 Free Software Foundation, Inc.
5
6
    This program is free software; you can redistribute it and/or modify
7
    it under the terms of the GNU General Public License as published by
8
    the Free Software Foundation; either version 2 of the License, or
9
    (at your option) any later version.
10
11
    This program is distributed in the hope that it will be useful,
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
    GNU General Public License for more details.
15
16
    You should have received a copy of the GNU General Public License
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
20
    Contributor:  Sven Luther <luther@debian.org>
21
*/
22
23
#include "config.h"
24
25
#include <string.h>
26
27
#include <parted/parted.h>
28
#include <parted/debug.h>
29
#include <parted/endian.h>
30
31
#if ENABLE_NLS
32
#  include <libintl.h>
33
#  define _(String) dgettext (PACKAGE, String)
34
#else
35
#  define _(String) (String)
36
#endif /* ENABLE_NLS */
37
38
#define DEBUG_BLOCK	0x01
39
#define DEBUG_CONST	0x02
40
#define DEBUG_FUNCS	0x04
41
#define DEBUG_ERROR	0x08
42
#define DEBUG_READ	0X10
43
#define DEBUG_WRITE	0X20
44
#if 0
45
#define MASTER_DEBUG DEBUG_BLOCK | DEBUG_CONST | DEBUG_FUNCS | DEBUG_ERROR | DEBUG_READ | DEBUG_WRITE
46
#endif
47
48
#ifdef MASTER_DEBUG
49
#define DPRINT(l,a,b...) do { if ((l) & (MASTER_DEBUG)) fprintf(stderr, "AMIGA : %s: " a, __func__ , ## b); } while (0) 
50
#define DPRINTF(l,a,b...) do { if ((l) & (MASTER_DEBUG)) fprintf(stderr, a, ## b); } while (0) 
51
#define TRACE() DPRINT(DEBUG_FUNCS, "\n")
52
#else 
53
#define DPRINT(l,a,b...)
54
#define DPRINTF(l,a,b...)
55
#define TRACE()
56
#endif /* MASTER_DEBUG */
57
58
/* String manipulation */
59
static void _amiga_set_bstr (const char *cstr, char *bstr, int maxsize) {
60
	int size = strlen (cstr);
61
	int i;
62
	TRACE();
63
64
	if (size >= maxsize) return;
65
	bstr[0] = size;
66
	for (i = 0; i<size; i++) bstr[i+1] = cstr[i];
67
}
68
static const char * _amiga_get_bstr (char * bstr) {
69
	char * cstr = bstr + 1;
70
	int size = bstr[0];
71
	TRACE();
72
	
73
	cstr[size] = '\0';
74
	return cstr;
75
}
76
77
#define	IDNAME_RIGIDDISK	0x5244534B	/* 'RDSK' */
78
#define IDNAME_BADBLOCK		0x42414442	/* 'BADB' */
79
#define	IDNAME_PARTITION	0x50415254	/* 'PART' */
80
#define IDNAME_FILESYSHEADER	0x46534844	/* 'FSHD' */
81
#define IDNAME_LOADSEG		0x4C534547	/* 'LSEG' */
82
#define IDNAME_BOOT		0x424f4f54	/* 'BOOT' */
83
#define IDNAME_FREE		0xffffffff	
84
85
static const char *
86
_amiga_block_id (uint32_t id) {
87
	TRACE();
88
	switch (id) {
89
		case IDNAME_RIGIDDISK :
90
			return "RDSK";
91
		case IDNAME_BADBLOCK :
92
			return "BADB";
93
		case IDNAME_PARTITION :
94
			return "PART";
95
		case IDNAME_FILESYSHEADER :
96
			return "FSHD";
97
		case IDNAME_LOADSEG :
98
			return "LSEG";
99
		case IDNAME_BOOT :
100
			return "BOOT";
101
		case IDNAME_FREE :
102
			return "<free>";
103
		default :
104
			return "<unknown>";
105
	}
106
}
107
static int
108
_amiga_valid_block_id (uint32_t id) {
109
	TRACE();
110
	switch (id) {
111
		case IDNAME_RIGIDDISK :
112
		case IDNAME_BADBLOCK :
113
		case IDNAME_PARTITION :
114
		case IDNAME_FILESYSHEADER :
115
		case IDNAME_LOADSEG :
116
		case IDNAME_BOOT :
117
			return 1;
118
		case IDNAME_FREE :
119
		default :
120
			return 0;
121
	}
122
}
123
struct AmigaBlock {
124
    uint32_t	amiga_ID;		/* Identifier 32 bit word */
125
    uint32_t	amiga_SummedLongss;	/* Size of the structure for checksums */
126
    int32_t	amiga_ChkSum;		/* Checksum of the structure */
127
};
128
#define AMIGA(pos) ((struct AmigaBlock *)(pos)) 
129
130
static int
131
_amiga_checksum (struct AmigaBlock *blk) {
132
	uint32_t *rdb = (uint32_t *) blk;
133
	uint32_t sum;
134
	int i, end;
135
	TRACE();
136
137
	sum = PED_BE32_TO_CPU (rdb[0]);
138
	end = PED_BE32_TO_CPU (rdb[1]);
139
140
	if (end > PED_SECTOR_SIZE) end = PED_SECTOR_SIZE;
141
142
	for (i = 1; i < end; i++) sum += PED_BE32_TO_CPU (rdb[i]);
143
144
	return sum;
145
}
146
147
static void
148
_amiga_calculate_checksum (struct AmigaBlock *blk) {
149
	TRACE();
150
	blk->amiga_ChkSum = PED_CPU_TO_BE32(
151
		PED_BE32_TO_CPU(blk->amiga_ChkSum) -
152
		_amiga_checksum((struct AmigaBlock *) blk));
153
	return;	
154
}
155
156
static struct AmigaBlock *
157
_amiga_read_block (PedDevice *dev, struct AmigaBlock *blk, PedSector block) {
158
	if (!ped_device_read (dev, blk, block, 1)) {
159
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
160
			PED_EXCEPTION_CANCEL,
161
			_("%s : Couldn't read block %llu\n"), __func__, block))
162
		{
163
			case PED_EXCEPTION_CANCEL :
164
			case PED_EXCEPTION_UNHANDLED :
165
			default : 
166
				return NULL;
167
		}
168
	}
169
	if (_amiga_checksum (blk) != 0) {
170
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
171
			PED_EXCEPTION_FIX | PED_EXCEPTION_IGNORE | PED_EXCEPTION_CANCEL,
172
			_("%s : Bad checksum on block %llu of type %s\n"),
173
			__func__, block, _amiga_block_id(PED_BE32_TO_CPU(blk->amiga_ID))))
174
		{
175
			case PED_EXCEPTION_CANCEL :
176
				return NULL;
177
			case PED_EXCEPTION_FIX :
178
				_amiga_calculate_checksum(AMIGA(blk));
179
				if (!ped_device_write (dev, blk, block, 1)) {
180
					switch (ped_exception_throw(PED_EXCEPTION_FATAL,
181
						PED_EXCEPTION_CANCEL,
182
						_("%s : Couldn't write block %d\n"), __func__, block))
183
					{
184
						case PED_EXCEPTION_CANCEL :
185
						case PED_EXCEPTION_UNHANDLED :
186
						default : 
187
							return NULL;
188
					}
189
				}
190
			case PED_EXCEPTION_IGNORE :
191
			case PED_EXCEPTION_UNHANDLED :
192
			default : 
193
				return blk;
194
		}
195
	}
196
	return blk;
197
}
198
199
struct RigidDiskBlock {
200
    uint32_t	rdb_ID;			/* Identifier 32 bit word : 'RDSK' */
201
    uint32_t	rdb_SummedLongs;	/* Size of the structure for checksums */
202
    int32_t	rdb_ChkSum;		/* Checksum of the structure */
203
    uint32_t	rdb_HostID;		/* SCSI Target ID of host, not really used */
204
    uint32_t	rdb_BlockBytes;		/* Size of disk blocks */
205
    uint32_t	rdb_Flags;		/* RDB Flags */
206
    /* block list heads */
207
    uint32_t	rdb_BadBlockList;	/* Bad block list */
208
    uint32_t	rdb_PartitionList;	/* Partition list */
209
    uint32_t	rdb_FileSysHeaderList;	/* File system header list */
210
    uint32_t	rdb_DriveInit;		/* Drive specific init code */
211
    uint32_t	rdb_BootBlockList;	/* Amiga OS 4 Boot Blocks */
212
    uint32_t	rdb_Reserved1[5];	/* Unused word, need to be set to $ffffffff */
213
    /* physical drive characteristics */
214
    uint32_t	rdb_Cylinders;		/* Number of the cylinders of the drive */
215
    uint32_t	rdb_Sectors;		/* Number of sectors of the drive */
216
    uint32_t	rdb_Heads;		/* Number of heads of the drive */
217
    uint32_t	rdb_Interleave;		/* Interleave */
218
    uint32_t	rdb_Park;		/* Head parking cylinder */
219
    uint32_t	rdb_Reserved2[3];	/* Unused word, need to be set to $ffffffff */
220
    uint32_t	rdb_WritePreComp;	/* Starting cylinder of write precompensation */
221
    uint32_t	rdb_ReducedWrite;	/* Starting cylinder of reduced write current */
222
    uint32_t	rdb_StepRate;		/* Step rate of the drive */
223
    uint32_t	rdb_Reserved3[5];	/* Unused word, need to be set to $ffffffff */
224
    /* logical drive characteristics */
225
    uint32_t	rdb_RDBBlocksLo;	/* low block of range reserved for hardblocks */
226
    uint32_t	rdb_RDBBlocksHi;	/* high block of range for these hardblocks */
227
    uint32_t	rdb_LoCylinder;		/* low cylinder of partitionable disk area */
228
    uint32_t	rdb_HiCylinder;		/* high cylinder of partitionable data area */
229
    uint32_t	rdb_CylBlocks;		/* number of blocks available per cylinder */
230
    uint32_t	rdb_AutoParkSeconds;	/* zero for no auto park */
231
    uint32_t	rdb_HighRDSKBlock;	/* highest block used by RDSK */
232
					/* (not including replacement bad blocks) */
233
    uint32_t	rdb_Reserved4;
234
    /* drive identification */
235
    char	rdb_DiskVendor[8];
236
    char	rdb_DiskProduct[16];
237
    char	rdb_DiskRevision[4];
238
    char	rdb_ControllerVendor[8];
239
    char	rdb_ControllerProduct[16];
240
    char	rdb_ControllerRevision[4];
241
    uint32_t	rdb_Reserved5[10];
242
};
243
244
#define	RDB_LOCATION_LIMIT	16
245
#define RDSK(pos) ((struct RigidDiskBlock *)(pos)) 
246
247
/* TODO : print drive ident strings */
248
void _amiga_dump_rdb (struct RigidDiskBlock * rdb) {
249
	TRACE();
250
	DPRINT(DEBUG_BLOCK, "RigidDiskBlock\n\trgb_ID = %08x %s\n",
251
		PED_BE32_TO_CPU(rdb->rdb_ID),
252
		(PED_BE32_TO_CPU(rdb->rdb_ID)==IDNAME_RIGIDDISK ? "RDSK" : ""));
253
	DPRINT(DEBUG_BLOCK, "\trdb_SummedLongs = %08x\n",
254
		PED_BE32_TO_CPU(rdb->rdb_SummedLongs));
255
	DPRINT(DEBUG_BLOCK, "\trdb_ChkSum = %08x (block checksum is %d)\n",
256
		PED_BE32_TO_CPU(rdb->rdb_ChkSum), _amiga_checksum (AMIGA(rdb)));
257
	DPRINT(DEBUG_BLOCK, "\trdb_HostID = %08x\n", PED_BE32_TO_CPU(rdb->rdb_HostID));
258
	DPRINT(DEBUG_BLOCK, "\trdb_BlockBytes = %08x\n", PED_BE32_TO_CPU(rdb->rdb_BlockBytes));
259
	DPRINT(DEBUG_BLOCK, "\trdb_Flags = %08x\n", PED_BE32_TO_CPU(rdb->rdb_Flags));
260
	DPRINT(DEBUG_BLOCK, "\trdb_BadBlockList = %08x\n", PED_BE32_TO_CPU(rdb->rdb_BadBlockList));
261
	DPRINT(DEBUG_BLOCK, "\trdb_PartitionList = %08x\n", PED_BE32_TO_CPU(rdb->rdb_PartitionList));
262
	DPRINT(DEBUG_BLOCK, "\trdb_FileSysHeaderList = %08x\n", PED_BE32_TO_CPU(rdb->rdb_FileSysHeaderList));
263
	DPRINT(DEBUG_BLOCK, "\trdb_DriveInit = %08x\n", PED_BE32_TO_CPU(rdb->rdb_DriveInit));
264
	DPRINT(DEBUG_BLOCK, "\trdb_BootBlockList = %08x\n", PED_BE32_TO_CPU(rdb->rdb_BootBlockList));
265
	DPRINT(DEBUG_BLOCK, "\trdb_Cylinders = %08x\n", PED_BE32_TO_CPU(rdb->rdb_Cylinders));
266
	DPRINT(DEBUG_BLOCK, "\trdb_Sectors = %08x\n", PED_BE32_TO_CPU(rdb->rdb_Sectors));
267
	DPRINT(DEBUG_BLOCK, "\trdb_Heads = %08x\n", PED_BE32_TO_CPU(rdb->rdb_Heads));
268
	DPRINT(DEBUG_BLOCK, "\trdb_Interleave = %08x\n", PED_BE32_TO_CPU(rdb->rdb_Interleave));
269
	DPRINT(DEBUG_BLOCK, "\trdb_Park = %08x\n", PED_BE32_TO_CPU(rdb->rdb_Park));
270
	DPRINT(DEBUG_BLOCK, "\trdb_WritePreComp = %08x\n", PED_BE32_TO_CPU(rdb->rdb_WritePreComp));
271
	DPRINT(DEBUG_BLOCK, "\trdb_ReducedWrite = %08x\n", PED_BE32_TO_CPU(rdb->rdb_ReducedWrite));
272
	DPRINT(DEBUG_BLOCK, "\trdb_StepRate = %08x\n", PED_BE32_TO_CPU(rdb->rdb_StepRate));
273
	DPRINT(DEBUG_BLOCK, "\trdb_RDBBlocksLo = %u\n", PED_BE32_TO_CPU(rdb->rdb_RDBBlocksLo));
274
	DPRINT(DEBUG_BLOCK, "\trdb_RDBBlocksHi = %u\n", PED_BE32_TO_CPU(rdb->rdb_RDBBlocksHi));
275
	DPRINT(DEBUG_BLOCK, "\trdb_LoCylinder = %u\n", PED_BE32_TO_CPU(rdb->rdb_LoCylinder));
276
	DPRINT(DEBUG_BLOCK, "\trdb_HiCylinder = %u\n", PED_BE32_TO_CPU(rdb->rdb_HiCylinder));
277
	DPRINT(DEBUG_BLOCK, "\trdb_CylBlocks = %u (Heads*Sectors = %u\n",
278
		PED_BE32_TO_CPU(rdb->rdb_CylBlocks),
279
		PED_BE32_TO_CPU(rdb->rdb_Sectors)*PED_BE32_TO_CPU(rdb->rdb_Heads));
280
	DPRINT(DEBUG_BLOCK, "\trdb_AutoParkSeconds = %08x\n", PED_BE32_TO_CPU(rdb->rdb_AutoParkSeconds));
281
	DPRINT(DEBUG_BLOCK, "\trdb_HighRDSKBlock = %08x\n", PED_BE32_TO_CPU(rdb->rdb_HighRDSKBlock));
282
}
283
284
#define AMIGA_RDB_NOT_FOUND ((uint32_t)0xffffffff)
285
286
static uint32_t
287
_amiga_find_rdb (PedDevice *dev, struct RigidDiskBlock *rdb) {
288
	int i;
289
	TRACE();
290
291
	for (i = 0; i<RDB_LOCATION_LIMIT; i++) {
292
		if (!_amiga_read_block (dev, AMIGA(rdb), i)) {
293
			continue;
294
		}
295
		if (PED_BE32_TO_CPU (rdb->rdb_ID) == IDNAME_RIGIDDISK) {
296
			return i;
297
		}
298
	}
299
	return AMIGA_RDB_NOT_FOUND;
300
}
301
302
struct PartitionBlock {
303
    uint32_t	pb_ID;			/* Identifier 32 bit word : 'PART' */
304
    uint32_t	pb_SummedLongs;		/* Size of the structure for checksums */
305
    int32_t	pb_ChkSum;		/* Checksum of the structure */
306
    uint32_t	pb_HostID;		/* SCSI Target ID of host, not really used */
307
    uint32_t	pb_Next;		/* Block number of the next PartitionBlock */
308
    uint32_t	pb_Flags;		/* Part Flags (NOMOUNT and BOOTABLE) */
309
    uint32_t	pb_Reserved1[2];
310
    uint32_t	pb_DevFlags;		/* Preferred flags for OpenDevice */
311
    uint8_t	pb_DriveName[32];	/* Preferred DOS device name: BSTR form */
312
    uint32_t	pb_Reserved2[15];
313
    uint32_t	de_TableSize;		/* Size of Environment vector */
314
    uint32_t	de_SizeBlock;		/* Size of the blocks in 32 bit words, usually 128 */
315
    uint32_t	de_SecOrg;	     	/* Not used; must be 0 */
316
    uint32_t	de_Surfaces;		/* Number of heads (surfaces) */
317
    uint32_t	de_SectorPerBlock;	/* Disk sectors per block, used with SizeBlock, usually 1 */
318
    uint32_t	de_BlocksPerTrack;	/* Blocks per track. drive specific */
319
    uint32_t	de_Reserved;		/* DOS reserved blocks at start of partition. */
320
    uint32_t	de_PreAlloc;		/* DOS reserved blocks at end of partition */
321
    uint32_t	de_Interleave;		/* Not used, usually 0 */
322
    uint32_t	de_LowCyl;		/* First cylinder of the partition */
323
    uint32_t	de_HighCyl;		/* Last cylinder of the partition */
324
    uint32_t	de_NumBuffers;		/* Initial # DOS of buffers.  */
325
    uint32_t	de_BufMemType;		/* Type of mem to allocate for buffers */
326
    uint32_t	de_MaxTransfer;		/* Max number of bytes to transfer at a time */
327
    uint32_t	de_Mask;		/* Address Mask to block out certain memory */
328
    int32_t	de_BootPri;		/* Boot priority for autoboot */
329
    uint32_t	de_DosType;		/* Dostype of the filesystem */
330
    uint32_t	de_Baud;		/* Baud rate for serial handler */
331
    uint32_t	de_Control;		/* Control word for handler/filesystem */
332
    uint32_t	de_BootBlocks;		/* Number of blocks containing boot code */
333
    uint32_t	pb_EReserved[12];
334
};
335
336
#define PART(pos) ((struct PartitionBlock *)(pos))
337
338
#define	PBFB_BOOTABLE	0	/* this partition is intended to be bootable */
339
#define	PBFF_BOOTABLE	1L	/*   (expected directories and files exist) */
340
#define	PBFB_NOMOUNT	1	/* do not mount this partition (e.g. manually */
341
#define	PBFF_NOMOUNT	2L	/*   mounted, but space reserved here) */
342
343
void _amiga_dump_part (struct PartitionBlock * part) {
344
	TRACE();
345
	DPRINT(DEBUG_BLOCK, "Partition : cylinder %d to %d, blocksize : %d (in bytes)\n",
346
		PED_BE32_TO_CPU(part->de_LowCyl),
347
		PED_BE32_TO_CPU(part->de_HighCyl),
348
		PED_BE32_TO_CPU(part->de_SizeBlock)*4*PED_BE32_TO_CPU(part->de_SectorPerBlock));
349
	DPRINT(DEBUG_BLOCK, "\tdostype : %08x, reserved : %d, prealloc : %d\n",
350
		PED_BE32_TO_CPU(part->de_DosType),
351
		PED_BE32_TO_CPU(part->de_Reserved),
352
		PED_BE32_TO_CPU(part->de_PreAlloc));
353
	DPRINT(DEBUG_BLOCK, "PartitionBlock\n");
354
	DPRINT(DEBUG_BLOCK, "\tpart_ID = %08x %s\n", PED_BE32_TO_CPU(part->pb_ID),
355
		(PED_BE32_TO_CPU(part->pb_ID)==IDNAME_PARTITION ? "PART" : ""));
356
	DPRINT(DEBUG_BLOCK, "\tpart_SummedLongs = %08x\n",
357
		PED_BE32_TO_CPU(part->pb_SummedLongs));
358
	DPRINT(DEBUG_BLOCK, "\tpart_ChkSum = %08x (block checksum is %d)\n",
359
		PED_BE32_TO_CPU(part->pb_ChkSum), _amiga_checksum (AMIGA(part)));
360
	DPRINT(DEBUG_BLOCK, "\tpart_HostID = %08x\n", PED_BE32_TO_CPU(part->pb_HostID));
361
	DPRINT(DEBUG_BLOCK, "\tpart_Next = %08x (%d)\n",
362
		PED_BE32_TO_CPU(part->pb_Next), PED_BE32_TO_CPU(part->pb_Next));
363
	DPRINT(DEBUG_BLOCK, "\tpart_Flags = %08x\n", PED_BE32_TO_CPU(part->pb_Flags));
364
	DPRINT(DEBUG_BLOCK, "\tpart_DevFlags = %08x\n", PED_BE32_TO_CPU(part->pb_DevFlags));
365
	DPRINT(DEBUG_BLOCK, "\tpart_DriveName = %s\n", _amiga_get_bstr(part->pb_DriveName));
366
	DPRINT(DEBUG_BLOCK, "\tde_TableSize = %08x\n", PED_BE32_TO_CPU(part->de_TableSize));
367
	DPRINT(DEBUG_BLOCK, "\tde_SizeBlock = %08x\n", PED_BE32_TO_CPU(part->de_SizeBlock));
368
	DPRINT(DEBUG_BLOCK, "\tde_SecOrg = %08x\n", PED_BE32_TO_CPU(part->de_SecOrg));
369
	DPRINT(DEBUG_BLOCK, "\tde_Surfaces = %08x\n", PED_BE32_TO_CPU(part->de_Surfaces));
370
	DPRINT(DEBUG_BLOCK, "\tde_SectorPerBlock = %08x\n", PED_BE32_TO_CPU(part->de_SectorPerBlock));
371
	DPRINT(DEBUG_BLOCK, "\tde_BlocksPerTrack = %08x\n", PED_BE32_TO_CPU(part->de_BlocksPerTrack));
372
	DPRINT(DEBUG_BLOCK, "\tde_Reserved = %08x\n", PED_BE32_TO_CPU(part->de_Reserved));
373
	DPRINT(DEBUG_BLOCK, "\tde_PreAlloc = %08x\n", PED_BE32_TO_CPU(part->de_PreAlloc));
374
	DPRINT(DEBUG_BLOCK, "\tde_Interleave = %08x\n", PED_BE32_TO_CPU(part->de_Interleave));
375
	DPRINT(DEBUG_BLOCK, "\tde_LowCyl = %08x\n", PED_BE32_TO_CPU(part->de_LowCyl));
376
	DPRINT(DEBUG_BLOCK, "\tde_HighCyl = %08x\n", PED_BE32_TO_CPU(part->de_HighCyl));
377
	DPRINT(DEBUG_BLOCK, "\tde_NumBuffers = %08x\n", PED_BE32_TO_CPU(part->de_NumBuffers));
378
	DPRINT(DEBUG_BLOCK, "\tde_BufMemType = %08x\n", PED_BE32_TO_CPU(part->de_BufMemType));
379
	DPRINT(DEBUG_BLOCK, "\tde_MaxTransfer = %08x\n", PED_BE32_TO_CPU(part->de_MaxTransfer));
380
	DPRINT(DEBUG_BLOCK, "\tde_Mask = %08x\n", PED_BE32_TO_CPU(part->de_Mask));
381
	DPRINT(DEBUG_BLOCK, "\tde_BootPri = %08x\n", PED_BE32_TO_CPU(part->de_BootPri));
382
	DPRINT(DEBUG_BLOCK, "\tde_DosType = %08x\n", PED_BE32_TO_CPU(part->de_DosType));
383
	DPRINT(DEBUG_BLOCK, "\tde_Baud = %08x\n", PED_BE32_TO_CPU(part->de_Baud));
384
	DPRINT(DEBUG_BLOCK, "\tde_Control = %08x\n", PED_BE32_TO_CPU(part->de_Control));
385
	DPRINT(DEBUG_BLOCK, "\tde_BootBlocks = %08x\n", PED_BE32_TO_CPU(part->de_BootBlocks));
386
}
387
388
#define AMIGA_MAX_PARTITIONS 128
389
390
struct LinkedBlock {
391
    uint32_t	lk_ID;			/* Identifier 32 bit word */
392
    uint32_t	lk_SummedLongs;		/* Size of the structure for checksums */
393
    int32_t	lk_ChkSum;		/* Checksum of the structure */
394
    uint32_t	pb_HostID;		/* SCSI Target ID of host, not really used */
395
    uint32_t	lk_Next;		/* Block number of the next PartitionBlock */
396
};
397
struct Linked2Block {
398
    uint32_t	lk2_ID;			/* Identifier 32 bit word */
399
    uint32_t	lk2_SummedLongs;		/* Size of the structure for checksums */
400
    int32_t	lk2_ChkSum;		/* Checksum of the structure */
401
    uint32_t	lk2_Next;		/* Block number of the next PartitionBlock */
402
    uint32_t	lk2_Reverved[13];
403
    uint32_t	lk2_Linked;		/* Secondary linked list */
404
};
405
#define LINK_END	0xffffffff
406
#define LNK(pos)	((struct LinkedBlock *)(pos))
407
#define LNK2(pos)	((struct Linked2Block *)(pos))
408
409
void _amiga_dump_linked (struct LinkedBlock * block) {
410
	TRACE();
411
	DPRINT(DEBUG_BLOCK, "LinkedBlock\n\tpart_ID = %08x %s\n",
412
		PED_BE32_TO_CPU(block->lk_ID),
413
		_amiga_block_id(PED_BE32_TO_CPU(block->lk_ID)));
414
	DPRINT(DEBUG_BLOCK, "\tlk_SummedLongs = %08x\n",
415
			PED_BE32_TO_CPU(block->lk_SummedLongs));
416
	DPRINT(DEBUG_BLOCK, "\tlk_ChkSum = %08x (block checksum is %d)\n",
417
		block->lk_ChkSum, _amiga_checksum (AMIGA(block)));
418
	DPRINT(DEBUG_BLOCK, "\tlk_Next = %08x (%d)\n",
419
		PED_BE32_TO_CPU(block->lk_Next), PED_BE32_TO_CPU(block->lk_Next));
420
	if (PED_BE32_TO_CPU(block->lk_ID)==IDNAME_FILESYSHEADER) {
421
		DPRINT(DEBUG_BLOCK, "\tlk2_Linked = %08x (%d)\n", 
422
			PED_BE32_TO_CPU(LNK2(block)->lk2_Linked),
423
			PED_BE32_TO_CPU(LNK2(block)->lk2_Linked));
424
	}
425
}
426
427
#define MAX_RDB_BLOCK (RDB_LOCATION_LIMIT + 2 * AMIGA_MAX_PARTITIONS + 2)
428
429
static PedDiskType amiga_disk_type;
430
431
static int
432
amiga_probe (PedDevice *dev)
433
{
434
	struct RigidDiskBlock *rdb;
435
	uint32_t found;
436
	TRACE();
437
	PED_ASSERT(dev!= NULL, return 0);
438
439
	if ((rdb=RDSK(ped_malloc(PED_SECTOR_SIZE)))==NULL) {
440
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
441
			PED_EXCEPTION_CANCEL,
442
			_("%s : Failed to allocate rdb block\n"), __func__))
443
		{
444
			case PED_EXCEPTION_CANCEL :
445
			case PED_EXCEPTION_UNHANDLED :
446
			default : 
447
				return 0;
448
		}
449
	}
450
	found = _amiga_find_rdb (dev, rdb);
451
	ped_free (rdb);
452
453
	return (found == AMIGA_RDB_NOT_FOUND ? 0 : 1);
454
}
455
		
456
static PedDisk*
457
amiga_alloc (PedDevice* dev)
458
{
459
	PedDisk *disk;
460
	struct AmigaDisk *adsk;
461
	struct RigidDiskBlock *rdb;
462
	int highest_cylinder, highest_block;
463
	TRACE();
464
	PED_ASSERT(dev!= NULL, return NULL);
465
466
	if (!(disk = _ped_disk_alloc (dev, &amiga_disk_type))) {
467
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
468
			PED_EXCEPTION_CANCEL,
469
			_("%s : Failed to allocate disk structure\n"), __func__))
470
		{
471
			case PED_EXCEPTION_CANCEL :
472
			case PED_EXCEPTION_UNHANDLED :
473
			default : 
474
				return NULL;
475
		}
476
	}
477
478
	if (!(disk->disk_specific = ped_malloc (PED_SECTOR_SIZE))) {
479
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
480
			PED_EXCEPTION_CANCEL,
481
			_("%s : Failed to allocate disk_specific rdb block\n"), __func__))
482
		{
483
			case PED_EXCEPTION_CANCEL :
484
			case PED_EXCEPTION_UNHANDLED :
485
			default : 
486
				ped_free (disk);
487
				return NULL;
488
		}
489
	}
490
	rdb = disk->disk_specific;
491
492
	memset(rdb, -1, sizeof(struct RigidDiskBlock));
493
494
	rdb->rdb_ID = PED_CPU_TO_BE32 (IDNAME_RIGIDDISK);
495
	rdb->rdb_SummedLongs = PED_CPU_TO_BE32 (64);
496
	rdb->rdb_HostID = PED_CPU_TO_BE32 (0);
497
	rdb->rdb_BlockBytes = PED_CPU_TO_BE32 (PED_SECTOR_SIZE);
498
	rdb->rdb_Flags = PED_CPU_TO_BE32 (0);
499
500
	/* Block lists */
501
	rdb->rdb_BadBlockList = PED_CPU_TO_BE32 (0xffffffff);
502
	rdb->rdb_PartitionList = PED_CPU_TO_BE32 (0xffffffff);
503
	rdb->rdb_FileSysHeaderList = PED_CPU_TO_BE32 (0xffffffff);
504
	rdb->rdb_DriveInit = PED_CPU_TO_BE32 (0xffffffff);
505
	
506
	/* Physical drive characteristics */
507
	rdb->rdb_Cylinders = PED_CPU_TO_BE32 (dev->cylinders);
508
	rdb->rdb_Sectors = PED_CPU_TO_BE32 (dev->sectors);
509
	rdb->rdb_Heads = PED_CPU_TO_BE32 (dev->heads);
510
	rdb->rdb_Interleave = PED_CPU_TO_BE32 (0);
511
	rdb->rdb_Park = PED_CPU_TO_BE32 (dev->cylinders);
512
	rdb->rdb_WritePreComp = PED_CPU_TO_BE32 (dev->cylinders);
513
	rdb->rdb_ReducedWrite = PED_CPU_TO_BE32 (dev->cylinders);
514
	rdb->rdb_StepRate = PED_CPU_TO_BE32 (0);
515
516
	highest_cylinder = MAX_RDB_BLOCK / (dev->sectors * dev->heads) + 1;
517
	highest_block = highest_cylinder * dev->sectors * dev->heads - 1;
518
519
	/* Logical driver characteristics */
520
	rdb->rdb_RDBBlocksLo = PED_CPU_TO_BE32 (0);
521
	rdb->rdb_RDBBlocksHi = PED_CPU_TO_BE32 (highest_block);
522
	rdb->rdb_LoCylinder = PED_CPU_TO_BE32 (highest_cylinder);
523
	rdb->rdb_HiCylinder = PED_CPU_TO_BE32 (dev->cylinders -1);
524
	rdb->rdb_CylBlocks = PED_CPU_TO_BE32 (dev->sectors * dev->heads);
525
	rdb->rdb_AutoParkSeconds = PED_CPU_TO_BE32 (0);
526
	/* rdb_HighRDSKBlock will only be set when writing */
527
	rdb->rdb_HighRDSKBlock = PED_CPU_TO_BE32 (0);
528
529
	/* Driver identification */
530
	_amiga_set_bstr("", rdb->rdb_DiskVendor, 8);
531
	_amiga_set_bstr(dev->model, rdb->rdb_DiskProduct, 16);
532
	_amiga_set_bstr("", rdb->rdb_DiskRevision, 4);
533
	_amiga_set_bstr("", rdb->rdb_ControllerVendor, 8);
534
	_amiga_set_bstr("", rdb->rdb_ControllerProduct, 16);
535
	_amiga_set_bstr("", rdb->rdb_ControllerRevision, 4);
536
537
	/* And calculate the checksum */
538
	_amiga_calculate_checksum ((struct AmigaBlock *) rdb);
539
	
540
	return disk;
541
}
542
543
static PedDisk*
544
amiga_duplicate (const PedDisk* disk)
545
{
546
	PedDisk*	new_disk;
547
	struct RigidDiskBlock *	new_rdb;
548
	struct RigidDiskBlock * old_rdb;
549
	TRACE();
550
	PED_ASSERT(disk!= NULL, return NULL);
551
	PED_ASSERT(disk->dev!= NULL, return NULL);
552
	PED_ASSERT(disk->disk_specific!= NULL, return NULL);
553
554
	old_rdb = (struct RigidDiskBlock *) disk->disk_specific;
555
       
556
	if (!(new_disk = ped_disk_new_fresh (disk->dev, &amiga_disk_type))) {
557
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
558
			PED_EXCEPTION_CANCEL,
559
			_("%s : Failed to allocate a new disk structure\n"), __func__))
560
		{
561
			case PED_EXCEPTION_CANCEL :
562
			case PED_EXCEPTION_UNHANDLED :
563
			default : 
564
				return NULL;
565
		}
566
	}
567
568
	new_rdb = (struct RigidDiskBlock *) new_disk->disk_specific;
569
	memcpy (new_rdb, old_rdb, 256);
570
	return new_disk;
571
}
572
573
static void
574
amiga_free (PedDisk* disk)
575
{
576
	TRACE();
577
	PED_ASSERT(disk!= NULL, return);
578
	PED_ASSERT(disk->disk_specific!= NULL, return);
579
580
	ped_free (disk->disk_specific);
581
	_ped_disk_free (disk);
582
}
583
584
#ifndef DISCOVER_ONLY
585
static int
586
amiga_clobber (PedDevice* dev)
587
{
588
	struct RigidDiskBlock *rdb;
589
	uint32_t i;
590
	int result = 0;
591
	TRACE();
592
	PED_ASSERT(dev!= NULL, return 0);
593
594
	if ((rdb=RDSK(ped_malloc(PED_SECTOR_SIZE)))==NULL) {
595
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
596
			PED_EXCEPTION_CANCEL,
597
			_("%s : Failed to allocate rdb block\n"), __func__))
598
		{
599
			case PED_EXCEPTION_CANCEL :
600
			case PED_EXCEPTION_UNHANDLED :
601
			default : 
602
				return 0;
603
		}
604
	}
605
606
	while ((i = _amiga_find_rdb (dev, rdb)) != AMIGA_RDB_NOT_FOUND) {
607
		rdb->rdb_ID = PED_CPU_TO_BE32 (0);
608
		result = ped_device_write (dev, (void*) rdb, i, 1);
609
	}
610
611
	ped_free (rdb);
612
613
	return result;
614
}
615
#endif /* !DISCOVER_ONLY */
616
617
static int
618
_amiga_loop_check (uint32_t block, uint32_t * blocklist, uint32_t max)
619
{
620
	uint32_t i;
621
	TRACE();
622
623
	for (i = 0; i < max; i++)
624
		if (block == blocklist[i]) {
625
			/* We are looping, let's stop.  */
626
			return 1;
627
		}
628
	blocklist[max] = block;
629
	return 0;
630
}
631
632
/* We have already allocated a rdb, we are now reading it from the disk */
633
static int
634
amiga_read (PedDisk* disk)
635
{
636
	struct RigidDiskBlock *rdb;
637
	struct PartitionBlock *partition;
638
	uint32_t partblock;
639
	uint32_t partlist[AMIGA_MAX_PARTITIONS];
640
	PedSector cylblocks;
641
	int i;
642
	TRACE();
643
	PED_ASSERT(disk!= NULL, return 0);
644
	PED_ASSERT(disk->dev!= NULL, return 0);
645
	PED_ASSERT(disk->disk_specific!= NULL, return 0);
646
	rdb = RDSK(disk->disk_specific);
647
648
	if (_amiga_find_rdb (disk->dev, rdb) == AMIGA_RDB_NOT_FOUND) {
649
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
650
			PED_EXCEPTION_CANCEL,
651
			_("%s : Didn't find rdb block, should never happen\n"), __func__))
652
		{
653
			case PED_EXCEPTION_CANCEL :
654
			case PED_EXCEPTION_UNHANDLED :
655
			default : 
656
				return 0;
657
		}
658
	}
659
#if (DEBUG_BLOCKS & MASTER_DEBUG)
660
		_amiga_dump_rdb(rdb);
661
#endif
662
663
	/* Let's copy the rdb read geometry to the dev */
664
	disk->dev->cylinders = PED_BE32_TO_CPU (rdb->rdb_Cylinders);
665
	disk->dev->heads = PED_BE32_TO_CPU (rdb->rdb_Heads);
666
	disk->dev->sectors = PED_BE32_TO_CPU (rdb->rdb_Sectors);
667
	cylblocks = (PedSector) PED_BE32_TO_CPU (rdb->rdb_Heads) *
668
		(PedSector) PED_BE32_TO_CPU (rdb->rdb_Sectors);
669
670
	/* Remove all partitions in the former in memory table */
671
	ped_disk_delete_all (disk);
672
673
	/* Let's allocate a partition block */
674
	if (!(partition = ped_malloc (PED_SECTOR_SIZE))) {
675
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
676
			PED_EXCEPTION_CANCEL,
677
			_("%s : Failed to allocate partition block\n"), __func__))
678
		{
679
			case PED_EXCEPTION_CANCEL :
680
			case PED_EXCEPTION_UNHANDLED :
681
			default : 
682
				return 0;
683
		}
684
	}
685
686
	/* We initialize the hardblock free list to detect loops */
687
	for (i = 0; i < AMIGA_MAX_PARTITIONS; i++) partlist[i] = 0xffffffff;
688
689
	for (i = 1, partblock = PED_BE32_TO_CPU(rdb->rdb_PartitionList);
690
		i < AMIGA_MAX_PARTITIONS && partblock != 0xffffffff;
691
		i++, partblock = PED_BE32_TO_CPU(partition->pb_Next))
692
	{
693
		PedPartition *part;
694
		PedSector start, end;
695
		struct DosEnvec *de;
696
		PedConstraint *constraint_exact;
697
		int j; 
698
699
		/* Let's look for loops in the partition table */
700
		if (_amiga_loop_check(partblock, partlist, i)) {
701
			break;
702
		}
703
704
		/* Let's allocate and read a partition block to get its geometry*/
705
		if (!_amiga_read_block (disk->dev, AMIGA(partition), (PedSector)partblock)) {
706
			ped_free(partition);
707
			return 0;
708
		}
709
#if (DEBUG_BLOCK & MASTER_DEBUG)
710
		_amiga_dump_part(partition);
711
#endif
712
713
		start = ((PedSector) PED_BE32_TO_CPU (partition->de_LowCyl)) * cylblocks;
714
		end = ((((PedSector) PED_BE32_TO_CPU (partition->de_HighCyl))+1) * (cylblocks))-1;
715
716
		/* We can now construct a new partition */
717
		if (!(part = ped_partition_new (disk, 0, NULL, start, end))) {
718
			switch (ped_exception_throw(PED_EXCEPTION_ERROR,
719
				PED_EXCEPTION_CANCEL,
720
				_("%s : Failed to allocate new partition (%llu -> %llu)\n"),
721
				__func__, start, end))
722
			{
723
				case PED_EXCEPTION_CANCEL :
724
				case PED_EXCEPTION_UNHANDLED :
725
				default : 
726
					ped_free(partition);
727
					return 0;
728
			}
729
		}
730
		/* And copy over the partition block */
731
		memcpy(part->disk_specific, partition, 256);
732
733
		part->num = i;
734
		part->type = 0;
735
		/* Let's probe what filesystem is present on the disk */
736
		part->fs_type = ped_file_system_probe (&part->geom);
737
		
738
		constraint_exact = ped_constraint_exact (&part->geom);
739
		if (!ped_disk_add_partition (disk, part, constraint_exact)) {
740
			switch (ped_exception_throw(PED_EXCEPTION_ERROR,
741
				PED_EXCEPTION_CANCEL,
742
				_("%s : Failed to add new partition\n"), __func__))
743
			{
744
				case PED_EXCEPTION_CANCEL :
745
				case PED_EXCEPTION_UNHANDLED :
746
				default : 
747
					ped_free(partition);
748
					return 0;
749
			}
750
		}
751
		ped_constraint_destroy (constraint_exact);
752
	}
753
	return 1;
754
}
755
756
static int
757
_amiga_find_free_blocks(PedDisk *disk, uint32_t *table,
758
	struct LinkedBlock *block, uint32_t first, uint32_t type)
759
{
760
	PedSector next;
761
	TRACE();
762
	PED_ASSERT(disk!= NULL, return 0);
763
	PED_ASSERT(disk->dev!= NULL, return 0);
764
765
	for (next = first; next != LINK_END; next = PED_BE32_TO_CPU(block->lk_Next)) {
766
		if (table[next] != IDNAME_FREE) {
767
			switch (ped_exception_throw(PED_EXCEPTION_ERROR,
768
				PED_EXCEPTION_FIX | PED_EXCEPTION_IGNORE | PED_EXCEPTION_CANCEL,
769
				_("%s : Loop detected at block %d\n"), __func__, next))
770
			{
771
				case PED_EXCEPTION_CANCEL :
772
					return 0;
773
				case PED_EXCEPTION_FIX :
774
					/* Need to add fixing code */
775
				case PED_EXCEPTION_IGNORE :
776
				case PED_EXCEPTION_UNHANDLED :
777
				default : 
778
					return 1;
779
			}
780
		}
781
782
		if (!_amiga_read_block (disk->dev, AMIGA(block), next)) {
783
			return 0;
784
		}
785
#if (DEBUG_BLOCK & MASTER_DEBUG)
786
		_amiga_dump_linked(block);
787
#endif
788
		if (PED_BE32_TO_CPU(block->lk_ID) != type) {
789
			switch (ped_exception_throw(PED_EXCEPTION_ERROR,
790
				PED_EXCEPTION_CANCEL,
791
				_("%s : The %s list seems bad at block %s\n"),
792
				__func__, _amiga_block_id(PED_BE32_TO_CPU(block->lk_ID)), next))
793
			{
794
				case PED_EXCEPTION_CANCEL :
795
				case PED_EXCEPTION_UNHANDLED :
796
				default : 
797
					return 0;
798
			}
799
		}
800
		table[next] = type;
801
		if (PED_BE32_TO_CPU(block->lk_ID) == IDNAME_FILESYSHEADER) {
802
			if (_amiga_find_free_blocks(disk, table, block,
803
				PED_BE32_TO_CPU(LNK2(block)->lk2_Linked),
804
				IDNAME_LOADSEG) == 0) return 0;
805
		}
806
	}
807
	return 1;
808
}
809
static uint32_t
810
_amiga_next_free_block(uint32_t *table, uint32_t start, uint32_t type) {
811
	int i;
812
	TRACE();
813
814
	for (i = start; table[i] != type && table[i] != IDNAME_FREE; i++);
815
	return i;
816
}
817
static PedPartition *
818
_amiga_next_real_partition(PedDisk *disk, PedPartition *part) {
819
	PedPartition *next;
820
	TRACE();
821
822
	for (next = ped_disk_next_partition (disk, part);
823
		next != NULL && !ped_partition_is_active (next);
824
		next = ped_disk_next_partition (disk, next));
825
	return next;
826
}
827
#ifndef DISCOVER_ONLY
828
static int
829
amiga_write (PedDisk* disk)
830
{
831
	struct RigidDiskBlock *rdb;
832
	struct LinkedBlock *block;
833
	struct PartitionBlock *partition;
834
	PedPartition *part, *next_part;
835
	PedSector cylblocks, first_hb, last_hb, last_used_hb;
836
	uint32_t * table;
837
	uint32_t i, rdb_block, max_part;
838
	uint32_t rdb_num, part_num, block_num, next_num;
839
	TRACE();
840
841
	PED_ASSERT (disk != NULL, return 0;);
842
	PED_ASSERT (disk->dev != NULL, return 0;);
843
	PED_ASSERT (disk->disk_specific != NULL, return 0;);
844
845
	if (!(rdb = ped_malloc (PED_SECTOR_SIZE))) {
846
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
847
			PED_EXCEPTION_CANCEL,
848
			_("%s : Failed to allocate rdb block\n"), __func__))
849
		{
850
			case PED_EXCEPTION_CANCEL :
851
			case PED_EXCEPTION_UNHANDLED :
852
			default : 
853
				return 0;
854
		}
855
	}
856
	/* Let's read the rdb */
857
	if ((rdb_num = _amiga_find_rdb (disk->dev, rdb)) == AMIGA_RDB_NOT_FOUND) {
858
		rdb_num = 2;
859
	} else {
860
		memcpy (RDSK(disk->disk_specific), rdb, PED_SECTOR_SIZE);
861
	}
862
	ped_free (rdb);
863
	rdb = RDSK(disk->disk_specific);
864
#if (DEBUG_BLOCK & MASTER_DEBUG)
865
		_amiga_dump_rdb(rdb);
866
#endif
867
868
	/* Let's copy the rdb read geometry to the dev */
869
	disk->dev->cylinders = PED_BE32_TO_CPU (rdb->rdb_Cylinders);
870
	disk->dev->heads = PED_BE32_TO_CPU (rdb->rdb_Heads);
871
	disk->dev->sectors = PED_BE32_TO_CPU (rdb->rdb_Sectors);
872
	cylblocks = (PedSector) PED_BE32_TO_CPU (rdb->rdb_Heads) *
873
		(PedSector) PED_BE32_TO_CPU (rdb->rdb_Sectors);
874
	first_hb = (PedSector) PED_BE32_TO_CPU (rdb->rdb_RDBBlocksLo);
875
	last_hb = (PedSector) PED_BE32_TO_CPU (rdb->rdb_RDBBlocksHi);
876
	last_used_hb = (PedSector) PED_BE32_TO_CPU (rdb->rdb_HighRDSKBlock);
877
878
	/* let's allocate a free block table and initialize it */
879
	if (!(table = ped_malloc ((last_hb - first_hb + 1) * sizeof(uint32_t)))) {
880
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
881
			PED_EXCEPTION_CANCEL,
882
			_("%s : Failed to allocate free block table\n"), __func__))
883
		{
884
			case PED_EXCEPTION_CANCEL :
885
			case PED_EXCEPTION_UNHANDLED :
886
			default : 
887
				return 0;
888
		}
889
	}
890
	memset(table, 0xff, (last_hb - first_hb + 1) * sizeof(uint32_t));
891
	for (i = 0; i<=rdb_num; i++) table[i] = IDNAME_RIGIDDISK;
892
	
893
	/* Let's allocate a partition block */
894
	if (!(block = ped_malloc (PED_SECTOR_SIZE))) {
895
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
896
			PED_EXCEPTION_CANCEL,
897
			_("%s : Failed to allocate partition block\n"), __func__))
898
		{
899
			case PED_EXCEPTION_CANCEL :
900
			case PED_EXCEPTION_UNHANDLED :
901
			default : 
902
				ped_free (table);
903
				return 0;
904
		}
905
	}
906
907
	/* And fill the free block table */
908
	if (_amiga_find_free_blocks(disk, table, block,
909
		PED_BE32_TO_CPU (rdb->rdb_BadBlockList), IDNAME_BADBLOCK) == 0)
910
	{
911
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
912
			PED_EXCEPTION_CANCEL,
913
			_("%s : Failed to list badblocks\n"), __func__))
914
		{
915
			case PED_EXCEPTION_CANCEL :
916
			case PED_EXCEPTION_UNHANDLED :
917
			default : 
918
				ped_free (table);
919
				ped_free (block);
920
				return 0;
921
		}
922
	}
923
	if (_amiga_find_free_blocks(disk, table, block,
924
		PED_BE32_TO_CPU (rdb->rdb_PartitionList), IDNAME_PARTITION) == 0)
925
	{
926
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
927
			PED_EXCEPTION_CANCEL,
928
			_("%s : Failed to list partitionblocks\n"), __func__))
929
		{
930
			case PED_EXCEPTION_CANCEL :
931
			case PED_EXCEPTION_UNHANDLED :
932
			default : 
933
				ped_free (table);
934
				ped_free (block);
935
				return 0;
936
		}
937
	}
938
	if (_amiga_find_free_blocks(disk, table, block,
939
		PED_BE32_TO_CPU (rdb->rdb_FileSysHeaderList), IDNAME_FILESYSHEADER) == 0)
940
	{
941
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
942
			PED_EXCEPTION_CANCEL,
943
			_("%s : Failed to list filesystemblocks\n"), __func__))
944
		{
945
			case PED_EXCEPTION_CANCEL :
946
			case PED_EXCEPTION_UNHANDLED :
947
			default : 
948
				ped_free (table);
949
				ped_free (block);
950
				return 0;
951
		}
952
	}
953
	if (_amiga_find_free_blocks(disk, table, block,
954
		PED_BE32_TO_CPU (rdb->rdb_BootBlockList), IDNAME_BOOT) == 0)
955
	{
956
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
957
			PED_EXCEPTION_CANCEL,
958
			_("%s : Failed to list bootblocks\n"), __func__))
959
		{
960
			case PED_EXCEPTION_CANCEL :
961
			case PED_EXCEPTION_UNHANDLED :
962
			default : 
963
				ped_free (table);
964
				ped_free (block);
965
				return 0;
966
		}
967
	}
968
969
	block_num = next_num = part_num = _amiga_next_free_block(table, rdb_num+1, IDNAME_PARTITION);
970
	part = _amiga_next_real_partition(disk, NULL);
971
	if (part == NULL) {
972
		rdb->rdb_PartitionList = PED_CPU_TO_BE32(LINK_END);
973
	} else {
974
		rdb->rdb_PartitionList = PED_CPU_TO_BE32(part_num);
975
		while (part != NULL) {
976
			PED_ASSERT(part->disk_specific!=NULL, return 0);
977
			next_part = _amiga_next_real_partition(disk, part);
978
			block_num = next_num;
979
			next_num = _amiga_next_free_block(table, block_num+1, IDNAME_PARTITION);
980
			partition = PART(part->disk_specific);
981
			partition->pb_Next = next_part==NULL ? PED_CPU_TO_BE32(LINK_END):PED_CPU_TO_BE32(next_num);
982
			partition->de_LowCyl = PED_CPU_TO_BE32(part->geom.start/cylblocks);
983
			partition->de_HighCyl = PED_CPU_TO_BE32((part->geom.end+1)/cylblocks-1);
984
			_amiga_calculate_checksum(AMIGA(partition));
985
			if (!ped_device_write (disk->dev, (void*) partition, block_num, 1)) {
986
				switch (ped_exception_throw(PED_EXCEPTION_ERROR,
987
					PED_EXCEPTION_CANCEL,
988
					_("%s : Failed to write partition block at\n"), __func__, block_num))
989
				{
990
					case PED_EXCEPTION_CANCEL :
991
					case PED_EXCEPTION_UNHANDLED :
992
					default : 
993
						ped_free (table);
994
						ped_free (block);
995
						/* WARNING : If we fail here, we stop everything,
996
						 * and the partition table is lost. A Better
997
						 * solution should be found, using the second
998
						 * half of the hardblocks to not overwrite the
999
						 * old partition table. It becomes problematic
1000
						 * if we use more than half of the hardblocks. */
1001
						return 0;
1002
				}
1003
			}
1004
			part = next_part;
1005
		}
1006
	}
1007
	if (block_num >PED_BE32_TO_CPU (rdb->rdb_HighRDSKBlock)) {
1008
		rdb->rdb_HighRDSKBlock = PED_CPU_TO_BE32(block_num);
1009
	}
1010
	_amiga_calculate_checksum(AMIGA(rdb));
1011
	if (!ped_device_write (disk->dev, (void*) disk->disk_specific, rdb_num, 1)) {
1012
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
1013
			PED_EXCEPTION_CANCEL,
1014
			_("%s : Failed to write rdb block at\n"), __func__, rdb_num))
1015
		{
1016
			case PED_EXCEPTION_CANCEL :
1017
			case PED_EXCEPTION_UNHANDLED :
1018
			default : 
1019
				ped_free (table);
1020
				ped_free (block);
1021
				return 0;
1022
		}
1023
	}
1024
			
1025
#if (DEBUG_BLOCK & MASTER_DEBUG)
1026
		_amiga_dump_rdb(rdb);
1027
#endif
1028
	ped_free (table);
1029
	ped_free (block);
1030
	return ped_device_sync (disk->dev);
1031
}
1032
#endif /* !DISCOVER_ONLY */
1033
1034
static PedPartition*
1035
amiga_partition_new (const PedDisk* disk, PedPartitionType part_type,
1036
		   const PedFileSystemType* fs_type,
1037
		   PedSector start, PedSector end)
1038
{
1039
	PedPartition *part;
1040
	PedDevice *dev;
1041
	PedSector cyl;
1042
	struct PartitionBlock *partition;
1043
	struct RigidDiskBlock *rdb;
1044
	TRACE();
1045
	PED_ASSERT(disk!= NULL, return NULL);
1046
	PED_ASSERT(disk->dev!= NULL, return NULL);
1047
	PED_ASSERT(disk->disk_specific!= NULL, return NULL);
1048
	dev = disk->dev;
1049
	cyl = (PedSector) (dev->sectors * dev->heads);
1050
	rdb = RDSK(disk->disk_specific);
1051
1052
	if (!(part = _ped_partition_alloc (disk, part_type, fs_type, start, end))) {
1053
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
1054
			PED_EXCEPTION_CANCEL,
1055
			_("%s : Failed to allocate a partition structure (%llu, %llu)"),
1056
			__func__, start, end))
1057
		{
1058
			case PED_EXCEPTION_CANCEL :
1059
			case PED_EXCEPTION_UNHANDLED :
1060
			default : 
1061
				return NULL;
1062
		}
1063
	}
1064
	
1065
1066
	if (ped_partition_is_active (part)) {
1067
		if (!(part->disk_specific = ped_malloc (PED_SECTOR_SIZE))) {
1068
			switch (ped_exception_throw(PED_EXCEPTION_ERROR,
1069
				PED_EXCEPTION_CANCEL,
1070
				_("%s : Failed to allocate a partition disk_specific block\n"), __func__))
1071
			{
1072
				case PED_EXCEPTION_CANCEL :
1073
				case PED_EXCEPTION_UNHANDLED :
1074
				default : 
1075
					ped_free (part);
1076
					return NULL;
1077
			}
1078
		}
1079
		partition = PART(part->disk_specific);
1080
		memset(partition, -1, sizeof(struct PartitionBlock));
1081
1082
		partition->pb_ID = PED_CPU_TO_BE32(IDNAME_PARTITION);
1083
		partition->pb_SummedLongs = PED_CPU_TO_BE32(64);
1084
		partition->pb_HostID = rdb->rdb_HostID;
1085
		partition->pb_Flags = PED_CPU_TO_BE32(0);
1086
		/* TODO : use a scheme including the device name and the
1087
		 * partition number, if it is possible */
1088
		_amiga_set_bstr("dhx", partition->pb_DriveName, 32);
1089
1090
		partition->de_TableSize = PED_CPU_TO_BE32(19);
1091
		partition->de_SizeBlock = PED_CPU_TO_BE32(128);
1092
		partition->de_SecOrg = PED_CPU_TO_BE32(0);
1093
		partition->de_Surfaces = PED_CPU_TO_BE32(dev->heads);
1094
		partition->de_SectorPerBlock = PED_CPU_TO_BE32(1);
1095
		partition->de_BlocksPerTrack = PED_CPU_TO_BE32(dev->sectors);
1096
		partition->de_Reserved = PED_CPU_TO_BE32(2);
1097
		partition->de_PreAlloc = PED_CPU_TO_BE32(0);
1098
		partition->de_Interleave = PED_CPU_TO_BE32(0);
1099
		partition->de_LowCyl = PED_CPU_TO_BE32(start/cyl);
1100
		partition->de_HighCyl = PED_CPU_TO_BE32((end+1)/cyl-1);
1101
		partition->de_NumBuffers = PED_CPU_TO_BE32(30);
1102
		partition->de_BufMemType = PED_CPU_TO_BE32(0);
1103
		partition->de_MaxTransfer = PED_CPU_TO_BE32(0x7fffffff);
1104
		partition->de_Mask = PED_CPU_TO_BE32(0xffffffff);
1105
		partition->de_BootPri = PED_CPU_TO_BE32(0);
1106
		partition->de_DosType = PED_CPU_TO_BE32(0x4c4e5800);
1107
		partition->de_Baud = PED_CPU_TO_BE32(0);
1108
		partition->de_Control = PED_CPU_TO_BE32(0);
1109
		partition->de_BootBlocks = PED_CPU_TO_BE32(0);
1110
1111
#if (DEBUG_BLOCK & MASTER_DEBUG)
1112
		_amiga_dump_part(partition);
1113
#endif
1114
	} else {
1115
		part->disk_specific = NULL;
1116
	}
1117
	return part;
1118
}
1119
1120
static PedPartition*
1121
amiga_partition_duplicate (const PedPartition* part)
1122
{
1123
	PedPartition *new_part;
1124
	struct PartitionBlock *new_amiga_part;
1125
	struct PartitionBlock *old_amiga_part;
1126
	TRACE();
1127
	PED_ASSERT(part!= NULL, return NULL);
1128
	PED_ASSERT(part->disk!= NULL, return NULL);
1129
	PED_ASSERT(part->disk_specific!= NULL, return NULL);
1130
	old_amiga_part = (struct PartitionBlock *) part->disk_specific;
1131
1132
	new_part = ped_partition_new (part->disk, part->type,
1133
				      part->fs_type, part->geom.start,
1134
				      part->geom.end);
1135
	if (!new_part) {
1136
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
1137
			PED_EXCEPTION_CANCEL,
1138
			_("%s : Failed to allocate a new partition structure\n"), __func__))
1139
		{
1140
			case PED_EXCEPTION_CANCEL :
1141
			case PED_EXCEPTION_UNHANDLED :
1142
			default : 
1143
				return NULL;
1144
		}
1145
	}
1146
1147
	new_amiga_part = (struct PartitionBlock *) new_part->disk_specific;
1148
	memcpy (new_amiga_part, old_amiga_part, 256);
1149
1150
	return new_part;
1151
}
1152
1153
static void
1154
amiga_partition_destroy (PedPartition* part)
1155
{
1156
	TRACE();
1157
	PED_ASSERT (part != NULL, return);
1158
1159
	if (ped_partition_is_active (part)) {
1160
		PED_ASSERT (part->disk_specific!= NULL, return);
1161
		ped_free (part->disk_specific);
1162
	}
1163
	_ped_partition_free (part);
1164
}
1165
1166
static int
1167
amiga_partition_set_system (PedPartition* part, const PedFileSystemType* fs_type)
1168
{
1169
	struct PartitionBlock *partition;
1170
	TRACE();
1171
1172
	PED_ASSERT (part != NULL, return 0);
1173
	PED_ASSERT (part->disk_specific != NULL, return 0);
1174
	partition = PART(part->disk_specific);
1175
1176
	part->fs_type = fs_type;
1177
1178
	if (!fs_type)
1179
		partition->de_DosType = PED_CPU_TO_BE32(0x4c4e5800); /* 'LNX\0' */
1180
	else if (!strcmp (fs_type->name, "ext2"))
1181
		partition->de_DosType = PED_CPU_TO_BE32(0x4c4e5800); /* 'LNX\0' */
1182
	else if (!strcmp (fs_type->name, "ext3"))
1183
		partition->de_DosType = PED_CPU_TO_BE32(0x45585403); /* 'EXT\3' */
1184
	else if (!strcmp (fs_type->name, "linux-swap"))
1185
		partition->de_DosType = PED_CPU_TO_BE32(0x53575000); /* 'SWP\0' */
1186
	else if (!strcmp (fs_type->name, "fat16"))
1187
		partition->de_DosType = PED_CPU_TO_BE32(0x46415400); /* 'FAT\0' */
1188
	else if (!strcmp (fs_type->name, "fat32"))
1189
		partition->de_DosType = PED_CPU_TO_BE32(0x46415401); /* 'FAT\1'*/
1190
	else if (!strcmp (fs_type->name, "hfs"))
1191
		partition->de_DosType = PED_CPU_TO_BE32(0x48465300); /* 'HFS\0' */
1192
	else if (!strcmp (fs_type->name, "jfs"))
1193
		partition->de_DosType = PED_CPU_TO_BE32(0x4a465300); /* 'JFS\0' */
1194
	else if (!strcmp (fs_type->name, "ntfs"))
1195
		partition->de_DosType = PED_CPU_TO_BE32(0x4e544653); /* 'NTFS' */
1196
	else if (!strcmp (fs_type->name, "reiserfs"))
1197
		partition->de_DosType = PED_CPU_TO_BE32(0x52465300); /* 'RFS\0' */
1198
	else if (!strcmp (fs_type->name, "sun-ufs"))
1199
		partition->de_DosType = PED_CPU_TO_BE32(0x53554653); /* 'SUFS' */
1200
	else if (!strcmp (fs_type->name, "hp-ufs"))
1201
		partition->de_DosType = PED_CPU_TO_BE32(0x48554653); /* 'HUFS' */
1202
	else if (!strcmp (fs_type->name, "xfs"))
1203
		partition->de_DosType = PED_CPU_TO_BE32(0x58465300); /* 'XFS\0' */
1204
	else
1205
		partition->de_DosType = PED_CPU_TO_BE32(0x00000000); /* unknown */
1206
	return 1;
1207
}
1208
1209
static int
1210
amiga_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
1211
{
1212
	struct PartitionBlock *partition;
1213
	TRACE();
1214
1215
	PED_ASSERT (part != NULL, return 0);
1216
	PED_ASSERT (part->disk_specific != NULL, return 0);
1217
1218
	partition = PART(part->disk_specific);
1219
1220
	switch (flag) {
1221
		case PED_PARTITION_BOOT:
1222
			if (state) partition->pb_Flags |= PED_CPU_TO_BE32(PBFF_BOOTABLE);
1223
			else partition->pb_Flags &= ~(PED_CPU_TO_BE32(PBFF_BOOTABLE));
1224
			return 1;
1225
		case PED_PARTITION_HIDDEN:
1226
			if (state) partition->pb_Flags |= PED_CPU_TO_BE32(PBFF_NOMOUNT);
1227
			else partition->pb_Flags &= ~(PED_CPU_TO_BE32(PBFF_NOMOUNT));
1228
			return 1;
1229
		default:
1230
			return 0;
1231
	}
1232
}
1233
1234
static int
1235
amiga_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
1236
{
1237
	struct PartitionBlock *partition;
1238
	TRACE();
1239
1240
	PED_ASSERT (part != NULL, return 0);
1241
	PED_ASSERT (part->disk_specific != NULL, return 0);
1242
1243
	partition = PART(part->disk_specific);
1244
1245
	switch (flag) {
1246
		case PED_PARTITION_BOOT:
1247
			return (partition->pb_Flags & PED_CPU_TO_BE32(PBFF_BOOTABLE));
1248
		case PED_PARTITION_HIDDEN:
1249
			return (partition->pb_Flags & PED_CPU_TO_BE32(PBFF_NOMOUNT));
1250
		default:
1251
			return 0;
1252
	}
1253
}
1254
1255
static int
1256
amiga_partition_is_flag_available (const PedPartition* part,
1257
				 PedPartitionFlag flag)
1258
{
1259
	TRACE();
1260
	switch (flag) {
1261
	case PED_PARTITION_BOOT:
1262
	case PED_PARTITION_HIDDEN:
1263
		return 1;
1264
	default:
1265
		return 0;
1266
	}
1267
}
1268
1269
static void             
1270
amiga_partition_set_name (PedPartition* part, const char* name)
1271
{               
1272
	struct PartitionBlock *partition;
1273
	TRACE();
1274
1275
	PED_ASSERT (part != NULL, return);
1276
	PED_ASSERT (part->disk_specific != NULL, return);
1277
1278
	partition = PART(part->disk_specific);
1279
	_amiga_set_bstr(name, partition->pb_DriveName, 32);
1280
}
1281
static const char*
1282
amiga_partition_get_name (const PedPartition* part)
1283
{
1284
	struct PartitionBlock *partition;
1285
	TRACE();
1286
1287
	PED_ASSERT (part != NULL, return 0);
1288
	PED_ASSERT (part->disk_specific != NULL, return 0);
1289
1290
	partition = PART(part->disk_specific);
1291
1292
	return _amiga_get_bstr(partition->pb_DriveName);
1293
}
1294
1295
static PedConstraint*
1296
_amiga_get_constraint (const PedDisk *disk)
1297
{
1298
	PedDevice *dev = disk->dev;
1299
	PedAlignment start_align, end_align;
1300
	PedGeometry max_geom;
1301
	struct RigidDiskBlock *rdb = RDSK(disk->disk_specific);
1302
	PedSector cyl = (PedSector) PED_BE32_TO_CPU(rdb->rdb_Sectors) *
1303
		PED_BE32_TO_CPU(rdb->rdb_Heads);
1304
	PedSector start = ((273 / cyl) + 1) * cyl;
1305
	PedSector length = dev->length - start;
1306
	PedSector max_part = (length / cyl) * cyl;
1307
	TRACE();
1308
1309
	if (!ped_alignment_init(&start_align, 0, cyl)) {
1310
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
1311
			PED_EXCEPTION_CANCEL,
1312
			_("%s : Failed to initialize the start constraint\n"), __func__))
1313
		{
1314
			case PED_EXCEPTION_CANCEL :
1315
			case PED_EXCEPTION_UNHANDLED :
1316
			default : 
1317
				return NULL;
1318
		}
1319
	}
1320
	if (!ped_alignment_init(&end_align, -1, cyl)) {
1321
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
1322
			PED_EXCEPTION_CANCEL,
1323
			_("%s : Failed to initialize the end constraint\n"), __func__))
1324
		{
1325
			case PED_EXCEPTION_CANCEL :
1326
			case PED_EXCEPTION_UNHANDLED :
1327
			default : 
1328
				return NULL;
1329
		}
1330
	}
1331
	if (!ped_geometry_init(&max_geom, dev, start, length)) {
1332
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
1333
			PED_EXCEPTION_CANCEL,
1334
			_("%s : Failed to initialize the max constraint\n"), __func__))
1335
		{
1336
			case PED_EXCEPTION_CANCEL :
1337
			case PED_EXCEPTION_UNHANDLED :
1338
			default : 
1339
				return NULL;
1340
		}
1341
	}
1342
1343
	return ped_constraint_new (&start_align, &end_align,
1344
		&max_geom, &max_geom, cyl, max_part);
1345
}
1346
1347
static void
1348
_amiga_dump_constraint (const PedConstraint* constraint)
1349
{
1350
	DPRINT (DEBUG_CONST, "Align Start : offset = %lld, grain = %lld\n",
1351
		constraint->start_align->offset,
1352
		constraint->start_align->grain_size);
1353
	DPRINT (DEBUG_CONST, "Align End : offset = %lld, grain = %lld\n",
1354
		constraint->end_align->offset,
1355
		constraint->end_align->grain_size);
1356
	DPRINT (DEBUG_CONST, "Range Start : start = %lld, length = %lld, end = %lld\n",
1357
		constraint->start_range->start,
1358
		constraint->start_range->length,
1359
		constraint->start_range->end);
1360
	DPRINT (DEBUG_CONST, "Range End : start = %lld, length = %lld, end = %lld\n",
1361
		constraint->end_range->start,
1362
		constraint->end_range->length,
1363
		constraint->end_range->end);
1364
	DPRINT (DEBUG_CONST, "Size : min = %lld, Max = %lld\n",
1365
		constraint->min_size, constraint->max_size);
1366
}
1367
1368
static int
1369
amiga_partition_align (PedPartition* part, const PedConstraint* constraint)
1370
{
1371
	TRACE();
1372
1373
	PED_ASSERT (part != NULL, return 0);
1374
	PED_ASSERT (part->disk != NULL, return 0);
1375
	
1376
#if (DEBUG_CONST & MASTER_DEBUG)
1377
	_amiga_dump_constraint (constraint);
1378
	_amiga_dump_constraint (_amiga_get_constraint (part->disk));
1379
#endif
1380
	if (_ped_partition_attempt_align (part, constraint,
1381
					  _amiga_get_constraint (part->disk)))
1382
	{
1383
	       	return 1;
1384
	}
1385
1386
#ifndef DISCOVER_ONLY
1387
	ped_exception_throw (
1388
		PED_EXCEPTION_ERROR,
1389
		PED_EXCEPTION_CANCEL,
1390
		_("%s : Unable to satisfy all constraints on the partition."), __func__);
1391
#endif
1392
	return 0;
1393
}
1394
1395
static int
1396
amiga_partition_enumerate (PedPartition* part)
1397
{
1398
	
1399
	int i;
1400
	PedPartition* p;
1401
	TRACE();
1402
	
1403
	PED_ASSERT (part != NULL, return 0);
1404
	PED_ASSERT (part->disk != NULL, return 0);
1405
1406
	/* never change the partition numbers */
1407
	if (part->num != -1)
1408
		return 1;
1409
	for (i = 1; i <= AMIGA_MAX_PARTITIONS; i++) {
1410
		p = ped_disk_get_partition (part->disk, i);
1411
		if (!p) {
1412
			part->num = i;
1413
			return 1;
1414
		}
1415
	}
1416
1417
	/* failed to allocate a number */
1418
#ifndef DISCOVER_ONLY
1419
	ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
1420
			     _("%s : Unable to allocate a partition"), __func__);
1421
#endif
1422
	return 0;
1423
}
1424
1425
static int
1426
amiga_alloc_metadata (PedDisk* disk)
1427
{
1428
	PedPartition*		new_part;
1429
	PedConstraint*		constraint_any = NULL;
1430
	PedSector		highest_block;
1431
	TRACE();
1432
1433
	PED_ASSERT (disk != NULL, goto error);
1434
	PED_ASSERT (disk->dev != NULL, goto error);
1435
1436
	constraint_any = ped_constraint_any (disk->dev);
1437
1438
	/* Allocate space for the RDB */
1439
	new_part = ped_partition_new (disk, PED_PARTITION_METADATA, NULL, 0, MAX_RDB_BLOCK);
1440
	if (!new_part)
1441
		goto error;
1442
1443
	if (!ped_disk_add_partition (disk, new_part, constraint_any)) {
1444
		ped_partition_destroy (new_part);
1445
		goto error;
1446
	}
1447
1448
	ped_constraint_destroy (constraint_any);
1449
	return 1;
1450
error:
1451
	ped_constraint_destroy (constraint_any);
1452
	return 0;
1453
}
1454
1455
static int
1456
amiga_get_max_primary_partition_count (const PedDisk* disk)
1457
{
1458
	TRACE();
1459
	return AMIGA_MAX_PARTITIONS;
1460
}
1461
1462
static PedDiskOps amiga_disk_ops = {
1463
	probe:			amiga_probe,
1464
#ifndef DISCOVER_ONLY
1465
	clobber:		amiga_clobber,
1466
#else
1467
	clobber:		NULL,
1468
#endif
1469
	alloc:			amiga_alloc,
1470
	duplicate:		amiga_duplicate,
1471
	free:			amiga_free,
1472
	read:			amiga_read,
1473
#ifndef DISCOVER_ONLY
1474
	write:			amiga_write,
1475
#else
1476
	write:			NULL,
1477
#endif
1478
1479
	partition_new:		amiga_partition_new,
1480
	partition_duplicate:	amiga_partition_duplicate,
1481
	partition_destroy:	amiga_partition_destroy,
1482
	partition_set_system:	amiga_partition_set_system,
1483
	partition_set_flag:	amiga_partition_set_flag,
1484
	partition_get_flag:	amiga_partition_get_flag,
1485
	partition_is_flag_available:
1486
				amiga_partition_is_flag_available,
1487
	partition_set_name:	amiga_partition_set_name,
1488
	partition_get_name:	amiga_partition_get_name,
1489
	partition_align:	amiga_partition_align,
1490
	partition_enumerate:	amiga_partition_enumerate,
1491
1492
1493
	alloc_metadata:		amiga_alloc_metadata,
1494
	get_max_primary_partition_count:
1495
				amiga_get_max_primary_partition_count
1496
};
1497
1498
static PedDiskType amiga_disk_type = {
1499
	next:		NULL,
1500
	name:		"amiga",
1501
	ops:		&amiga_disk_ops,
1502
	features:	PED_DISK_TYPE_PARTITION_NAME
1503
};
1504
1505
void
1506
ped_disk_amiga_init ()
1507
{
1508
	TRACE();
1509
	PED_ASSERT(sizeof(struct AmigaBlock) != 3, return);
1510
	PED_ASSERT(sizeof(struct RigidDiskBlock) != 64, return);
1511
	PED_ASSERT(sizeof(struct PartitionBlock) != 64, return);
1512
	PED_ASSERT(sizeof(struct LinkedBlock) != 5, return);
1513
	PED_ASSERT(sizeof(struct Linked2Block) != 18, return);
1514
1515
	ped_register_disk_type (&amiga_disk_type);
1516
}
1517
1518
void
1519
ped_disk_amiga_done ()
1520
{
1521
	TRACE();
1522
1523
	ped_unregister_disk_type (&amiga_disk_type);
1524
}
(-)parted-1.6.9.orig/libparted/fs_amiga/Makefile.am (+14 lines)
Line 0 Link Here
1
partedincludedir      =	-I$(top_srcdir)/include
2
3
noinst_LTLIBRARIES    =	libamigafs.la
4
libamigafs_la_SOURCES    =	amiga.h		\
5
			amiga.c		\
6
			affs.h		\
7
			affs.c		\
8
			asfs.h		\
9
			asfs.c		\
10
			apfs.h		\
11
			apfs.c		\
12
			interface.c
13
14
INCLUDES = $(partedincludedir) @INTLINCS@
(-)parted-1.6.9.orig/libparted/fs_amiga/Makefile.in (+445 lines)
Line 0 Link Here
1
# Makefile.in generated by automake 1.7.9 from Makefile.am.
2
# @configure_input@
3
4
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
5
# Free Software Foundation, Inc.
6
# This Makefile.in is free software; the Free Software Foundation
7
# gives unlimited permission to copy and/or distribute it,
8
# with or without modifications, as long as this notice is preserved.
9
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13
# PARTICULAR PURPOSE.
14
15
@SET_MAKE@
16
17
srcdir = @srcdir@
18
top_srcdir = @top_srcdir@
19
VPATH = @srcdir@
20
pkgdatadir = $(datadir)/@PACKAGE@
21
pkglibdir = $(libdir)/@PACKAGE@
22
pkgincludedir = $(includedir)/@PACKAGE@
23
top_builddir = ../..
24
25
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
26
INSTALL = @INSTALL@
27
install_sh_DATA = $(install_sh) -c -m 644
28
install_sh_PROGRAM = $(install_sh) -c
29
install_sh_SCRIPT = $(install_sh) -c
30
INSTALL_HEADER = $(INSTALL_DATA)
31
transform = $(program_transform_name)
32
NORMAL_INSTALL = :
33
PRE_INSTALL = :
34
POST_INSTALL = :
35
NORMAL_UNINSTALL = :
36
PRE_UNINSTALL = :
37
POST_UNINSTALL = :
38
host_triplet = @host@
39
ACLOCAL = @ACLOCAL@
40
AMDEP_FALSE = @AMDEP_FALSE@
41
AMDEP_TRUE = @AMDEP_TRUE@
42
AMTAR = @AMTAR@
43
AR = @AR@
44
AUTOCONF = @AUTOCONF@
45
AUTOHEADER = @AUTOHEADER@
46
AUTOMAKE = @AUTOMAKE@
47
AWK = @AWK@
48
CC = @CC@
49
CCDEPMODE = @CCDEPMODE@
50
CFLAGS = @CFLAGS@
51
CPP = @CPP@
52
CPPFLAGS = @CPPFLAGS@
53
CXX = @CXX@
54
CXXCPP = @CXXCPP@
55
CXXDEPMODE = @CXXDEPMODE@
56
CXXFLAGS = @CXXFLAGS@
57
CYGPATH_W = @CYGPATH_W@
58
DEFS = @DEFS@
59
DEPDIR = @DEPDIR@
60
ECHO = @ECHO@
61
ECHO_C = @ECHO_C@
62
ECHO_N = @ECHO_N@
63
ECHO_T = @ECHO_T@
64
EGREP = @EGREP@
65
EXEEXT = @EXEEXT@
66
F77 = @F77@
67
FFLAGS = @FFLAGS@
68
GMSGFMT = @GMSGFMT@
69
INSTALL_DATA = @INSTALL_DATA@
70
INSTALL_PROGRAM = @INSTALL_PROGRAM@
71
INSTALL_SCRIPT = @INSTALL_SCRIPT@
72
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
73
INTLINCS = @INTLINCS@
74
INTLLIBS = @INTLLIBS@
75
LDFLAGS = @LDFLAGS@
76
LIBICONV = @LIBICONV@
77
LIBINTL = @LIBINTL@
78
LIBOBJS = @LIBOBJS@
79
LIBS = @LIBS@
80
LIBTOOL = @LIBTOOL@
81
LN_S = @LN_S@
82
LTLIBICONV = @LTLIBICONV@
83
LTLIBINTL = @LTLIBINTL@
84
LTLIBOBJS = @LTLIBOBJS@
85
LT_AGE = @LT_AGE@
86
LT_CURRENT = @LT_CURRENT@
87
LT_RELEASE = @LT_RELEASE@
88
LT_REVISION = @LT_REVISION@
89
MAKEINFO = @MAKEINFO@
90
MKINSTALLDIRS = @MKINSTALLDIRS@
91
MSGFMT = @MSGFMT@
92
MSGMERGE = @MSGMERGE@
93
OBJEXT = @OBJEXT@
94
OS = @OS@
95
OS_LIBS = @OS_LIBS@
96
PACKAGE = @PACKAGE@
97
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
98
PACKAGE_NAME = @PACKAGE_NAME@
99
PACKAGE_STRING = @PACKAGE_STRING@
100
PACKAGE_TARNAME = @PACKAGE_TARNAME@
101
PACKAGE_VERSION = @PACKAGE_VERSION@
102
PARTEDLDFLAGS = @PARTEDLDFLAGS@
103
PARTED_LIBS = @PARTED_LIBS@
104
PATH_SEPARATOR = @PATH_SEPARATOR@
105
POSUB = @POSUB@
106
RANLIB = @RANLIB@
107
REISER_LIBS = @REISER_LIBS@
108
SET_MAKE = @SET_MAKE@
109
SHELL = @SHELL@
110
STRIP = @STRIP@
111
USE_NLS = @USE_NLS@
112
UUID_LIBS = @UUID_LIBS@
113
VERSION = @VERSION@
114
XGETTEXT = @XGETTEXT@
115
ac_ct_AR = @ac_ct_AR@
116
ac_ct_CC = @ac_ct_CC@
117
ac_ct_CXX = @ac_ct_CXX@
118
ac_ct_F77 = @ac_ct_F77@
119
ac_ct_RANLIB = @ac_ct_RANLIB@
120
ac_ct_STRIP = @ac_ct_STRIP@
121
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
122
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
123
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
124
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
125
am__include = @am__include@
126
am__leading_dot = @am__leading_dot@
127
am__quote = @am__quote@
128
bindir = @bindir@
129
build = @build@
130
build_alias = @build_alias@
131
build_cpu = @build_cpu@
132
build_os = @build_os@
133
build_vendor = @build_vendor@
134
datadir = @datadir@
135
exec_prefix = @exec_prefix@
136
host = @host@
137
host_alias = @host_alias@
138
host_cpu = @host_cpu@
139
host_os = @host_os@
140
host_vendor = @host_vendor@
141
includedir = @includedir@
142
infodir = @infodir@
143
install_sh = @install_sh@
144
libdir = @libdir@
145
libexecdir = @libexecdir@
146
localstatedir = @localstatedir@
147
mandir = @mandir@
148
oldincludedir = @oldincludedir@
149
prefix = @prefix@
150
program_transform_name = @program_transform_name@
151
sbindir = @sbindir@
152
sharedstatedir = @sharedstatedir@
153
sysconfdir = @sysconfdir@
154
target_alias = @target_alias@
155
partedincludedir = -I$(top_srcdir)/include
156
157
noinst_LTLIBRARIES = libamigafs.la
158
libext2_la_SOURCES = amiga.h		\
159
			amiga.c		\
160
			affs.h		\
161
			affs.c		\
162
			asfs.h		\
163
			asfs.c		\
164
			apfs.h		\
165
			apfs.c		\
166
			interface.c
167
168
169
INCLUDES = $(partedincludedir) @INTLINCS@
170
subdir = libparted/fs_amiga
171
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
172
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
173
CONFIG_HEADER = $(top_builddir)/config.h
174
CONFIG_CLEAN_FILES =
175
LTLIBRARIES = $(noinst_LTLIBRARIES)
176
177
libamigafs_la_LDFLAGS =
178
libamigafs_la_LIBADD =
179
libamigafs_la_SOURCES = libamigafs.la.c
180
libamigafs_la_OBJECTS = libamigafs.la.lo
181
182
DEFAULT_INCLUDES =  -I. -I$(srcdir) -I$(top_builddir)
183
depcomp = $(SHELL) $(top_srcdir)/depcomp
184
am__depfiles_maybe = depfiles
185
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/libamigafs.la.Plo
186
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
187
	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
188
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
189
	$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
190
CCLD = $(CC)
191
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
192
	$(AM_LDFLAGS) $(LDFLAGS) -o $@
193
DIST_SOURCES = libamigafs.la.c
194
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
195
SOURCES = libamigafs.la.c
196
197
all: all-am
198
199
.SUFFIXES:
200
.SUFFIXES: .c .lo .o .obj
201
$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
202
	cd $(top_srcdir) && \
203
	  $(AUTOMAKE) --gnu  libparted/fs_amiga/Makefile
204
Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
205
	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
206
207
clean-noinstLTLIBRARIES:
208
	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
209
	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
210
	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
211
	  test "$$dir" = "$$p" && dir=.; \
212
	  echo "rm -f \"$${dir}/so_locations\""; \
213
	  rm -f "$${dir}/so_locations"; \
214
	done
215
libamigafs.la: $(libamigafs_la_OBJECTS) $(libamigafs_la_DEPENDENCIES) 
216
	$(LINK)  $(libamigafs_la_LDFLAGS) $(libamigafs_la_OBJECTS) $(libamigafs_la_LIBADD) $(LIBS)
217
218
mostlyclean-compile:
219
	-rm -f *.$(OBJEXT) core *.core
220
221
distclean-compile:
222
	-rm -f *.tab.c
223
224
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamigafs.la.Plo@am__quote@
225
226
.c.o:
227
@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
228
@am__fastdepCC_TRUE@	  -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
229
@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
230
@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
231
@am__fastdepCC_TRUE@	fi
232
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
233
@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
234
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
235
@am__fastdepCC_FALSE@	$(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
236
237
.c.obj:
238
@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
239
@am__fastdepCC_TRUE@	  -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
240
@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
241
@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
242
@am__fastdepCC_TRUE@	fi
243
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
244
@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
245
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
246
@am__fastdepCC_FALSE@	$(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
247
248
.c.lo:
249
@am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
250
@am__fastdepCC_TRUE@	  -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
251
@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
252
@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
253
@am__fastdepCC_TRUE@	fi
254
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
255
@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
256
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
257
@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
258
259
mostlyclean-libtool:
260
	-rm -f *.lo
261
262
clean-libtool:
263
	-rm -rf .libs _libs
264
265
distclean-libtool:
266
	-rm -f libtool
267
uninstall-info-am:
268
269
ETAGS = etags
270
ETAGSFLAGS =
271
272
CTAGS = ctags
273
CTAGSFLAGS =
274
275
tags: TAGS
276
277
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
278
	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
279
	unique=`for i in $$list; do \
280
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
281
	  done | \
282
	  $(AWK) '    { files[$$0] = 1; } \
283
	       END { for (i in files) print i; }'`; \
284
	mkid -fID $$unique
285
286
TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
287
		$(TAGS_FILES) $(LISP)
288
	tags=; \
289
	here=`pwd`; \
290
	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
291
	unique=`for i in $$list; do \
292
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
293
	  done | \
294
	  $(AWK) '    { files[$$0] = 1; } \
295
	       END { for (i in files) print i; }'`; \
296
	test -z "$(ETAGS_ARGS)$$tags$$unique" \
297
	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
298
	     $$tags $$unique
299
300
ctags: CTAGS
301
CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
302
		$(TAGS_FILES) $(LISP)
303
	tags=; \
304
	here=`pwd`; \
305
	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
306
	unique=`for i in $$list; do \
307
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
308
	  done | \
309
	  $(AWK) '    { files[$$0] = 1; } \
310
	       END { for (i in files) print i; }'`; \
311
	test -z "$(CTAGS_ARGS)$$tags$$unique" \
312
	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
313
	     $$tags $$unique
314
315
GTAGS:
316
	here=`$(am__cd) $(top_builddir) && pwd` \
317
	  && cd $(top_srcdir) \
318
	  && gtags -i $(GTAGS_ARGS) $$here
319
320
distclean-tags:
321
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
322
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
323
324
top_distdir = ../..
325
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
326
327
distdir: $(DISTFILES)
328
	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
329
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
330
	list='$(DISTFILES)'; for file in $$list; do \
331
	  case $$file in \
332
	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
333
	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
334
	  esac; \
335
	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
336
	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
337
	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
338
	    dir="/$$dir"; \
339
	    $(mkinstalldirs) "$(distdir)$$dir"; \
340
	  else \
341
	    dir=''; \
342
	  fi; \
343
	  if test -d $$d/$$file; then \
344
	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
345
	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
346
	    fi; \
347
	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
348
	  else \
349
	    test -f $(distdir)/$$file \
350
	    || cp -p $$d/$$file $(distdir)/$$file \
351
	    || exit 1; \
352
	  fi; \
353
	done
354
check-am: all-am
355
check: check-am
356
all-am: Makefile $(LTLIBRARIES)
357
358
installdirs:
359
install: install-am
360
install-exec: install-exec-am
361
install-data: install-data-am
362
uninstall: uninstall-am
363
364
install-am: all-am
365
	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
366
367
installcheck: installcheck-am
368
install-strip:
369
	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
370
	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
371
	  `test -z '$(STRIP)' || \
372
	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
373
mostlyclean-generic:
374
375
clean-generic:
376
377
distclean-generic:
378
	-rm -f $(CONFIG_CLEAN_FILES)
379
380
maintainer-clean-generic:
381
	@echo "This command is intended for maintainers to use"
382
	@echo "it deletes files that may require special tools to rebuild."
383
clean: clean-am
384
385
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
386
	mostlyclean-am
387
388
distclean: distclean-am
389
	-rm -rf ./$(DEPDIR)
390
	-rm -f Makefile
391
distclean-am: clean-am distclean-compile distclean-generic \
392
	distclean-libtool distclean-tags
393
394
dvi: dvi-am
395
396
dvi-am:
397
398
info: info-am
399
400
info-am:
401
402
install-data-am:
403
404
install-exec-am:
405
406
install-info: install-info-am
407
408
install-man:
409
410
installcheck-am:
411
412
maintainer-clean: maintainer-clean-am
413
	-rm -rf ./$(DEPDIR)
414
	-rm -f Makefile
415
maintainer-clean-am: distclean-am maintainer-clean-generic
416
417
mostlyclean: mostlyclean-am
418
419
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
420
	mostlyclean-libtool
421
422
pdf: pdf-am
423
424
pdf-am:
425
426
ps: ps-am
427
428
ps-am:
429
430
uninstall-am: uninstall-info-am
431
432
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
433
	clean-libtool clean-noinstLTLIBRARIES ctags distclean \
434
	distclean-compile distclean-generic distclean-libtool \
435
	distclean-tags distdir dvi dvi-am info info-am install \
436
	install-am install-data install-data-am install-exec \
437
	install-exec-am install-info install-info-am install-man \
438
	install-strip installcheck installcheck-am installdirs \
439
	maintainer-clean maintainer-clean-generic mostlyclean \
440
	mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \
441
	pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
442
443
# Tell versions [3.59,3.63) of GNU make to not export all variables.
444
# Otherwise a system limit (for SysV at least) may be exceeded.
445
.NOEXPORT:
(-)parted-1.6.9.orig/libparted/fs_amiga/affs.c (+447 lines)
Line 0 Link Here
1
/*
2
    affs.c -- parted suppoer for affs filesystems
3
    Copyright (C) 1998-2000 Free Software Foundation, Inc.
4
  
5
    This program is free software; you can redistribute it and/or modify
6
    it under the terms of the GNU General Public License as published by
7
    the Free Software Foundation; either version 2 of the License, or
8
    (at your option) any later version.
9
10
    This program is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
    GNU General Public License for more details.
14
15
    You should have received a copy of the GNU General Public License
16
    along with this program; if not, write to the Free Software
17
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
*/
19
20
#include "config.h"
21
22
#include <stdlib.h>
23
#include <string.h>
24
#include <parted/parted.h>
25
#include <parted/debug.h>
26
#include <parted/endian.h>
27
28
#include "amiga.h"
29
#include "affs.h"
30
31
#if ENABLE_NLS
32
#  include <libintl.h>
33
#  define _(String) dgettext (PACKAGE, String)
34
#else
35
#  define _(String) (String)
36
#endif /* ENABLE_NLS */
37
38
static int
39
_affs_probe_root (uint32_t *block, int blocksize) {
40
	int i;
41
	uint32_t sum;
42
43
	if (PED_BE32_TO_CPU (block[0]) != 2) return 0;
44
	if (PED_BE32_TO_CPU (block[128*blocksize-1]) != 1) return 0;
45
	for (i = 0, sum = 0; i < 128*blocksize; i++)
46
		sum += PED_BE32_TO_CPU (block[i]);
47
	if (sum) return 0;
48
	return 1;
49
}
50
51
static PedGeometry*
52
_generic_affs_probe (PedGeometry* geom, uint32_t kind)
53
{
54
	uint32_t *block;
55
	int32_t i;
56
	PedSector root, len, pos;
57
	struct PartitionBlock * part;
58
	int blocksize = 1, reserved = 2, prealloc = 0;
59
60
	PED_ASSERT (geom != NULL, return NULL);
61
	PED_ASSERT (geom->dev != NULL, return NULL);
62
63
	/* Finds the blocksize, prealloc and reserved values of the partition block */
64
	if (!(part = ped_malloc (PED_SECTOR_SIZE*blocksize))) {
65
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
66
			_("%s : Failed to allocate partition block\n"), __func__);
67
		goto error_part;
68
	}
69
	if (amiga_find_part(geom, part) != NULL) {
70
		prealloc = PED_BE32_TO_CPU (part->de_PreAlloc);
71
		reserved = PED_BE32_TO_CPU (part->de_Reserved);
72
		reserved = reserved == 0 ? 1 : reserved;
73
		blocksize = PED_BE32_TO_CPU (part->de_SizeBlock)
74
			* PED_BE32_TO_CPU (part->de_SectorPerBlock) / 128;
75
	}
76
	ped_free (part);
77
78
	/* Test boot block */
79
	if (!(block = ped_malloc (PED_SECTOR_SIZE*blocksize))) {
80
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
81
			_("%s : Failed to allocate block\n"), __func__);
82
		goto error_block;
83
	}
84
	if (!ped_device_read (geom->dev, block, geom->start, blocksize)) {
85
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
86
			_("%s : Couldn't read boot block %llu\n"), __func__, geom->start);
87
		goto error;
88
	}
89
	if (PED_BE32_TO_CPU (block[0]) != kind) {
90
		goto error;
91
	}
92
93
	/* Find and test the root block */
94
	len = geom->length / blocksize - reserved;
95
	pos = (len - 1) / 2;
96
	root = geom->start + (pos + reserved) * blocksize;
97
	printf ("Pralloc = %d, Reserved = %d, blocksize = %d, root block at %llu\n",
98
		prealloc, reserved, blocksize, root);
99
100
	if (!ped_device_read (geom->dev, block, root, blocksize)) {
101
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
102
			_("%s : Couldn't read root block %llu\n"), __func__, root);
103
		goto error;
104
	}
105
	if (_affs_probe_root(block, blocksize) == 1) {
106
		ped_free (block);
107
		return ped_geometry_duplicate (geom);
108
	}
109
110
error:
111
	ped_free (block);
112
error_block:
113
error_part:
114
	return NULL;
115
}
116
static PedGeometry*
117
_affs0_probe (PedGeometry* geom) {
118
	return _generic_affs_probe (geom, 0x444f5300);
119
}
120
static PedGeometry*
121
_affs1_probe (PedGeometry* geom) {
122
	return _generic_affs_probe (geom, 0x444f5301);
123
}
124
static PedGeometry*
125
_affs2_probe (PedGeometry* geom) {
126
	return _generic_affs_probe (geom, 0x444f5302);
127
}
128
static PedGeometry*
129
_affs3_probe (PedGeometry* geom) {
130
	return _generic_affs_probe (geom, 0x444f5303);
131
}
132
static PedGeometry*
133
_affs4_probe (PedGeometry* geom) {
134
	return _generic_affs_probe (geom, 0x444f5304);
135
}
136
static PedGeometry*
137
_affs5_probe (PedGeometry* geom) {
138
	return _generic_affs_probe (geom, 0x444f5305);
139
}
140
static PedGeometry*
141
_affs6_probe (PedGeometry* geom) {
142
	return _generic_affs_probe (geom, 0x444f5306);
143
}
144
static PedGeometry*
145
_affs7_probe (PedGeometry* geom) {
146
	return _generic_affs_probe (geom, 0x444f5307);
147
}
148
static PedGeometry*
149
_amufs_probe (PedGeometry* geom) {
150
	return _generic_affs_probe (geom, 0x6d754653);
151
}
152
static PedGeometry*
153
_amufs0_probe (PedGeometry* geom) {
154
	return _generic_affs_probe (geom, 0x6d754600);
155
}
156
static PedGeometry*
157
_amufs1_probe (PedGeometry* geom) {
158
	return _generic_affs_probe (geom, 0x6d754601);
159
}
160
static PedGeometry*
161
_amufs2_probe (PedGeometry* geom) {
162
	return _generic_affs_probe (geom, 0x6d754602);
163
}
164
static PedGeometry*
165
_amufs3_probe (PedGeometry* geom) {
166
	return _generic_affs_probe (geom, 0x6d754603);
167
}
168
static PedGeometry*
169
_amufs4_probe (PedGeometry* geom) {
170
	return _generic_affs_probe (geom, 0x6d754604);
171
}
172
static PedGeometry*
173
_amufs5_probe (PedGeometry* geom) {
174
	return _generic_affs_probe (geom, 0x6d754605);
175
}
176
177
static PedFileSystemOps _affs0_ops = {
178
	probe:		_affs0_probe,
179
	clobber:	NULL,
180
	open:		NULL,
181
	create:         NULL,
182
	close:		NULL,
183
	check:          NULL,
184
	resize:		NULL,
185
	copy:           NULL,
186
	get_create_constraint:	NULL,
187
	get_copy_constraint:	NULL,
188
	get_resize_constraint:	NULL
189
};
190
static PedFileSystemOps _affs1_ops = {
191
	probe:		_affs1_probe,
192
	clobber:	NULL,
193
	open:		NULL,
194
	create:         NULL,
195
	close:		NULL,
196
	check:          NULL,
197
	resize:		NULL,
198
	copy:           NULL,
199
	get_create_constraint:	NULL,
200
	get_copy_constraint:	NULL,
201
	get_resize_constraint:	NULL
202
};
203
static PedFileSystemOps _affs2_ops = {
204
	probe:		_affs2_probe,
205
	clobber:	NULL,
206
	open:		NULL,
207
	create:         NULL,
208
	close:		NULL,
209
	check:          NULL,
210
	resize:		NULL,
211
	copy:           NULL,
212
	get_create_constraint:	NULL,
213
	get_copy_constraint:	NULL,
214
	get_resize_constraint:	NULL
215
};
216
static PedFileSystemOps _affs3_ops = {
217
	probe:		_affs3_probe,
218
	clobber:	NULL,
219
	open:		NULL,
220
	create:         NULL,
221
	close:		NULL,
222
	check:          NULL,
223
	resize:		NULL,
224
	copy:           NULL,
225
	get_create_constraint:	NULL,
226
	get_copy_constraint:	NULL,
227
	get_resize_constraint:	NULL
228
};
229
static PedFileSystemOps _affs4_ops = {
230
	probe:		_affs4_probe,
231
	clobber:	NULL,
232
	open:		NULL,
233
	create:         NULL,
234
	close:		NULL,
235
	check:          NULL,
236
	resize:		NULL,
237
	copy:           NULL,
238
	get_create_constraint:	NULL,
239
	get_copy_constraint:	NULL,
240
	get_resize_constraint:	NULL
241
};
242
static PedFileSystemOps _affs5_ops = {
243
	probe:		_affs5_probe,
244
	clobber:	NULL,
245
	open:		NULL,
246
	create:         NULL,
247
	close:		NULL,
248
	check:          NULL,
249
	resize:		NULL,
250
	copy:           NULL,
251
	get_create_constraint:	NULL,
252
	get_copy_constraint:	NULL,
253
	get_resize_constraint:	NULL
254
};
255
static PedFileSystemOps _affs6_ops = {
256
	probe:		_affs6_probe,
257
	clobber:	NULL,
258
	open:		NULL,
259
	create:         NULL,
260
	close:		NULL,
261
	check:          NULL,
262
	resize:		NULL,
263
	copy:           NULL,
264
	get_create_constraint:	NULL,
265
	get_copy_constraint:	NULL,
266
	get_resize_constraint:	NULL
267
};
268
static PedFileSystemOps _affs7_ops = {
269
	probe:		_affs7_probe,
270
	clobber:	NULL,
271
	open:		NULL,
272
	create:         NULL,
273
	close:		NULL,
274
	check:          NULL,
275
	resize:		NULL,
276
	copy:           NULL,
277
	get_create_constraint:	NULL,
278
	get_copy_constraint:	NULL,
279
	get_resize_constraint:	NULL
280
};
281
static PedFileSystemOps _amufs_ops = {
282
	probe:		_amufs_probe,
283
	clobber:	NULL,
284
	open:		NULL,
285
	create:         NULL,
286
	close:		NULL,
287
	check:          NULL,
288
	resize:		NULL,
289
	copy:           NULL,
290
	get_create_constraint:	NULL,
291
	get_copy_constraint:	NULL,
292
	get_resize_constraint:	NULL
293
};
294
static PedFileSystemOps _amufs0_ops = {
295
	probe:		_amufs0_probe,
296
	clobber:	NULL,
297
	open:		NULL,
298
	create:         NULL,
299
	close:		NULL,
300
	check:          NULL,
301
	resize:		NULL,
302
	copy:           NULL,
303
	get_create_constraint:	NULL,
304
	get_copy_constraint:	NULL,
305
	get_resize_constraint:	NULL
306
};
307
static PedFileSystemOps _amufs1_ops = {
308
	probe:		_amufs1_probe,
309
	clobber:	NULL,
310
	open:		NULL,
311
	create:         NULL,
312
	close:		NULL,
313
	check:          NULL,
314
	resize:		NULL,
315
	copy:           NULL,
316
	get_create_constraint:	NULL,
317
	get_copy_constraint:	NULL,
318
	get_resize_constraint:	NULL
319
};
320
static PedFileSystemOps _amufs2_ops = {
321
	probe:		_amufs2_probe,
322
	clobber:	NULL,
323
	open:		NULL,
324
	create:         NULL,
325
	close:		NULL,
326
	check:          NULL,
327
	resize:		NULL,
328
	copy:           NULL,
329
	get_create_constraint:	NULL,
330
	get_copy_constraint:	NULL,
331
	get_resize_constraint:	NULL
332
};
333
static PedFileSystemOps _amufs3_ops = {
334
	probe:		_amufs3_probe,
335
	clobber:	NULL,
336
	open:		NULL,
337
	create:         NULL,
338
	close:		NULL,
339
	check:          NULL,
340
	resize:		NULL,
341
	copy:           NULL,
342
	get_create_constraint:	NULL,
343
	get_copy_constraint:	NULL,
344
	get_resize_constraint:	NULL
345
};
346
static PedFileSystemOps _amufs4_ops = {
347
	probe:		_amufs4_probe,
348
	clobber:	NULL,
349
	open:		NULL,
350
	create:         NULL,
351
	close:		NULL,
352
	check:          NULL,
353
	resize:		NULL,
354
	copy:           NULL,
355
	get_create_constraint:	NULL,
356
	get_copy_constraint:	NULL,
357
	get_resize_constraint:	NULL
358
};
359
static PedFileSystemOps _amufs5_ops = {
360
	probe:		_amufs5_probe,
361
	clobber:	NULL,
362
	open:		NULL,
363
	create:         NULL,
364
	close:		NULL,
365
	check:          NULL,
366
	resize:		NULL,
367
	copy:           NULL,
368
	get_create_constraint:	NULL,
369
	get_copy_constraint:	NULL,
370
	get_resize_constraint:	NULL
371
};
372
373
PedFileSystemType _affs0_type = {
374
       next:		 NULL,
375
       ops:		 &_affs0_ops,
376
       name:		 "affs0"
377
};
378
PedFileSystemType _affs1_type = {
379
       next:		 NULL,
380
       ops:		 &_affs1_ops,
381
       name:		 "affs1"
382
};
383
PedFileSystemType _affs2_type = {
384
       next:		 NULL,
385
       ops:		 &_affs2_ops,
386
       name:		 "affs2"
387
};
388
PedFileSystemType _affs3_type = {
389
       next:		 NULL,
390
       ops:		 &_affs3_ops,
391
       name:		 "affs3"
392
};
393
PedFileSystemType _affs4_type = {
394
       next:		 NULL,
395
       ops:		 &_affs4_ops,
396
       name:		 "affs4"
397
};
398
PedFileSystemType _affs5_type = {
399
       next:		 NULL,
400
       ops:		 &_affs5_ops,
401
       name:		 "affs5"
402
};
403
PedFileSystemType _affs6_type = {
404
       next:		 NULL,
405
       ops:		 &_affs6_ops,
406
       name:		 "affs6"
407
};
408
PedFileSystemType _affs7_type = {
409
       next:		 NULL,
410
       ops:		 &_affs7_ops,
411
       name:		 "affs7"
412
};
413
PedFileSystemType _amufs_type = {
414
       next:		 NULL,
415
       ops:		 &_amufs_ops,
416
       name:		 "amufs"
417
};
418
PedFileSystemType _amufs0_type = {
419
       next:		 NULL,
420
       ops:		 &_amufs0_ops,
421
       name:		 "amufs0"
422
};
423
PedFileSystemType _amufs1_type = {
424
       next:		 NULL,
425
       ops:		 &_amufs1_ops,
426
       name:		 "amufs1"
427
};
428
PedFileSystemType _amufs2_type = {
429
       next:		 NULL,
430
       ops:		 &_amufs2_ops,
431
       name:		 "amufs2"
432
};
433
PedFileSystemType _amufs3_type = {
434
       next:		 NULL,
435
       ops:		 &_amufs3_ops,
436
       name:		 "amufs3"
437
};
438
PedFileSystemType _amufs4_type = {
439
       next:		 NULL,
440
       ops:		 &_amufs4_ops,
441
       name:		 "amufs4"
442
};
443
PedFileSystemType _amufs5_type = {
444
       next:		 NULL,
445
       ops:		 &_amufs5_ops,
446
       name:		 "amufs5"
447
};
(-)parted-1.6.9.orig/libparted/fs_amiga/affs.h (+20 lines)
Line 0 Link Here
1
2
/*
3
    affs.h -- parted suppoer for affs filesystems header files
4
    Copyright (C) 1998-2000 Free Software Foundation, Inc.
5
  
6
    This program is free software; you can redistribute it and/or modify
7
    it under the terms of the GNU General Public License as published by
8
    the Free Software Foundation; either version 2 of the License, or
9
    (at your option) any later version.
10
11
    This program is distributed in the hope that it will be useful,
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
    GNU General Public License for more details.
15
16
    You should have received a copy of the GNU General Public License
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
*/
20
(-)parted-1.6.9.orig/libparted/fs_amiga/amiga.c (+382 lines)
Line 0 Link Here
1
/* 
2
    libparted/fs_amiga - amiga filesystem support.
3
    Copyright (C) 2000, 2001 Free Software Foundation, Inc.
4
5
    This program is free software; you can redistribute it and/or modify
6
    it under the terms of the GNU General Public License as published by
7
    the Free Software Foundation; either version 2 of the License, or
8
    (at your option) any later version.
9
10
    This program is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
    GNU General Public License for more details.
14
15
    You should have received a copy of the GNU General Public License
16
    along with this program; if not, write to the Free Software
17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
19
    Contributor:  Sven Luther <luther@debian.org>
20
*/
21
22
#include <string.h>
23
#include <parted/parted.h>
24
#include <parted/debug.h>
25
#include <parted/endian.h>
26
27
#include "amiga.h"
28
29
#if ENABLE_NLS
30
#  include <libintl.h>
31
#  define _(String) dgettext (PACKAGE, String)
32
#else
33
#  define _(String) (String)
34
#endif /* ENABLE_NLS */
35
36
/* String manipulation */
37
static void _amiga_set_bstr (const char *cstr, char *bstr, int maxsize) {
38
	int size = strlen (cstr);
39
	int i;
40
41
	if (size >= maxsize) return;
42
	bstr[0] = size;
43
	for (i = 0; i<size; i++) bstr[i+1] = cstr[i];
44
}
45
static const char * _amiga_get_bstr (char * bstr) {
46
	char * cstr = bstr + 1;
47
	int size = bstr[0];
48
	
49
	cstr[size] = '\0';
50
	return cstr;
51
}
52
53
#define	IDNAME_RIGIDDISK	0x5244534B	/* 'RDSK' */
54
#define IDNAME_BADBLOCK		0x42414442	/* 'BADB' */
55
#define	IDNAME_PARTITION	0x50415254	/* 'PART' */
56
#define IDNAME_FILESYSHEADER	0x46534844	/* 'FSHD' */
57
#define IDNAME_LOADSEG		0x4C534547	/* 'LSEG' */
58
#define IDNAME_BOOT		0x424f4f54	/* 'BOOT' */
59
#define IDNAME_FREE		0xffffffff	
60
61
static const char *
62
_amiga_block_id (uint32_t id) {
63
	switch (id) {
64
		case IDNAME_RIGIDDISK :
65
			return "RDSK";
66
		case IDNAME_BADBLOCK :
67
			return "BADB";
68
		case IDNAME_PARTITION :
69
			return "PART";
70
		case IDNAME_FILESYSHEADER :
71
			return "FSHD";
72
		case IDNAME_LOADSEG :
73
			return "LSEG";
74
		case IDNAME_BOOT :
75
			return "BOOT";
76
		case IDNAME_FREE :
77
			return "<free>";
78
		default :
79
			return "<unknown>";
80
	}
81
}
82
static int
83
_amiga_valid_block_id (uint32_t id) {
84
	switch (id) {
85
		case IDNAME_RIGIDDISK :
86
		case IDNAME_BADBLOCK :
87
		case IDNAME_PARTITION :
88
		case IDNAME_FILESYSHEADER :
89
		case IDNAME_LOADSEG :
90
		case IDNAME_BOOT :
91
			return 1;
92
		case IDNAME_FREE :
93
		default :
94
			return 0;
95
	}
96
}
97
98
struct AmigaIds *
99
_amiga_add_id (uint32_t id, struct AmigaIds *ids) {
100
	struct AmigaIds *newid;
101
102
	if ((newid=ped_malloc(sizeof (struct AmigaIds)))==NULL) {
103
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
104
			_("%s : Failed to allocate id list element\n"), __func__);
105
		return 0;
106
	}
107
	newid->ID = id;
108
	newid->next = ids;
109
	return newid;
110
}
111
112
void
113
_amiga_free_ids (struct AmigaIds *ids) {
114
	struct AmigaIds *current, *next;
115
116
	for (current = ids; current != NULL; current = next) {
117
		next = current->next;
118
		ped_free (current);
119
	}
120
}
121
int
122
_amiga_id_in_list (uint32_t id, struct AmigaIds *ids) {
123
	struct AmigaIds *current;
124
125
	for (current = ids; current != NULL; current = current->next) {
126
		if (id == current->ID)
127
			return 1;
128
	}
129
	return 0;
130
}
131
132
#define AMIGA_RDB_NOT_FOUND	((uint32_t)0xffffffff)
133
134
struct AmigaBlock {
135
    uint32_t	amiga_ID;		/* Identifier 32 bit word */
136
    uint32_t	amiga_SummedLongss;	/* Size of the structure for checksums */
137
    int32_t	amiga_ChkSum;		/* Checksum of the structure */
138
};
139
#define AMIGA(pos) ((struct AmigaBlock *)(pos)) 
140
141
struct RigidDiskBlock {
142
    uint32_t	rdb_ID;			/* Identifier 32 bit word : 'RDSK' */
143
    uint32_t	rdb_SummedLongs;	/* Size of the structure for checksums */
144
    int32_t	rdb_ChkSum;		/* Checksum of the structure */
145
    uint32_t	rdb_HostID;		/* SCSI Target ID of host, not really used */
146
    uint32_t	rdb_BlockBytes;		/* Size of disk blocks */
147
    uint32_t	rdb_Flags;		/* RDB Flags */
148
    /* block list heads */
149
    uint32_t	rdb_BadBlockList;	/* Bad block list */
150
    uint32_t	rdb_PartitionList;	/* Partition list */
151
    uint32_t	rdb_FileSysHeaderList;	/* File system header list */
152
    uint32_t	rdb_DriveInit;		/* Drive specific init code */
153
    uint32_t	rdb_BootBlockList;	/* Amiga OS 4 Boot Blocks */
154
    uint32_t	rdb_Reserved1[5];	/* Unused word, need to be set to $ffffffff */
155
    /* physical drive characteristics */
156
    uint32_t	rdb_Cylinders;		/* Number of the cylinders of the drive */
157
    uint32_t	rdb_Sectors;		/* Number of sectors of the drive */
158
    uint32_t	rdb_Heads;		/* Number of heads of the drive */
159
    uint32_t	rdb_Interleave;		/* Interleave */
160
    uint32_t	rdb_Park;		/* Head parking cylinder */
161
    uint32_t	rdb_Reserved2[3];	/* Unused word, need to be set to $ffffffff */
162
    uint32_t	rdb_WritePreComp;	/* Starting cylinder of write precompensation */
163
    uint32_t	rdb_ReducedWrite;	/* Starting cylinder of reduced write current */
164
    uint32_t	rdb_StepRate;		/* Step rate of the drive */
165
    uint32_t	rdb_Reserved3[5];	/* Unused word, need to be set to $ffffffff */
166
    /* logical drive characteristics */
167
    uint32_t	rdb_RDBBlocksLo;	/* low block of range reserved for hardblocks */
168
    uint32_t	rdb_RDBBlocksHi;	/* high block of range for these hardblocks */
169
    uint32_t	rdb_LoCylinder;		/* low cylinder of partitionable disk area */
170
    uint32_t	rdb_HiCylinder;		/* high cylinder of partitionable data area */
171
    uint32_t	rdb_CylBlocks;		/* number of blocks available per cylinder */
172
    uint32_t	rdb_AutoParkSeconds;	/* zero for no auto park */
173
    uint32_t	rdb_HighRDSKBlock;	/* highest block used by RDSK */
174
					/* (not including replacement bad blocks) */
175
    uint32_t	rdb_Reserved4;
176
    /* drive identification */
177
    char	rdb_DiskVendor[8];
178
    char	rdb_DiskProduct[16];
179
    char	rdb_DiskRevision[4];
180
    char	rdb_ControllerVendor[8];
181
    char	rdb_ControllerProduct[16];
182
    char	rdb_ControllerRevision[4];
183
    uint32_t	rdb_Reserved5[10];
184
};
185
186
#define AMIGA_MAX_PARTITIONS	128
187
#define	RDB_LOCATION_LIMIT	16
188
#define RDSK(pos) ((struct RigidDiskBlock *)(pos)) 
189
190
static int
191
_amiga_checksum (struct AmigaBlock *blk) {
192
	uint32_t *rdb = (uint32_t *) blk;
193
	uint32_t sum;
194
	int i, end;
195
196
	sum = PED_BE32_TO_CPU (rdb[0]);
197
	end = PED_BE32_TO_CPU (rdb[1]);
198
199
	if (end > PED_SECTOR_SIZE) end = PED_SECTOR_SIZE;
200
201
	for (i = 1; i < end; i++) sum += PED_BE32_TO_CPU (rdb[i]);
202
203
	return sum;
204
}
205
206
static void
207
_amiga_calculate_checksum (struct AmigaBlock *blk) {
208
209
	blk->amiga_ChkSum = PED_CPU_TO_BE32(
210
		PED_BE32_TO_CPU(blk->amiga_ChkSum) -
211
		_amiga_checksum((struct AmigaBlock *) blk));
212
	return;	
213
}
214
215
216
static struct AmigaBlock *
217
_amiga_read_block (PedDevice *dev, struct AmigaBlock *blk, PedSector block, struct AmigaIds *ids) {
218
	if (!ped_device_read (dev, blk, block, 1)) {
219
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
220
			PED_EXCEPTION_CANCEL,
221
			_("%s : Couldn't read block %llu\n"), __func__, block))
222
		{
223
			case PED_EXCEPTION_CANCEL :
224
			case PED_EXCEPTION_UNHANDLED :
225
			default : 
226
				return NULL;
227
		}
228
	}
229
	if (ids && !_amiga_id_in_list(PED_BE32_TO_CPU(blk->amiga_ID), ids))
230
		return NULL;
231
	if (_amiga_checksum (blk) != 0) {
232
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
233
			PED_EXCEPTION_FIX | PED_EXCEPTION_IGNORE | PED_EXCEPTION_CANCEL,
234
			_("%s : Bad checksum on block %llu of type %s\n"),
235
			__func__, block, _amiga_block_id(PED_BE32_TO_CPU(blk->amiga_ID))))
236
		{
237
			case PED_EXCEPTION_CANCEL :
238
				return NULL;
239
			case PED_EXCEPTION_FIX :
240
				_amiga_calculate_checksum(AMIGA(blk));
241
				if (!ped_device_write (dev, blk, block, 1)) {
242
					switch (ped_exception_throw(PED_EXCEPTION_FATAL,
243
						PED_EXCEPTION_CANCEL,
244
						_("%s : Couldn't write block %d\n"), __func__, block))
245
					{
246
						case PED_EXCEPTION_CANCEL :
247
						case PED_EXCEPTION_UNHANDLED :
248
						default : 
249
							return NULL;
250
					}
251
				}
252
			case PED_EXCEPTION_IGNORE :
253
			case PED_EXCEPTION_UNHANDLED :
254
			default : 
255
				return blk;
256
		}
257
	}
258
	return blk;
259
}
260
261
static uint32_t
262
_amiga_find_rdb (PedDevice *dev, struct RigidDiskBlock *rdb) {
263
	int i;
264
	struct AmigaIds *ids;
265
	
266
	ids = _amiga_add_id (IDNAME_RIGIDDISK, NULL);
267
268
	for (i = 0; i<RDB_LOCATION_LIMIT; i++) {
269
		if (!_amiga_read_block (dev, AMIGA(rdb), i, ids)) {
270
			continue;
271
		}
272
		if (PED_BE32_TO_CPU (rdb->rdb_ID) == IDNAME_RIGIDDISK) {
273
			_amiga_free_ids (ids);
274
			return i;
275
		}
276
	}
277
	_amiga_free_ids (ids);
278
	return AMIGA_RDB_NOT_FOUND;
279
}
280
281
static int
282
_amiga_loop_check (uint32_t block, uint32_t * blocklist, uint32_t max)
283
{
284
	uint32_t i;
285
286
	for (i = 0; i < max; i++)
287
		if (block == blocklist[i]) {
288
			/* We are looping, let's stop.  */
289
			return 1;
290
		}
291
	blocklist[max] = block;
292
	return 0;
293
}
294
295
/* We have already allocated a rdb, we are now reading it from the disk */
296
struct PartitionBlock *
297
amiga_find_part (PedGeometry *geom, struct PartitionBlock *part)
298
{
299
	struct RigidDiskBlock *rdb;
300
	uint32_t partblock;
301
	uint32_t partlist[AMIGA_MAX_PARTITIONS];
302
	int i;
303
304
	PED_ASSERT(geom!= NULL, return NULL);
305
	PED_ASSERT(geom->dev!= NULL, return NULL);
306
307
	if (!(rdb = ped_malloc (PED_SECTOR_SIZE))) {
308
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
309
			PED_EXCEPTION_CANCEL,
310
			_("%s : Failed to allocate disk_specific rdb block\n"), __func__))
311
		{
312
			case PED_EXCEPTION_CANCEL :
313
			case PED_EXCEPTION_UNHANDLED :
314
			default : 
315
				return NULL;
316
		}
317
	}
318
	if (_amiga_find_rdb (geom->dev, rdb) == AMIGA_RDB_NOT_FOUND) {
319
		switch (ped_exception_throw(PED_EXCEPTION_ERROR,
320
			PED_EXCEPTION_CANCEL,
321
			_("%s : Didn't find rdb block, should never happen\n"), __func__))
322
		{
323
			case PED_EXCEPTION_CANCEL :
324
			case PED_EXCEPTION_UNHANDLED :
325
			default : 
326
				ped_free(rdb);
327
				return NULL;
328
		}
329
	}
330
331
	/* We initialize the hardblock free list to detect loops */
332
	for (i = 0; i < AMIGA_MAX_PARTITIONS; i++) partlist[i] = 0xffffffff;
333
334
	for (i = 1, partblock = PED_BE32_TO_CPU(rdb->rdb_PartitionList);
335
		i < AMIGA_MAX_PARTITIONS && partblock != 0xffffffff;
336
		i++, partblock = PED_BE32_TO_CPU(part->pb_Next))
337
	{
338
		PedSector start, end;
339
		PedSector cylblocks;
340
341
		/* Let's look for loops in the partition table */
342
		if (_amiga_loop_check(partblock, partlist, i)) {
343
			ped_free (rdb);
344
			return NULL;
345
		}
346
		/* Let's read a partition block to get its geometry*/
347
		if (!ped_device_read (geom->dev, part, (PedSector)partblock, 1)) {
348
			switch (ped_exception_throw(PED_EXCEPTION_ERROR,
349
				PED_EXCEPTION_CANCEL,
350
				_("%s : Failed to to read partition block %llu\n"),
351
				__func__, (PedSector)partblock))
352
			{
353
				case PED_EXCEPTION_CANCEL :
354
				case PED_EXCEPTION_UNHANDLED :
355
				default : 
356
					ped_free(rdb);
357
					return NULL;
358
			}
359
		}
360
361
		/* Current block is not a Partition Block */
362
		if (part->pb_ID != IDNAME_PARTITION) {
363
			ped_free (rdb);
364
			return NULL;
365
		}
366
367
		/* Calculate the geometry of the partition */
368
		cylblocks = ((PedSector) PED_BE32_TO_CPU (part->de_Surfaces)) *
369
			((PedSector) PED_BE32_TO_CPU (part->de_BlocksPerTrack));
370
		start = ((PedSector) PED_BE32_TO_CPU (part->de_LowCyl)) * cylblocks;
371
		end = ((((PedSector) PED_BE32_TO_CPU (part->de_HighCyl))+1) * (cylblocks))-1;
372
373
		/* And check if it is the one we are searching for */
374
		if (start == geom->start && end == geom->end) {
375
			ped_free (rdb);
376
			return part;
377
		}
378
	}
379
380
	ped_free (rdb);
381
	return NULL;
382
}
(-)parted-1.6.9.orig/libparted/fs_amiga/amiga.h (+71 lines)
Line 0 Link Here
1
/*
2
    util.h -- amiga partition table headers.
3
    Copyright (C) 1998-2000 Free Software Foundation, Inc.
4
  
5
    This program is free software; you can redistribute it and/or modify
6
    it under the terms of the GNU General Public License as published by
7
    the Free Software Foundation; either version 2 of the License, or
8
    (at your option) any later version.
9
10
    This program is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
    GNU General Public License for more details.
14
15
    You should have received a copy of the GNU General Public License
16
    along with this program; if not, write to the Free Software
17
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
*/
19
20
struct PartitionBlock {
21
    uint32_t	pb_ID;			/* Identifier 32 bit word : 'PART' */
22
    uint32_t	pb_SummedLongs;		/* Size of the structure for checksums */
23
    int32_t	pb_ChkSum;		/* Checksum of the structure */
24
    uint32_t	pb_HostID;		/* SCSI Target ID of host, not really used */
25
    uint32_t	pb_Next;		/* Block number of the next PartitionBlock */
26
    uint32_t	pb_Flags;		/* Part Flags (NOMOUNT and BOOTABLE) */
27
    uint32_t	pb_Reserved1[2];
28
    uint32_t	pb_DevFlags;		/* Preferred flags for OpenDevice */
29
    uint8_t	pb_DriveName[32];	/* Preferred DOS device name: BSTR form */
30
    uint32_t	pb_Reserved2[15];
31
    uint32_t	de_TableSize;		/* Size of Environment vector */
32
    uint32_t	de_SizeBlock;		/* Size of the blocks in 32 bit words, usually 128 */
33
    uint32_t	de_SecOrg;	     	/* Not used; must be 0 */
34
    uint32_t	de_Surfaces;		/* Number of heads (surfaces) */
35
    uint32_t	de_SectorPerBlock;	/* Disk sectors per block, used with SizeBlock, usually 1 */
36
    uint32_t	de_BlocksPerTrack;	/* Blocks per track. drive specific */
37
    uint32_t	de_Reserved;		/* DOS reserved blocks at start of partition. */
38
    uint32_t	de_PreAlloc;		/* DOS reserved blocks at end of partition */
39
    uint32_t	de_Interleave;		/* Not used, usually 0 */
40
    uint32_t	de_LowCyl;		/* First cylinder of the partition */
41
    uint32_t	de_HighCyl;		/* Last cylinder of the partition */
42
    uint32_t	de_NumBuffers;		/* Initial # DOS of buffers.  */
43
    uint32_t	de_BufMemType;		/* Type of mem to allocate for buffers */
44
    uint32_t	de_MaxTransfer;		/* Max number of bytes to transfer at a time */
45
    uint32_t	de_Mask;		/* Address Mask to block out certain memory */
46
    int32_t	de_BootPri;		/* Boot priority for autoboot */
47
    uint32_t	de_DosType;		/* Dostype of the filesystem */
48
    uint32_t	de_Baud;		/* Baud rate for serial handler */
49
    uint32_t	de_Control;		/* Control word for handler/filesystem */
50
    uint32_t	de_BootBlocks;		/* Number of blocks containing boot code */
51
    uint32_t	pb_EReserved[12];
52
};
53
54
#define PART(pos) ((struct PartitionBlock *)(pos))
55
56
#define	PBFB_BOOTABLE	0	/* this partition is intended to be bootable */
57
#define	PBFF_BOOTABLE	1L	/*   (expected directories and files exist) */
58
#define	PBFB_NOMOUNT	1	/* do not mount this partition (e.g. manually */
59
#define	PBFF_NOMOUNT	2L	/*   mounted, but space reserved here) */
60
61
struct PartitionBlock * amiga_find_part (PedGeometry *geom, struct PartitionBlock *part);
62
63
struct AmigaIds {
64
	uint32_t ID;
65
	struct AmigaIds *next;
66
};
67
68
struct AmigaIds * _amiga_add_id (uint32_t id, struct AmigaIds *ids);
69
void _amiga_free_ids (struct AmigaIds *ids);
70
int _amiga_id_in_list (uint32_t id, struct AmigaIds *ids);
71
(-)parted-1.6.9.orig/libparted/fs_amiga/apfs.c (+150 lines)
Line 0 Link Here
1
/*
2
    apfs.c -- parted support for apfs filesystems
3
    Copyright (C) 1998-2000 Free Software Foundation, Inc.
4
  
5
    This program is free software; you can redistribute it and/or modify
6
    it under the terms of the GNU General Public License as published by
7
    the Free Software Foundation; either version 2 of the License, or
8
    (at your option) any later version.
9
10
    This program is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
    GNU General Public License for more details.
14
15
    You should have received a copy of the GNU General Public License
16
    along with this program; if not, write to the Free Software
17
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
*/
19
20
#include "config.h"
21
22
#include <stdlib.h>
23
#include <string.h>
24
#include <parted/parted.h>
25
#include <parted/debug.h>
26
#include <parted/endian.h>
27
28
#include "amiga.h"
29
#include "apfs.h"
30
31
#if ENABLE_NLS
32
#  include <libintl.h>
33
#  define _(String) dgettext (PACKAGE, String)
34
#else
35
#  define _(String) (String)
36
#endif /* ENABLE_NLS */
37
38
static int
39
_apfs_probe_root (uint32_t *block, uint32_t blocksize, uint32_t kind) {
40
	if (PED_BE32_TO_CPU (block[0]) != kind) return 0;
41
	return 1;
42
}
43
44
static PedGeometry*
45
_generic_apfs_probe (PedGeometry* geom, uint32_t kind)
46
{
47
	uint32_t *block;
48
	int32_t i, sum;
49
	PedSector root;
50
	struct PartitionBlock * part;
51
	uint32_t blocksize = 1, reserved = 2, prealloc = 0;
52
53
	PED_ASSERT (geom != NULL, return NULL);
54
	PED_ASSERT (geom->dev != NULL, return NULL);
55
56
	/* Finds the blocksize, prealloc and reserved values of the partition block */
57
	if (!(part = ped_malloc (PED_SECTOR_SIZE*blocksize))) {
58
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
59
			_("%s : Failed to allocate partition block\n"), __func__);
60
		goto error_part;
61
	}
62
	if (amiga_find_part(geom, part) != NULL) {
63
		prealloc = PED_BE32_TO_CPU (part->de_PreAlloc);
64
		reserved = PED_BE32_TO_CPU (part->de_Reserved);
65
		blocksize = PED_BE32_TO_CPU (part->de_SizeBlock)
66
			* PED_BE32_TO_CPU (part->de_SectorPerBlock) / 128;
67
	}
68
	ped_free (part);
69
70
	/* Test boot block */
71
	if (!(block = ped_malloc (PED_SECTOR_SIZE*blocksize))) {
72
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
73
			_("%s : Failed to allocate block\n"), __func__);
74
		goto error_block;
75
	}
76
	if (!ped_device_read (geom->dev, block, geom->start, blocksize)) {
77
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
78
			_("%s : Couldn't read boot block %llu\n"), __func__, geom->start);
79
		goto error;
80
	}
81
	if (PED_BE32_TO_CPU (block[0]) != kind) {
82
		goto error;
83
	}
84
85
	/* Find and test the root block */
86
	root = geom->start+reserved*blocksize;
87
	if (!ped_device_read (geom->dev, block, root, blocksize)) {
88
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
89
			_("%s : Couldn't read root block %llu\n"), __func__, root);
90
		goto error;
91
	}
92
	if (_apfs_probe_root(block, blocksize, kind) == 1) {
93
		ped_free(block);
94
		return ped_geometry_duplicate (geom);
95
	}
96
97
error:
98
	ped_free (block);
99
error_block:
100
error_part:
101
	return NULL;
102
}
103
104
static PedGeometry*
105
_apfs1_probe (PedGeometry* geom) {
106
	return _generic_apfs_probe (geom, 0x50463101);
107
}
108
109
static PedGeometry*
110
_apfs2_probe (PedGeometry* geom) {
111
	return _generic_apfs_probe (geom, 0x50463102);
112
}
113
114
static PedFileSystemOps _apfs1_ops = {
115
	probe:		_apfs1_probe,
116
	clobber:	NULL,
117
	open:		NULL,
118
	create:         NULL,
119
	close:		NULL,
120
	check:          NULL,
121
	resize:		NULL,
122
	copy:           NULL,
123
	get_create_constraint:	NULL,
124
	get_copy_constraint:	NULL,
125
	get_resize_constraint:	NULL
126
};
127
static PedFileSystemOps _apfs2_ops = {
128
	probe:		_apfs2_probe,
129
	clobber:	NULL,
130
	open:		NULL,
131
	create:         NULL,
132
	close:		NULL,
133
	check:          NULL,
134
	resize:		NULL,
135
	copy:           NULL,
136
	get_create_constraint:	NULL,
137
	get_copy_constraint:	NULL,
138
	get_resize_constraint:	NULL
139
};
140
141
PedFileSystemType _apfs1_type = {
142
       next:		 NULL,
143
       ops:		 &_apfs1_ops,
144
       name:		 "apfs1"
145
};
146
PedFileSystemType _apfs2_type = {
147
       next:		 NULL,
148
       ops:		 &_apfs2_ops,
149
       name:		 "apfs2"
150
};
(-)parted-1.6.9.orig/libparted/fs_amiga/apfs.h (+19 lines)
Line 0 Link Here
1
2
/*
3
    apfs.h -- parted support for apfs filesystems header files
4
    Copyright (C) 1998-2000 Free Software Foundation, Inc.
5
  
6
    This program is free software; you can redistribute it and/or modify
7
    it under the terms of the GNU General Public License as published by
8
    the Free Software Foundation; either version 2 of the License, or
9
    (at your option) any later version.
10
11
    This program is distributed in the hope that it will be useful,
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
    GNU General Public License for more details.
15
16
    You should have received a copy of the GNU General Public License
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
*/
(-)parted-1.6.9.orig/libparted/fs_amiga/asfs.c (+144 lines)
Line 0 Link Here
1
/*
2
    asfs.c -- parted asfs filesystem support
3
    Copyright (C) 1998-2000 Free Software Foundation, Inc.
4
  
5
    This program is free software; you can redistribute it and/or modify
6
    it under the terms of the GNU General Public License as published by
7
    the Free Software Foundation; either version 2 of the License, or
8
    (at your option) any later version.
9
10
    This program is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
    GNU General Public License for more details.
14
15
    You should have received a copy of the GNU General Public License
16
    along with this program; if not, write to the Free Software
17
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
*/
19
20
#include "config.h"
21
22
#include <stdlib.h>
23
#include <string.h>
24
#include <parted/parted.h>
25
#include <parted/debug.h>
26
#include <parted/endian.h>
27
28
#include "amiga.h"
29
#include "asfs.h"
30
31
#if ENABLE_NLS
32
#  include <libintl.h>
33
#  define _(String) dgettext (PACKAGE, String)
34
#else
35
#  define _(String) (String)
36
#endif /* ENABLE_NLS */
37
38
static int
39
_asfs_probe_root (PedGeometry *geom, uint32_t *block, int blocksize, PedSector root) {
40
	int i, sum;
41
	PedSector start, end;
42
43
	if (PED_BE32_TO_CPU (block[0]) != 0x53465300) return 0;
44
	for (i = 0, sum = 1; i < 128*blocksize; i++) sum += PED_BE32_TO_CPU (block[i]);
45
	if (sum != 0) return 0;
46
	if (PED_BE32_TO_CPU (block[2]) * blocksize + geom->start != root) {
47
		return 0;
48
	}
49
	start = ((((PedSector) PED_BE32_TO_CPU (block[8])) << 32)
50
		+ (PedSector) PED_BE32_TO_CPU (block[9])) / 512;
51
	end = (((((PedSector) PED_BE32_TO_CPU (block[10])) << 32)
52
		+ (PedSector) PED_BE32_TO_CPU (block[11])) / 512) - 1;
53
	if (start != geom->start || end != geom->end) return 0;
54
	return 1;
55
}
56
57
static PedGeometry*
58
_asfs_probe (PedGeometry* geom)
59
{
60
	uint32_t *block;
61
	struct PartitionBlock * part;
62
	int blocksize = 1, reserved = 1, prealloc = 1;
63
	PedSector root, root2;
64
	int found = 0;
65
66
	PED_ASSERT (geom != NULL, return NULL);
67
	PED_ASSERT (geom->dev != NULL, return NULL);
68
69
	/* Finds the blocksize, prealloc and reserved values of the partition block */
70
	if (!(part = ped_malloc (PED_SECTOR_SIZE*blocksize))) {
71
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
72
			_("%s : Failed to allocate partition block\n"), __func__);
73
		goto error_part;
74
	}
75
	if (amiga_find_part(geom, part) != NULL) {
76
		prealloc = PED_BE32_TO_CPU (part->de_PreAlloc) == 0 ?
77
			1 : PED_BE32_TO_CPU (part->de_PreAlloc);
78
		reserved = PED_BE32_TO_CPU (part->de_Reserved) == 0 ?
79
			1 : PED_BE32_TO_CPU (part->de_Reserved);
80
		blocksize = PED_BE32_TO_CPU (part->de_SizeBlock)
81
			* PED_BE32_TO_CPU (part->de_SectorPerBlock) / 128;
82
	}
83
	ped_free (part);
84
85
	/* Test boot block */
86
	if (!(block = ped_malloc (PED_SECTOR_SIZE*blocksize))) {
87
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
88
			_("%s : Failed to allocate block\n"), __func__);
89
		goto error_block;
90
	}
91
	root = geom->start;
92
	if (!ped_device_read (geom->dev, block, root, blocksize)) {
93
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
94
			_("%s : Couldn't read root block %llu\n"), __func__, root);
95
		goto error;
96
	}
97
	if (PED_BE32_TO_CPU (block[0]) != 0x53465300) {
98
		goto error;
99
	}
100
101
	/* Find and test the root blocks */
102
	if (_asfs_probe_root(geom, block, blocksize, root)) {
103
		found++;
104
	}
105
	root = geom->end - blocksize - (geom->length % blocksize) + 1;
106
	if (!ped_device_read (geom->dev, block, root, 1)) {
107
		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
108
			_("%s : Couldn't read root block %llu\n"), __func__, root);
109
		goto error;
110
	}
111
	if (_asfs_probe_root(geom, block, blocksize, root)) {
112
		found++;
113
	}
114
	if (found != 0) {
115
		ped_free (block);
116
		return ped_geometry_duplicate (geom);
117
	}
118
119
error:
120
	ped_free (block);
121
error_block:
122
error_part:
123
	return NULL;
124
}
125
126
static PedFileSystemOps _asfs_ops = {
127
	probe:		_asfs_probe,
128
	clobber:	NULL,
129
	open:		NULL,
130
	create:         NULL,
131
	close:		NULL,
132
	check:          NULL,
133
	resize:		NULL,
134
	copy:           NULL,
135
	get_create_constraint:	NULL,
136
	get_copy_constraint:	NULL,
137
	get_resize_constraint:	NULL
138
};
139
140
PedFileSystemType _asfs_type = {
141
       next:		 NULL,
142
       ops:		 &_asfs_ops,
143
       name:		 "asfs"
144
};
(-)parted-1.6.9.orig/libparted/fs_amiga/asfs.h (+19 lines)
Line 0 Link Here
1
2
/*
3
    asfs.h -- parted asfs filesystem support header files
4
    Copyright (C) 1998-2000 Free Software Foundation, Inc.
5
  
6
    This program is free software; you can redistribute it and/or modify
7
    it under the terms of the GNU General Public License as published by
8
    the Free Software Foundation; either version 2 of the License, or
9
    (at your option) any later version.
10
11
    This program is distributed in the hope that it will be useful,
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
    GNU General Public License for more details.
15
16
    You should have received a copy of the GNU General Public License
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
*/
(-)parted-1.6.9.orig/libparted/fs_amiga/interface.c (+90 lines)
Line 0 Link Here
1
/*
2
    interface.c -- parted support amiga filesystems
3
    Copyright (C) 1998-2000 Free Software Foundation, Inc.
4
  
5
    This program is free software; you can redistribute it and/or modify
6
    it under the terms of the GNU General Public License as published by
7
    the Free Software Foundation; either version 2 of the License, or
8
    (at your option) any later version.
9
10
    This program is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
    GNU General Public License for more details.
14
15
    You should have received a copy of the GNU General Public License
16
    along with this program; if not, write to the Free Software
17
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
*/
19
20
21
#include "config.h"
22
23
#include <stdlib.h>
24
#include <string.h>
25
#include <parted/parted.h>
26
#include <parted/debug.h>
27
#include <parted/endian.h>
28
29
extern PedFileSystemType _affs0_type;
30
extern PedFileSystemType _affs1_type;
31
extern PedFileSystemType _affs2_type;
32
extern PedFileSystemType _affs3_type;
33
extern PedFileSystemType _affs4_type;
34
extern PedFileSystemType _affs5_type;
35
extern PedFileSystemType _affs6_type;
36
extern PedFileSystemType _affs7_type;
37
extern PedFileSystemType _amufs_type;
38
extern PedFileSystemType _amufs0_type;
39
extern PedFileSystemType _amufs1_type;
40
extern PedFileSystemType _amufs2_type;
41
extern PedFileSystemType _amufs3_type;
42
extern PedFileSystemType _amufs4_type;
43
extern PedFileSystemType _amufs5_type;
44
extern PedFileSystemType _asfs_type;
45
extern PedFileSystemType _apfs1_type;
46
extern PedFileSystemType _apfs2_type;
47
48
void ped_file_system_amiga_init ()
49
{
50
	ped_file_system_type_register (&_affs0_type);
51
	ped_file_system_type_register (&_affs1_type);
52
	ped_file_system_type_register (&_affs2_type);
53
	ped_file_system_type_register (&_affs3_type);
54
	ped_file_system_type_register (&_affs4_type);
55
	ped_file_system_type_register (&_affs5_type);
56
	ped_file_system_type_register (&_affs6_type);
57
	ped_file_system_type_register (&_affs7_type);
58
	ped_file_system_type_register (&_amufs_type);
59
	ped_file_system_type_register (&_amufs0_type);
60
	ped_file_system_type_register (&_amufs1_type);
61
	ped_file_system_type_register (&_amufs2_type);
62
	ped_file_system_type_register (&_amufs3_type);
63
	ped_file_system_type_register (&_amufs4_type);
64
	ped_file_system_type_register (&_amufs5_type);
65
	ped_file_system_type_register (&_asfs_type);
66
	ped_file_system_type_register (&_apfs1_type);
67
	ped_file_system_type_register (&_apfs2_type);
68
}
69
70
void ped_file_system_amiga_done ()
71
{
72
	ped_file_system_type_unregister (&_affs0_type);
73
	ped_file_system_type_unregister (&_affs1_type);
74
	ped_file_system_type_unregister (&_affs2_type);
75
	ped_file_system_type_unregister (&_affs3_type);
76
	ped_file_system_type_unregister (&_affs4_type);
77
	ped_file_system_type_unregister (&_affs5_type);
78
	ped_file_system_type_unregister (&_affs6_type);
79
	ped_file_system_type_unregister (&_affs7_type);
80
	ped_file_system_type_unregister (&_amufs_type);
81
	ped_file_system_type_unregister (&_amufs0_type);
82
	ped_file_system_type_unregister (&_amufs1_type);
83
	ped_file_system_type_unregister (&_amufs2_type);
84
	ped_file_system_type_unregister (&_amufs3_type);
85
	ped_file_system_type_unregister (&_amufs4_type);
86
	ped_file_system_type_unregister (&_amufs5_type);
87
	ped_file_system_type_unregister (&_asfs_type);
88
	ped_file_system_type_unregister (&_apfs1_type);
89
	ped_file_system_type_unregister (&_apfs2_type);
90
}
(-)parted-1.6.9.orig/libparted/libparted.c (+8 lines)
Lines 86-97 Link Here
86
extern void ped_disk_msdos_init ();
86
extern void ped_disk_msdos_init ();
87
extern void ped_disk_pc98_init ();
87
extern void ped_disk_pc98_init ();
88
extern void ped_disk_sun_init ();
88
extern void ped_disk_sun_init ();
89
extern void ped_disk_amiga_init ();
89
90
90
static void
91
static void
91
init_disk_types ()
92
init_disk_types ()
92
{
93
{
93
	ped_disk_loop_init ();	/* must be last in the probe list */
94
	ped_disk_loop_init ();	/* must be last in the probe list */
94
95
96
	ped_disk_amiga_init ();
95
	ped_disk_sun_init ();
97
	ped_disk_sun_init ();
96
#ifdef ENABLE_PC98
98
#ifdef ENABLE_PC98
97
	ped_disk_pc98_init ();
99
	ped_disk_pc98_init ();
Lines 104-109 Link Here
104
}
106
}
105
107
106
#ifdef ENABLE_FS
108
#ifdef ENABLE_FS
109
extern void ped_file_system_amiga_init (void);
107
extern void ped_file_system_xfs_init (void);
110
extern void ped_file_system_xfs_init (void);
108
extern void ped_file_system_ufs_init (void);
111
extern void ped_file_system_ufs_init (void);
109
extern void ped_file_system_reiserfs_init (void);
112
extern void ped_file_system_reiserfs_init (void);
Lines 117-122 Link Here
117
static void
120
static void
118
init_file_system_types ()
121
init_file_system_types ()
119
{
122
{
123
	ped_file_system_amiga_init ();
120
	ped_file_system_xfs_init ();
124
	ped_file_system_xfs_init ();
121
	ped_file_system_ufs_init ();
125
	ped_file_system_ufs_init ();
122
	ped_file_system_reiserfs_init ();
126
	ped_file_system_reiserfs_init ();
Lines 137-146 Link Here
137
extern void ped_disk_msdos_done ();
141
extern void ped_disk_msdos_done ();
138
extern void ped_disk_pc98_done ();
142
extern void ped_disk_pc98_done ();
139
extern void ped_disk_sun_done ();
143
extern void ped_disk_sun_done ();
144
extern void ped_disk_amiga_done ();
140
145
141
static void
146
static void
142
done_disk_types ()
147
done_disk_types ()
143
{
148
{
149
	ped_disk_amiga_done ();
144
	ped_disk_sun_done ();
150
	ped_disk_sun_done ();
145
#ifdef ENABLE_PC98
151
#ifdef ENABLE_PC98
146
	ped_disk_pc98_done ();
152
	ped_disk_pc98_done ();
Lines 190-195 Link Here
190
extern void ped_file_system_reiserfs_done (void);
196
extern void ped_file_system_reiserfs_done (void);
191
extern void ped_file_system_ufs_done (void);
197
extern void ped_file_system_ufs_done (void);
192
extern void ped_file_system_xfs_done (void);
198
extern void ped_file_system_xfs_done (void);
199
extern void ped_file_system_amiga_done (void);
193
200
194
static void
201
static void
195
done_file_system_types ()
202
done_file_system_types ()
Lines 203-208 Link Here
203
	ped_file_system_reiserfs_done ();
210
	ped_file_system_reiserfs_done ();
204
	ped_file_system_ufs_done ();
211
	ped_file_system_ufs_done ();
205
	ped_file_system_xfs_done ();
212
	ped_file_system_xfs_done ();
213
	ped_file_system_amiga_done ();
206
}
214
}
207
#endif /* ENABLE_FS */
215
#endif /* ENABLE_FS */
208
216

Return to bug 50660