History log of /freebsd-10.1-release/sys/geom/geom_bsd.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 230643 28-Jan-2012 attilio

Avoid to check the same cache line/variable from all the locking
primitives by breaking stop_scheduler into a per-thread variable.
Also, store the new td_stopsched very close to td_*locks members as
they will be accessed mostly in the same codepaths as td_stopsched and
this results in avoiding a further cache-line pollution, possibly.

STOP_SCHEDULER() was pondered to use a new 'thread' argument, in order to
take advantage of already cached curthread, but in the end there should
not really be a performance benefit, while introducing a KPI breakage.

In collabouration with: flo
Reviewed by: avg
MFC after: 3 months (or never)
X-MFC: r228424


# 223921 11-Jul-2011 ae

Include sys/sbuf.h directly.

Reviewed by: pjd


# 219029 25-Feb-2011 netchild

Add some FEATURE macros for various GEOM classes.

No FreeBSD version bump, the userland application to query the features will
be committed last and can serve as an indication of the availablility if
needed.

Sponsored by: Google Summer of Code 2010
Submitted by: kibab
Reviewed by: silence on geom@ during 2 weeks
X-MFC after: to be determined in last commit with code from this project


# 185518 01-Dec-2008 ivoras

Trivial patch to show on which geom has the error been detected.

Submitted by: Rick C. Petty
Approved by: gnn (mentor)
MFC after: 1 month


# 174347 06-Dec-2007 jhb

Only attach to a GPT partition if it has the GPT_ENT_TYPE_FREEBSD type.

XXX: This only works currently with GEOM_GPT which only exists in 6.x.
XXX: I didn't add 'mbroffset' support for a GPT partition holding a BSD
label as I'm not sure if they use relative or absolute offsets.

MFC after: 3 days


# 158875 24-May-2006 ceri

Remove the trailing half of a sentence which was clearly superceded
by the preceding one some time during editing.


# 157581 07-Apr-2006 marcel

Change gctl_set_param() to return an error instead of setting an
error on the request. Add a wrapper, gctl_set_param_err(), that
sets the error on the request from the error returned by
gctl_set_param() and update current callers of gctl_set_param()
to call gctl_set_param_err() instead.
This makes gctl_set_param() much more usable in situations where
the caller knows better what to do with certain (apparent) error
conditions and setting an error on the request is not one of the
things that need to be done.


# 152972 30-Nov-2005 sobomax

It is unclear who is wrong and who is right, but when operating on
plain file bsdlabel(8) always writes label at a fixed offset from
its beginning (512 bytes), regardless of the sector size. At the same
time, bsdlabel geom class expects label to be available at the very
beginning of the second sector.

As a result, images prepared in userland for media with sector size
different from 512 bytes (i.e. 2k for cdroms) are not recognized by
the tasting mechanism.

Solve the problem by always looking for the label at 512-byte offset
if we can't find it at the beginning of the second sector and sector
size is not 512 bytes.


# 152971 30-Nov-2005 sobomax

Don't pass error value pointer to g_read_data(9) at all if we don't
have any use of it.

Suggested by: pjd


# 152967 30-Nov-2005 sobomax

Check for g_read_data(9) errors properly:

o The only indication of error condition is NULL value returned by
the function;

o value pointed to by error argument is undefined in the case when
operation completes successfully.

Discussed with: phk


# 143719 16-Mar-2005 pjd

Plug memory leak.

Submitted by: Ted Unangst
Found by: Coverity Prevent analysis tool
Approved by: phk
MFC after: 3 days


# 139778 06-Jan-2005 imp

