probe-storage.c (00687e57) | probe-storage.c (422ee277) |
---|---|
1/*************************************************************************** 2 * 3 * probe-storage.c : Probe for storage devices 4 * 5 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 6 * Use is subject to license terms. 7 * 8 * Licensed under the Academic Free License version 2.1 --- 324 unchanged lines hidden (view full) --- 333 char *device_file; 334 char *raw_device_file; 335 LibHalContext *ctx = NULL; 336 DBusError error; 337 char *drive_type; 338 dbus_bool_t is_cdrom; 339 dbus_bool_t is_floppy; 340 struct dk_minfo minfo; | 1/*************************************************************************** 2 * 3 * probe-storage.c : Probe for storage devices 4 * 5 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 6 * Use is subject to license terms. 7 * 8 * Licensed under the Academic Free License version 2.1 --- 324 unchanged lines hidden (view full) --- 333 char *device_file; 334 char *raw_device_file; 335 LibHalContext *ctx = NULL; 336 DBusError error; 337 char *drive_type; 338 dbus_bool_t is_cdrom; 339 dbus_bool_t is_floppy; 340 struct dk_minfo minfo; |
341 unsigned int block_size = 512; |
|
341 dbus_bool_t only_check_for_media; 342 int got_media = FALSE; 343 dbus_bool_t is_write_protected = FALSE; 344 dbus_bool_t is_mbr = FALSE; 345 dbus_bool_t is_smi = FALSE; 346 dbus_bool_t is_gpt = FALSE; 347 dbus_bool_t is_partitioned = FALSE; 348 dbus_bool_t vtoc_slices = FALSE; --- 52 unchanged lines hidden (view full) --- 401 ret = 0; 402 403 if (is_cdrom) { 404 HAL_DEBUG (("Checking for optical disc on %s", raw_device_file)); 405 got_media = get_media_info(rfd, &minfo); 406 if (!got_media) { 407 goto out_cs; 408 } | 342 dbus_bool_t only_check_for_media; 343 int got_media = FALSE; 344 dbus_bool_t is_write_protected = FALSE; 345 dbus_bool_t is_mbr = FALSE; 346 dbus_bool_t is_smi = FALSE; 347 dbus_bool_t is_gpt = FALSE; 348 dbus_bool_t is_partitioned = FALSE; 349 dbus_bool_t vtoc_slices = FALSE; --- 52 unchanged lines hidden (view full) --- 402 ret = 0; 403 404 if (is_cdrom) { 405 HAL_DEBUG (("Checking for optical disc on %s", raw_device_file)); 406 got_media = get_media_info(rfd, &minfo); 407 if (!got_media) { 408 goto out_cs; 409 } |
410 block_size = minfo.dki_lbsize; |
|
409 /* XXX */ 410 is_write_protected = TRUE; 411 } else if (is_floppy) { 412 HAL_DEBUG (("Checking for floppy on %s", raw_device_file)); 413 if (check_floppy(rfd, &is_write_protected)) { 414 got_media = TRUE; 415 } 416 /* don't look for partitions on floppy */ 417 goto out_cs; 418 } else { 419 got_media = TRUE; | 411 /* XXX */ 412 is_write_protected = TRUE; 413 } else if (is_floppy) { 414 HAL_DEBUG (("Checking for floppy on %s", raw_device_file)); 415 if (check_floppy(rfd, &is_write_protected)) { 416 got_media = TRUE; 417 } 418 /* don't look for partitions on floppy */ 419 goto out_cs; 420 } else { 421 got_media = TRUE; |
422 if (get_media_info(rfd, &minfo)) { 423 block_size = minfo.dki_lbsize; 424 } |
|
420 } 421 422 HAL_DEBUG (("Checking for partitions on %s", device_file)); 423 424 if ((fd = open (device_file, O_RDONLY | O_NONBLOCK)) < 0) { 425 HAL_DEBUG (("Cannot open %s: %s", device_file, strerror (errno))); 426 goto out_cs; 427 } 428 | 425 } 426 427 HAL_DEBUG (("Checking for partitions on %s", device_file)); 428 429 if ((fd = open (device_file, O_RDONLY | O_NONBLOCK)) < 0) { 430 HAL_DEBUG (("Cannot open %s: %s", device_file, strerror (errno))); 431 goto out_cs; 432 } 433 |
429 dos_cnt = get_num_dos_drives(fd); | 434 dos_cnt = get_num_dos_drives(fd, block_size); |
430 is_mbr = (dos_cnt > 0); 431 if (is_mbr) { 432 scheme = "mbr"; 433 } 434 if (read_vtoc(rfd, &vtoc) >= 0) { 435 if (!vtoc_one_slice_entire_disk(&vtoc)) { 436 is_smi = TRUE; 437 if (!is_mbr) { --- 48 unchanged lines hidden --- | 435 is_mbr = (dos_cnt > 0); 436 if (is_mbr) { 437 scheme = "mbr"; 438 } 439 if (read_vtoc(rfd, &vtoc) >= 0) { 440 if (!vtoc_one_slice_entire_disk(&vtoc)) { 441 is_smi = TRUE; 442 if (!is_mbr) { --- 48 unchanged lines hidden --- |