Mercurial > illumos > illumos-gate
changeset 10283:76ddfbe3b1a4
PSARC 2009/413 Driver Private Minor Numbers for GLDv3
6864944 Deliver PSARC 2009/413 Driver Private Minor Numbers for GLDv3
author | Garrett D'Amore <Garrett.Damore@Sun.COM> |
---|---|
date | Sat, 08 Aug 2009 19:40:49 -0700 |
parents | e1d9bb38fa41 |
children | f12571ecd37e |
files | usr/src/uts/common/io/mac/mac.c usr/src/uts/common/sys/mac_provider.h |
diffstat | 2 files changed, 18 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/io/mac/mac.c Fri Aug 07 15:12:49 2009 -0700 +++ b/usr/src/uts/common/io/mac/mac.c Sat Aug 08 19:40:49 2009 -0700 @@ -417,11 +417,11 @@ /* * Allocate an id space to manage minor numbers. The range of the - * space will be from MAC_MAX_MINOR+1 to MAXMIN32 (maximum legal - * minor number is MAXMIN, but id_t is type of integer and does not - * allow MAXMIN). + * space will be from MAC_MAX_MINOR+1 to MAC_PRIVATE_MINOR-1. This + * leaves half of the 32-bit minors available for driver private use. */ - minor_ids = id_space_create("mac_minor_ids", MAC_MAX_MINOR+1, MAXMIN32); + minor_ids = id_space_create("mac_minor_ids", MAC_MAX_MINOR+1, + MAC_PRIVATE_MINOR-1); ASSERT(minor_ids != NULL); minor_count = 0;
--- a/usr/src/uts/common/sys/mac_provider.h Fri Aug 07 15:12:49 2009 -0700 +++ b/usr/src/uts/common/sys/mac_provider.h Sat Aug 08 19:40:49 2009 -0700 @@ -31,6 +31,7 @@ #include <sys/ddi.h> #include <sys/sunddi.h> #include <sys/stream.h> +#include <sys/mkdev.h> #include <sys/mac_flow.h> #include <sys/mac.h> @@ -49,6 +50,19 @@ #define MAC_VERSION 0x2 /* + * This is the first minor number available for MAC provider private + * use. This makes it possible to deliver a driver that is both a MAC + * provider and a regular character/block device. See PSARC 2009/380 + * for more detail about the construction of such devices. The value + * chosen leaves half of the 32-bit minor numbers (which are really + * only 18 bits wide) available for driver private use. Drivers can + * easily identify their private number by the presence of this value + * in the bits that make up the minor number, since its just the + * highest bit available for such minor numbers. + */ +#define MAC_PRIVATE_MINOR ((MAXMIN32 + 1) / 2) + +/* * Opaque handle types */ typedef struct __mac_rule_handle *mac_rule_handle_t;