libspl: Provide platform-specific zone implementations

FreeBSD has the concept of jails, a precursor to Solaris's zones, which
can be mapped to the required zones interface with relative ease.  The
previous ZFS implementation in FreeBSD did so, and we should continue
to provide an appropriate implementation in OpenZFS as well.

Move lib/libspl/zone.c into platform code and adopt the correct
implementation for FreeBSD.

While here, prune unused code.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes #10851
This commit is contained in:
Ryan Moeller
2020-08-30 17:37:44 +00:00
committed by Brian Behlendorf
parent eff621071f
commit 46b7d53baf
4 changed files with 50 additions and 43 deletions
-9
View File
@@ -26,25 +26,16 @@
#ifndef _LIBSPL_ZONE_H
#define _LIBSPL_ZONE_H
#include <sys/types.h>
#include <sys/zone.h>
#include <sys/priv.h>
#ifdef __cplusplus
extern "C" {
#endif
#define GLOBAL_ZONEID 0
#define GLOBAL_ZONEID_NAME "global"
/*
* Functions for mapping between id and name for active zones.
*/
extern zoneid_t getzoneid(void);
extern zoneid_t getzoneidbyname(const char *);
extern ssize_t getzonenamebyid(zoneid_t, char *, size_t);
#ifdef __cplusplus
}