hd-geometry.c (3b35d4542c8537a9269f6372df531ced6c960084) hd-geometry.c (a9262f551eba44d4d0f9e396d7124c059a93e204)
1/*
2 * Hard disk geometry utilities
3 *
4 * Copyright (C) 2012 Red Hat, Inc.
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 *

--- 49 unchanged lines hidden (view full) ---

58 uint8_t buf[BDRV_SECTOR_SIZE];
59 int i, heads, sectors, cylinders;
60 struct partition *p;
61 uint32_t nr_sects;
62 uint64_t nb_sectors;
63
64 blk_get_geometry(blk, &nb_sectors);
65
1/*
2 * Hard disk geometry utilities
3 *
4 * Copyright (C) 2012 Red Hat, Inc.
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 *

--- 49 unchanged lines hidden (view full) ---

58 uint8_t buf[BDRV_SECTOR_SIZE];
59 int i, heads, sectors, cylinders;
60 struct partition *p;
61 uint32_t nr_sects;
62 uint64_t nb_sectors;
63
64 blk_get_geometry(blk, &nb_sectors);
65
66 if (blk_pread(blk, 0, buf, BDRV_SECTOR_SIZE, 0) < 0) {
66 if (blk_pread(blk, 0, BDRV_SECTOR_SIZE, buf, 0) < 0) {
67 return -1;
68 }
69 /* test msdos magic */
70 if (buf[510] != 0x55 || buf[511] != 0xaa) {
71 return -1;
72 }
73 for (i = 0; i < 4; i++) {
74 p = ((struct partition *)(buf + 0x1be)) + i;

--- 89 unchanged lines hidden ---
67 return -1;
68 }
69 /* test msdos magic */
70 if (buf[510] != 0x55 || buf[511] != 0xaa) {
71 return -1;
72 }
73 for (i = 0; i < 4; i++) {
74 p = ((struct partition *)(buf + 0x1be)) + i;

--- 89 unchanged lines hidden ---