Commit Graph

86 Commits

Author SHA1 Message Date
phk
269b7a298a Add g_wither_geom_close() function. 2004-10-29 09:19:03 +00:00
phk
80dc3e1bc2 Don't call g_waitidle(), it happens automagically now. 2004-10-23 20:52:15 +00:00
arr
b510c7b809 - Turn KASSERT()s into warning printf()'s in the g_class_load() routine.
This removes a panic that will occur if you build with GENERIC and
  attempt to kldload a GEOM module that is already in the kernel.

Reviewed by: phk
2004-10-22 22:16:24 +00:00
green
c125751bac When loading GEOM modules, we expect the actual load process to be done
by the time that kldload(8) returns.  Satisfy that by making the GEOM
module load event -- only when the kernel is !cold -- wait until the
GEOM module init function has finished instead of returning immediately.

This is the other half of fixing md(8) (actually, "mfs" in fstab(5))
that is similar to r1.128 of src/sys/dev/md/md.c.  This bug would be
why RAM disks would often fail on boot and the first call to mdconfig(8)
would probably fail.

pjd has ideas for not requiring kldload(8) to work synchronously for
control devices that could make this obsolete.

Silence on:	-arch
2004-10-12 04:44:54 +00:00
phk
38ae102f61 For removable devices without media we set a zero mediasize but a non-zero
sectorsize in order to avoid a lot of checks around various divisions etc.

Enforce the sectorsize being > 0 with a KASSERT on successful open.

Fix scsi_cd.c to return 2k sectors when no media inserted.
2004-09-05 21:15:58 +00:00
phk
685cf0583f OK, now check geom class version numbers. 2004-08-08 08:34:46 +00:00
phk
2568a59fae OOps, that check was a bit premature. Allow zero versions as well. 2004-08-08 07:30:47 +00:00
phk
e7ff003728 Give classes a version number and refuse to touch classes which are not
understood.  This makes room for additional binary compatibility in the
future.

Put fields in the class for the geom's methods and initialize the methods
of a new geom from these fields.  This saves some code in all classes.
2004-08-08 06:46:27 +00:00
phk
5be6baa85c Only detach consumers which are attached when we wither stuff away.
Pointed out by:	pjd
2004-07-09 14:06:17 +00:00
phk
042d10f8ef Make withering water tight.
When we orphan/wither a provider, an attached geom+consumer could
end up being withered as a result and it may be in front of us in
the normal object scanning order so we need to do multi-pass.  On
the other hand, there may be withering stuff we can't get rid off
(yet), so we need to keep track of both the existence of withering
stuff and if there is more we can do at this time.
2004-07-08 16:17:14 +00:00
phk
a0a0195602 Fail normally rather than KASSERT if attempt to open a spoiled consumer. 2004-07-08 10:34:09 +00:00
pjd
5fae899223 Move "is consumer attached?" check before G_VALID_PROVIDER() check,
because if consumer is not attached, its provider never will be valid,
so we never reach this check.

Approved by:	phk
2004-03-18 07:17:10 +00:00
phk
8940a1c435 Be more insistent on destroying geoms at unload time. Still not perfect,
but it will do (better) for now.

KASSERT that to have providers a class must have an access method.

Tag the new_provider event with the geom as well.
2004-03-11 08:16:23 +00:00
phk
9a7074f4cb Rearrange some of the GEOM debugging tools to be more structured.
Retire g_sanity() and corresponding debugflag (0x8)

  Retire g_{stall,release}_events().

  Under #ifdef DIAGNOSTIC:

    Make g_valid_obj() an official function and have it return an an
    non-zero integer which indicates the kind of object when found.

    Implement G_VALID_{CLASS,GEOM,CONSUMER,PROVIDER}() macros based
    on g_valid_obj().

    Sprinkle calls to these macros liberally over the infrastructure.

    Always check that we do not free a live object.
2004-03-10 08:49:08 +00:00
phk
4b105bbf3a Don't panic on providers already withered when we wither a geom. 2004-03-07 17:33:15 +00:00
phk
14df0ab802 Add a KASSERT which checks that a class never fails a closing ->access()
call.
2004-02-14 17:58:57 +00:00
phk
124977fbb6 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.
2004-02-12 22:42:11 +00:00
phk
f0fded48fd Allow a GEOM class to unload if it has no geoms or a method function to
get rid of them.

Prodded by:	pjd
2004-02-02 19:49:41 +00:00
pjd
35dc7138a2 - Use proper names in KASSERTs.
- Typos.

