@@ -279,55 +279,6 @@ let shutdown_mode_of_device ~xs (x: device) =
279279 then ShutdownRequest
280280 else Classic
281281
282- let blkback_needs_physical_device_in_transaction ~xs (x : device ) =
283- read_feature_flag ~xs x " feature-blkback-needs-physical-device-in-transaction"
284-
285- let major_number_table = [| 3 ; 22 ; 33 ; 34 ; 56 ; 57 ; 88 ; 89 ; 90 ; 91 |]
286-
287- (* * Given a string device name, return the major and minor number *)
288- let device_major_minor name =
289- (* This is the same algorithm xend uses: *)
290- let a = int_of_char 'a' in
291- (* Interpret as 'sda1', 'hda' etc *)
292- try
293- let number chars =
294- if chars = [] then
295- 0
296- else
297- int_of_string (String. implode chars) in
298- match String. explode name with
299- | 's' :: 'd' :: ('a' ..'p' as letter ) :: rest ->
300- 8 , 16 * (int_of_char letter - a) + (number rest)
301- | 'x' :: 'v' :: 'd' :: ('a' ..'p' as letter ) :: rest ->
302- 202 , 16 * (int_of_char letter - a) + (number rest)
303- | 'h' :: 'd' :: ('a' ..'t' as letter ) :: rest ->
304- let n = int_of_char letter - a in
305- major_number_table.(n / 2 ), 64 * (n mod 2 ) + (number rest)
306- | _ ->
307- raise (Device_unrecognized name)
308- with _ ->
309- let file = if Filename. is_relative name then " /dev/" ^ name else name in
310- Statdev. get_major_minor file
311-
312- (* * Given a major and minor number, return a device name *)
313- let major_minor_to_device (major , minor ) =
314- let a = int_of_char 'a' in
315- let number x = if x = 0 then " " else string_of_int x in
316- match major with
317- | 8 -> Printf. sprintf " sd%c%s" (char_of_int (minor / 16 + a)) (number (minor mod 16 ))
318- | 202 -> Printf. sprintf " xvd%c%s" (char_of_int (minor / 16 + a)) (number (minor mod 16 ))
319- | x ->
320- (* Find the index of x in the table *)
321- let n = snd(Array. fold_left (fun (idx , result ) n -> idx + 1 , if x = n then idx else result) (0 , - 1 ) major_number_table) in
322- if n = - 1 then failwith (Printf. sprintf " Couldn't determine device name for (%d, %d)" major minor)
323- else
324- let plus_one, minor = if minor > = 64 then 1 , minor - 64 else 0 , minor in
325- Printf. sprintf " hd%c%s" (char_of_int (n * 2 + plus_one + a)) (number minor)
326-
327- let device_name number =
328- let major, minor = number / 256 , number mod 256 in
329- major_minor_to_device (major, minor)
330-
331282type mode = ReadOnly | ReadWrite
332283
333284let string_of_mode = function
@@ -378,10 +329,6 @@ let devty_of_string = function
378329 | "disk" -> Disk
379330 | _ -> invalid_arg " devty_of_string"
380331
381- let string_of_major_minor file =
382- let major, minor = device_major_minor file in
383- sprintf " %x:%x" major minor
384-
385332let kind_of_physty physty =
386333 match physty with
387334 | Qcow -> Tap
@@ -535,18 +482,10 @@ let add ~xs ~hvm ~mode ~device_number ~phystype ~params ~dev_type ~unpluggable
535482 " mode" , string_of_mode mode;
536483 " params" , params;
537484 ];
538- if blkback_needs_physical_device_in_transaction ~xs device then
539- Hashtbl. add back_tbl " physical-device" (string_of_major_minor params);
540485
541486 if protocol <> Protocol_Native then
542487 Hashtbl. add front_tbl " protocol" (string_of_protocol protocol);
543488
544- if hvm && dev_type = CDROM then
545- (* CA-50383: Don't place physical-device in the HVM CDROM
546- case, to prevent blkback from pinning the device node. A
547- Vbd.media_eject will only make qemu close it again. *)
548- Hashtbl. remove back_tbl " physical-device" ;
549-
550489 let back = Hashtbl. to_list back_tbl in
551490 let front = Hashtbl. to_list front_tbl in
552491
0 commit comments