Merge branch 'freebsd/current/main' into hardened/current/master

This commit is contained in:
HardenedBSD Sync Services 2024-10-21 06:01:43 -06:00
commit a5e977a8f0
No known key found for this signature in database
9 changed files with 47 additions and 34 deletions

View File

@ -421,6 +421,8 @@ bsd_to_linux_termios(struct termios *bios, struct linux_termios *lios)
lios->c_iflag |= LINUX_IXOFF;
if (bios->c_iflag & IMAXBEL)
lios->c_iflag |= LINUX_IMAXBEL;
if (bios->c_iflag & IUTF8)
lios->c_iflag |= LINUX_IUTF8;
lios->c_oflag = 0;
if (bios->c_oflag & OPOST)
@ -538,6 +540,8 @@ linux_to_bsd_termios(struct linux_termios *lios, struct termios *bios)
bios->c_iflag |= IXOFF;
if (lios->c_iflag & LINUX_IMAXBEL)
bios->c_iflag |= IMAXBEL;
if (lios->c_iflag & LINUX_IUTF8)
bios->c_iflag |= IUTF8;
bios->c_oflag = 0;
if (lios->c_oflag & LINUX_OPOST)

View File

@ -462,6 +462,7 @@
#define LINUX_IXOFF 0x0001000
#define LINUX_IMAXBEL 0x0002000
#define LINUX_IUTF8 0x0004000
/* Linux c_oflag masks */
#define LINUX_OPOST 0x0000001

View File

@ -25,17 +25,11 @@
* SUCH DAMAGE.
*/
/* Format L3.0, since we move to XZ API */
#define CLOOP_MAGIC_LZMA \
"#!/bin/sh\n" \
"#L3.0\n" \
"n=uncompress\n" \
"m=geom_$n\n" \
"(kldstat -m $m 2>&-||kldload $m)>&-&&" \
"mount_cd9660 /dev/`mdconfig -af $0`.$n $1\n" \
"exit $?\n"
#define DEFAULT_SUFX_LZMA ".ulzma"
/* Format L3.0, since we move to XZ API */
#define CLOOP_MAGIC_LZMA "#!/bin/sh\n#L3.0\n"
size_t mkuz_lzma_cbound(size_t);
void *mkuz_lzma_init(int *);
void mkuz_lzma_compress(void *, const struct mkuz_blk *, struct mkuz_blk *);

View File

@ -26,9 +26,7 @@
#define DEFAULT_SUFX_ZLIB ".uzip"
#define CLOOP_MAGIC_ZLIB "#!/bin/sh\n#V2.0 Format\n" \
"(kldstat -qm g_uzip||kldload geom_uzip)>&-&&" \
"mount_cd9660 /dev/`mdconfig -af $0`.uzip $1\nexit $?\n"
#define CLOOP_MAGIC_ZLIB "#!/bin/sh\n#V2.0 Format\n"
size_t mkuz_zlib_cbound(size_t);
void *mkuz_zlib_init(int *);

View File

@ -27,9 +27,7 @@
#define DEFAULT_SUFX_ZSTD ".uzst"
#define CLOOP_MAGIC_ZSTD "#!/bin/sh\n#Z4.0 Format\n" \
"(kldstat -qm g_uzip||kldload geom_uzip)>&-&&" \
"mount_cd9660 /dev/`mdconfig -af $0`.uzip $1\nexit $?\n"
#define CLOOP_MAGIC_ZSTD "#!/bin/sh\n#Z4.0 Format\n"
size_t mkuz_zstd_cbound(size_t);
void *mkuz_zstd_init(int *);

View File

@ -207,23 +207,6 @@ The same tradeoff continues to apply: reads in
.Xr geom_uzip 4
become more expensive the greater the cluster size.
.Pp
The
.Nm
utility
inserts a short shell script at the beginning of the generated image,
which makes it possible to
.Dq run
the image just like any other shell script.
The script tries to load the
.Xr geom_uzip 4
class if it is not loaded, configure the image as an
.Xr md 4
disk device using
.Xr mdconfig 8 ,
and automatically mount it using
.Xr mount_cd9660 8
on the mount point provided as the first argument to the script.
.Pp
The de-duplication is a
.Fx
specific feature and while it does not require any changes to on-disk
@ -247,6 +230,34 @@ for
.Dq 1 .
.Sh EXIT STATUS
.Ex -std
.Sh EXAMPLES
.Pp
The following describes how to create and mount a uzip image.
.Pp
Create a file system image:
.Bd -literal -offset indent
makefs /src.img /usr/src
.Ed
.Pp
Create the uzip image, the output file will be named src.img.uzip:
.Bd -literal -offset indent
mkuzip /src.img
.Ed
.Pp
Ensure geom_uzip is loaded:
.Bd -literal -offset indent
kldload geom_uzip
.Ed
.Pp
Create an MD device backed by the uzip image:
.Bd -literal -offset indent
mdconfig -f /src.img.uzip
.Ed
.Pp
Mount the uzip image:
.Bd -literal -offset indent
mount -o ro /dev/md0.uzip /mnt
.Ed
.Sh SEE ALSO
.Xr gzip 1 ,
.Xr xz 1 ,

View File

@ -298,7 +298,7 @@ int main(int argc, char **argv)
toc[hdr.nblocks] = 0;
cfs.fdw = open(oname, (cfs.en_dedup ? O_RDWR : O_WRONLY) | O_TRUNC | O_CREAT,
S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (cfs.fdw < 0) {
err(1, "open(%s)", oname);
/* Not reached */

View File

@ -37,6 +37,7 @@
.Op Fl i Ar ifname
.Op Fl r Ar file
.Op Fl s Ar snaplen
.Op Fl u
.Op Fl v
.Op Fl w Ar file
.Op Fl f Ar filter
@ -89,6 +90,8 @@ This option also works with the -f option.
Snapshot
.Ar snaplen
bytes from each packet.
.It Fl u
Unbuffered output.
.It Fl v
Enable debugging messages.
When defined multiple times the verbosity level increases.

View File

@ -829,7 +829,7 @@ main(int argc, char *argv[])
const char *optstring;
char *pp;
optstring = "b:d:hi:r:s:vw:f:";
optstring = "b:d:hi:r:s:uvw:f:";
while ((o = getopt(argc, argv, optstring)) != -1) {
switch (o) {
case 'b':
@ -899,6 +899,10 @@ main(int argc, char *argv[])
if (snapshot == 0)
snapshot = -1;
break;
case 'u':
setbuf(stdout, NULL);
setbuf(stderr, NULL);
break;
case 'v':
verbose++;
break;