disk_netbsd.c (16 calls) and mount_netbsd.c (2) are catalogued now: messages 218-233 for the new sentences (no hw.disknames, a %s partition cannot be mounted/checked, no %s here, the name rule with blanks and 32 characters, the new partition did not appear, no /etc/mtree, repairing permissions needs the administrator, no mount table) and the numbers that already existed for the same texts as on Linux (no disk %s, not mounted, the system's, erasing needs the administrator, no drive, holds the system, mounted on, no room for the mounts). German copy in programs/localized/de_DE.UTF-8/msg/mcdesys.msg with the same numbers. Verification: both files pass x86_64--netbsd-gcc -std=gnu11 -fsyntax-only -Wall with the tree's sysroot (they are only compiled on NetBSD). The catalog was measured through mcde_sys_msg (the function the backend calls): LANG=C "No list of disks (hw.disknames).", "A name has letters, digits, blanks, - and _, at most 32.", "Only the administrator can repair permissions."; LANG=de_DE.UTF-8 "Keine Plattenliste (hw.disknames).", "Ein Name hat Buchstaben, Ziffern, Leerzeichen, - und _, höchstens 32.", "Nur der Administrator kann die Rechte reparieren." make mcde-linux was refused by the build lock: another session holds it (tools/build-lock.sh tools/userland.sh, pid 3102819) -- one build at a time, root AGENTS.md. The two changed sources are NetBSD-only, so the Linux library is unaffected; the Linux build, check and plist run follows when the lock is free.
49 lines
1.4 KiB
C
49 lines
1.4 KiB
C
/*
|
|
* mount_netbsd.c -- MCDE: the mounts of a NetBSD system (McdeSys)
|
|
*
|
|
* License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
|
|
*
|
|
* getmntinfo(3) (sys/mount.h) gives the kernel's mount table: the device or
|
|
* the server's export, the mount point and the file system type. The label
|
|
* of a volume is not in that table; McdeSys's disk list (disk_netbsd.c,
|
|
* dkctl listwedges) has it, and the desktop takes the label from there when
|
|
* it has one. A network mount's "label" is the server's name it came from.
|
|
*
|
|
* C99 and POSIX only (ext/src/mcde/AGENTS.md).
|
|
*/
|
|
|
|
#define _NETBSD_SOURCE
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <sys/param.h>
|
|
#include <sys/mount.h>
|
|
|
|
#include <Mcde/McdeSys.h>
|
|
|
|
#include "private.h"
|
|
|
|
int
|
|
mcde_sys_mounts_backend(McdeSysMount *m, size_t max)
|
|
{
|
|
struct statvfs *mnt;
|
|
int n, i;
|
|
|
|
if (m == NULL || max == 0)
|
|
return mcde_sys_fail(MCDE_SYS_EINVAL, mcde_sys_msg(MSG_MNT_NO_ROOM, "No room for the mounts."));
|
|
if ((n = getmntinfo(&mnt, MNT_NOWAIT)) <= 0)
|
|
return mcde_sys_fail(MCDE_SYS_EFAIL, mcde_sys_msg(MSG_NMNT_NO_TABLE, "No mount table."));
|
|
for (i = 0; i < n && (size_t) i < max; i++) {
|
|
McdeSysMount *x = &m[i];
|
|
|
|
memset(x, 0, sizeof *x);
|
|
snprintf(x->source, sizeof x->source, "%s",
|
|
mnt[i].f_mntfromname);
|
|
snprintf(x->mountpoint, sizeof x->mountpoint, "%s",
|
|
mnt[i].f_mntonname);
|
|
snprintf(x->fstype, sizeof x->fstype, "%s",
|
|
mnt[i].f_fstypename);
|
|
}
|
|
return i;
|
|
}
|