mirror of https://github.com/zrafa/xinu-avr.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
772 B
29 lines
772 B
/* namopen.c - namopen */ |
|
|
|
#include <xinu.h> |
|
|
|
/*------------------------------------------------------------------------ |
|
* namopen - Open a file or device based on the name |
|
*------------------------------------------------------------------------ |
|
*/ |
|
devcall namopen( |
|
struct dentry *devptr, /* Entry in device switch table */ |
|
char *name, /* Name to open */ |
|
char *mode /* Mode argument */ |
|
) |
|
{ |
|
char newname[NM_MAXLEN]; /* Name with prefix replaced */ |
|
did32 newdev; /* Device ID after mapping */ |
|
|
|
/* Use namespace to map name to a new name and new descriptor */ |
|
|
|
newdev = nammap(name, newname, devptr->dvnum); |
|
|
|
if (newdev == SYSERR) { |
|
return SYSERR; |
|
} |
|
|
|
/* Open underlying device and return status */ |
|
|
|
return open(newdev, newname, mode); |
|
}
|
|
|