Approved by:	phk, scottl (mentor)
2004-02-02 17:50:09 +00:00
phk
67d8392228 Add KASSERTS.
Submitted by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2004-01-23 21:02:49 +00:00
phk
cd37a85408 Plug an insignificant memoryleak.
Submitted by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2004-01-23 20:40:25 +00:00
phk
437b669def Print the correct pointer in a KASSERT.
Submitted by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2004-01-11 10:02:42 +00:00
phk
cce4827569 KASSERT against no-op access requests.
Submitted by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2004-01-09 16:10:32 +00:00
phk
d7fc6b258d Call class->init() an class->fini() while the class is hooked up,
rather than right before and right after.  This allows these routines
to manipulate the mesh.

KASSERT that nobody creates a geom on an alien class.

Assert topology in g_valid_obj().

Approved by:	re@
2003-11-18 18:17:39 +00:00
phk
06ab707e79 This is a crude bandaid for 5.2 to protect against providers which disappear
while being tasted.  I can moderately easy trigger this with atapi-cd, but
I do not fully understand the circumstances.
2003-11-15 18:44:43 +00:00
phk
dc1586f843 Introduce a per provider wither flag 2003-10-06 09:05:44 +00:00
phk
ec0641f616 Don't panic over the fact that unloading failed if we already knew that. 2003-08-22 11:00:54 +00:00
obrien
40ee2bd5c8 Use __FBSDID().
Approved by:	phk
2003-06-11 06:49:16 +00:00
phk
dd1aaed417 Drop a memory-corruption debugging test-tool. 2003-06-07 10:55:48 +00:00
phk
69b4e9ce01 Add missing va_end() calls.
Noticed by:	tmm
2003-06-07 10:16:53 +00:00
phk
e23e34a198 Introduce g_provider_by_name() function, and use it. 2003-06-04 18:17:52 +00:00
phk
1ee949187c Add a KASSERT to prevent the same GEOM class from being processed loaded
twice.

Enforce that classes should have different names while we are here.
2003-06-04 17:51:10 +00:00
phk
5a2388f470 constify g_sanity() 2003-06-01 13:30:39 +00:00
phk
3325608f8f Introduce a init and fini member functions on a class.
Use ->init() and ->fini() to handle the mutex in geom_disk.c

Remove the g_add_class() function and replace it with a standardized
g_modevent() function.

This adds the basic infrastructure for loading/unloading GEOM classes
2003-05-31 18:13:07 +00:00
phk
055cf65eb1 Back out all the stuff that didn't belong in the last commit. 2003-05-02 06:42:59 +00:00
phk
4c52a206d2 Use g_slice_spoiled() rather than g_std_spoiled().
Remember to free the buffer we got from g_read_data().
2003-05-02 06:36:14 +00:00
phk
098143e63b Rework the "withering" mechanism:
Introduce g_wither_geom() to do the work in one single place.
2003-05-02 06:15:27 +00:00
phk
c51ae09b82 Remove the now obsolete geomidorname hack. 2003-05-01 20:32:24 +00:00
phk
def0071c3d Remove now unneeded special case for "geom.ctl". 2003-05-01 18:18:14 +00:00
phk
3bbfe9f43b Rename g_call_me() to g_post_event(), and give it a flag
argument to determine if we can M_WAITOK in malloc.
2003-04-23 20:46:12 +00:00
phk
7c462ceb2b Turn EV_NEW_PROVIDER into a g_call_me() event. 2003-04-23 20:16:13 +00:00
phk
67a31a6107 Convert EV_SPOILED event to use g_call_me(). 2003-04-23 20:06:38 +00:00
phk
16bcc257a6 Turn the hardwired NEW_CLASS event into a g_call_me() event. 2003-04-23 19:34:38 +00:00
phk
ee10d53986 Remove unused event pointers in object structures.
Remove KASSERTS which checked that they were unused.
2003-04-23 06:54:44 +00:00
phk
03b1ca36ba 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.
2003-04-13 09:02:06 +00:00
phk
2e8ebbf548 If we hit access ahead of a spoil event, we should have negative
delta access-counts and proceed.
2003-04-12 17:04:34 +00:00
phk
cedf04c475 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.
2003-04-02 20:41:18 +00:00
phk
a47b0e4a84 Only orphan things if the open/close actually succeeded. 2003-04-02 13:10:40 +00:00
phk
192c308033 g_class_by_name() was unused too. 2003-03-25 09:11:17 +00:00
phk
45e43ab0e8 Remove unuse g_insert_geom(). 2003-03-25 09:07:35 +00:00