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)
Mon, Dec 9, 7:57 PM
Unknown Object (File)
Wed, Nov 27, 3:59 AM
Unknown Object (File)
Sun, Nov 24, 4:26 PM
Unknown Object (File)
Sun, Nov 24, 1:37 PM
Unknown Object (File)
Sun, Nov 24, 12:37 PM
Unknown Object (File)
Nov 19 2024, 5:45 PM
Unknown Object (File)
Nov 19 2024, 12:40 PM
Unknown Object (File)
Nov 19 2024, 12:33 PM

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

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 19135
Build 18760: arc lint + arc unit

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
214–225

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
214–225

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
214–225

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
180

"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.