device_nodes(3K) DG/UX R4.11MU05 device_nodes(3K)
NAME
device_nodes: fs_submit_dev_pathname_request - create or delete
device nodes
SYNOPSIS
#include "/usr/src/uts/aviion/ii/i_fs.h"
void fs_submit_dev_pathname_request (
fs_dev_request_operation_enum_type operation, /*READ_ONLY*/
...
)
DESCRIPTION
This routine is used by device drivers to submit a request to create
or delete a /dev entry. If the root file system is already mounted,
the request will be processed immediately. Otherwise, the request is
added to a queue for processing as soon as the root file system is
mounted.
The operation parameter is an enumeration value describing the opera
tion to be performed: Fs_Dev_Request_Operation_Create to create a de
vice node, or Fs_Dev_Request_Operation_Delete to delete one.
There are one or more variadic function arguments; these are pointers
to pathname component structures that together describe the device
node to be created or deleted. The first argument describes the
first component of the node's pathname (e.g., the dev in
/dev/dsk/root); the second argument describes the second pathname
component; etc. The argument list must be terminated by the pointer
value FS_DEV_PATHNAME_NULL_COMPONENT. Each pathname component struc
ture looks like:
typedef struct {
char_type name[MAXNAMELEN];
df_file_mode_type mode_bits;
uint32_type user_id;
uint32_type group_id;
io_device_number_type device;
}
fs_dev_pathname_component_type;
The fields in this structure are relevant only for
Fs_Dev_Request_Operation_Create operations, except as noted below.
The fields are:
name The filename of the component in the pathname of the
device node that is being created or deleted. For ex
ample, the filename of the first component of a request
to create or delete /dev/dsk/root would be "dev", while
the filename of the third component of that request
would be "root".
mode_bits The initial mode bits of the pathname component being
created, including both access permissions (read,
write, execute, etc.) and file type information (direc
tory vs. character-special file vs. block-special
file).
user_id The user ID to be assigned to pathname component being
created.
group_id The group ID to be assigned to pathname component being
created.
device The device number of the node being created. This
field is only valid if the component being created is a
block-special or character-special file.
The attributes (mode bits, user ID and group ID) of intermediate
directory components are relevant only during
Fs_Dev_Request_Operation_Create operations, and then only for in
termediate directories that don't already exist. Once created,
such directories' attributes will not be changed by any subse
quent create requests. During Fs_Dev_Request_Operation_Delete
operations, only the device node component of the request is
deleted; all intermediate directories are unaffected.
For convenience, a number of predefined pathname component struc
tures have been created in the FS subsystem. They include
fs_dev_dev_pathname_component (used to specify /dev itself),
fs_dev_pdsk_pathname_component (used to specify the pdsk subdi
rectory of /dev), and many other structures with names of the
form fs_dev_directory_pathname_component.
DIAGNOSTICS
Requests to create device nodes that already exist will result in er
ror messages to the system console.
EXAMPLES
The following example creates a character-special device node named
/dev/net/device_node_name with device_number as the node's device
number:
char_ptr_type device_node_name;
io_device_number_type device_number;
fs_dev_pathname_component_type node_component;
node_component.mode_bits = S_IFCHR | S_IRUSR | S_IWUSR;
node_component.user_id = FS_STANDARD_DEVICE_USER_ID;
node_component.group_id = FS_STANDARD_DEVICE_GROUP_ID;
node_component.device = device_number;
misc_format_line (node_component.name, usizeof (node_component.name),
"%s", device_node_name);
fs_submit_dev_pathname_request (Fs_Dev_Request_Operation_Create,
&fs_dev_dev_pathname_component,
&fs_dev_net_pathname_component,
&node_component,
FS_DEV_PATHNAME_NULL_COMPONENT);
SEE ALSO
device_configuration(3K).
Programming in the DG/UX Kernel Environment.
Licensed material--property of copyright holder(s)