Rob Gittins wrote:

>
> Hi Jim,
>
> Would it be possible to extend vsd_create to take a key as well as 
> create and return a key?  This way a FS can have predefined key values 
> for specific data elements.  This might simplify the usage in some cases.
>
> Thanks,
> Rob
>
I don't think so.  Of course, anything is possible in software, but what 
I mean is that the keys are system wide.  Once a vsd_create() is done, 
that key is gone until it is destroyed.  There isn't a way to reserve a 
key.  The key is only an index into the array of vsd's, starting at zero 
and incrementing for each vsd that is created  The array grows 
dynamically with the key, there are no preinitialized entries.

The user of VSD should not care what their key is.  It should be opaque 
to the user, that is, the user of vsd doesn't need to know the value of 
the key or the order (or number) of vsd elements.

Having a "predefined key" is no different than just using the key 
returned by vsd_create().  All the calls will be the same, having:
  uint_t MyFSvsdKey = 0;
  vsd_create(&MyFSvsdKey, NULL);
is no different than
  #define MyFSvsdKey 1 (or some number)

Also, you want the key to be the smallest available, since it determines 
how big of a vsd array needs to be allocated.  You wouldn't want to use 
a big number because it may be the only vsd being used and we would be 
wasting space by allocating a large array.  Lastly, how would the 
"reservation" of keys be managed?  Who would control that so two 
different groups/projects don't claim the same key?

Again, it is doable, but I don't think it is the right thing to do.  Let 
me know if you still have questions.  I could give you a pointer to the 
code, which may help in understanding how it works.

Jim


Reply via email to