Dcntl

Section: Aug. 5, 1993 (2)
Updated: MiNT Programmer's Manual
Index Return to Main Contents
 

NAME

Dcntl - perform a file system specific operation on a file or directory  

SYNOPSIS

#include <filesys.h>

LONG Dcntl( WORD cmd, char *name, LONG arg);
 

DESCRIPTION

Dcntl performs a file system specific command, given by cmd, upon the file or directory specified by name. The exact nature of the operation performed depends upon the file system on which name resides. The interpretation of the third argument arg depends upon the specific command.

The only built-in file systems which support Dcntl operations are the device file system U:\DEV and the unified file system U:\.

U:\ understands the following commands:

FS_INSTALL
Installs a new file system. name must be U:\, and arg is a pointer to an fs_descr structure, which has the following format:

struct fs_descr
{
/* points to the file system structure for this file system */
        FILESYS *file_system;
/* device number for a particular mount point; filled in when an FS_MOUNT
 * Dcntl call is made
 */
        short dev_no;
/* "flags" may be used by the file system for whatever it wants */
        long flags;
/* the next 4 long words are reserved by the kernel */
        long reserved[4];
};


If the FS_INSTALL call is successful, a pointer to a kernel information structure (struct kerinfo) is returned; otherwise, a NULL pointer is returned. Note that even if the call is successful and the file system is installed, it is still not accessible until it has been given a name with FS_MOUNT.
FS_MOUNT
Mounts an already existing file system into drive U:\. arg is a pointer to an fs_descr structure describing the file system, and name gives the name under which the file system may be accessed. After the mount, the file systems "dev_no" field will be updated to reflect the new, kernel-assigned device number for this instance of the file system. This allows file systems to be mounted multiple times. On success, the (positive) device number is returned; on failure, a negative error number is returned.
FS_UNMOUNT
Removes a mount created by FS_MOUNT. arg points to the fs_descr structure describing the file system, and name is the name under which the system is mounted.
FS_UNINSTALL
Removes a file system completely from the kernel. This call is allowed only if no remaining names exist for the file system, i.e. if all mount points have been removed by FS_UNMOUNT> arg points to the fs_descr structure describing the file system, and name must be U:\.

U:\DEV understands the following commands:

DEV_INSTALL
Installs a new device driver whose name is given by name (which must be the complete path and file name, e.g. U:\DEV\FOO). The device may be accessed only through GEMDOS file operations; the BIOS will not be aware of it. arg is a pointer to a device descriptor structure:

struct dev_descr {
 /* pointer to device driver structure */
        DEVDRV  *driver;
 /* placed in the "aux" field of file cookies */
        short   dinfo;
 /* either 0 or O_TTY */
        short   flags;
 /* if flags&O_TTY, this points to the tty structure associated
  * with the device
  */
        struct tty *tty;
 /* reserved for future expansion -- set to 0 */
        long    reserved[4];
};
If the attempt to install the device is successful, Dcntl will return a pointer to a structure with type "struct kerinfo" that describes the kernel (see the documentation for loadable file systems for more information on this structure). This structure is in protected memory and can be accessed only in supervisor mode. Moreover, the structure is read only; attempts to write to it will produce unpredictable errors. If there is not enough memory to install the new device, a null pointer will be returned.
DEV_NEWTTY
Installs a driver for a new BIOS terminal device whose name is name (this must be the full path name, e.g. U:\DEV\BAR). arg is the BIOS device number of this device. Note that the BIOS must have been told about the device already via the Bconmap system call or some similar mechanism; otherwise, any attempt to access the file will result in an unknown device error (EUNDEV). This command simply informs the kernel about a BIOS device that already exists, unlike DEV_INSTALL which actually creates a new device.
DEV_NEWBIOS
Installs a driver for a new BIOS non-terminal device whose name is name (this must be the full path name, e.g. U:\DEV\BAR). arg is the BIOS device number of this device. Note that the BIOS must have been told about the device already via the Bconmap system call or some similar mechanism; otherwise, any attempt to access the file will result in an unknown device error (EUNDEV). Like DEV_NEWTTY, this command informs the kernel of the existence of a BIOS device. The difference between the two commands is that DEV_NEWTTY should be used for devices which may be used as terminal devices (e.g. serial lines), whereas DEV_NEWBIOS is useful for devices for which data must be always transmitted "raw" (e.g. a SCSI tape device, or perhaps a LAN device).
 
 

RETURNS

The value returned depends on the specific operation requested and the file system involved. Generally, a 0 or positive return value should mean success, and a negative one failure. An exception is the value returned by DEV_INSTALL, which is either a pointer to a kernel information structure, or null on failure.  

SEE ALSO

Bconmap(2), Fcntl(2)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURNS
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 08:58:10 GMT, February 14, 2025