UFS_DISK_CLOSE(3)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’… UFS_DISK_CLOSE(3) πŸ’…

okay so this is the UFS_DISK_CLOSE(3) page from the Library Functions Manual, and we're about to talk about opening and closing userland UFS disks. stay with me bestie, it's giving very niche but very iconic πŸ’–


✨ NAME ✨

  • ufs_disk_close, ufs_disk_fillout, ufs_disk_fillout_blank, ufs_disk_write β€” open and close userland UFS disks πŸŽ€

πŸ“š LIBRARY πŸ“š

UFS File System Access Library (libufs, -lufs) β€” that's the library, periodt. πŸ¦‹

πŸ’» SYNOPSIS πŸ’»

#include <sys/param.h>
#include <sys/mount.h>
#include <ufs/ufs/ufsmount.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
#include <libufs.h>

int
ufs_disk_close(struct uufsd *disk);

int
ufs_disk_fillout(struct uufsd *disk, const char *name);

int
ufs_disk_fillout_blank(struct uufsd *disk, const char *name);

int
ufs_disk_write(struct uufsd *disk);

🫢 DESCRIPTION 🫢

Okay so ufs_disk_close() closes a disk and frees the internal memory related to it. the way it does not free the disk structure, tho β€” that part is important, bestie. it just handles the disk and its internal memory, not the uufsd struct itself. πŸ’…

ufs_disk_fillout() and ufs_disk_fillout_blank() open a disk specified by name and populate the structure pointed to by disk. the structure referenced by the disk pointer must be aligned to at least the alignment specified by LIBUFS_ALIGN, which is defined in the <libufs.h> header file. the disk is opened read-only. the specified name may be either a mountpoint, a device name or a filesystem image. πŸŽ€

ufs_disk_fillout() assumes there is a valid superblock and will fail if not, whereas ufs_disk_fillout_blank() makes no assumptions of that sort. so one is like "superblock check bestie" and the other is "no thoughts, just open" β€” but like, technically, not literally. 🌸

ufs_disk_write() attempts to re-open a disk as writable if it is not currently. that's the whole lil mission. πŸ”₯

😭 ERRORS 😭

  • ufs_disk_close() has no failure points. icon behavior, honestly. ✨
  • ufs_disk_fillout() may fail for any of the reasons ufs_disk_fillout_blank() might, as well as for any reason sbread(3) might. πŸ’€
  • ufs_disk_fillout_blank() may fail and set errno for any of the errors specified for the library functions open(2), strdup(3). additionally, it may follow the libufs(3) error methodologies in situations where no device could be found to open. 🫢
  • ufs_disk_write() may fail and set errno for any of the errors specified for the library functions open(2) and stat(2). namely, it will fail if the disk in question may not be written to. 😭

πŸ‘€ SEE ALSO πŸ‘€

open(2), getfsfile(3), libufs(3), sbread(3) πŸ‘‘

πŸ•°οΈ HISTORY πŸ•°οΈ

These functions first appeared as part of libufs(3) in FreeBSD 5.0. πŸ¦‹

πŸ‘‘ AUTHORS πŸ‘‘

Juli Mallett <jmallett@FreeBSD.org> πŸ’–


xoxo, this page is from Debian, dated November 17, 2023 β€” mwah, bestie πŸ’‹

πŸ“¦ where this page comes from