routine in the Sram driver
gets a file descriptor to use with the
The logic is:
to get the minor number for the device.
Increment the opened variable.
Because this is such a simple driver,
opened is not actually used,
but it is always good practice to
keep track of the number of times
a particular device has been opened
so that the
routine can identify the final close of the device.
Note that this variable is declared
and set to 0 in the Sram.h header file
to ensure that its accuracy is preserved
across a reboot.
Return 0 if successful.
If not successful, set
u.u_error to EBUSY
and return -1.
routine will be called only when the device is opened
for raw I/O,
so error conditions are returned through the
rather than through the buf structure.
This routine should be exclusive
if it adjusts functionality.
In that case, the
routine would need to be coded
to allow a file descriptor to be reopened
after it is closed.
© 2005 The SCO Group, Inc. All rights reserved.