On Sat, Jun 30, 2012 at 5:50 AM, Markus Armbruster <arm...@redhat.com> wrote: > Blue Swirl <blauwir...@gmail.com> writes: > >> On Fri, Jun 29, 2012 at 3:34 PM, Markus Armbruster <arm...@redhat.com> wrote: >>> Commit f3d54fc4 factored it out of hw/ide.c for reuse. Sensible, >>> except it was put into block.c. Device-specific functionality should >>> be kept in device code, not the block layer. Move it to >>> hw/hd-geometry.c, and make stylistic changes required to keep >>> checkpatch.pl happy. >>> >>> Signed-off-by: Markus Armbruster <arm...@redhat.com> >>> --- >>> block.c | 121 ------------------------------------------ >>> block.h | 1 - >>> blockdev.h | 5 ++ >>> hw/Makefile.objs | 2 +- >>> hw/hd-geometry.c | 153 >>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++ >>> hw/ide/core.c | 2 +- >>> hw/scsi-disk.c | 4 +- >>> hw/virtio-blk.c | 2 +- >>> 8 files changed, 163 insertions(+), 127 deletions(-) >>> create mode 100644 hw/hd-geometry.c > [...] >>> diff --git a/blockdev.h b/blockdev.h >>> index 260e16b..7b05945 100644 >>> --- a/blockdev.h >>> +++ b/blockdev.h >>> @@ -62,4 +62,9 @@ void qmp_change_blockdev(const char *device, const char >>> *filename, >>> bool has_format, const char *format, Error **errp); >>> void do_commit(Monitor *mon, const QDict *qdict); >>> int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data); >>> + >>> +/* Hard disk geometry */ >>> +void hd_geometry_guess(BlockDriverState *bs, >>> + int *pcyls, int *pheads, int *psecs); >> >> I'd move this to a separate header under hw/. > > hw/hd-geometry.h? Or a header collecting shared block device model > code, say hw/block-common.h?
I'd be happy with either. > >>> + >>> #endif >>> diff --git a/hw/Makefile.objs b/hw/Makefile.objs >>> index 3d77259..5bf1d76 100644 >>> --- a/hw/Makefile.objs >>> +++ b/hw/Makefile.objs >>> @@ -137,7 +137,7 @@ common-obj-$(CONFIG_MAX111X) += max111x.o >>> common-obj-$(CONFIG_DS1338) += ds1338.o >>> common-obj-y += i2c.o smbus.o smbus_eeprom.o >>> common-obj-y += eeprom93xx.o >>> -common-obj-y += scsi-disk.o cdrom.o >>> +common-obj-y += scsi-disk.o cdrom.o hd-geometry.o >>> common-obj-y += scsi-generic.o scsi-bus.o >>> common-obj-y += hid.o >>> common-obj-$(CONFIG_SSI) += ssi.o >>> diff --git a/hw/hd-geometry.c b/hw/hd-geometry.c >>> new file mode 100644 >>> index 0000000..9b22e3f >>> --- /dev/null >>> +++ b/hw/hd-geometry.c >>> @@ -0,0 +1,153 @@ >>> +/* >>> + * Hard disk geometry utilities >>> + * >>> + * Copyright (c) 2003 Fabrice Bellard >>> + * >>> + * Permission is hereby granted, free of charge, to any person obtaining a >>> copy >>> + * of this software and associated documentation files (the "Software"), >>> to deal >>> + * in the Software without restriction, including without limitation the >>> rights >>> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or >>> sell >>> + * copies of the Software, and to permit persons to whom the Software is >>> + * furnished to do so, subject to the following conditions: >>> + * >>> + * The above copyright notice and this permission notice shall be included >>> in >>> + * all copies or substantial portions of the Software. >>> + * >>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS >>> OR >>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, >>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL >>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR >>> OTHER >>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING >>> FROM, >>> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS >>> IN >>> + * THE SOFTWARE. >>> + */ > > By the way, X11 license. I'd very much prefer to put my contributions > under GPLv2+. Is there an acceptable way to do that? IANAL, but isn't MIT license compatible with GPL? Then maybe you could license your contributions under GPLv2+, for example with the same statement as GPLv2 to GPLv2+: "Contributions after 2012-mm-dd are licensed under the terms of the GNU GPL, version 2 or (at your option) any later version." Though after that, the file would be dual licensed. Those who want to use the MIT version can use the file before the change. >>> +#include "blockdev.h" >>> + >>> +struct partition { >> >> Partition > > Okay. > > [...]