
In order to avoid creating libfsdriver exceptions, two changes to VFS are necessary: - the returned position field for reads/writes is no longer abused to return the new pipe size; VFS is perfectly capable of updating the size itself; - during system startup, PFS is now sent a mount request, just like all other file systems. In proper "two steps forward, one step back" fashion, the latter point has the consequence that PFS can no longer drop its privileges at startup. This is probably best resolved with a more general solution for all boot image system services. The upside is that PFS no longer needs to be linked with libc. Change-Id: I92e2410cdb0d93d0e6107bae10bc08efc2dbb8b3
43 lines
987 B
C
43 lines
987 B
C
#include "fs.h"
|
|
|
|
|
|
/*===========================================================================*
|
|
* fs_newnode *
|
|
*===========================================================================*/
|
|
int fs_newnode(mode_t mode, uid_t uid, gid_t gid, dev_t dev,
|
|
struct fsdriver_node *node)
|
|
{
|
|
register int r = OK;
|
|
struct inode *rip;
|
|
|
|
/* Try to allocate the inode */
|
|
if( (rip = alloc_inode(dev, mode, uid, gid) ) == NULL) return(err_code);
|
|
|
|
switch (mode & S_IFMT) {
|
|
case S_IFBLK:
|
|
case S_IFCHR:
|
|
rip->i_rdev = dev; /* Major/minor dev numbers */
|
|
break;
|
|
case S_IFIFO:
|
|
if ((get_block(dev, rip->i_num)) == NULL)
|
|
r = EIO;
|
|
break;
|
|
default:
|
|
r = EIO; /* Unsupported file type */
|
|
}
|
|
|
|
if (r != OK) {
|
|
free_inode(rip);
|
|
} else {
|
|
/* Fill in the fields of the response message */
|
|
node->fn_ino_nr = rip->i_num;
|
|
node->fn_mode = rip->i_mode;
|
|
node->fn_size = rip->i_size;
|
|
node->fn_uid = rip->i_uid;
|
|
node->fn_gid = rip->i_gid;
|
|
node->fn_dev = dev;
|
|
}
|
|
|
|
return(r);
|
|
}
|