AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
rofs.c File Reference

The operations of a read-only filesystem that would change it: each fails with EROFS. More...

#include <core/system.h>
#include <fs/vfs.h>
#include <fs/rofs.h>

Go to the source code of this file.

Functions

ssize_t rofs_write (struct vnode *vnode, off_t offset, struct iobuf *io)
 Refuses a write to a read-only filesystem.
int rofs_trunc (struct vnode *vnode, off_t len)
 Refuses to truncate a file on a read-only filesystem.
int rofs_vmknod (struct vnode *dir, const char *fn, uint32_t mode, dev_t dev, struct uio *uio, struct vnode **ref)
 Refuses to make a node on a read-only filesystem.
int rofs_vunlink (struct vnode *dir, const char *fn, struct uio *uio)
 Refuses to remove a name from a read-only filesystem.
int rofs_vlink (struct vnode *dir, const char *fn, struct vnode *vnode, struct uio *uio)
 Refuses to make a hard link on a read-only filesystem.
int rofs_vrename (struct vnode *odir, const char *ofn, struct vnode *ndir, const char *nfn, struct uio *uio)
 Refuses to rename on a read-only filesystem.
int rofs_setattr (struct vnode *vnode)
 Refuses to change a node's attributes on a read-only filesystem.

Detailed Description

The operations of a read-only filesystem that would change it: each fails with EROFS.

A read-only filesystem (initramfs) uses them in its table of vnode operations.

Definition in file rofs.c.

Function Documentation

◆ rofs_setattr()

int rofs_setattr ( struct vnode * vnode)

Refuses to change a node's attributes on a read-only filesystem.

Parameters
vnodethe node
Returns
-EROFS

Definition at line 100 of file rofs.c.

References rofs_setattr().

Referenced by rofs_setattr().

◆ rofs_trunc()

int rofs_trunc ( struct vnode * vnode,
off_t len )

Refuses to truncate a file on a read-only filesystem.

Parameters
vnodethe file
lenthe length asked for
Returns
-EROFS

Definition at line 31 of file rofs.c.

References rofs_trunc().

Referenced by rofs_trunc().

◆ rofs_vlink()

int rofs_vlink ( struct vnode * dir,
const char * fn,
struct vnode * vnode,
struct uio * uio )

Refuses to make a hard link on a read-only filesystem.

Parameters
dirthe directory
fnthe new name
vnodethe file to link
uiowho is asking
Returns
-EROFS

Definition at line 74 of file rofs.c.

References rofs_vlink().

Referenced by rofs_vlink().

◆ rofs_vmknod()

int rofs_vmknod ( struct vnode * dir,
const char * fn,
uint32_t mode,
dev_t dev,
struct uio * uio,
struct vnode ** ref )

Refuses to make a node on a read-only filesystem.

Parameters
dirthe directory
fnthe new node's name
modeits type and permissions
devits device number
uiowho is asking
refnot set
Returns
-EROFS

Definition at line 47 of file rofs.c.

References rofs_vmknod().

Referenced by rofs_vmknod().

◆ rofs_vrename()

int rofs_vrename ( struct vnode * odir,
const char * ofn,
struct vnode * ndir,
const char * nfn,
struct uio * uio )

Refuses to rename on a read-only filesystem.

Parameters
odirthe old directory
ofnthe old name
ndirthe new directory
nfnthe new name
uiowho is asking
Returns
-EROFS

Definition at line 89 of file rofs.c.

References rofs_vrename().

Referenced by rofs_vrename().

◆ rofs_vunlink()

int rofs_vunlink ( struct vnode * dir,
const char * fn,
struct uio * uio )

Refuses to remove a name from a read-only filesystem.

Parameters
dirthe directory
fnthe name
uiowho is asking
Returns
-EROFS

Definition at line 60 of file rofs.c.

References rofs_vunlink().

Referenced by rofs_vunlink().

◆ rofs_write()

ssize_t rofs_write ( struct vnode * vnode,
off_t offset,
struct iobuf * io )

Refuses a write to a read-only filesystem.

Parameters
vnodethe file
offsetwhere the write would be
iothe data
Returns
-EROFS

Definition at line 19 of file rofs.c.

References rofs_write().

Referenced by rofs_write().