| Main index | Section 3 | Options |
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
#include <libufs.h>
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); }
The function putinode() may fail and set errno for any of the errors specified for the library functions ufs_disk_write(3) or pwrite(2).
Additionally both functions may follow the libufs(3) error methodologies in case of a device error.
| GETINODE (3) | September 2, 2020 |
| Main index | Section 3 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
| “ | Ken Thompson has an automobile which he helped design. Unlike most automobiles, it has neither speedometer, nor gas gauge, nor any of the other numerous idiot lights which plague the modern driver. Rather, if the driver makes a mistake, a giant “?” lights up in the center of the dashboard. “The experienced driver,” says Thompson, “will usually know what's wrong.” | ” |