Commit Graph

16 Commits

Author SHA1 Message Date
Konstantin Belousov
d485c77f20 Remove #define _KERNEL hacks from libprocstat
Make sys/buf.h, sys/pipe.h, sys/fs/devfs/devfs*.h headers usable in
userspace, assuming that the consumer has an idea what it is for.
Unhide more material from sys/mount.h and sys/ufs/ufs/inode.h,
sys/ufs/ufs/ufsmount.h for consumption of userspace tools, with the
same caveat.

Remove unacceptable hack from usr.sbin/makefs which relied on sys/buf.h
being unusable in userspace, where it override struct buf with its own
definition.  Instead, provide struct m_buf and struct m_vnode and adapt
code to use local variants.

Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D28679
2021-02-21 11:38:21 +02:00
Ryan Moeller
245bfd34da Deduplicate fsid comparisons
Comparing fsid_t objects requires internal knowledge of the fsid structure
and yet this is duplicated across a number of places in the code.

Simplify by creating a fsidcmp function (macro).

Reviewed by:	mjg, rmacklem
Approved by:	mav (mentor)
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D24749
2020-05-21 01:55:35 +00:00
Pedro F. Giffuni
1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Maxim Sobolev
bf43319445 Fix an issue in the rev.316718 causing variable to be unsed uninitialized.
Reported by:    Coverity
Nudged by:      cem
MFC after:	2 weeks
2017-04-12 19:23:41 +00:00
Maxim Sobolev
591e89c89b Work around an issue with mksnap_ffs not working in chroot'ed environment.
The problem is that the statfs(2) system call used to determine the relevant
mount point returns path within real root in the f_mntonname, causing
nmount(2) system call to fail with ENOENT.

Use a bit of heuristics to skip over few starting path elements when it
happens until we hit an actual mount point.

For this to work properly the whole mount should be accessible within the
chroot, it's going to still fail if chroot only has access to a part of the
mounted fs.

Reviewed by:	mckusick
Approved by:	mckusick
MFC after:	2 weeks
2017-04-11 21:55:39 +00:00
Jaakko Heinonen
7f79e870d2 - Print the nmount(2) provided error message only when it is set.
- Ensure that the error message is NUL-terminated before printing it.

PR:		bin/147482
MFC after:	2 weeks
2010-10-10 09:24:19 +00:00
Pawel Jakub Dawidek
923f9901b4 Initialize iov and iovlen before use.
Reported by:	Lucius Windschuh <lwindschuh@googlemail.com>
2009-06-02 18:30:09 +00:00
Pawel Jakub Dawidek
c8cf3f3d0e - Move from mount(2) to nmount(2). This should allow to convert MNT_SNAPSHOT
flag from a mount flag to FS-specific flag.
- Simplify usage. Instead of 'mksnap_ffs /mnt/foo /mnt/foo/snap' allow to
  give only one argument: 'mksnap_ffs /mnt/foo/snap'. Old usage is also
  accepted for now.
- Add an example of how to mount a snapshot.
2009-05-29 19:18:41 +00:00
Poul-Henning Kamp
b697270ad8 Make sure we don't pass garbage to the kernel.
The filesystem is named "ufs" not "ffs".
2004-12-08 11:54:50 +00:00
Dag-Erling Smørgrav
a1b99708d0 Style nit in previous commit. 2004-01-27 19:28:13 +00:00
Kirk McKusick
cea1849767 Preserve acls option on mounts when taking a snapshot.
Submitted by:	Wiktor Niesiobedzki <freebsd-lists@w.evip.pl>
2004-01-27 18:28:11 +00:00
Kirk McKusick
d62e006473 Check that the user running mksnap_ffs has permission to create and
remove a snapshot file from the directory in which they have requested
to have it made. If they do not have write permission in the directory
or the directory is sticky and not owned by the user, then they
will not be able to remove the snapshot when they are done with it.
2003-11-04 07:04:01 +00:00
Tom Rhodes
201747dffc style(9): sort functions. 2003-10-29 21:23:44 +00:00
Tom Rhodes
91b6ac7c44 Properly prototype C function usage().
Sync usage() with the manual page: s/file/snapshot_name/g.
2003-10-29 21:21:09 +00:00
Kirk McKusick
6d540f8137 Close out a possible race where anybody in group operator could
chown an arbitrary file to operator.

Reported by:	Ian Dowse <iedowse@maths.tcd.ie>
Sponsored by:   DARPA & NAI Labs.
2003-03-02 08:07:57 +00:00
Kirk McKusick
d35ae777f2 Add the mksnap_ffs command to the sbin directory. This setuid root
program allows users in the operator group to take filesystem
snapshots. Its first use will be in support of `dump -L'.

Approved by:	Technical Review Board <trb@FreeBSD.org>
Sponsored by:   DARPA & NAI Labs.
2003-03-02 01:50:33 +00:00