Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107675327
D38313.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
954 B
Referenced Files
None
Subscribers
None
D38313.diff
View Options
diff --git a/stand/kboot/kboot.h b/stand/kboot/kboot.h
--- a/stand/kboot/kboot.h
+++ b/stand/kboot/kboot.h
@@ -44,6 +44,7 @@
uint64_t first_avail(uint64_t align, uint64_t min_size, uint64_t type);
void print_avail(void);
bool populate_avail_from_iomem(void);
+uint64_t space_avail(uint64_t start);
/* util.c */
bool file2str(const char *fn, char *buffer, size_t buflen);
diff --git a/stand/kboot/seg.c b/stand/kboot/seg.c
--- a/stand/kboot/seg.c
+++ b/stand/kboot/seg.c
@@ -344,3 +344,22 @@
close(fd);
return true;
}
+
+/*
+ * Return the amount of space available in the segment that @start@ lives in,
+ * from @start@ to the end of the segment.
+ */
+uint64_t
+space_avail(uint64_t start)
+{
+ for (int i = 0; i < nr_seg; i++) {
+ if (start >= segs[i].start && start <= segs[i].end)
+ return segs[i].end - start;
+ }
+
+ /*
+ * Properly used, we should never get here. Unsure if this should be a
+ * panic or not.
+ */
+ return 0;
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 18, 12:23 PM (16 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15857287
Default Alt Text
D38313.diff (954 B)
Attached To
Mode
D38313: kboot: space_avail -- how much space exists from 'start' to end of segment
Attached
Detach File
Event Timeline
Log In to Comment