Page MenuHomeFreeBSD

Remove {max/min}_offset, use vm_map_{max/min}.
ClosedPublic

Authored by kib on Aug 24 2018, 3:32 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 7 2024, 8:00 PM
Unknown Object (File)
Jan 29 2024, 1:47 AM
Unknown Object (File)
Jan 29 2024, 1:47 AM
Unknown Object (File)
Dec 20 2023, 3:12 AM
Unknown Object (File)
Dec 9 2023, 12:56 AM
Unknown Object (File)
Oct 31 2023, 1:34 PM
Unknown Object (File)
Sep 20 2023, 5:19 AM
Unknown Object (File)
Sep 9 2023, 7:35 AM

Details

Summary

Exposing max_offset and min_offset defines in public headers is causing
clashes with variable names, for example when building QEMU:

In file included from /root/src/xen/tools/qemu-xen-dir/hw/usb/xen-usb.c:30:
In file included from /root/src/xen/tools/qemu-xen-dir/include/hw/xen/xen_backend.h:4:
In file included from /root/src/xen/tools/qemu-xen-dir/include/hw/xen/xen_common.h:19:
In file included from /root/src/xen/tools/qemu-xen-dir/include/hw/pci/pci.h:6:
In file included from /root/src/xen/tools/qemu-xen-dir/include/sysemu/dma.h:16:
In file included from /root/src/xen/tools/qemu-xen-dir/include/block/block.h:10:
/root/src/xen/tools/qemu-xen-dir/include/block/dirty-bitmap.h:86:68: error: expected ')'
bool bdrv_dirty_iter_next_area(BdrvDirtyBitmapIter *iter, uint64_t max_offset,

^

/usr/include/vm/vm_map.h:188:26: note: expanded from macro 'max_offset'
#define max_offset header.start /* (c) */

^

/root/src/xen/tools/qemu-xen-dir/include/block/dirty-bitmap.h:86:31: note: to match this '('
bool bdrv_dirty_iter_next_area(BdrvDirtyBitmapIter *iter, uint64_t max_offset,

^
Test Plan

Only tested with an amd64 buildkernel so far, will run a tinderbox before committing to make sure everything is fine.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 19218

Event Timeline

Remove unrelated netfront change.

I'm going on vacations for the whole next week and I'm not taking any computer, so I won't be able to commit this. If someone feels like picking this up in the meantime that's great, if not I will pick it up in two weeks.

This revision is now accepted and ready to land.Aug 24 2018, 4:46 PM

If this is going to hit 12.0, it must be done before KBI freeze. I will start tinderbox with the change and ask re approval after.

sys/vm/vm_map.h
220–233

Why not use these functions, rather than a new macro, everywhere the values are being read? And, just use a new macro/function for purposes of initializing the fields.

sys/vm/vm_map.h
220–233

But then why keeping the macros ? I would go with the functions use as suggested, but change the macros to comment in struct vm_map definition, while directly use header.end and header.start for initialization.

Is this fine ?

sys/vm/vm_map.h
220–233

I'm okay with that plan.

kib edited reviewers, added: royger; removed: kib.

Remove min_offset and max_offset at all.

This revision now requires review to proceed.Aug 27 2018, 5:46 PM
kib retitled this revision from mm: rename {max/min}_offset to vm_map_{max/min}_offset to Remove {max/min}_offset, use vm_map_{max/min}..Aug 27 2018, 5:46 PM
kib edited the summary of this revision. (Show Details)

Updated patch passed make tinderbox.

alc added inline comments.
sys/vm/vm_map.h
178

"Counterintuitively, the map's min offset value is stored in map->header.end, and its max offset value is stored in map->header.start.

This revision is now accepted and ready to land.Aug 29 2018, 6:42 AM

This revision can now be closed. (Do you have any idea why revisions, like this one, are no longer closing automatically?)

In D16881#361605, @alc wrote:

This revision can now be closed. (Do you have any idea why revisions, like this one, are no longer closing automatically?)

It seems that phabricator did not receive the commit mail, or ignored it.