|
NAME
LIBRARYUFS File System Access Library (libufs, -lufs) SYNOPSIS
int
int
DESCRIPTIONThe
The dinodep union is defined as: union dinodep {
struct ufs1_dinode *dp1;
struct ufs2_dinode *dp2;
};
Sample code to clear write permissions for inode number inumber stored on the filesystem described by diskp. #include <sys/stat.h>
#include <err.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
#include <libufs.h>
void
clearwrite(struct uufsd *diskp, ino_t inumber)
{
union dinodep dp;
if (getinode(diskp, &dp, inumber) == -1)
err(1, "getinode: %s", diskp->d_error);
switch (diskp->d_ufs) {
case 1: /* UFS 1 filesystem */
dp.dp1->di_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
break;
case 2: /* UFS 2 filesystem */
dp.dp2->di_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
break;
default:
errx(1, "unknown filesystem type");
}
if (putinode(diskp) == -1)
err(1, "putinode: %s", diskp->d_error);
}
RETURN VALUESThe ERRORSThe function The function Additionally both functions may follow the libufs(3) error methodologies in case of a device error. SEE ALSOHISTORYThese functions first appeared as part of libufs(3) in FreeBSD 13.0. AUTHORSMarshall Kirk McKusick <mckusick@FreeBSD.org>
|