/* -> /*- for copyright notices, minor format tweaks as necessary


# 138732 12-Dec-2004 phk

Pass the file->flags down to geom ioctl handlers.

Reject certain ioctls if write permission is not indicated.

Bump geom API version.

Reported by: Ruben de Groot <mail25@bzerk.org>


# 133318 08-Aug-2004 phk

Tag all geom classes in the tree with a version number.


# 133314 08-Aug-2004 phk

Use default method initialization on geoms.


# 125803 14-Feb-2004 phk

Do not check error code from closing ->access() calls, we know they succeed.


# 125755 12-Feb-2004 phk

Remove the absolute count g_access_abs() function since experience has
shown that it is not useful.

Rename the relative count g_access_rel() function to g_access(), only
the name has changed.

Change all g_access_rel() calls in our CVS tree to call g_access() instead.

Add an #ifndef BURN_BRIDGES #define of g_access_rel() for source
code compatibility.


# 119660 01-Sep-2003 phk

Simplify the ioctl handling in GEOM.

This replaces the current ioctl processing with a direct call path
from geom_dev() where the ioctl arrives (from SPECFS) to any directly
connected GEOM class.

The inverse of the above is no longer supported. This is the
situation were you have one or more intervening GEOM classes, for
instance a BSDlabel on top of a MBR or PC98. If you want to issue
MBR or PC98 specific ioctls, you will need to issue them on a MBR
or PC98 providers.

This paves the way for inviting CD's, FD's and other special cases
inside GEOM.


# 116196 11-Jun-2003 obrien

Use __FBSDID().

Approved by: phk


# 115624 01-Jun-2003 phk

Simplify the GEOM OAM api: Drop the request type, and let everything
hinge on the "verb" parameter which the class gets to interpret as
it sees fit.

Move the entire request into the kernel and move changed parameters
back when done.


# 115611 01-Jun-2003 phk

Use bcmp() to compare hash strings.


# 115509 31-May-2003 phk

Remove unused variables.
Remove #ifdef notyet which will never become.

Found by: FlexeLint


# 115468 31-May-2003 phk

Remove the G_CLASS_INITIALIZER, we do not need it anymore.


# 114785 06-May-2003 phk

Fix the WARNING for wrong rawoffset, I tested incompatible units.

Approved by: re/jhb


# 114712 05-May-2003 phk

Don't warn if the rawoffset is zero, that is actually the best value it
could have.


# 114705 05-May-2003 phk

Turn the check that rawoffset == mbroffset into a warning instead.


# 114672 04-May-2003 phk

Only accept a rawoffset if it is identical to the mbroffset.


# 114671 04-May-2003 phk

Add a way to read the current mbroffset from a BSD label class.


# 114668 04-May-2003 phk

Remove debugging printfs which should not have been committed.


# 114568 03-May-2003 phk

Add a OAM interface for changing the label and writing the boot code.


# 114556 02-May-2003 phk

Make bsd_disklabel_le_enc calculate the checksum and fill it in.
(If there is a legitimate need to correctly encode and pack a
disklabel with an invalid checksum custom tools can be built for
that.)

Make bsd_disklabel_le_dec() validate the magics, number of partitions
(against a new parameter) and the checksum.

Vastly simplify the logic of the GEOM::BSD class implementation:

Let g_bsd_modify() always take a byte-stream label.

This simplifies all users, except the ioctl's which now have to
convert to a byte-stream first. Their loss.

g_bsd_modify() is called with topology held now, and it returns
with it held.

Always update the md5sum in g_bsd_modify(), otherwise the check
is no use after the first modification of the label. Make the
MD5 over the bytestream version of the label.

Move the rawoffset hack to g_bsd_modify() and remove all the
inram/ondisk conversions.

Don't configure hotspots in g_bsd_modify(), do it in taste instead,
we do not support moving the label to a different location on the
fly anyway.

This passes all current regression tests.


# 114506 02-May-2003 phk

Use g_slice_spoiled() rather than g_std_spoiled()


# 113937 23-Apr-2003 phk

Rename g_call_me() to g_post_event(), and give it a flag
argument to determine if we can M_WAITOK in malloc.


# 113713 19-Apr-2003 phk

Make more of the "hotspot" stuff generic:

Give the class a way to specify the necessary action for read/delete/write:
ALLOW, DENY, START or CALL.

Update geom_bsd to use this.


# 113593 17-Apr-2003 phk

These two files fell off during my previous commit: put the encoding
decoding functions for struct disklabel in a separate .c file.


# 113432 13-Apr-2003 phk

Time has run from the "run GEOM in userland" harness, and the new regression
test is built to test GEOM as running in the kernel.

This commit is basically "unifdef -D_KERNEL" to remove the mainly #include
related code to support the userland-harness.


# 113390 12-Apr-2003 phk

Retire the "frontstuff" record keeping, it was no match for the
in-band meta-data of BSD labels and a more complex solution will be needed.


# 113032 03-Apr-2003 phk

Remove all references to BIO_SETATTR. We will not be using it.


# 113011 03-Apr-2003 phk

Use <sys/endian.h> instead of geom_enc.c for endianess-agnostification.


# 112989 02-Apr-2003 phk

Add handling for cancelled events in the g_call_me() methods.


# 112988 02-Apr-2003 phk

Change events to have an array of "void *" references, and give the
event posting functions varargs to fill these.

Attribute g_call_me() to appropriate g_geom's where necessary.

Add a flag argument to g_call_me() methods which will be used to signal
cancellation of events in the future.

This commit should be a no-op.


# 112552 24-Mar-2003 phk

Premptively change initializations of struct g_class to use C99
sparse struct initializations before we extend the struct with
new OAM related member functions.


# 112367 18-Mar-2003 phk

Including <sys/stdint.h> is (almost?) universally only to be able to use
%j in printfs, so put a newsted include in <sys/systm.h> where the printf
prototype lives and save everybody else the trouble.


# 112069 10-Mar-2003 phk

Fix yet another fallout of our M_* song and dance.


# 109973 28-Jan-2003 phk

Mark some args unused so this compiles in userland.


# 109900 26-Jan-2003 phk

Implement DIOCBSDBB ioctl which overwrites first BBSIZE bytes of BSD
labeled disk.

This is complicated by the fact that BBSIZE is greater than the
PAGE_SIZE limit ioctl inflicts on arguments which are automatically
copied in.

As long as we don't need access to userland memory (copyin/out) we
can deal with the ioctl using g_callme() which executes it from the
GEOM event thread.

Once we need copyin/out, we need to return the bio with EDIRIOCTL
in order to make geom_dev call us back in the original process context
where copyin will work.

Unfortunately, that results in us getting called with Giant, so
we have to DROP_GIANT/PICKUP_GIANT around the code where we diddle
GEOMs internals.

Sometimes you just can't win...

... But it does make geom_bsd.c an almost complete example of the
GEOM beastiarium.


# 109169 13-Jan-2003 phk

Fix typo.


# 109081 10-Jan-2003 jhb

Output the fstype of each partition in a disklabel in the configuration
text similar to the way that the MBR module dumps its slice types.


# 108819 06-Jan-2003 phk

BSD disklabels expose the controling label though the 'c' partition, and
some trick is necessary to prevent further BSD geoms from attaching to
that. Our old trick was to make sure we don't attach to a geom from
the "BSD" class, but this doesn't work if an intermediary geom obscures
this fact. Instead, calculate the MD5 checksum of the label we target
and ask if anybody below us loves that label. If they do we don't.

Coded by: gordon.


# 107953 16-Dec-2002 phk

Constification and some s/int/u_int/ changes.


# 107832 13-Dec-2002 phk

Don't interpret the hotspots relative to all slices on a slicer, but
relative to the parent device.


# 107526 02-Dec-2002 phk

Use the hotspot code to prevent people from overwriting their disklabel
with stuff which would ruin the day for any open parititons.

Approved by: re


# 106634 08-Nov-2002 phk

Always recalculate the SRM checksum if the label is at 64 bytes offset.

Tested by: jhb


# 106559 07-Nov-2002 nyan

Fix to support pc98.
It is mostly merged from MBR specific part.

Reviewed by: phk


# 106076 28-Oct-2002 phk

Add more compatibility junk.


# 105551 20-Oct-2002 phk

Now that the sectorsize and mediasize are properties of the provider,
don't take the detour over the I/O path to discover them using getattr(),
we can just pick them out directly.

Do note though, that for now they are only valid after the first open
of the underlying disk device due compatibility with the old disk_create()
API. This will change in the future so they will always be valid.

Sponsored by: DARPA & NAI Labs.


# 105542 20-Oct-2002 phk

Make the sectorsize a property of providers so we can include it in the XML
output.

Sponsored by: DARPA & NAI Labs


# 105505 20-Oct-2002 phk

Style(9) and english(9) fixes.

Submitted by: schweikh


# 104534 05-Oct-2002 phk

Fix argument order mistake when decoding disklabels from on-disk format.

Detected by: jhay
Sponsored by: DARPA & NAI Labs.


# 104197 30-Sep-2002 phk

Don the asbestos underwear and add the code which lets DIOCWDINFO
write modified disklabels back to disk.

Sponsored by: DARPA & NAI Labs.


# 104195 30-Sep-2002 phk

Retire g_io_fail() and let g_io_deliver() take an error argument instead.

Sponsored by: DARPA & NAI Labs.


# 104065 27-Sep-2002 phk

Extensively rework the geom_bsd method, put a lot of comments in, betting
that this will make people use this for their future copy&paste operations.

Rework the detection of raw-disk offsets in disklabels. This actually
unearthed a number of bugs in the (now) previous version.

Also accept labels which don't have a magic RAW_PART, provided they don't
confuse us too much.

Change the order of our sanity-checks on labels found on disks to be more
robust.

Check against MAXPARTITIONS in our sanity-check and reject disklabels
we cannot cope with.

Create new g_bsd_modify() function to implment disklabel modifying
ioctls.

Implement DIOCSDINFO and DIOCWDINFO with the provision that the latter
still not writes your change back to disk. I didn't have the nerves
for that yet.

In the start routine, use g_call_me() for complex ioctls to prevent
sleeping.

Sponsored by: DARPA & NAI Labs.


# 104064 27-Sep-2002 phk

Add the new g_slice_config() call, which can add/delete/change a slice,
with support for trying, doing and forcing.

This will eventually replace g_slice_addslice() which gets changed from
grabbing topology to requing it in this commit as well.

Sponsored by: DARPA & NAI Labs.


# 104062 27-Sep-2002 phk

Correctly en/decode MAXPARTITIONS partitions.

Sponsored by: DARPA & NAI Labs.


# 103284 13-Sep-2002 phk

"Fix" printf format issues by using %j

Sponsored by: DARPA & NAI Labs.


# 103009 06-Sep-2002 phk

Remove "magicspace". It looks good on paper, it doesn't work in practice.

Sponsored by: DARPA & NAI Labs.


# 98066 09-Jun-2002 phk

Improve some on the naming.

Submitted by: iedowse


# 97887 05-Jun-2002 phk

Change the registration of magic spaces so it does its own memory management.

Sponsored by: DARPA & NAI Labs.


# 97078 21-May-2002 phk

Introduce the concept of "magic spaces", and implement them in most of
the relevant classes.

Some methods may implement various "magic spaces", this is reserved
or magic areas on the disk, set a side for various and sundry purposes.
A good example is the BSD disklabel and boot code on i386 which occupies
a total of four magic spaces: boot1, the disklabel, the padding behind
the disklabel and boot2. The reason we don't simply tell people to
write the appropriate stuff on the underlying device is that (some of)
the magic spaces might be real-time modifiable. It is for instance
possible to change a disklabel while partitions are open, provided
the open partitions do not get trampled in the process.

Sponsored by: DARPA & NAI Labs.


# 97075 21-May-2002 phk

Remove the "-class" suffix from classes, they will not be ambiguous.

Sponsored by: DARPA & NAI Labs.


# 96953 19-May-2002 phk

Generalize a bit: we don't need separate functions to find the i386 and
alpha disklabels, just one function which is told where to look.

Sponsored by: DARPA & NAI Labs.


# 95323 23-Apr-2002 phk

Implement the GEOMGETCONF ioctl which returns vital stats for the
current device in XML in an sbuf.

Sponsored by: DARPA & NAI Labs


# 94287 09-Apr-2002 phk

Implement DIOCGFRONTSTUFF ioctl which reports how many bytes from the start
of the device magic stuff might occupy.

Sponsored by: DARPA & NAI Labs.


# 93776 04-Apr-2002 phk

Move access and orphan member functions from class to geom.

Sponsored by: DARPA & NAI Labs


# 93657 02-Apr-2002 phk

Retire the bogus ioctl DIOCGPART in toto.

Once again we can notice that badly thought out hacks ferment and infect
far more code than initially expected.

Sponsored by: DARPA and NAI Labs.


# 93326 28-Mar-2002 phk

In the absense of any smarter way to do this, cast various printf
arguments to silence printf format warnings.


# 93292 27-Mar-2002 phk

Calculate the checksum the right place for alpha. The fact that this
worked for the beast disklabel only goes to show how weak a simple
parity really is.


# 93250 26-Mar-2002 phk

Eliminate some thread pointers which do not make sense anymore.

Split private parts of geom.h into geom_int.h. The latter should
never be included in class implemtations.


# 93248 26-Mar-2002 phk

Cave in to tradition and rename "methods" to "classes".


# 93097 24-Mar-2002 phk

Make the BSD method width/endian agnostic and support alpha
architecture labels as well.

Sponsored by: DARPA, NAI Labs.


# 92513 17-Mar-2002 phk

Make this compile in the userland-regression testsuite again.


# 92403 16-Mar-2002 phk

Add a generic and general ioctl pass-through mechanism.

It should now be posible to issue ioctls to SCSI CD drives.


# 92108 11-Mar-2002 phk

First commit of the GEOM subsystem to make it easier for people to
test and play with this.

This is not yet production quality and should be run only on dedicated
test boxes.

For people who want to develop transformations for GEOM there exist a
set of shims to run geom in userland (ask phk@freebsd.org).

Reports of all kinds to: phk@freebsd.org
Please include in report:
dmesg
sysctl debug.geomdot
sysctl debug.geomconf

Known significant limitations:
no kernel dump facility.
ioctls severely restricted.

Sponsored by: DARPA, NAI Labs