Merge commit 'refs/top-bases/linux-zfs-branch' into linux-zfs-branch
This commit is contained in:
commit
dee88e0790
2
META
2
META
|
@ -1,7 +1,7 @@
|
||||||
Meta: 1
|
Meta: 1
|
||||||
Name: zfs
|
Name: zfs
|
||||||
Branch: 1.0
|
Branch: 1.0
|
||||||
Version: 0.4.9
|
Version: 0.5.0
|
||||||
Release: 1
|
Release: 1
|
||||||
Release-Tags: relext
|
Release-Tags: relext
|
||||||
License: CDDL
|
License: CDDL
|
||||||
|
|
|
@ -2409,8 +2409,11 @@ dump_simulated_ddt(spa_t *spa)
|
||||||
avl_tree_t t;
|
avl_tree_t t;
|
||||||
void *cookie = NULL;
|
void *cookie = NULL;
|
||||||
zdb_ddt_entry_t *zdde;
|
zdb_ddt_entry_t *zdde;
|
||||||
ddt_histogram_t ddh_total = { 0 };
|
ddt_histogram_t ddh_total;
|
||||||
ddt_stat_t dds_total = { 0 };
|
ddt_stat_t dds_total;
|
||||||
|
|
||||||
|
bzero(&ddh_total, sizeof (ddt_histogram_t));
|
||||||
|
bzero(&dds_total, sizeof (ddt_stat_t));
|
||||||
|
|
||||||
avl_create(&t, ddt_entry_compare,
|
avl_create(&t, ddt_entry_compare,
|
||||||
sizeof (zdb_ddt_entry_t), offsetof(zdb_ddt_entry_t, zdde_node));
|
sizeof (zdb_ddt_entry_t), offsetof(zdb_ddt_entry_t, zdde_node));
|
||||||
|
|
|
@ -17,10 +17,13 @@ libspl_la_SOURCES = \
|
||||||
${top_srcdir}/lib/libspl/gethrestime.c \
|
${top_srcdir}/lib/libspl/gethrestime.c \
|
||||||
${top_srcdir}/lib/libspl/getmntany.c \
|
${top_srcdir}/lib/libspl/getmntany.c \
|
||||||
${top_srcdir}/lib/libspl/list.c \
|
${top_srcdir}/lib/libspl/list.c \
|
||||||
|
${top_srcdir}/lib/libspl/ltos.c \
|
||||||
${top_srcdir}/lib/libspl/mkdirp.c \
|
${top_srcdir}/lib/libspl/mkdirp.c \
|
||||||
|
${top_srcdir}/lib/libspl/stol.c \
|
||||||
${top_srcdir}/lib/libspl/strlcat.c \
|
${top_srcdir}/lib/libspl/strlcat.c \
|
||||||
${top_srcdir}/lib/libspl/strlcpy.c \
|
${top_srcdir}/lib/libspl/strlcpy.c \
|
||||||
${top_srcdir}/lib/libspl/strnlen.c \
|
${top_srcdir}/lib/libspl/strnlen.c \
|
||||||
|
${top_srcdir}/lib/libspl/timestamp.c \
|
||||||
${top_srcdir}/lib/libspl/zone.c \
|
${top_srcdir}/lib/libspl/zone.c \
|
||||||
${top_srcdir}/lib/libspl/xdr.c \
|
${top_srcdir}/lib/libspl/xdr.c \
|
||||||
${top_srcdir}/lib/libspl/${TARGET_ASM_DIR}/atomic.S \
|
${top_srcdir}/lib/libspl/${TARGET_ASM_DIR}/atomic.S \
|
||||||
|
|
|
@ -0,0 +1,240 @@
|
||||||
|
/*
|
||||||
|
* CDDL HEADER START
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the terms of the
|
||||||
|
* Common Development and Distribution License (the "License").
|
||||||
|
* You may not use this file except in compliance with the License.
|
||||||
|
*
|
||||||
|
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
* or http://www.opensolaris.org/os/licensing.
|
||||||
|
* See the License for the specific language governing permissions
|
||||||
|
* and limitations under the License.
|
||||||
|
*
|
||||||
|
* When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
* If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
*
|
||||||
|
* CDDL HEADER END
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _TSOL_LABEL_H
|
||||||
|
#define _TSOL_LABEL_H
|
||||||
|
|
||||||
|
#include <sys/types32.h>
|
||||||
|
#include <sys/tsol/label.h>
|
||||||
|
#include <priv.h>
|
||||||
|
|
||||||
|
/* Procedural Interface Structure Definitions */
|
||||||
|
|
||||||
|
struct label_info { /* structure returned by label_info */
|
||||||
|
short ilabel_len; /* max Information Label length */
|
||||||
|
short slabel_len; /* max Sensitivity Label length */
|
||||||
|
short clabel_len; /* max CMW Label length */
|
||||||
|
short clear_len; /* max Clearance Label length */
|
||||||
|
short vers_len; /* version string length */
|
||||||
|
short header_len; /* max len of banner page header */
|
||||||
|
short protect_as_len; /* max len of banner page protect as */
|
||||||
|
short caveats_len; /* max len of banner page caveats */
|
||||||
|
short channels_len; /* max len of banner page channels */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct label_set_identifier { /* valid label set identifier */
|
||||||
|
int type; /* type of the set */
|
||||||
|
char *name; /* name of the set if needed */
|
||||||
|
} set_id;
|
||||||
|
|
||||||
|
struct name_fields { /* names for label builder fields */
|
||||||
|
char *class_name; /* Classifications field name */
|
||||||
|
char *comps_name; /* Compartments field name */
|
||||||
|
char *marks_name; /* Markings field name */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Label Set Identifier Types */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The accreditation ranges as specified in the label encodings file.
|
||||||
|
* The name parameter is ignored.
|
||||||
|
*
|
||||||
|
* System Accreditation Range is all valid labels plus Admin High and Low.
|
||||||
|
*
|
||||||
|
* User Accreditation Range is valid user labels as defined in the
|
||||||
|
* ACCREDITATION RANGE: section of the label encodings file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define SYSTEM_ACCREDITATION_RANGE 1
|
||||||
|
#define USER_ACCREDITATION_RANGE 2
|
||||||
|
|
||||||
|
|
||||||
|
/* System Call Interface Definitions */
|
||||||
|
|
||||||
|
extern int getlabel(const char *, m_label_t *);
|
||||||
|
extern int fgetlabel(int, m_label_t *);
|
||||||
|
|
||||||
|
extern int getplabel(m_label_t *);
|
||||||
|
extern int setflabel(const char *, m_label_t *);
|
||||||
|
extern char *getpathbylabel(const char *, char *, size_t,
|
||||||
|
const m_label_t *sl);
|
||||||
|
extern m_label_t *getzonelabelbyid(zoneid_t);
|
||||||
|
extern m_label_t *getzonelabelbyname(const char *);
|
||||||
|
extern zoneid_t getzoneidbylabel(const m_label_t *);
|
||||||
|
extern char *getzonenamebylabel(const m_label_t *);
|
||||||
|
extern char *getzonerootbyid(zoneid_t);
|
||||||
|
extern char *getzonerootbyname(const char *);
|
||||||
|
extern char *getzonerootbylabel(const m_label_t *);
|
||||||
|
extern m_label_t *getlabelbypath(const char *);
|
||||||
|
|
||||||
|
|
||||||
|
/* Flag word values */
|
||||||
|
|
||||||
|
#define ALL_ENTRIES 0x00000000
|
||||||
|
#define ACCESS_RELATED 0x00000001
|
||||||
|
#define ACCESS_MASK 0x0000FFFF
|
||||||
|
#define ACCESS_SHIFT 0
|
||||||
|
|
||||||
|
#define LONG_WORDS 0x00010000 /* use long names */
|
||||||
|
#define SHORT_WORDS 0x00020000 /* use short names if present */
|
||||||
|
#define LONG_CLASSIFICATION 0x00040000 /* use long classification */
|
||||||
|
#define SHORT_CLASSIFICATION 0x00080000 /* use short classification */
|
||||||
|
#define NO_CLASSIFICATION 0x00100000 /* don't translate the class */
|
||||||
|
#define VIEW_INTERNAL 0x00200000 /* don't promote/demote */
|
||||||
|
#define VIEW_EXTERNAL 0x00400000 /* promote/demote label */
|
||||||
|
|
||||||
|
#define NEW_LABEL 0x00000001 /* create a full new label */
|
||||||
|
#define NO_CORRECTION 0x00000002 /* don't correct label errors */
|
||||||
|
/* implies NEW_LABEL */
|
||||||
|
|
||||||
|
#define CVT_DIM 0x01 /* display word dimmed */
|
||||||
|
#define CVT_SET 0x02 /* display word currently set */
|
||||||
|
|
||||||
|
/* Procedure Interface Definitions available to user */
|
||||||
|
|
||||||
|
/* APIs shared with the kernel are in <sys/tsol/label.h */
|
||||||
|
|
||||||
|
extern m_label_t *blabel_alloc(void);
|
||||||
|
extern void blabel_free(m_label_t *);
|
||||||
|
extern size32_t blabel_size(void);
|
||||||
|
extern char *bsltoh(const m_label_t *);
|
||||||
|
extern char *bcleartoh(const m_label_t *);
|
||||||
|
|
||||||
|
extern char *bsltoh_r(const m_label_t *, char *);
|
||||||
|
extern char *bcleartoh_r(const m_label_t *, char *);
|
||||||
|
extern char *h_alloc(uint8_t);
|
||||||
|
extern void h_free(char *);
|
||||||
|
|
||||||
|
extern int htobsl(const char *, m_label_t *);
|
||||||
|
extern int htobclear(const char *, m_label_t *);
|
||||||
|
|
||||||
|
extern m_range_t *getuserrange(const char *);
|
||||||
|
extern m_range_t *getdevicerange(const char *);
|
||||||
|
|
||||||
|
extern int set_effective_priv(priv_op_t, int, ...);
|
||||||
|
extern int set_inheritable_priv(priv_op_t, int, ...);
|
||||||
|
extern int set_permitted_priv(priv_op_t, int, ...);
|
||||||
|
extern int is_system_labeled(void);
|
||||||
|
|
||||||
|
/* Procedures needed for multi-level printing */
|
||||||
|
|
||||||
|
extern int tsol_check_admin_auth(uid_t uid);
|
||||||
|
|
||||||
|
/* APIs implemented via labeld */
|
||||||
|
|
||||||
|
extern int blinset(const m_label_t *, const set_id *);
|
||||||
|
extern int labelinfo(struct label_info *);
|
||||||
|
extern ssize_t labelvers(char **, size_t);
|
||||||
|
extern char *bltocolor(const m_label_t *);
|
||||||
|
extern char *bltocolor_r(const m_label_t *, size_t, char *);
|
||||||
|
|
||||||
|
extern ssize_t bsltos(const m_label_t *, char **, size_t, int);
|
||||||
|
extern ssize_t bcleartos(const m_label_t *, char **, size_t, int);
|
||||||
|
|
||||||
|
|
||||||
|
extern char *sbsltos(const m_label_t *, size_t);
|
||||||
|
extern char *sbcleartos(const m_label_t *, size_t);
|
||||||
|
|
||||||
|
|
||||||
|
extern int stobsl(const char *, m_label_t *, int, int *);
|
||||||
|
extern int stobclear(const char *, m_label_t *, int, int *);
|
||||||
|
extern int bslvalid(const m_label_t *);
|
||||||
|
extern int bclearvalid(const m_label_t *);
|
||||||
|
|
||||||
|
/* DIA label conversion and parsing */
|
||||||
|
|
||||||
|
/* Conversion types */
|
||||||
|
|
||||||
|
typedef enum _m_label_str {
|
||||||
|
M_LABEL = 1, /* process or user clearance */
|
||||||
|
M_INTERNAL = 2, /* internal form for use in public databases */
|
||||||
|
M_COLOR = 3, /* process label color */
|
||||||
|
PRINTER_TOP_BOTTOM = 4, /* DIA banner page top/bottom */
|
||||||
|
PRINTER_LABEL = 5, /* DIA banner page label */
|
||||||
|
PRINTER_CAVEATS = 6, /* DIA banner page caveats */
|
||||||
|
PRINTER_CHANNELS = 7 /* DIA banner page handling channels */
|
||||||
|
} m_label_str_t;
|
||||||
|
|
||||||
|
/* Flags for conversion, not all flags apply to all types */
|
||||||
|
#define DEF_NAMES 0x1
|
||||||
|
#define SHORT_NAMES 0x3 /* short names are prefered where defined */
|
||||||
|
#define LONG_NAMES 0x4 /* long names are prefered where defined */
|
||||||
|
|
||||||
|
extern int label_to_str(const m_label_t *, char **, const m_label_str_t,
|
||||||
|
uint_t);
|
||||||
|
extern int l_to_str_internal(const m_label_t *, char **);
|
||||||
|
|
||||||
|
/* Parsing types */
|
||||||
|
typedef enum _m_label_type {
|
||||||
|
MAC_LABEL = 1, /* process or object label */
|
||||||
|
USER_CLEAR = 2 /* user's clearance (LUB) */
|
||||||
|
} m_label_type_t;
|
||||||
|
|
||||||
|
/* Flags for parsing */
|
||||||
|
|
||||||
|
#define L_DEFAULT 0x0
|
||||||
|
#define L_MODIFY_EXISTING 0x1 /* start parsing with existing label */
|
||||||
|
#define L_NO_CORRECTION 0x2 /* must be correct by l_e rules */
|
||||||
|
#define L_CHECK_AR 0x10 /* must be in l_e AR */
|
||||||
|
|
||||||
|
/* EINVAL sub codes */
|
||||||
|
|
||||||
|
#define M_OUTSIDE_AR -4 /* not in l_e AR */
|
||||||
|
#define M_BAD_STRING -3 /* DIA L_BAD_LABEL */
|
||||||
|
/* bad requested label type, bad previous label type */
|
||||||
|
#define M_BAD_LABEL -2 /* DIA L_BAD_CLASSIFICATION, */
|
||||||
|
|
||||||
|
extern int str_to_label(const char *, m_label_t **, const m_label_type_t,
|
||||||
|
uint_t, int *);
|
||||||
|
extern int hexstr_to_label(const char *, m_label_t *);
|
||||||
|
|
||||||
|
extern m_label_t *m_label_alloc(const m_label_type_t);
|
||||||
|
|
||||||
|
extern int m_label_dup(m_label_t **, const m_label_t *);
|
||||||
|
|
||||||
|
extern void m_label_free(m_label_t *);
|
||||||
|
|
||||||
|
/* Contract Private interfaces with the label builder GUIs */
|
||||||
|
|
||||||
|
extern int bslcvtfull(const m_label_t *, const m_range_t *, int,
|
||||||
|
char **, char **[], char **[], char *[], int *, int *);
|
||||||
|
extern int bslcvt(const m_label_t *, int, char **, char *[]);
|
||||||
|
extern int bclearcvtfull(const m_label_t *, const m_range_t *, int,
|
||||||
|
char **, char **[], char **[], char *[], int *, int *);
|
||||||
|
extern int bclearcvt(const m_label_t *, int, char **, char *[]);
|
||||||
|
|
||||||
|
extern int labelfields(struct name_fields *);
|
||||||
|
extern int userdefs(m_label_t *, m_label_t *);
|
||||||
|
extern int zonecopy(m_label_t *, char *, char *, char *, int);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
/* testing hook: see devfsadm.c, mkdevalloc.c and allocate.c */
|
||||||
|
#define is_system_labeled_debug(statbufp) \
|
||||||
|
((stat("/ALLOCATE_FORCE_LABEL", (statbufp)) == 0) ? 1 : 0)
|
||||||
|
#else /* DEBUG */
|
||||||
|
#define is_system_labeled_debug(statbufp) 0
|
||||||
|
#endif /* DEBUG */
|
||||||
|
|
||||||
|
#endif /* !_TSOL_LABEL_H */
|
|
@ -0,0 +1,467 @@
|
||||||
|
/*
|
||||||
|
* CDDL HEADER START
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the terms of the
|
||||||
|
* Common Development and Distribution License (the "License").
|
||||||
|
* You may not use this file except in compliance with the License.
|
||||||
|
*
|
||||||
|
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
* or http://www.opensolaris.org/os/licensing.
|
||||||
|
* See the License for the specific language governing permissions
|
||||||
|
* and limitations under the License.
|
||||||
|
*
|
||||||
|
* When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
* If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
*
|
||||||
|
* CDDL HEADER END
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _LABELD_H
|
||||||
|
#define _LABELD_H
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <tsol/label.h>
|
||||||
|
#include <sys/tsol/label_macro.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Definitions for the call parameters for the door-based label
|
||||||
|
* translation service.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define BUFSIZE 4096
|
||||||
|
|
||||||
|
#define DOOR_PATH "/var/tsol/doors/"
|
||||||
|
#define DOOR_NAME "labeld"
|
||||||
|
#define COOKIE (void *)0x6c616264 /* "labd" */
|
||||||
|
|
||||||
|
/* Op codes */
|
||||||
|
|
||||||
|
/* Labeld Commands */
|
||||||
|
|
||||||
|
#define LABELDNULL 1
|
||||||
|
|
||||||
|
/* Miscellaneous */
|
||||||
|
|
||||||
|
#define BLINSET 10
|
||||||
|
#define BSLVALID 11
|
||||||
|
#define BILVALID 12
|
||||||
|
#define BCLEARVALID 13
|
||||||
|
#define LABELINFO 14
|
||||||
|
#define LABELVERS 15
|
||||||
|
#define BLTOCOLOR 16
|
||||||
|
|
||||||
|
/* Binary to String Label Translation */
|
||||||
|
|
||||||
|
#define BSLTOS 23
|
||||||
|
#define BCLEARTOS 25
|
||||||
|
|
||||||
|
/* String to Binary Label Translation */
|
||||||
|
|
||||||
|
#define STOBSL 31
|
||||||
|
#define STOBCLEAR 33
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Dimming List Routines
|
||||||
|
* Contract private for label builders
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define BSLCVT 40
|
||||||
|
#define BCLEARCVT 42
|
||||||
|
#define LABELFIELDS 43
|
||||||
|
#define UDEFS 44
|
||||||
|
|
||||||
|
#define GETFLABEL 45
|
||||||
|
#define SETFLABEL 46
|
||||||
|
#define ZCOPY 47
|
||||||
|
|
||||||
|
/* NEW LABELS */
|
||||||
|
/* DIA printer banner labels */
|
||||||
|
|
||||||
|
#define PR_CAVEATS 101
|
||||||
|
#define PR_CHANNELS 102
|
||||||
|
#define PR_LABEL 103
|
||||||
|
#define PR_TOP 104
|
||||||
|
|
||||||
|
/* DIA label to string */
|
||||||
|
|
||||||
|
#define LTOS 105
|
||||||
|
|
||||||
|
/* DIA string to label */
|
||||||
|
|
||||||
|
#define STOL 106
|
||||||
|
|
||||||
|
/* Structures */
|
||||||
|
|
||||||
|
typedef uint_t bufp_t; /* offset into buf[] in/out string buffer */
|
||||||
|
|
||||||
|
/* Null call */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int null;
|
||||||
|
} null_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int null;
|
||||||
|
} null_ret_t;
|
||||||
|
|
||||||
|
/* Miscellaneous interfaces */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bslabel_t label;
|
||||||
|
int type;
|
||||||
|
} inset_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int inset;
|
||||||
|
} inset_ret_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bslabel_t label;
|
||||||
|
} slvalid_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int valid;
|
||||||
|
} slvalid_ret_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bclear_t clear;
|
||||||
|
} clrvalid_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int valid;
|
||||||
|
} clrvalid_ret_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int null;
|
||||||
|
} info_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
struct label_info info;
|
||||||
|
} info_ret_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int null;
|
||||||
|
} vers_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char vers[BUFSIZE];
|
||||||
|
} vers_ret_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
blevel_t label;
|
||||||
|
} color_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char color[BUFSIZE];
|
||||||
|
} color_ret_t;
|
||||||
|
|
||||||
|
/* Binary Label to String interfaces */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bslabel_t label;
|
||||||
|
uint_t flags;
|
||||||
|
} bsltos_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char slabel[BUFSIZE];
|
||||||
|
} bsltos_ret_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bclear_t clear;
|
||||||
|
uint_t flags;
|
||||||
|
} bcleartos_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char cslabel[BUFSIZE];
|
||||||
|
} bcleartos_ret_t;
|
||||||
|
|
||||||
|
/* String to Binary Label interfaces */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bslabel_t label;
|
||||||
|
uint_t flags;
|
||||||
|
char string[BUFSIZE];
|
||||||
|
} stobsl_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bslabel_t label;
|
||||||
|
} stobsl_ret_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bclear_t clear;
|
||||||
|
uint_t flags;
|
||||||
|
char string[BUFSIZE];
|
||||||
|
} stobclear_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bclear_t clear;
|
||||||
|
} stobclear_ret_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The following Dimming List and Miscellaneous interfaces
|
||||||
|
* implement contract private interfaces for the label builder
|
||||||
|
* interfaces.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Dimming List interfaces */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bslabel_t label;
|
||||||
|
brange_t bounds;
|
||||||
|
uint_t flags;
|
||||||
|
} bslcvt_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bufp_t string;
|
||||||
|
bufp_t dim;
|
||||||
|
bufp_t lwords;
|
||||||
|
bufp_t swords;
|
||||||
|
size_t d_len;
|
||||||
|
size_t l_len;
|
||||||
|
size_t s_len;
|
||||||
|
int first_comp;
|
||||||
|
int first_mark;
|
||||||
|
char buf[BUFSIZE];
|
||||||
|
} cvt_ret_t;
|
||||||
|
|
||||||
|
typedef cvt_ret_t bslcvt_ret_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bclear_t clear;
|
||||||
|
brange_t bounds;
|
||||||
|
uint_t flags;
|
||||||
|
} bclearcvt_call_t;
|
||||||
|
|
||||||
|
typedef cvt_ret_t bclearcvt_ret_t;
|
||||||
|
|
||||||
|
/* Miscellaneous interfaces */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int null;
|
||||||
|
} fields_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bufp_t classi;
|
||||||
|
bufp_t compsi;
|
||||||
|
bufp_t marksi;
|
||||||
|
char buf[BUFSIZE];
|
||||||
|
} fields_ret_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int null;
|
||||||
|
} udefs_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bslabel_t sl;
|
||||||
|
bclear_t clear;
|
||||||
|
} udefs_ret_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bslabel_t sl;
|
||||||
|
char pathname[BUFSIZE];
|
||||||
|
} setfbcl_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int status;
|
||||||
|
} setfbcl_ret_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bslabel_t src_win_sl;
|
||||||
|
int transfer_mode;
|
||||||
|
bufp_t remote_dir;
|
||||||
|
bufp_t filename;
|
||||||
|
bufp_t local_dir;
|
||||||
|
bufp_t display;
|
||||||
|
char buf[BUFSIZE];
|
||||||
|
} zcopy_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int status;
|
||||||
|
} zcopy_ret_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
m_label_t label;
|
||||||
|
uint_t flags;
|
||||||
|
} pr_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char buf[BUFSIZE];
|
||||||
|
} pr_ret_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
m_label_t label;
|
||||||
|
uint_t flags;
|
||||||
|
} ls_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char buf[BUFSIZE];
|
||||||
|
} ls_ret_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
m_label_t label;
|
||||||
|
uint_t flags;
|
||||||
|
char string[BUFSIZE];
|
||||||
|
} sl_call_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
m_label_t label;
|
||||||
|
} sl_ret_t;
|
||||||
|
|
||||||
|
/* Labeld operation call structure */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint_t op;
|
||||||
|
union {
|
||||||
|
null_call_t null_arg;
|
||||||
|
|
||||||
|
inset_call_t inset_arg;
|
||||||
|
slvalid_call_t slvalid_arg;
|
||||||
|
clrvalid_call_t clrvalid_arg;
|
||||||
|
info_call_t info_arg;
|
||||||
|
vers_call_t vers_arg;
|
||||||
|
color_call_t color_arg;
|
||||||
|
|
||||||
|
bsltos_call_t bsltos_arg;
|
||||||
|
bcleartos_call_t bcleartos_arg;
|
||||||
|
|
||||||
|
stobsl_call_t stobsl_arg;
|
||||||
|
stobclear_call_t stobclear_arg;
|
||||||
|
|
||||||
|
bslcvt_call_t bslcvt_arg;
|
||||||
|
bclearcvt_call_t bclearcvt_arg;
|
||||||
|
fields_call_t fields_arg;
|
||||||
|
udefs_call_t udefs_arg;
|
||||||
|
setfbcl_call_t setfbcl_arg;
|
||||||
|
zcopy_call_t zcopy_arg;
|
||||||
|
pr_call_t pr_arg;
|
||||||
|
ls_call_t ls_arg;
|
||||||
|
sl_call_t sl_arg;
|
||||||
|
} cargs;
|
||||||
|
} labeld_call_t;
|
||||||
|
|
||||||
|
/* Labeld operation return structure */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int ret; /* labeld return codes */
|
||||||
|
int err; /* function error codes */
|
||||||
|
union {
|
||||||
|
null_ret_t null_ret;
|
||||||
|
|
||||||
|
inset_ret_t inset_ret;
|
||||||
|
slvalid_ret_t slvalid_ret;
|
||||||
|
clrvalid_ret_t clrvalid_ret;
|
||||||
|
info_ret_t info_ret;
|
||||||
|
vers_ret_t vers_ret;
|
||||||
|
color_ret_t color_ret;
|
||||||
|
|
||||||
|
bsltos_ret_t bsltos_ret;
|
||||||
|
bcleartos_ret_t bcleartos_ret;
|
||||||
|
|
||||||
|
stobsl_ret_t stobsl_ret;
|
||||||
|
stobclear_ret_t stobclear_ret;
|
||||||
|
|
||||||
|
bslcvt_ret_t bslcvt_ret;
|
||||||
|
bclearcvt_ret_t bclearcvt_ret;
|
||||||
|
fields_ret_t fields_ret;
|
||||||
|
udefs_ret_t udefs_ret;
|
||||||
|
setfbcl_ret_t setfbcl_ret;
|
||||||
|
zcopy_ret_t zcopy_ret;
|
||||||
|
pr_ret_t pr_ret;
|
||||||
|
ls_ret_t ls_ret;
|
||||||
|
sl_ret_t sl_ret;
|
||||||
|
} rvals;
|
||||||
|
} labeld_ret_t;
|
||||||
|
|
||||||
|
/* Labeld call/return structure */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
union {
|
||||||
|
labeld_call_t acall;
|
||||||
|
labeld_ret_t aret;
|
||||||
|
} param;
|
||||||
|
} labeld_data_t;
|
||||||
|
|
||||||
|
#define callop param.acall.op
|
||||||
|
#define retret param.aret.ret
|
||||||
|
#define reterr param.aret.err
|
||||||
|
|
||||||
|
#define CALL_SIZE(type, buf) (size_t)(sizeof (type) + sizeof (int) + (buf))
|
||||||
|
#define RET_SIZE(type, buf) (size_t)(sizeof (type) + 2*sizeof (int) + (buf))
|
||||||
|
#define CALL_SIZE_STR(type, buf) CALL_SIZE(type, (-BUFSIZE +(buf)))
|
||||||
|
|
||||||
|
/* Return Codes */
|
||||||
|
|
||||||
|
#define SUCCESS 1 /* Call OK */
|
||||||
|
#define NOTFOUND -1 /* Function not found */
|
||||||
|
#define SERVERFAULT -2 /* Internal labeld error */
|
||||||
|
#define NOSERVER -3 /* No server thread available, try later */
|
||||||
|
|
||||||
|
/* Labeld common client call function */
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
__call_labeld(labeld_data_t **dptr, size_t *ndata, size_t *adata)
|
||||||
|
{
|
||||||
|
return NOSERVER;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Flag Translation Values */
|
||||||
|
|
||||||
|
#define L_NEW_LABEL 0x10000000
|
||||||
|
|
||||||
|
/* GFI FLAGS */
|
||||||
|
|
||||||
|
#define GFI_FLAG_MASK 0x0000FFFF
|
||||||
|
#define GFI_ACCESS_RELATED 0x00000001
|
||||||
|
|
||||||
|
/* binary to ASCII */
|
||||||
|
|
||||||
|
#define LABELS_NO_CLASS 0x00010000
|
||||||
|
#define LABELS_SHORT_CLASS 0x00020000
|
||||||
|
#define LABELS_SHORT_WORDS 0x00040000
|
||||||
|
|
||||||
|
/* Label view */
|
||||||
|
|
||||||
|
#define LABELS_VIEW_INTERNAL 0x00100000
|
||||||
|
#define LABELS_VIEW_EXTERNAL 0x00200000
|
||||||
|
|
||||||
|
/* Dimming list (convert -- b*cvt* ) */
|
||||||
|
|
||||||
|
#define LABELS_FULL_CONVERT 0x00010000
|
||||||
|
|
||||||
|
/* ASCII to binary */
|
||||||
|
|
||||||
|
#define LABELS_NEW_LABEL 0x00010000
|
||||||
|
#define LABELS_FULL_PARSE 0x00020000
|
||||||
|
#define LABELS_ONLY_INFO_LABEL 0x00040000
|
||||||
|
|
||||||
|
#define MOVE_FILE 0
|
||||||
|
#define COPY_FILE 1
|
||||||
|
#define LINK_FILE 2
|
||||||
|
|
||||||
|
#define PIPEMSG_FILEOP_ERROR 1
|
||||||
|
#define PIPEMSG_EXIST_ERROR 2
|
||||||
|
#define PIPEMSG_DONE 7
|
||||||
|
#define PIPEMSG_PATH_ERROR 20
|
||||||
|
#define PIPEMSG_ZONE_ERROR 21
|
||||||
|
#define PIPEMSG_LABEL_ERROR 22
|
||||||
|
#define PIPEMSG_READ_ERROR 23
|
||||||
|
#define PIPEMSG_READONLY_ERROR 24
|
||||||
|
#define PIPEMSG_WRITE_ERROR 25
|
||||||
|
#define PIPEMSG_CREATE_ERROR 26
|
||||||
|
#define PIPEMSG_DELETE_ERROR 27
|
||||||
|
#define PIPEMSG_CANCEL 101
|
||||||
|
#define PIPEMSG_PROCEED 102
|
||||||
|
#define PIPEMSG_MERGE 103
|
||||||
|
#define PIPEMSG_REPLACE_BUFFER 104
|
||||||
|
#define PIPEMSG_RENAME_BUFFER 105
|
||||||
|
#define PIPEMSG_MULTI_PROCEED 106
|
||||||
|
#define PIPEMSG_RENAME_FILE 107
|
||||||
|
|
||||||
|
#endif /* _LABELD_H */
|
|
@ -32,6 +32,15 @@
|
||||||
/* Couldn't find this definition in OpenGrok */
|
/* Couldn't find this definition in OpenGrok */
|
||||||
#define PRIV_SYS_CONFIG "sys_config"
|
#define PRIV_SYS_CONFIG "sys_config"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* priv_op_t indicates a privilege operation type
|
||||||
|
*/
|
||||||
|
typedef enum priv_op {
|
||||||
|
PRIV_ON,
|
||||||
|
PRIV_OFF,
|
||||||
|
PRIV_SET
|
||||||
|
} priv_op_t;
|
||||||
|
|
||||||
static inline boolean_t priv_ineffect(const char *priv) { return B_TRUE; }
|
static inline boolean_t priv_ineffect(const char *priv) { return B_TRUE; }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* CDDL HEADER START
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the terms of the
|
||||||
|
* Common Development and Distribution License (the "License").
|
||||||
|
* You may not use this file except in compliance with the License.
|
||||||
|
*
|
||||||
|
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
* or http://www.opensolaris.org/os/licensing.
|
||||||
|
* See the License for the specific language governing permissions
|
||||||
|
* and limitations under the License.
|
||||||
|
*
|
||||||
|
* When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
* If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
*
|
||||||
|
* CDDL HEADER END
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*
|
||||||
|
* Common routines for acquiring snapshots of kstats for
|
||||||
|
* iostat, mpstat, and vmstat.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _STATCOMMON_H
|
||||||
|
#define _STATCOMMON_H
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#define NODATE 0 /* Default: No time stamp */
|
||||||
|
#define DDATE 1 /* Standard date format */
|
||||||
|
#define UDATE 2 /* Internal representation of Unix time */
|
||||||
|
|
||||||
|
/* Print a timestamp in either Unix or standard format. */
|
||||||
|
void print_timestamp(uint_t);
|
||||||
|
|
||||||
|
#endif /* _STATCOMMON_H */
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* CDDL HEADER START
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the terms of the
|
||||||
|
* Common Development and Distribution License, Version 1.0 only
|
||||||
|
* (the "License"). You may not use this file except in compliance
|
||||||
|
* with the License.
|
||||||
|
*
|
||||||
|
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
* or http://www.opensolaris.org/os/licensing.
|
||||||
|
* See the License for the specific language governing permissions
|
||||||
|
* and limitations under the License.
|
||||||
|
*
|
||||||
|
* When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
* If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
*
|
||||||
|
* CDDL HEADER END
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _LIBSPL_SYS_SYSTM_H
|
||||||
|
#define _LIBSPL_SYS_SYSTM_H
|
||||||
|
|
||||||
|
#endif /* _LIBSPL_SYS_SYSTM_H */
|
|
@ -30,6 +30,18 @@
|
||||||
#include_next <sys/time.h>
|
#include_next <sys/time.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#ifndef SEC
|
||||||
|
#define SEC 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MILLISEC
|
||||||
|
#define MILLISEC 1000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MICROSEC
|
||||||
|
#define MICROSEC 1000000
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef NANOSEC
|
#ifndef NANOSEC
|
||||||
#define NANOSEC 1000000000
|
#define NANOSEC 1000000000
|
||||||
#endif
|
#endif
|
||||||
|
@ -41,4 +53,4 @@
|
||||||
extern hrtime_t gethrtime(void);
|
extern hrtime_t gethrtime(void);
|
||||||
extern void gethrestime(timestruc_t *);
|
extern void gethrestime(timestruc_t *);
|
||||||
|
|
||||||
#endif
|
#endif /* _LIBSPL_SYS_TIME_H */
|
||||||
|
|
|
@ -0,0 +1,168 @@
|
||||||
|
/*
|
||||||
|
* CDDL HEADER START
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the terms of the
|
||||||
|
* Common Development and Distribution License (the "License").
|
||||||
|
* You may not use this file except in compliance with the License.
|
||||||
|
*
|
||||||
|
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
* or http://www.opensolaris.org/os/licensing.
|
||||||
|
* See the License for the specific language governing permissions
|
||||||
|
* and limitations under the License.
|
||||||
|
*
|
||||||
|
* When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
* If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
*
|
||||||
|
* CDDL HEADER END
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SYS_TSOL_LABEL_H
|
||||||
|
#define _SYS_TSOL_LABEL_H
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#ifdef _KERNEL
|
||||||
|
#include <sys/cred.h>
|
||||||
|
#include <sys/vnode.h>
|
||||||
|
#include <sys/tsol/label_macro.h>
|
||||||
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* types of label comparison
|
||||||
|
*/
|
||||||
|
#define EQUALITY_CHECK 0
|
||||||
|
#define DOMINANCE_CHECK 1
|
||||||
|
|
||||||
|
/* Manifest human readable label names */
|
||||||
|
#define ADMIN_LOW "ADMIN_LOW"
|
||||||
|
#define ADMIN_HIGH "ADMIN_HIGH"
|
||||||
|
|
||||||
|
/* Binary Label Structure Definitions */
|
||||||
|
|
||||||
|
typedef struct _mac_label_impl m_label_t;
|
||||||
|
|
||||||
|
typedef m_label_t blevel_t, /* compatibility */
|
||||||
|
bslabel_t, /* Sensitivity Label */
|
||||||
|
bclear_t; /* Clearance */
|
||||||
|
|
||||||
|
typedef struct _tsol_binary_level_lrange { /* Level Range */
|
||||||
|
m_label_t *lower_bound;
|
||||||
|
m_label_t *upper_bound;
|
||||||
|
} m_range_t;
|
||||||
|
|
||||||
|
typedef m_range_t blrange_t;
|
||||||
|
|
||||||
|
typedef struct tsol_mlp_s {
|
||||||
|
uchar_t mlp_ipp;
|
||||||
|
uint16_t mlp_port;
|
||||||
|
uint16_t mlp_port_upper;
|
||||||
|
} tsol_mlp_t;
|
||||||
|
|
||||||
|
/* Procedure Interface Definitions available to user and kernel */
|
||||||
|
|
||||||
|
extern int bltype(const void *, uint8_t);
|
||||||
|
extern int blequal(const m_label_t *, const m_label_t *);
|
||||||
|
extern int bldominates(const m_label_t *, const m_label_t *);
|
||||||
|
extern int blstrictdom(const m_label_t *, const m_label_t *);
|
||||||
|
extern int blinrange(const m_label_t *, const m_range_t *);
|
||||||
|
extern void blmaximum(m_label_t *, const m_label_t *);
|
||||||
|
extern void blminimum(m_label_t *, const m_label_t *);
|
||||||
|
extern void bsllow(m_label_t *);
|
||||||
|
extern void bslhigh(m_label_t *);
|
||||||
|
extern void bclearlow(m_label_t *);
|
||||||
|
extern void bclearhigh(m_label_t *);
|
||||||
|
extern void bslundef(m_label_t *);
|
||||||
|
extern void bclearundef(m_label_t *);
|
||||||
|
extern void setbltype(void *, uint8_t);
|
||||||
|
extern boolean_t bisinvalid(const void *);
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
|
typedef struct tsol_mlp_entry_s {
|
||||||
|
struct tsol_mlp_entry_s *mlpe_next, *mlpe_prev;
|
||||||
|
zoneid_t mlpe_zoneid;
|
||||||
|
tsol_mlp_t mlpe_mlp;
|
||||||
|
} tsol_mlp_entry_t;
|
||||||
|
|
||||||
|
typedef struct tsol_mlp_list_s {
|
||||||
|
krwlock_t mlpl_rwlock;
|
||||||
|
tsol_mlp_entry_t *mlpl_first, *mlpl_last;
|
||||||
|
} tsol_mlp_list_t;
|
||||||
|
|
||||||
|
typedef struct ts_label_s {
|
||||||
|
uint_t tsl_ref; /* Reference count */
|
||||||
|
uint32_t tsl_doi; /* Domain of Interpretation */
|
||||||
|
uint32_t tsl_flags; /* TSLF_* below */
|
||||||
|
m_label_t tsl_label; /* Actual label */
|
||||||
|
} ts_label_t;
|
||||||
|
|
||||||
|
#define DEFAULT_DOI 1
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TSLF_UNLABELED is set in tsl_flags for packets with no explicit label
|
||||||
|
* when the peer is unlabeled.
|
||||||
|
*
|
||||||
|
* TSLF_IMPLICIT_IN is set when a packet is received with no explicit label
|
||||||
|
* from a peer which is flagged in the tnrhdb as label-aware.
|
||||||
|
*
|
||||||
|
* TSLF_IMPLICIT_OUT is set when the packet should be sent without an
|
||||||
|
* explict label even if the peer or next-hop router is flagged in the
|
||||||
|
* tnrhdb as label-aware.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define TSLF_UNLABELED 0x00000001 /* peer is unlabeled */
|
||||||
|
#define TSLF_IMPLICIT_IN 0x00000002 /* inbound implicit */
|
||||||
|
#define TSLF_IMPLICIT_OUT 0x00000004 /* outbound implicit */
|
||||||
|
|
||||||
|
#define CR_SL(cr) (label2bslabel(crgetlabel(cr)))
|
||||||
|
|
||||||
|
extern ts_label_t *l_admin_low;
|
||||||
|
extern ts_label_t *l_admin_high;
|
||||||
|
extern uint32_t default_doi;
|
||||||
|
extern int sys_labeling;
|
||||||
|
|
||||||
|
extern void label_init(void);
|
||||||
|
extern ts_label_t *labelalloc(const m_label_t *, uint32_t, int);
|
||||||
|
extern ts_label_t *labeldup(const ts_label_t *, int);
|
||||||
|
extern void label_hold(ts_label_t *);
|
||||||
|
extern void label_rele(ts_label_t *);
|
||||||
|
extern m_label_t *label2bslabel(ts_label_t *);
|
||||||
|
extern uint32_t label2doi(ts_label_t *);
|
||||||
|
extern boolean_t label_equal(const ts_label_t *, const ts_label_t *);
|
||||||
|
extern cred_t *newcred_from_bslabel(m_label_t *, uint32_t, int);
|
||||||
|
extern cred_t *copycred_from_bslabel(const cred_t *, m_label_t *,
|
||||||
|
uint32_t, int);
|
||||||
|
extern cred_t *copycred_from_tslabel(const cred_t *, ts_label_t *,
|
||||||
|
int);
|
||||||
|
extern ts_label_t *getflabel(vnode_t *);
|
||||||
|
extern int getlabel(const char *, m_label_t *);
|
||||||
|
extern int fgetlabel(int, m_label_t *);
|
||||||
|
extern int _blinrange(const m_label_t *, const brange_t *);
|
||||||
|
extern int blinlset(const m_label_t *, const blset_t);
|
||||||
|
|
||||||
|
extern int l_to_str_internal(const m_label_t *, char **);
|
||||||
|
extern int hexstr_to_label(const char *, m_label_t *);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The use of '!!' here prevents users from referencing this function-like
|
||||||
|
* macro as though it were an l-value, and in normal use is optimized away
|
||||||
|
* by the compiler.
|
||||||
|
*/
|
||||||
|
#define is_system_labeled() (!!(sys_labeling > 0))
|
||||||
|
|
||||||
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !_SYS_TSOL_LABEL_H */
|
|
@ -0,0 +1,351 @@
|
||||||
|
/*
|
||||||
|
* CDDL HEADER START
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the terms of the
|
||||||
|
* Common Development and Distribution License (the "License").
|
||||||
|
* You may not use this file except in compliance with the License.
|
||||||
|
*
|
||||||
|
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
* or http://www.opensolaris.org/os/licensing.
|
||||||
|
* See the License for the specific language governing permissions
|
||||||
|
* and limitations under the License.
|
||||||
|
*
|
||||||
|
* When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
* If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
*
|
||||||
|
* CDDL HEADER END
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _LABEL_MACRO_H
|
||||||
|
#define _LABEL_MACRO_H
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
/* PRIVATE ONLY TO THE LABEL LIBRARY. DO NOT USE ELSEWHERE */
|
||||||
|
|
||||||
|
/* Actual Binary Label Structure Definitions */
|
||||||
|
|
||||||
|
typedef int16_t _Classification;
|
||||||
|
typedef struct {
|
||||||
|
union {
|
||||||
|
uint8_t class_ar[2];
|
||||||
|
_Classification class_chunk;
|
||||||
|
} class_u;
|
||||||
|
} Classification_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_t c1;
|
||||||
|
uint32_t c2;
|
||||||
|
uint32_t c3;
|
||||||
|
uint32_t c4;
|
||||||
|
uint32_t c5;
|
||||||
|
uint32_t c6;
|
||||||
|
uint32_t c7;
|
||||||
|
uint32_t c8;
|
||||||
|
} Compartments_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_t m1;
|
||||||
|
uint32_t m2;
|
||||||
|
uint32_t m3;
|
||||||
|
uint32_t m4;
|
||||||
|
uint32_t m5;
|
||||||
|
uint32_t m6;
|
||||||
|
uint32_t m7;
|
||||||
|
uint32_t m8;
|
||||||
|
} Markings_t;
|
||||||
|
|
||||||
|
typedef struct _mac_label_impl {
|
||||||
|
uint8_t id; /* Magic to say label type */
|
||||||
|
uint8_t _c_len; /* Number of Compartment words */
|
||||||
|
Classification_t classification;
|
||||||
|
Compartments_t compartments;
|
||||||
|
} _mac_label_impl_t;
|
||||||
|
|
||||||
|
typedef _mac_label_impl_t _blevel_impl_t, /* compatibility */
|
||||||
|
_bslabel_impl_t, /* Sensitivity Label */
|
||||||
|
_bclear_impl_t; /* Clearance */
|
||||||
|
|
||||||
|
typedef struct _binary_information_label_impl { /* Information Label */
|
||||||
|
_mac_label_impl_t binformation_level;
|
||||||
|
Markings_t markings;
|
||||||
|
} _bilabel_impl_t;
|
||||||
|
|
||||||
|
typedef struct _binary_cmw_label_impl { /* CMW Label */
|
||||||
|
_bslabel_impl_t bcl_sensitivity_label;
|
||||||
|
_bilabel_impl_t bcl_information_label;
|
||||||
|
} _bclabel_impl_t;
|
||||||
|
|
||||||
|
typedef struct _binary_level_range_impl { /* Level Range */
|
||||||
|
_mac_label_impl_t lower_bound;
|
||||||
|
_mac_label_impl_t upper_bound;
|
||||||
|
} _brange_impl_t, brange_t;
|
||||||
|
|
||||||
|
#define NMLP_MAX 0x10
|
||||||
|
#define NSLS_MAX 0x4
|
||||||
|
|
||||||
|
typedef _mac_label_impl_t blset_t[NSLS_MAX];
|
||||||
|
|
||||||
|
/* Label Identifier Types */
|
||||||
|
|
||||||
|
#define SUN_MAC_ID 0x41 /* MAC label, legacy SUN_SL_ID */
|
||||||
|
#define SUN_UCLR_ID 0x49 /* User Clearance, legacy SUN_CLR_ID */
|
||||||
|
|
||||||
|
#define _C_LEN 8 /* number of compartments words */
|
||||||
|
|
||||||
|
/* m_label_t macros */
|
||||||
|
#define _MTYPE(l, t) \
|
||||||
|
(((_mac_label_impl_t *)(l))->id == (t))
|
||||||
|
|
||||||
|
#define _MSETTYPE(l, t) \
|
||||||
|
(((_mac_label_impl_t *)(l))->id = (t))
|
||||||
|
|
||||||
|
#define _MGETTYPE(l) (((_mac_label_impl_t *)(l))->id)
|
||||||
|
|
||||||
|
#define _MEQUAL(l1, l2) \
|
||||||
|
(LCLASS(l1) == LCLASS(l2) && \
|
||||||
|
(l1)->_comps.c1 == (l2)->_comps.c1 && \
|
||||||
|
(l1)->_comps.c2 == (l2)->_comps.c2 && \
|
||||||
|
(l1)->_comps.c3 == (l2)->_comps.c3 && \
|
||||||
|
(l1)->_comps.c4 == (l2)->_comps.c4 && \
|
||||||
|
(l1)->_comps.c5 == (l2)->_comps.c5 && \
|
||||||
|
(l1)->_comps.c6 == (l2)->_comps.c6 && \
|
||||||
|
(l1)->_comps.c7 == (l2)->_comps.c7 && \
|
||||||
|
(l1)->_comps.c8 == (l2)->_comps.c8)
|
||||||
|
|
||||||
|
#define SUN_INVALID_ID 0 /* uninitialized label */
|
||||||
|
#define SUN_CMW_ID 0x83 /* 104 - total bytes in CMW Label */
|
||||||
|
#define SUN_SL_ID 0x41 /* 36 - total bytes in Sensitivity Label */
|
||||||
|
#define SUN_SL_UN 0xF1 /* undefined Sensitivity Label */
|
||||||
|
#define SUN_IL_ID 0x42 /* 68 - total bytes in Information Label */
|
||||||
|
#define SUN_IL_UN 0x73 /* undefined Information Label */
|
||||||
|
#define SUN_CLR_ID 0x49 /* 36 - total bytes in Clearance */
|
||||||
|
#define SUN_CLR_UN 0xF9 /* undefined Clearance */
|
||||||
|
|
||||||
|
#define _bcl_sl bcl_sensitivity_label
|
||||||
|
#define _bcl_il bcl_information_label
|
||||||
|
#define _bslev_il binformation_level
|
||||||
|
|
||||||
|
#define _lclass classification
|
||||||
|
#ifdef _BIG_ENDIAN
|
||||||
|
#define LCLASS(slp) ((slp)->_lclass.class_u.class_chunk)
|
||||||
|
#define LCLASS_SET(slp, l) ((slp)->_lclass.class_u.class_chunk = (l))
|
||||||
|
#else
|
||||||
|
#define LCLASS(slp) \
|
||||||
|
((_Classification)(((slp)->_lclass.class_u.class_ar[0] << 8) | \
|
||||||
|
(slp)->_lclass.class_u.class_ar[1]))
|
||||||
|
#define LCLASS_SET(slp, l) \
|
||||||
|
((slp)->_lclass.class_u.class_ar[0] = (uint8_t)((l)>> 8), \
|
||||||
|
(slp)->_lclass.class_u.class_ar[1] = (uint8_t)(l))
|
||||||
|
#endif /* _BIG_ENDIAN */
|
||||||
|
#define _comps compartments
|
||||||
|
|
||||||
|
#define _iid _bslev_il.id
|
||||||
|
#define _i_c_len _bslev_il._c_len
|
||||||
|
#define _iclass _bslev_il._lclass
|
||||||
|
#ifdef _BIG_ENDIAN
|
||||||
|
#define ICLASS(ilp) ((ilp)->_iclass.class_u.class_chunk)
|
||||||
|
#define ICLASS_SET(ilp, l) ((ilp)->_iclass.class_u.class_chunk = (l))
|
||||||
|
#else
|
||||||
|
#define ICLASS(ilp) \
|
||||||
|
((_Classification)(((ilp)->_iclass.class_u.class_ar[0] << 8) | \
|
||||||
|
(ilp)->_iclass.class_u.class_ar[1]))
|
||||||
|
#define ICLASS_SET(ilp, l) \
|
||||||
|
((ilp)->_iclass.class_u.class_ar[0] = (uint8_t)((l)>> 8), \
|
||||||
|
(ilp)->_iclass.class_u.class_ar[1] = (uint8_t)(l))
|
||||||
|
#endif /* _BIG_ENDIAN */
|
||||||
|
#define _icomps _bslev_il._comps
|
||||||
|
#define _imarks markings
|
||||||
|
|
||||||
|
/* Manifest Constant Values */
|
||||||
|
|
||||||
|
#define LOW_CLASS 0 /* Admin_Low classification value */
|
||||||
|
#define HIGH_CLASS 0x7FFF /* Admin_High classification value */
|
||||||
|
#define EMPTY_SET 0 /* Empty compartments and markings set */
|
||||||
|
#define UNIVERSAL_SET 0xFFFFFFFFU /* Universal compartments and */
|
||||||
|
/* markings set */
|
||||||
|
|
||||||
|
/* Construct initial labels */
|
||||||
|
|
||||||
|
#define _LOW_LABEL(l, t) \
|
||||||
|
((l)->id = t, (l)->_c_len = _C_LEN, LCLASS_SET(l, LOW_CLASS), \
|
||||||
|
(l)->_comps.c1 = (l)->_comps.c2 = (l)->_comps.c3 = (l)->_comps.c4 = \
|
||||||
|
(l)->_comps.c5 = (l)->_comps.c6 = (l)->_comps.c7 = (l)->_comps.c8 = \
|
||||||
|
EMPTY_SET)
|
||||||
|
|
||||||
|
#define _HIGH_LABEL(l, t) \
|
||||||
|
((l)->id = t, (l)->_c_len = _C_LEN, LCLASS_SET(l, HIGH_CLASS), \
|
||||||
|
(l)->_comps.c1 = (l)->_comps.c2 = (l)->_comps.c3 = (l)->_comps.c4 = \
|
||||||
|
(l)->_comps.c5 = (l)->_comps.c6 = (l)->_comps.c7 = (l)->_comps.c8 = \
|
||||||
|
UNIVERSAL_SET)
|
||||||
|
|
||||||
|
/* Macro equivalents */
|
||||||
|
|
||||||
|
/* Is this memory a properly formatted label of type t? */
|
||||||
|
#define BLTYPE(l, t) \
|
||||||
|
((t) == SUN_CMW_ID ? \
|
||||||
|
(((_bclabel_impl_t *)(l))->_bcl_sl.id == SUN_SL_ID || \
|
||||||
|
((_bclabel_impl_t *)(l))->_bcl_sl.id == SUN_SL_UN) && \
|
||||||
|
(((_bclabel_impl_t *)(l))->_bcl_il._iid == SUN_IL_ID || \
|
||||||
|
((_bclabel_impl_t *)(l))->_bcl_il._iid == SUN_IL_UN) : \
|
||||||
|
((_mac_label_impl_t *)(l))->id == (t))
|
||||||
|
|
||||||
|
/* Are the levels of these labels equal? */
|
||||||
|
#define BLEQUAL(l1, l2) \
|
||||||
|
_BLEQUAL((_mac_label_impl_t *)(l1), (_mac_label_impl_t *)(l2))
|
||||||
|
|
||||||
|
#define _BLEQUAL(l1, l2) \
|
||||||
|
(LCLASS(l1) == LCLASS(l2) && \
|
||||||
|
(l1)->_comps.c1 == (l2)->_comps.c1 && \
|
||||||
|
(l1)->_comps.c2 == (l2)->_comps.c2 && \
|
||||||
|
(l1)->_comps.c3 == (l2)->_comps.c3 && \
|
||||||
|
(l1)->_comps.c4 == (l2)->_comps.c4 && \
|
||||||
|
(l1)->_comps.c5 == (l2)->_comps.c5 && \
|
||||||
|
(l1)->_comps.c6 == (l2)->_comps.c6 && \
|
||||||
|
(l1)->_comps.c7 == (l2)->_comps.c7 && \
|
||||||
|
(l1)->_comps.c8 == (l2)->_comps.c8)
|
||||||
|
|
||||||
|
/* Does the level of l1 dominate that of l2? */
|
||||||
|
#define BLDOMINATES(l1, l2) \
|
||||||
|
_BLDOMINATES((_mac_label_impl_t *)(l1), (_mac_label_impl_t *)(l2))
|
||||||
|
|
||||||
|
#define _BLDOMINATES(l1, l2) (LCLASS(l1) >= LCLASS(l2) && \
|
||||||
|
(l2)->_comps.c1 == ((l1)->_comps.c1 & (l2)->_comps.c1) && \
|
||||||
|
(l2)->_comps.c2 == ((l1)->_comps.c2 & (l2)->_comps.c2) && \
|
||||||
|
(l2)->_comps.c3 == ((l1)->_comps.c3 & (l2)->_comps.c3) && \
|
||||||
|
(l2)->_comps.c4 == ((l1)->_comps.c4 & (l2)->_comps.c4) && \
|
||||||
|
(l2)->_comps.c5 == ((l1)->_comps.c5 & (l2)->_comps.c5) && \
|
||||||
|
(l2)->_comps.c6 == ((l1)->_comps.c6 & (l2)->_comps.c6) && \
|
||||||
|
(l2)->_comps.c7 == ((l1)->_comps.c7 & (l2)->_comps.c7) && \
|
||||||
|
(l2)->_comps.c8 == ((l1)->_comps.c8 & (l2)->_comps.c8))
|
||||||
|
|
||||||
|
/* Does the level of l1 strictly dominate that of l2? */
|
||||||
|
#define BLSTRICTDOM(l1, l2) (!BLEQUAL(l1, l2) && BLDOMINATES(l1, l2))
|
||||||
|
|
||||||
|
/* Is the level of l within the range r? */
|
||||||
|
#define BLINRANGE(l, r)\
|
||||||
|
(BLDOMINATES((l), &((r)->lower_bound)) && \
|
||||||
|
BLDOMINATES(&((r)->upper_bound), (l)))
|
||||||
|
|
||||||
|
/* Least Upper Bound level l1 and l2 replacing l1 with the result. */
|
||||||
|
#define BLMAXIMUM(l1, l2) \
|
||||||
|
_BLMAXIMUM((_mac_label_impl_t *)(l1), (_mac_label_impl_t *)(l2))
|
||||||
|
|
||||||
|
#define _BLMAXIMUM(l1, l2)\
|
||||||
|
(((l1)->_lclass = (LCLASS(l1) < LCLASS(l2)) ? \
|
||||||
|
(l2)->_lclass : (l1)->_lclass), \
|
||||||
|
(l1)->_comps.c1 |= (l2)->_comps.c1, \
|
||||||
|
(l1)->_comps.c2 |= (l2)->_comps.c2, \
|
||||||
|
(l1)->_comps.c3 |= (l2)->_comps.c3, \
|
||||||
|
(l1)->_comps.c4 |= (l2)->_comps.c4, \
|
||||||
|
(l1)->_comps.c5 |= (l2)->_comps.c5, \
|
||||||
|
(l1)->_comps.c6 |= (l2)->_comps.c6, \
|
||||||
|
(l1)->_comps.c7 |= (l2)->_comps.c7, \
|
||||||
|
(l1)->_comps.c8 |= (l2)->_comps.c8)
|
||||||
|
|
||||||
|
/* Greatest Lower Bound level l1 and l2 replacing l1 with the result. */
|
||||||
|
#define BLMINIMUM(l1, l2) \
|
||||||
|
_BLMINIMUM((_mac_label_impl_t *)(l1), (_mac_label_impl_t *)(l2))
|
||||||
|
|
||||||
|
#define _BLMINIMUM(l1, l2)\
|
||||||
|
(((l1)->_lclass = (LCLASS(l1) > LCLASS(l2)) ? \
|
||||||
|
(l2)->_lclass : (l1)->_lclass), \
|
||||||
|
(l1)->_comps.c1 &= (l2)->_comps.c1, \
|
||||||
|
(l1)->_comps.c2 &= (l2)->_comps.c2, \
|
||||||
|
(l1)->_comps.c3 &= (l2)->_comps.c3, \
|
||||||
|
(l1)->_comps.c4 &= (l2)->_comps.c4, \
|
||||||
|
(l1)->_comps.c5 &= (l2)->_comps.c5, \
|
||||||
|
(l1)->_comps.c6 &= (l2)->_comps.c6, \
|
||||||
|
(l1)->_comps.c7 &= (l2)->_comps.c7, \
|
||||||
|
(l1)->_comps.c8 &= (l2)->_comps.c8)
|
||||||
|
|
||||||
|
/* Create Manifest Labels */
|
||||||
|
|
||||||
|
/* Write a System_Low CMW Label into this memory. */
|
||||||
|
#define BCLLOW(l) (BSLLOW(BCLTOSL(l)), BILLOW(BCLTOIL(l)))
|
||||||
|
|
||||||
|
/* Write a System_Low Sensitivity Label into this memory. */
|
||||||
|
#define BSLLOW(l) _BSLLOW((_bslabel_impl_t *)(l))
|
||||||
|
|
||||||
|
#define _BSLLOW(l) \
|
||||||
|
((l)->id = SUN_SL_ID, (l)->_c_len = _C_LEN, LCLASS_SET(l, LOW_CLASS), \
|
||||||
|
(l)->_comps.c1 = (l)->_comps.c2 = (l)->_comps.c3 = (l)->_comps.c4 = \
|
||||||
|
(l)->_comps.c5 = (l)->_comps.c6 = (l)->_comps.c7 = (l)->_comps.c8 = \
|
||||||
|
EMPTY_SET)
|
||||||
|
|
||||||
|
/* Write a System_High Sensitivity Label into this memory. */
|
||||||
|
#define BSLHIGH(l) _BSLHIGH((_bslabel_impl_t *)(l))
|
||||||
|
|
||||||
|
#define _BSLHIGH(l) \
|
||||||
|
((l)->id = SUN_SL_ID, (l)->_c_len = _C_LEN, LCLASS_SET(l, HIGH_CLASS), \
|
||||||
|
(l)->_comps.c1 = (l)->_comps.c2 = (l)->_comps.c3 = (l)->_comps.c4 = \
|
||||||
|
(l)->_comps.c5 = (l)->_comps.c6 = (l)->_comps.c7 = (l)->_comps.c8 = \
|
||||||
|
UNIVERSAL_SET)
|
||||||
|
|
||||||
|
/* Write a System_Low Information Label into this memory. */
|
||||||
|
#define BILLOW(l) _BILLOW((_bilabel_impl_t *)(l))
|
||||||
|
|
||||||
|
#define _BILLOW(l) \
|
||||||
|
((l)->_iid = SUN_IL_ID, (l)->_i_c_len = _C_LEN, \
|
||||||
|
ICLASS_SET(l, LOW_CLASS), \
|
||||||
|
(l)->_icomps.c1 = (l)->_icomps.c2 = (l)->_icomps.c3 = \
|
||||||
|
(l)->_icomps.c4 = (l)->_icomps.c5 = (l)->_icomps.c6 = \
|
||||||
|
(l)->_icomps.c7 = (l)->_icomps.c8 = EMPTY_SET, \
|
||||||
|
(l)->_imarks.m1 = (l)->_imarks.m2 = (l)->_imarks.m3 = \
|
||||||
|
(l)->_imarks.m4 = (l)->_imarks.m5 = (l)->_imarks.m6 = \
|
||||||
|
(l)->_imarks.m7 = (l)->_imarks.m8 = EMPTY_SET)
|
||||||
|
|
||||||
|
|
||||||
|
/* Write a System_Low Sensitivity Label into this memory. */
|
||||||
|
#define BCLEARLOW(l) _BCLEARLOW((_bclear_impl_t *)(l))
|
||||||
|
|
||||||
|
#define _BCLEARLOW(c) \
|
||||||
|
((c)->id = SUN_CLR_ID, (c)->_c_len = _C_LEN, \
|
||||||
|
LCLASS_SET(c, LOW_CLASS), \
|
||||||
|
(c)->_comps.c1 = (c)->_comps.c2 = (c)->_comps.c3 = (c)->_comps.c4 = \
|
||||||
|
(c)->_comps.c5 = (c)->_comps.c6 = (c)->_comps.c7 = (c)->_comps.c8 = \
|
||||||
|
EMPTY_SET)
|
||||||
|
|
||||||
|
/* Write a System_High Sensitivity Label into this memory. */
|
||||||
|
#define BCLEARHIGH(l) _BCLEARHIGH((_bclear_impl_t *)(l))
|
||||||
|
|
||||||
|
#define _BCLEARHIGH(c) \
|
||||||
|
((c)->id = SUN_CLR_ID, (c)->_c_len = _C_LEN, \
|
||||||
|
LCLASS_SET(c, HIGH_CLASS), \
|
||||||
|
(c)->_comps.c1 = (c)->_comps.c2 = (c)->_comps.c3 = (c)->_comps.c4 = \
|
||||||
|
(c)->_comps.c5 = (c)->_comps.c6 = (c)->_comps.c7 = (c)->_comps.c8 = \
|
||||||
|
UNIVERSAL_SET)
|
||||||
|
|
||||||
|
/* Write an undefined Sensitivity Label into this memory. */
|
||||||
|
#define BSLUNDEF(l) (((_bslabel_impl_t *)(l))->id = SUN_SL_UN)
|
||||||
|
|
||||||
|
/* Write an undefined Clearance into this memory. */
|
||||||
|
#define BCLEARUNDEF(c) (((_bclear_impl_t *)(c))->id = SUN_CLR_UN)
|
||||||
|
|
||||||
|
/* Retrieve the Sensitivity Label portion of a CMW Label */
|
||||||
|
#define BCLTOSL(l) ((bslabel_t *)&((_bclabel_impl_t *)(l))->_bcl_sl)
|
||||||
|
|
||||||
|
/* Retrieve the Information Label portion of a CMW Label */
|
||||||
|
#define BCLTOIL(l) ((_bilabel_impl_t *)&((_bclabel_impl_t *)(l))->_bcl_il)
|
||||||
|
|
||||||
|
/* Copy the Sensitivity Label portion from a CMW Label */
|
||||||
|
#define GETCSL(l1, l2) \
|
||||||
|
(*((_bslabel_impl_t *)(l1)) = ((_bclabel_impl_t *)(l2))->_bcl_sl)
|
||||||
|
|
||||||
|
/* Replace the Sensitivity Label portion of a CMW Label */
|
||||||
|
#define SETCSL(l1, l2) \
|
||||||
|
(((_bclabel_impl_t *)(l1))->_bcl_sl = *((_bslabel_impl_t *)(l2)))
|
||||||
|
|
||||||
|
/* Set type of this memory to the label type 't' */
|
||||||
|
#define SETBLTYPE(l, t) (((_bclabel_impl_t *)(l))->_bcl_sl.id = (t))
|
||||||
|
|
||||||
|
#define GETBLTYPE(l) (((const _bclabel_impl_t *)(l))->_bcl_sl.id)
|
||||||
|
|
||||||
|
#endif /* !_LABEL_MACRO_H */
|
|
@ -37,14 +37,72 @@
|
||||||
* contributors.
|
* contributors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _LIBSPL_SYS_UIO_H
|
#ifndef _LIBSPL_SYS_UIO_H
|
||||||
#define _LIBSPL_SYS_UIO_H
|
#define _LIBSPL_SYS_UIO_H
|
||||||
|
|
||||||
/* struct iovec is defined in glibc's sys/uio.h */
|
|
||||||
#include_next <sys/uio.h>
|
#include_next <sys/uio.h>
|
||||||
|
|
||||||
typedef enum uio_rw { UIO_READ, UIO_WRITE } uio_rw_t;
|
typedef struct iovec iovec_t;
|
||||||
|
|
||||||
#define UIO_SYSSPACE 1
|
typedef enum uio_rw {
|
||||||
|
UIO_READ = 0,
|
||||||
|
UIO_WRITE = 1,
|
||||||
|
} uio_rw_t;
|
||||||
|
|
||||||
|
typedef enum uio_seg {
|
||||||
|
UIO_USERSPACE = 0,
|
||||||
|
UIO_SYSSPACE = 1,
|
||||||
|
UIO_USERISPACE= 2,
|
||||||
|
} uio_seg_t;
|
||||||
|
|
||||||
|
typedef struct uio {
|
||||||
|
struct iovec *uio_iov; /* pointer to array of iovecs */
|
||||||
|
int uio_iovcnt; /* number of iovecs */
|
||||||
|
offset_t uio_loffset; /* file offset */
|
||||||
|
uio_seg_t uio_segflg; /* address space (kernel or user) */
|
||||||
|
uint16_t uio_fmode; /* file mode flags */
|
||||||
|
uint16_t uio_extflg; /* extended flags */
|
||||||
|
offset_t uio_limit; /* u-limit (maximum byte offset) */
|
||||||
|
ssize_t uio_resid; /* residual count */
|
||||||
|
} uio_t;
|
||||||
|
|
||||||
|
typedef enum xuio_type {
|
||||||
|
UIOTYPE_ASYNCIO,
|
||||||
|
UIOTYPE_ZEROCOPY,
|
||||||
|
} xuio_type_t;
|
||||||
|
|
||||||
|
#define UIOA_IOV_MAX 16
|
||||||
|
|
||||||
|
typedef struct uioa_page_s { /* locked uio_iov state */
|
||||||
|
int uioa_pfncnt; /* count of pfn_t(s) in *uioa_ppp */
|
||||||
|
void **uioa_ppp; /* page_t or pfn_t arrary */
|
||||||
|
caddr_t uioa_base; /* address base */
|
||||||
|
size_t uioa_len; /* span length */
|
||||||
|
} uioa_page_t;
|
||||||
|
|
||||||
|
typedef struct xuio {
|
||||||
|
uio_t xu_uio; /* embedded UIO structure */
|
||||||
|
|
||||||
|
/* Extended uio fields */
|
||||||
|
enum xuio_type xu_type; /* uio type */
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t xu_a_state; /* state of async i/o */
|
||||||
|
ssize_t xu_a_mbytes; /* bytes moved */
|
||||||
|
uioa_page_t *xu_a_lcur; /* uioa_locked[] pointer */
|
||||||
|
void **xu_a_lppp; /* lcur->uioa_pppp[] pointer */
|
||||||
|
void *xu_a_hwst[4]; /* opaque hardware state */
|
||||||
|
uioa_page_t xu_a_locked[UIOA_IOV_MAX];
|
||||||
|
} xu_aio;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
int xu_zc_rw; /* read or write buffer */
|
||||||
|
void *xu_zc_priv; /* fs specific */
|
||||||
|
} xu_zc;
|
||||||
|
} xu_ext;
|
||||||
|
} xuio_t;
|
||||||
|
|
||||||
|
#define XUIO_XUZC_PRIV(xuio) xuio->xu_ext.xu_zc.xu_zc_priv
|
||||||
|
#define XUIO_XUZC_RW(xuio) xuio->xu_ext.xu_zc.xu_zc_rw
|
||||||
|
|
||||||
#endif /* _SYS_UIO_H */
|
#endif /* _SYS_UIO_H */
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* CDDL HEADER START
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the terms of the
|
||||||
|
* Common Development and Distribution License, Version 1.0 only
|
||||||
|
* (the "License"). You may not use this file except in compliance
|
||||||
|
* with the License.
|
||||||
|
*
|
||||||
|
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
* or http://www.opensolaris.org/os/licensing.
|
||||||
|
* See the License for the specific language governing permissions
|
||||||
|
* and limitations under the License.
|
||||||
|
*
|
||||||
|
* When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
* If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
*
|
||||||
|
* CDDL HEADER END
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _LIBSPL_SYS_VNODE_H
|
||||||
|
#define _LIBSPL_SYS_VNODE_H
|
||||||
|
|
||||||
|
#endif /* _LIBSPL_SYS_VNODE_H */
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* CDDL HEADER START
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the terms of the
|
||||||
|
* Common Development and Distribution License, Version 1.0 only
|
||||||
|
* (the "License"). You may not use this file except in compliance
|
||||||
|
* with the License.
|
||||||
|
*
|
||||||
|
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
* or http://www.opensolaris.org/os/licensing.
|
||||||
|
* See the License for the specific language governing permissions
|
||||||
|
* and limitations under the License.
|
||||||
|
*
|
||||||
|
* When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
* If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
*
|
||||||
|
* CDDL HEADER END
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _LIBSPL_UTIL_SSCANF_H
|
||||||
|
#define _LIBSPL_UTIL_SSCANF_H
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,313 @@
|
||||||
|
/*
|
||||||
|
* CDDL HEADER START
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the terms of the
|
||||||
|
* Common Development and Distribution License (the "License").
|
||||||
|
* You may not use this file except in compliance with the License.
|
||||||
|
*
|
||||||
|
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
* or http://www.opensolaris.org/os/licensing.
|
||||||
|
* See the License for the specific language governing permissions
|
||||||
|
* and limitations under the License.
|
||||||
|
*
|
||||||
|
* When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
* If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
*
|
||||||
|
* CDDL HEADER END
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <sys/tsol/label_macro.h>
|
||||||
|
#include <sys/tsol/label.h>
|
||||||
|
#include "label.h"
|
||||||
|
#include "labeld.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static _mac_label_impl_t low;
|
||||||
|
static _mac_label_impl_t high;
|
||||||
|
static int inited = 0;
|
||||||
|
|
||||||
|
#define freeit(a, l) free(a)
|
||||||
|
|
||||||
|
/* 0x + Classification + '-' + ll + '-' + Compartments + end of string */
|
||||||
|
#define _HEX_SIZE 2+(sizeof (Classification_t)*2)+4+\
|
||||||
|
(sizeof (Compartments_t)*2)+1
|
||||||
|
|
||||||
|
/* 0x + Classification + '-' + ll + '-' + end of string */
|
||||||
|
#define _MIN_HEX (2 + (sizeof (Classification_t)*2) + 4 + 1)
|
||||||
|
|
||||||
|
static char digits[] = "0123456789abcdef";
|
||||||
|
|
||||||
|
#define HEX(h, i, l, s) \
|
||||||
|
for (; i < s; /* */) {\
|
||||||
|
h[i++] = digits[(unsigned int)(*l >> 4)];\
|
||||||
|
h[i++] = digits[(unsigned int)(*l++&0xF)]; }
|
||||||
|
|
||||||
|
static int
|
||||||
|
__hex(char **s, const m_label_t *l)
|
||||||
|
{
|
||||||
|
char *hex;
|
||||||
|
int i = 0;
|
||||||
|
uchar_t *hl;
|
||||||
|
int hex_len;
|
||||||
|
uchar_t *len;
|
||||||
|
|
||||||
|
hl = (uchar_t *)&(((_mac_label_impl_t *)l)->_c_len);
|
||||||
|
len = hl;
|
||||||
|
|
||||||
|
if (*len == 0) {
|
||||||
|
/* old binary label */
|
||||||
|
hex_len = _HEX_SIZE;
|
||||||
|
} else {
|
||||||
|
hex_len = _MIN_HEX + (*len * sizeof (uint32_t) * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((hex = malloc(hex_len)) == NULL) {
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* header */
|
||||||
|
|
||||||
|
hex[i++] = '0';
|
||||||
|
hex[i++] = 'x';
|
||||||
|
|
||||||
|
/* classification */
|
||||||
|
|
||||||
|
hl++; /* start at classification */
|
||||||
|
HEX(hex, i, hl, 6);
|
||||||
|
|
||||||
|
/* Add compartments length */
|
||||||
|
hex[i++] = '-';
|
||||||
|
HEX(hex, i, len, 9);
|
||||||
|
hex[i++] = '-';
|
||||||
|
|
||||||
|
/* compartments */
|
||||||
|
HEX(hex, i, hl, hex_len-1);
|
||||||
|
hex[i] = '\0';
|
||||||
|
|
||||||
|
/* truncate trailing zeros */
|
||||||
|
|
||||||
|
while (hex[i-1] == '0' && hex[i-2] == '0') {
|
||||||
|
i -= 2;
|
||||||
|
}
|
||||||
|
hex[i] = '\0';
|
||||||
|
|
||||||
|
if ((*s = strdup(hex)) == NULL) {
|
||||||
|
freeit(hex, hex_len);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
freeit(hex, hex_len);
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
l_to_str_internal(const m_label_t *l, char **s)
|
||||||
|
{
|
||||||
|
if (inited == 0) {
|
||||||
|
inited = 1;
|
||||||
|
_BSLLOW(&low);
|
||||||
|
_BSLHIGH(&high);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(_MTYPE(l, SUN_MAC_ID) || _MTYPE(l, SUN_UCLR_ID))) {
|
||||||
|
errno = EINVAL;
|
||||||
|
*s = NULL;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
if (_MEQUAL(&low, (_mac_label_impl_t *)l)) {
|
||||||
|
if ((*s = strdup(ADMIN_LOW)) == NULL) {
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
if (_MEQUAL(&high, (_mac_label_impl_t *)l)) {
|
||||||
|
if ((*s = strdup(ADMIN_HIGH)) == NULL) {
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (__hex(s, l));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* label_to_str -- convert a label to the requested type of string.
|
||||||
|
*
|
||||||
|
* Entry l = label to convert;
|
||||||
|
* t = type of conversion;
|
||||||
|
* f = flags for conversion type;
|
||||||
|
*
|
||||||
|
* Exit *s = allocated converted string;
|
||||||
|
* Caller must call free() to free.
|
||||||
|
*
|
||||||
|
* Returns 0, success.
|
||||||
|
* -1, error, errno set; *s = NULL.
|
||||||
|
*
|
||||||
|
* Calls labeld
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
label_to_str(const m_label_t *l, char **s, const m_label_str_t t, uint_t f)
|
||||||
|
{
|
||||||
|
labeld_data_t call;
|
||||||
|
labeld_data_t *callp = &call;
|
||||||
|
size_t bufsize = sizeof (labeld_data_t);
|
||||||
|
size_t datasize;
|
||||||
|
int err;
|
||||||
|
int string_start = 0;
|
||||||
|
|
||||||
|
if (inited == 0) {
|
||||||
|
inited = 1;
|
||||||
|
_BSLLOW(&low);
|
||||||
|
_BSLHIGH(&high);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define lscall callp->param.acall.cargs.ls_arg
|
||||||
|
#define lsret callp->param.aret.rvals.ls_ret
|
||||||
|
switch (t) {
|
||||||
|
case M_LABEL:
|
||||||
|
call.callop = LTOS;
|
||||||
|
lscall.label = *l;
|
||||||
|
lscall.flags = f;
|
||||||
|
datasize = CALL_SIZE(ls_call_t, 0);
|
||||||
|
if ((err = __call_labeld(&callp, &bufsize, &datasize)) ==
|
||||||
|
SUCCESS) {
|
||||||
|
if (callp->reterr != 0) {
|
||||||
|
errno = EINVAL;
|
||||||
|
*s = NULL;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
*s = strdup(lsret.buf);
|
||||||
|
if (callp != &call) {
|
||||||
|
/* release returned buffer */
|
||||||
|
(void) munmap((void *)callp, bufsize);
|
||||||
|
}
|
||||||
|
if (*s == NULL) {
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
switch (err) {
|
||||||
|
case NOSERVER:
|
||||||
|
/* server not present */
|
||||||
|
/* special case admin_low and admin_high */
|
||||||
|
|
||||||
|
if (_MEQUAL(&low, (_mac_label_impl_t *)l)) {
|
||||||
|
if ((*s = strdup(ADMIN_LOW)) == NULL) {
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
} else if (_MEQUAL(&high, (_mac_label_impl_t *)l)) {
|
||||||
|
if ((*s = strdup(ADMIN_HIGH)) == NULL) {
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
errno = ENOTSUP;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
errno = EINVAL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*s = NULL;
|
||||||
|
return (-1);
|
||||||
|
#undef lscall
|
||||||
|
#undef lsret
|
||||||
|
|
||||||
|
case M_INTERNAL: {
|
||||||
|
return (l_to_str_internal(l, s));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define ccall callp->param.acall.cargs.color_arg
|
||||||
|
#define cret callp->param.aret.rvals.color_ret
|
||||||
|
case M_COLOR:
|
||||||
|
datasize = CALL_SIZE(color_call_t, 0);
|
||||||
|
call.callop = BLTOCOLOR;
|
||||||
|
ccall.label = *l;
|
||||||
|
|
||||||
|
if (__call_labeld(&callp, &bufsize, &datasize) == SUCCESS) {
|
||||||
|
if (callp->reterr != 0) {
|
||||||
|
errno = EINVAL;
|
||||||
|
*s = NULL;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
*s = strdup(cret.color);
|
||||||
|
if (callp != &call) {
|
||||||
|
/* release returned buffer */
|
||||||
|
(void) munmap((void *)callp, bufsize);
|
||||||
|
}
|
||||||
|
if (*s == NULL) {
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
} else {
|
||||||
|
errno = ENOTSUP;
|
||||||
|
*s = NULL;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
#undef ccall
|
||||||
|
#undef cret
|
||||||
|
|
||||||
|
#define prcall callp->param.acall.cargs.pr_arg
|
||||||
|
#define prret callp->param.aret.rvals.pr_ret
|
||||||
|
case PRINTER_TOP_BOTTOM:
|
||||||
|
call.callop = PR_TOP;
|
||||||
|
break;
|
||||||
|
case PRINTER_LABEL:
|
||||||
|
call.callop = PR_LABEL;
|
||||||
|
break;
|
||||||
|
case PRINTER_CAVEATS:
|
||||||
|
call.callop = PR_CAVEATS;
|
||||||
|
string_start = 1; /* compensate for leading space */
|
||||||
|
break;
|
||||||
|
case PRINTER_CHANNELS:
|
||||||
|
call.callop = PR_CHANNELS;
|
||||||
|
string_start = 1; /* compensate for leading space */
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
errno = EINVAL;
|
||||||
|
*s = NULL;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
/* do the common printer calls */
|
||||||
|
datasize = CALL_SIZE(pr_call_t, 0);
|
||||||
|
prcall.label = *l;
|
||||||
|
prcall.flags = f;
|
||||||
|
if (__call_labeld(&callp, &bufsize, &datasize) == SUCCESS) {
|
||||||
|
if (callp->reterr != 0) {
|
||||||
|
errno = EINVAL;
|
||||||
|
*s = NULL;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
*s = strdup(&prret.buf[string_start]);
|
||||||
|
if (callp != &call) {
|
||||||
|
/* release returned buffer */
|
||||||
|
(void) munmap((void *)callp, bufsize);
|
||||||
|
}
|
||||||
|
if (*s == NULL) {
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
} else {
|
||||||
|
errno = ENOTSUP;
|
||||||
|
*s = NULL;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
#undef prcall
|
||||||
|
#undef prret
|
||||||
|
}
|
|
@ -0,0 +1,432 @@
|
||||||
|
/*
|
||||||
|
* CDDL HEADER START
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the terms of the
|
||||||
|
* Common Development and Distribution License (the "License").
|
||||||
|
* You may not use this file except in compliance with the License.
|
||||||
|
*
|
||||||
|
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
* or http://www.opensolaris.org/os/licensing.
|
||||||
|
* See the License for the specific language governing permissions
|
||||||
|
* and limitations under the License.
|
||||||
|
*
|
||||||
|
* When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
* If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
*
|
||||||
|
* CDDL HEADER END
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <strings.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <sys/tsol/label_macro.h>
|
||||||
|
#include <sys/tsol/label.h>
|
||||||
|
#include <label.h>
|
||||||
|
#include <labeld.h>
|
||||||
|
|
||||||
|
#define IS_LOW(s) \
|
||||||
|
((strncasecmp(s, ADMIN_LOW, (sizeof (ADMIN_LOW) - 1)) == 0) && \
|
||||||
|
(s[sizeof (ADMIN_LOW) - 1] == '\0'))
|
||||||
|
#define IS_HIGH(s) \
|
||||||
|
((strncasecmp(s, ADMIN_HIGH, (sizeof (ADMIN_HIGH) - 1)) == 0) && \
|
||||||
|
(s[sizeof (ADMIN_HIGH) - 1] == '\0'))
|
||||||
|
#define IS_HEX(f, s) \
|
||||||
|
(((((f) == L_NO_CORRECTION)) || ((f) == L_DEFAULT)) && \
|
||||||
|
(((s)[0] == '0') && (((s)[1] == 'x') || ((s)[1] == 'X'))))
|
||||||
|
|
||||||
|
static boolean_t
|
||||||
|
unhex(const char **h, uchar_t *l, int len)
|
||||||
|
{
|
||||||
|
const char *hx = *h;
|
||||||
|
char ch;
|
||||||
|
uchar_t byte;
|
||||||
|
|
||||||
|
for (; len--; ) {
|
||||||
|
ch = *hx++;
|
||||||
|
if (!isxdigit(ch))
|
||||||
|
return (B_FALSE);
|
||||||
|
if (isdigit(ch))
|
||||||
|
byte = ch - '0';
|
||||||
|
else
|
||||||
|
byte = ch - (isupper(ch) ? 'A' - 10 : 'a' - 10);
|
||||||
|
byte <<= 4;
|
||||||
|
ch = *hx++;
|
||||||
|
if (!isxdigit(ch))
|
||||||
|
return (B_FALSE);
|
||||||
|
if (isdigit(ch))
|
||||||
|
byte |= ch - '0';
|
||||||
|
else
|
||||||
|
byte |= ch - (isupper(ch) ? 'A' - 10 : 'a' - 10);
|
||||||
|
*l++ = byte;
|
||||||
|
}
|
||||||
|
*h = hx;
|
||||||
|
return (B_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Formats accepted:
|
||||||
|
* 0x + 4 class + 64 comps + end of string
|
||||||
|
* 0x + 4 class + '-' + ll + '-' + comps + end of string
|
||||||
|
* ll = number of words to fill out the entire comps field
|
||||||
|
* presumes trailing zero for comps
|
||||||
|
*
|
||||||
|
* So in the case of 256 comps (i.e., 8 compartment words):
|
||||||
|
* 0x0006-08-7ff3f
|
||||||
|
* 0x + Classification + Compartments + end of string
|
||||||
|
* 0[xX]hhh...
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int
|
||||||
|
htol(const char *s, m_label_t *l)
|
||||||
|
{
|
||||||
|
const char *h = &s[2]; /* skip 0[xX] */
|
||||||
|
uchar_t *lp = (uchar_t *)&(((_mac_label_impl_t *)l)->_lclass);
|
||||||
|
size_t len = sizeof (_mac_label_impl_t) - 4;
|
||||||
|
int bytes;
|
||||||
|
|
||||||
|
/* unpack 16 bit signed classification */
|
||||||
|
if (!unhex(&h, lp, 2) || (LCLASS(l) < 0)) {
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
lp = (uchar_t *)&(((_mac_label_impl_t *)l)->_comps);
|
||||||
|
if (h[0] == '-' && h[3] == '-') {
|
||||||
|
uchar_t size;
|
||||||
|
|
||||||
|
/* length specified of internal text label */
|
||||||
|
h++; /* skip '-' */
|
||||||
|
if (!unhex(&h, &size, 1)) {
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
/* convert size from words to bytes */
|
||||||
|
if ((size * sizeof (uint32_t)) > len) {
|
||||||
|
/*
|
||||||
|
* internal label greater than will fit in current
|
||||||
|
* binary.
|
||||||
|
*/
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
bzero(lp, len);
|
||||||
|
h++; /* skip '-' */
|
||||||
|
}
|
||||||
|
bytes = strlen(h)/2;
|
||||||
|
if ((bytes > len) ||
|
||||||
|
(bytes*2 != strlen(h)) ||
|
||||||
|
!unhex(&h, lp, bytes)) {
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* hexstr_to_label -- parse a string representing a hex label into a
|
||||||
|
* binary label. Only admin high/low and hex are
|
||||||
|
* accepted.
|
||||||
|
*
|
||||||
|
* Returns 0, success.
|
||||||
|
* -1, failure
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
hexstr_to_label(const char *s, m_label_t *l)
|
||||||
|
{
|
||||||
|
uint_t f = L_DEFAULT;
|
||||||
|
|
||||||
|
/* translate hex, admin_low and admin_high */
|
||||||
|
if (IS_LOW(s)) {
|
||||||
|
_LOW_LABEL(l, SUN_MAC_ID);
|
||||||
|
return (0);
|
||||||
|
} else if (IS_HIGH(s)) {
|
||||||
|
_HIGH_LABEL(l, SUN_MAC_ID);
|
||||||
|
return (0);
|
||||||
|
} else if (IS_HEX(f, s)) {
|
||||||
|
_LOW_LABEL(l, SUN_MAC_ID);
|
||||||
|
if (htol(s, l) == 0)
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
convert_id(m_label_type_t t)
|
||||||
|
{
|
||||||
|
switch (t) {
|
||||||
|
case MAC_LABEL:
|
||||||
|
return (SUN_MAC_ID);
|
||||||
|
case USER_CLEAR:
|
||||||
|
return (SUN_UCLR_ID);
|
||||||
|
default:
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* str_to_label -- parse a string into the requested label type.
|
||||||
|
*
|
||||||
|
* Entry s = string to parse.
|
||||||
|
* l = label to create or modify.
|
||||||
|
* t = label type (MAC_LABEL, USER_CLEAR).
|
||||||
|
* f = flags
|
||||||
|
* L_DEFAULT,
|
||||||
|
* L_MODIFY_EXISTING, use the existing label as a basis for
|
||||||
|
* the parse string.
|
||||||
|
* L_NO_CORRECTION, s must be correct and full by the
|
||||||
|
* label_encoding rules.
|
||||||
|
* L_CHECK_AR, for non-hex s, MAC_LABEL, check the l_e AR
|
||||||
|
*
|
||||||
|
* Exit l = parsed label value.
|
||||||
|
* e = index into string of error.
|
||||||
|
* = M_BAD_STRING (-3 L_BAD_LABEL) or could be zero,
|
||||||
|
* indicates entire string,
|
||||||
|
* e = M_BAD_LABEL (-2 L_BAD_CLASSIFICATION), problems with l
|
||||||
|
* e = M_OUTSIDE_AR (-4 unrelated to L_BAD_* return values)
|
||||||
|
*
|
||||||
|
* Returns 0, success.
|
||||||
|
* -1, failure
|
||||||
|
* errno = ENOTSUP, the underlying label mechanism
|
||||||
|
* does not support label parsing.
|
||||||
|
* ENOMEM, unable to allocate memory for l.
|
||||||
|
* EINVAL, invalid argument, l != NULL or
|
||||||
|
* invalid label type for the underlying
|
||||||
|
* label mechanism.
|
||||||
|
*/
|
||||||
|
#define _M_GOOD_LABEL -1 /* gfi L_GOOD_LABEL */
|
||||||
|
int
|
||||||
|
str_to_label(const char *str, m_label_t **l, const m_label_type_t t, uint_t f,
|
||||||
|
int *e)
|
||||||
|
{
|
||||||
|
char *s = strdup(str);
|
||||||
|
char *st = s;
|
||||||
|
char *p;
|
||||||
|
labeld_data_t call;
|
||||||
|
labeld_data_t *callp = &call;
|
||||||
|
size_t bufsize = sizeof (labeld_data_t);
|
||||||
|
size_t datasize;
|
||||||
|
int err = M_BAD_LABEL;
|
||||||
|
int id = convert_id(t);
|
||||||
|
boolean_t new = B_FALSE;
|
||||||
|
uint_t lf = (f & ~L_CHECK_AR); /* because L_DEFAULT == 0 */
|
||||||
|
|
||||||
|
if (st == NULL) {
|
||||||
|
errno = ENOMEM;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
if (*l == NULL) {
|
||||||
|
if ((*l = m_label_alloc(t)) == NULL) {
|
||||||
|
free(st);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
if (id == -1) {
|
||||||
|
goto badlabel;
|
||||||
|
}
|
||||||
|
_LOW_LABEL(*l, id);
|
||||||
|
new = B_TRUE;
|
||||||
|
} else if (_MTYPE(*l, SUN_INVALID_ID) &&
|
||||||
|
((lf == L_NO_CORRECTION) || (lf == L_DEFAULT))) {
|
||||||
|
_LOW_LABEL(*l, id);
|
||||||
|
new = B_TRUE;
|
||||||
|
} else if (!(_MTYPE(*l, SUN_MAC_ID) || _MTYPE(*l, SUN_CLR_ID))) {
|
||||||
|
goto badlabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (new == B_FALSE && id == -1) {
|
||||||
|
goto badlabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get to the beginning of the string to parse */
|
||||||
|
while (isspace(*s)) {
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* accept a leading '[' and trailing ']' for old times sake */
|
||||||
|
if (*s == '[') {
|
||||||
|
*s = ' ';
|
||||||
|
s++;
|
||||||
|
while (isspace(*s)) {
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p = s;
|
||||||
|
while (*p != '\0' && *p != ']') {
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* strip trailing spaces */
|
||||||
|
while (p != s && isspace(*(p-1))) {
|
||||||
|
--p;
|
||||||
|
}
|
||||||
|
*p = '\0'; /* end of string */
|
||||||
|
|
||||||
|
/* translate hex, admin_low and admin_high */
|
||||||
|
id = _MGETTYPE(*l);
|
||||||
|
if (IS_LOW(s)) {
|
||||||
|
_LOW_LABEL(*l, id);
|
||||||
|
goto goodlabel;
|
||||||
|
} else if (IS_HIGH(s)) {
|
||||||
|
_HIGH_LABEL(*l, id);
|
||||||
|
goto goodlabel;
|
||||||
|
} else if (IS_HEX(lf, s)) {
|
||||||
|
if (htol(s, *l) != 0) {
|
||||||
|
/* whole string in error */
|
||||||
|
err = 0;
|
||||||
|
goto badlabel;
|
||||||
|
}
|
||||||
|
goto goodlabel;
|
||||||
|
}
|
||||||
|
#define slcall callp->param.acall.cargs.sl_arg
|
||||||
|
#define slret callp->param.aret.rvals.sl_ret
|
||||||
|
/* now try label server */
|
||||||
|
|
||||||
|
datasize = CALL_SIZE_STR(sl_call_t, strlen(st) + 1);
|
||||||
|
if (datasize > bufsize) {
|
||||||
|
if ((callp = malloc(datasize)) == NULL) {
|
||||||
|
free(st);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
bufsize = datasize;
|
||||||
|
}
|
||||||
|
callp->callop = STOL;
|
||||||
|
slcall.label = **l;
|
||||||
|
slcall.flags = f;
|
||||||
|
if (new)
|
||||||
|
slcall.flags |= L_NEW_LABEL;
|
||||||
|
(void) strcpy(slcall.string, st);
|
||||||
|
/*
|
||||||
|
* callp->reterr = L_GOOD_LABEL (-1) == OK;
|
||||||
|
* L_BAD_CLASSIFICATION (-2) == bad input
|
||||||
|
* classification: class
|
||||||
|
* L_BAD_LABEL (-3) == either string or input label bad
|
||||||
|
* M_OUTSIDE_AR (-4) == resultant MAC_LABEL is out
|
||||||
|
* l_e accreditation range
|
||||||
|
* O'E == offset in string 0 == entire string.
|
||||||
|
*/
|
||||||
|
if (__call_labeld(&callp, &bufsize, &datasize) == SUCCESS) {
|
||||||
|
|
||||||
|
err = callp->reterr;
|
||||||
|
if (callp != &call) {
|
||||||
|
/* free allocated buffer */
|
||||||
|
free(callp);
|
||||||
|
}
|
||||||
|
switch (err) {
|
||||||
|
case _M_GOOD_LABEL: /* L_GOOD_LABEL */
|
||||||
|
**l = slret.label;
|
||||||
|
goto goodlabel;
|
||||||
|
case M_BAD_LABEL: /* L_BAD_CLASSIFICATION */
|
||||||
|
case M_BAD_STRING: /* L_BAD_LABEL */
|
||||||
|
default:
|
||||||
|
goto badlabel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (callp->reterr) {
|
||||||
|
case NOSERVER:
|
||||||
|
errno = ENOTSUP;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
errno = EINVAL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
free(st);
|
||||||
|
return (-1);
|
||||||
|
|
||||||
|
badlabel:
|
||||||
|
errno = EINVAL;
|
||||||
|
free(st);
|
||||||
|
if (e != NULL)
|
||||||
|
*e = err;
|
||||||
|
return (-1);
|
||||||
|
|
||||||
|
goodlabel:
|
||||||
|
free(st);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
#undef slcall
|
||||||
|
#undef slret
|
||||||
|
|
||||||
|
/*
|
||||||
|
* m_label_alloc -- allocate a label structure
|
||||||
|
*
|
||||||
|
* Entry t = label type (MAC_LABEL, USER_CLEAR).
|
||||||
|
*
|
||||||
|
* Exit If error, NULL, errno set to ENOMEM
|
||||||
|
* Otherwise, pointer to m_label_t memory
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ARGUSED */
|
||||||
|
m_label_t *
|
||||||
|
m_label_alloc(const m_label_type_t t)
|
||||||
|
{
|
||||||
|
m_label_t *l;
|
||||||
|
|
||||||
|
switch (t) {
|
||||||
|
case MAC_LABEL:
|
||||||
|
case USER_CLEAR:
|
||||||
|
if ((l = malloc(sizeof (_mac_label_impl_t))) == NULL) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
_MSETTYPE(l, SUN_INVALID_ID);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
errno = EINVAL;
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
return (l);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* m_label_dup -- make a duplicate copy of the given label.
|
||||||
|
*
|
||||||
|
* Entry l = label to duplicate.
|
||||||
|
*
|
||||||
|
* Exit d = duplicate copy of l.
|
||||||
|
*
|
||||||
|
* Returns 0, success
|
||||||
|
* -1, if error.
|
||||||
|
* errno = ENOTSUP, the underlying label mechanism
|
||||||
|
* does not support label duplication.
|
||||||
|
* ENOMEM, unable to allocate memory for d.
|
||||||
|
* EINVAL, invalid argument, l == NULL or
|
||||||
|
* invalid label type for the underlying
|
||||||
|
* label mechanism.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
m_label_dup(m_label_t **d, const m_label_t *l)
|
||||||
|
{
|
||||||
|
if (d == NULL || *d != NULL) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
if ((*d = malloc(sizeof (_mac_label_impl_t))) == NULL) {
|
||||||
|
errno = ENOMEM;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
(void) memcpy(*d, l, sizeof (_mac_label_impl_t));
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* m_label_free -- free label structure
|
||||||
|
*
|
||||||
|
* Entry l = label to free.
|
||||||
|
*
|
||||||
|
* Exit memory freed.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
m_label_free(m_label_t *l)
|
||||||
|
{
|
||||||
|
if (l)
|
||||||
|
free(l);
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
/*
|
||||||
|
* CDDL HEADER START
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the terms of the
|
||||||
|
* Common Development and Distribution License (the "License").
|
||||||
|
* You may not use this file except in compliance with the License.
|
||||||
|
*
|
||||||
|
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
* or http://www.opensolaris.org/os/licensing.
|
||||||
|
* See the License for the specific language governing permissions
|
||||||
|
* and limitations under the License.
|
||||||
|
*
|
||||||
|
* When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
* If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
*
|
||||||
|
* CDDL HEADER END
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <langinfo.h>
|
||||||
|
#include "statcommon.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Print timestamp as decimal reprentation of time_t value (-T u was specified)
|
||||||
|
* or in date(1) format (-T d was specified).
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
print_timestamp(uint_t timestamp_fmt)
|
||||||
|
{
|
||||||
|
time_t t = time(NULL);
|
||||||
|
static char *fmt = NULL;
|
||||||
|
|
||||||
|
/* We only need to retrieve this once per invocation */
|
||||||
|
if (fmt == NULL)
|
||||||
|
fmt = nl_langinfo(_DATE_FMT);
|
||||||
|
|
||||||
|
if (timestamp_fmt == UDATE) {
|
||||||
|
(void) printf("%ld\n", t);
|
||||||
|
} else if (timestamp_fmt == DDATE) {
|
||||||
|
char dstr[64];
|
||||||
|
int len;
|
||||||
|
|
||||||
|
len = strftime(dstr, sizeof (dstr), fmt, localtime(&t));
|
||||||
|
if (len > 0)
|
||||||
|
(void) printf("%s\n", dstr);
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,6 +20,7 @@ libzfs_la_SOURCES = \
|
||||||
${top_srcdir}/lib/libzfs/libzfs_changelist.c \
|
${top_srcdir}/lib/libzfs/libzfs_changelist.c \
|
||||||
${top_srcdir}/lib/libzfs/libzfs_config.c \
|
${top_srcdir}/lib/libzfs/libzfs_config.c \
|
||||||
${top_srcdir}/lib/libzfs/libzfs_dataset.c \
|
${top_srcdir}/lib/libzfs/libzfs_dataset.c \
|
||||||
|
${top_srcdir}/lib/libzfs/libzfs_fru.c \
|
||||||
${top_srcdir}/lib/libzfs/libzfs_graph.c \
|
${top_srcdir}/lib/libzfs/libzfs_graph.c \
|
||||||
${top_srcdir}/lib/libzfs/libzfs_import.c \
|
${top_srcdir}/lib/libzfs/libzfs_import.c \
|
||||||
${top_srcdir}/lib/libzfs/libzfs_mount.c \
|
${top_srcdir}/lib/libzfs/libzfs_mount.c \
|
||||||
|
|
|
@ -101,7 +101,7 @@ namespace_reload(libzfs_handle_t *hdl)
|
||||||
nvlist_t *config;
|
nvlist_t *config;
|
||||||
config_node_t *cn;
|
config_node_t *cn;
|
||||||
nvpair_t *elem;
|
nvpair_t *elem;
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
void *cookie;
|
void *cookie;
|
||||||
|
|
||||||
if (hdl->libzfs_ns_gen == 0) {
|
if (hdl->libzfs_ns_gen == 0) {
|
||||||
|
@ -226,7 +226,7 @@ zpool_get_config(zpool_handle_t *zhp, nvlist_t **oldconfig)
|
||||||
int
|
int
|
||||||
zpool_refresh_stats(zpool_handle_t *zhp, boolean_t *missing)
|
zpool_refresh_stats(zpool_handle_t *zhp, boolean_t *missing)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
int error;
|
int error;
|
||||||
nvlist_t *config;
|
nvlist_t *config;
|
||||||
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
||||||
|
|
|
@ -308,7 +308,7 @@ get_recvd_props_ioctl(zfs_handle_t *zhp)
|
||||||
{
|
{
|
||||||
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
||||||
nvlist_t *recvdprops;
|
nvlist_t *recvdprops;
|
||||||
zfs_cmd_t zc = { 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (zcmd_alloc_dst_nvlist(hdl, &zc, 0) != 0)
|
if (zcmd_alloc_dst_nvlist(hdl, &zc, 0) != 0)
|
||||||
|
@ -371,7 +371,7 @@ static int
|
||||||
get_stats(zfs_handle_t *zhp)
|
get_stats(zfs_handle_t *zhp)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
|
|
||||||
if (zcmd_alloc_dst_nvlist(zhp->zfs_hdl, &zc, 0) != 0)
|
if (zcmd_alloc_dst_nvlist(zhp->zfs_hdl, &zc, 0) != 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
@ -431,7 +431,7 @@ make_dataset_handle_common(zfs_handle_t *zhp, zfs_cmd_t *zc)
|
||||||
zfs_handle_t *
|
zfs_handle_t *
|
||||||
make_dataset_handle(libzfs_handle_t *hdl, const char *path)
|
make_dataset_handle(libzfs_handle_t *hdl, const char *path)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
|
|
||||||
zfs_handle_t *zhp = calloc(sizeof (zfs_handle_t), 1);
|
zfs_handle_t *zhp = calloc(sizeof (zfs_handle_t), 1);
|
||||||
|
|
||||||
|
@ -1308,7 +1308,7 @@ zfs_setprop_error(libzfs_handle_t *hdl, zfs_prop_t prop, int err,
|
||||||
int
|
int
|
||||||
zfs_prop_set(zfs_handle_t *zhp, const char *propname, const char *propval)
|
zfs_prop_set(zfs_handle_t *zhp, const char *propname, const char *propval)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
prop_changelist_t *cl = NULL;
|
prop_changelist_t *cl = NULL;
|
||||||
char errbuf[1024];
|
char errbuf[1024];
|
||||||
|
@ -1398,7 +1398,7 @@ error:
|
||||||
int
|
int
|
||||||
zfs_prop_inherit(zfs_handle_t *zhp, const char *propname, boolean_t received)
|
zfs_prop_inherit(zfs_handle_t *zhp, const char *propname, boolean_t received)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
int ret;
|
int ret;
|
||||||
prop_changelist_t *cl;
|
prop_changelist_t *cl;
|
||||||
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
||||||
|
@ -1573,7 +1573,7 @@ static int
|
||||||
get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src,
|
get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src,
|
||||||
char **source, uint64_t *val)
|
char **source, uint64_t *val)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
nvlist_t *zplprops = NULL;
|
nvlist_t *zplprops = NULL;
|
||||||
struct mnttab mnt;
|
struct mnttab mnt;
|
||||||
char *mntopt_on = NULL;
|
char *mntopt_on = NULL;
|
||||||
|
@ -2307,7 +2307,7 @@ zfs_prop_get_userquota_common(zfs_handle_t *zhp, const char *propname,
|
||||||
uint64_t *propvalue, zfs_userquota_prop_t *typep)
|
uint64_t *propvalue, zfs_userquota_prop_t *typep)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
|
|
||||||
(void) strncpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
|
(void) strncpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
|
||||||
|
|
||||||
|
@ -2426,7 +2426,7 @@ top:
|
||||||
int
|
int
|
||||||
zfs_iter_filesystems(zfs_handle_t *zhp, zfs_iter_f func, void *data)
|
zfs_iter_filesystems(zfs_handle_t *zhp, zfs_iter_f func, void *data)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
zfs_handle_t *nzhp;
|
zfs_handle_t *nzhp;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -2462,7 +2462,7 @@ zfs_iter_filesystems(zfs_handle_t *zhp, zfs_iter_f func, void *data)
|
||||||
int
|
int
|
||||||
zfs_iter_snapshots(zfs_handle_t *zhp, zfs_iter_f func, void *data)
|
zfs_iter_snapshots(zfs_handle_t *zhp, zfs_iter_f func, void *data)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
zfs_handle_t *nzhp;
|
zfs_handle_t *nzhp;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -2553,7 +2553,7 @@ static int
|
||||||
check_parents(libzfs_handle_t *hdl, const char *path, uint64_t *zoned,
|
check_parents(libzfs_handle_t *hdl, const char *path, uint64_t *zoned,
|
||||||
boolean_t accept_ancestor, int *prefixlen)
|
boolean_t accept_ancestor, int *prefixlen)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
char parent[ZFS_MAXNAMELEN];
|
char parent[ZFS_MAXNAMELEN];
|
||||||
char *slash;
|
char *slash;
|
||||||
zfs_handle_t *zhp;
|
zfs_handle_t *zhp;
|
||||||
|
@ -2763,7 +2763,7 @@ int
|
||||||
zfs_create(libzfs_handle_t *hdl, const char *path, zfs_type_t type,
|
zfs_create(libzfs_handle_t *hdl, const char *path, zfs_type_t type,
|
||||||
nvlist_t *props)
|
nvlist_t *props)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
int ret;
|
int ret;
|
||||||
uint64_t size = 0;
|
uint64_t size = 0;
|
||||||
uint64_t blocksize = zfs_prop_default_numeric(ZFS_PROP_VOLBLOCKSIZE);
|
uint64_t blocksize = zfs_prop_default_numeric(ZFS_PROP_VOLBLOCKSIZE);
|
||||||
|
@ -2914,7 +2914,7 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs_type_t type,
|
||||||
int
|
int
|
||||||
zfs_destroy(zfs_handle_t *zhp, boolean_t defer)
|
zfs_destroy(zfs_handle_t *zhp, boolean_t defer)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
|
|
||||||
(void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
|
(void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
|
||||||
|
|
||||||
|
@ -2975,7 +2975,7 @@ zfs_check_snap_cb(zfs_handle_t *zhp, void *arg)
|
||||||
int
|
int
|
||||||
zfs_destroy_snaps(zfs_handle_t *zhp, char *snapname, boolean_t defer)
|
zfs_destroy_snaps(zfs_handle_t *zhp, char *snapname, boolean_t defer)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
int ret;
|
int ret;
|
||||||
struct destroydata dd = { 0 };
|
struct destroydata dd = { 0 };
|
||||||
|
|
||||||
|
@ -3020,7 +3020,7 @@ zfs_destroy_snaps(zfs_handle_t *zhp, char *snapname, boolean_t defer)
|
||||||
int
|
int
|
||||||
zfs_clone(zfs_handle_t *zhp, const char *target, nvlist_t *props)
|
zfs_clone(zfs_handle_t *zhp, const char *target, nvlist_t *props)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
char parent[ZFS_MAXNAMELEN];
|
char parent[ZFS_MAXNAMELEN];
|
||||||
int ret;
|
int ret;
|
||||||
char errbuf[1024];
|
char errbuf[1024];
|
||||||
|
@ -3110,7 +3110,7 @@ int
|
||||||
zfs_promote(zfs_handle_t *zhp)
|
zfs_promote(zfs_handle_t *zhp)
|
||||||
{
|
{
|
||||||
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
char parent[MAXPATHLEN];
|
char parent[MAXPATHLEN];
|
||||||
int ret;
|
int ret;
|
||||||
char errbuf[1024];
|
char errbuf[1024];
|
||||||
|
@ -3164,7 +3164,7 @@ zfs_snapshot(libzfs_handle_t *hdl, const char *path, boolean_t recursive,
|
||||||
const char *delim;
|
const char *delim;
|
||||||
char parent[ZFS_MAXNAMELEN];
|
char parent[ZFS_MAXNAMELEN];
|
||||||
zfs_handle_t *zhp;
|
zfs_handle_t *zhp;
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
int ret;
|
int ret;
|
||||||
char errbuf[1024];
|
char errbuf[1024];
|
||||||
|
|
||||||
|
@ -3296,7 +3296,7 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, boolean_t force)
|
||||||
{
|
{
|
||||||
rollback_data_t cb = { 0 };
|
rollback_data_t cb = { 0 };
|
||||||
int err;
|
int err;
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
boolean_t restore_resv = 0;
|
boolean_t restore_resv = 0;
|
||||||
uint64_t old_volsize = 0, new_volsize;
|
uint64_t old_volsize = 0, new_volsize;
|
||||||
zfs_prop_t resv_prop = { 0 };
|
zfs_prop_t resv_prop = { 0 };
|
||||||
|
@ -3412,7 +3412,7 @@ int
|
||||||
zfs_rename(zfs_handle_t *zhp, const char *target, boolean_t recursive)
|
zfs_rename(zfs_handle_t *zhp, const char *target, boolean_t recursive)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
char *delim;
|
char *delim;
|
||||||
prop_changelist_t *cl = NULL;
|
prop_changelist_t *cl = NULL;
|
||||||
zfs_handle_t *zhrp = NULL;
|
zfs_handle_t *zhrp = NULL;
|
||||||
|
@ -3720,7 +3720,7 @@ zfs_deleg_share_nfs(libzfs_handle_t *hdl, char *dataset, char *path,
|
||||||
char *resource, void *export, void *sharetab,
|
char *resource, void *export, void *sharetab,
|
||||||
int sharemax, zfs_share_op_t operation)
|
int sharemax, zfs_share_op_t operation)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
(void) strlcpy(zc.zc_name, dataset, sizeof (zc.zc_name));
|
(void) strlcpy(zc.zc_name, dataset, sizeof (zc.zc_name));
|
||||||
|
@ -3771,7 +3771,7 @@ static int
|
||||||
zfs_smb_acl_mgmt(libzfs_handle_t *hdl, char *dataset, char *path,
|
zfs_smb_acl_mgmt(libzfs_handle_t *hdl, char *dataset, char *path,
|
||||||
zfs_smb_acl_op_t cmd, char *resource1, char *resource2)
|
zfs_smb_acl_op_t cmd, char *resource1, char *resource2)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
nvlist_t *nvlist = NULL;
|
nvlist_t *nvlist = NULL;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
@ -3853,7 +3853,7 @@ int
|
||||||
zfs_userspace(zfs_handle_t *zhp, zfs_userquota_prop_t type,
|
zfs_userspace(zfs_handle_t *zhp, zfs_userquota_prop_t type,
|
||||||
zfs_userspace_cb_t func, void *arg)
|
zfs_userspace_cb_t func, void *arg)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
int error;
|
int error;
|
||||||
zfs_useracct_t buf[100];
|
zfs_useracct_t buf[100];
|
||||||
|
|
||||||
|
@ -3889,7 +3889,7 @@ int
|
||||||
zfs_hold(zfs_handle_t *zhp, const char *snapname, const char *tag,
|
zfs_hold(zfs_handle_t *zhp, const char *snapname, const char *tag,
|
||||||
boolean_t recursive, boolean_t temphold, boolean_t enoent_ok)
|
boolean_t recursive, boolean_t temphold, boolean_t enoent_ok)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
||||||
|
|
||||||
(void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
|
(void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
|
||||||
|
@ -4038,7 +4038,7 @@ int
|
||||||
zfs_release(zfs_handle_t *zhp, const char *snapname, const char *tag,
|
zfs_release(zfs_handle_t *zhp, const char *snapname, const char *tag,
|
||||||
boolean_t recursive)
|
boolean_t recursive)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
||||||
|
|
||||||
(void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
|
(void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
|
||||||
|
|
|
@ -379,7 +379,7 @@ zfs_graph_add(libzfs_handle_t *hdl, zfs_graph_t *zgp, const char *source,
|
||||||
static int
|
static int
|
||||||
iterate_children(libzfs_handle_t *hdl, zfs_graph_t *zgp, const char *dataset)
|
iterate_children(libzfs_handle_t *hdl, zfs_graph_t *zgp, const char *dataset)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
zfs_vertex_t *zvp;
|
zfs_vertex_t *zvp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -473,7 +473,7 @@ iterate_children(libzfs_handle_t *hdl, zfs_graph_t *zgp, const char *dataset)
|
||||||
static boolean_t
|
static boolean_t
|
||||||
external_dependents(libzfs_handle_t *hdl, zfs_graph_t *zgp, const char *dataset)
|
external_dependents(libzfs_handle_t *hdl, zfs_graph_t *zgp, const char *dataset)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check whether this dataset is a clone or has clones since
|
* Check whether this dataset is a clone or has clones since
|
||||||
|
|
|
@ -374,7 +374,7 @@ static nvlist_t *
|
||||||
refresh_config(libzfs_handle_t *hdl, nvlist_t *config)
|
refresh_config(libzfs_handle_t *hdl, nvlist_t *config)
|
||||||
{
|
{
|
||||||
nvlist_t *nvl;
|
nvlist_t *nvl;
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (zcmd_write_conf_nvlist(hdl, &zc, config) != 0)
|
if (zcmd_write_conf_nvlist(hdl, &zc, config) != 0)
|
||||||
|
|
|
@ -61,7 +61,7 @@ static int read_efi_label(nvlist_t *config, diskaddr_t *sb);
|
||||||
static int
|
static int
|
||||||
zpool_get_all_props(zpool_handle_t *zhp)
|
zpool_get_all_props(zpool_handle_t *zhp)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
||||||
|
|
||||||
(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
|
(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
|
||||||
|
@ -558,7 +558,7 @@ error:
|
||||||
int
|
int
|
||||||
zpool_set_prop(zpool_handle_t *zhp, const char *propname, const char *propval)
|
zpool_set_prop(zpool_handle_t *zhp, const char *propname, const char *propval)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
char errbuf[1024];
|
char errbuf[1024];
|
||||||
nvlist_t *nvl = NULL;
|
nvlist_t *nvl = NULL;
|
||||||
|
@ -875,7 +875,7 @@ int
|
||||||
zpool_create(libzfs_handle_t *hdl, const char *pool, nvlist_t *nvroot,
|
zpool_create(libzfs_handle_t *hdl, const char *pool, nvlist_t *nvroot,
|
||||||
nvlist_t *props, nvlist_t *fsprops)
|
nvlist_t *props, nvlist_t *fsprops)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
nvlist_t *zc_fsprops = NULL;
|
nvlist_t *zc_fsprops = NULL;
|
||||||
nvlist_t *zc_props = NULL;
|
nvlist_t *zc_props = NULL;
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
|
@ -1007,7 +1007,7 @@ create_failed:
|
||||||
int
|
int
|
||||||
zpool_destroy(zpool_handle_t *zhp)
|
zpool_destroy(zpool_handle_t *zhp)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
zfs_handle_t *zfp = NULL;
|
zfs_handle_t *zfp = NULL;
|
||||||
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
|
@ -1051,7 +1051,7 @@ zpool_destroy(zpool_handle_t *zhp)
|
||||||
int
|
int
|
||||||
zpool_add(zpool_handle_t *zhp, nvlist_t *nvroot)
|
zpool_add(zpool_handle_t *zhp, nvlist_t *nvroot)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
int ret;
|
int ret;
|
||||||
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
|
@ -1175,7 +1175,7 @@ zpool_add(zpool_handle_t *zhp, nvlist_t *nvroot)
|
||||||
int
|
int
|
||||||
zpool_export_common(zpool_handle_t *zhp, boolean_t force, boolean_t hardforce)
|
zpool_export_common(zpool_handle_t *zhp, boolean_t force, boolean_t hardforce)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
|
|
||||||
(void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN,
|
(void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN,
|
||||||
|
@ -1388,7 +1388,7 @@ int
|
||||||
zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
|
zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
|
||||||
nvlist_t *props, boolean_t importfaulted)
|
nvlist_t *props, boolean_t importfaulted)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
zpool_rewind_policy_t policy;
|
zpool_rewind_policy_t policy;
|
||||||
nvlist_t *nvi = NULL;
|
nvlist_t *nvi = NULL;
|
||||||
char *thename;
|
char *thename;
|
||||||
|
@ -1532,7 +1532,7 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
|
||||||
int
|
int
|
||||||
zpool_scan(zpool_handle_t *zhp, pool_scan_func_t func)
|
zpool_scan(zpool_handle_t *zhp, pool_scan_func_t func)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
||||||
|
|
||||||
|
@ -2074,7 +2074,7 @@ int
|
||||||
zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags,
|
zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags,
|
||||||
vdev_state_t *newstate)
|
vdev_state_t *newstate)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
nvlist_t *tgt;
|
nvlist_t *tgt;
|
||||||
boolean_t avail_spare, l2cache, islog;
|
boolean_t avail_spare, l2cache, islog;
|
||||||
|
@ -2145,7 +2145,7 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags,
|
||||||
int
|
int
|
||||||
zpool_vdev_offline(zpool_handle_t *zhp, const char *path, boolean_t istmp)
|
zpool_vdev_offline(zpool_handle_t *zhp, const char *path, boolean_t istmp)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
nvlist_t *tgt;
|
nvlist_t *tgt;
|
||||||
boolean_t avail_spare, l2cache;
|
boolean_t avail_spare, l2cache;
|
||||||
|
@ -2195,7 +2195,7 @@ zpool_vdev_offline(zpool_handle_t *zhp, const char *path, boolean_t istmp)
|
||||||
int
|
int
|
||||||
zpool_vdev_fault(zpool_handle_t *zhp, uint64_t guid, vdev_aux_t aux)
|
zpool_vdev_fault(zpool_handle_t *zhp, uint64_t guid, vdev_aux_t aux)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
||||||
|
|
||||||
|
@ -2230,7 +2230,7 @@ zpool_vdev_fault(zpool_handle_t *zhp, uint64_t guid, vdev_aux_t aux)
|
||||||
int
|
int
|
||||||
zpool_vdev_degrade(zpool_handle_t *zhp, uint64_t guid, vdev_aux_t aux)
|
zpool_vdev_degrade(zpool_handle_t *zhp, uint64_t guid, vdev_aux_t aux)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
||||||
|
|
||||||
|
@ -2284,7 +2284,7 @@ int
|
||||||
zpool_vdev_attach(zpool_handle_t *zhp,
|
zpool_vdev_attach(zpool_handle_t *zhp,
|
||||||
const char *old_disk, const char *new_disk, nvlist_t *nvroot, int replacing)
|
const char *old_disk, const char *new_disk, nvlist_t *nvroot, int replacing)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
int ret;
|
int ret;
|
||||||
nvlist_t *tgt;
|
nvlist_t *tgt;
|
||||||
|
@ -2475,7 +2475,7 @@ zpool_vdev_attach(zpool_handle_t *zhp,
|
||||||
int
|
int
|
||||||
zpool_vdev_detach(zpool_handle_t *zhp, const char *path)
|
zpool_vdev_detach(zpool_handle_t *zhp, const char *path)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
nvlist_t *tgt;
|
nvlist_t *tgt;
|
||||||
boolean_t avail_spare, l2cache;
|
boolean_t avail_spare, l2cache;
|
||||||
|
@ -2573,7 +2573,7 @@ int
|
||||||
zpool_vdev_split(zpool_handle_t *zhp, char *newname, nvlist_t **newroot,
|
zpool_vdev_split(zpool_handle_t *zhp, char *newname, nvlist_t **newroot,
|
||||||
nvlist_t *props, splitflags_t flags)
|
nvlist_t *props, splitflags_t flags)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
nvlist_t *tree, *config, **child, **newchild, *newconfig = NULL;
|
nvlist_t *tree, *config, **child, **newchild, *newconfig = NULL;
|
||||||
nvlist_t **varray = NULL, *zc_props = NULL;
|
nvlist_t **varray = NULL, *zc_props = NULL;
|
||||||
|
@ -2783,7 +2783,7 @@ out:
|
||||||
int
|
int
|
||||||
zpool_vdev_remove(zpool_handle_t *zhp, const char *path)
|
zpool_vdev_remove(zpool_handle_t *zhp, const char *path)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
nvlist_t *tgt;
|
nvlist_t *tgt;
|
||||||
boolean_t avail_spare, l2cache, islog;
|
boolean_t avail_spare, l2cache, islog;
|
||||||
|
@ -2828,7 +2828,7 @@ zpool_vdev_remove(zpool_handle_t *zhp, const char *path)
|
||||||
int
|
int
|
||||||
zpool_clear(zpool_handle_t *zhp, const char *path, nvlist_t *rewindnvl)
|
zpool_clear(zpool_handle_t *zhp, const char *path, nvlist_t *rewindnvl)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
nvlist_t *tgt;
|
nvlist_t *tgt;
|
||||||
zpool_rewind_policy_t policy;
|
zpool_rewind_policy_t policy;
|
||||||
|
@ -2896,7 +2896,7 @@ zpool_clear(zpool_handle_t *zhp, const char *path, nvlist_t *rewindnvl)
|
||||||
int
|
int
|
||||||
zpool_vdev_clear(zpool_handle_t *zhp, uint64_t guid)
|
zpool_vdev_clear(zpool_handle_t *zhp, uint64_t guid)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
||||||
|
|
||||||
|
@ -2980,7 +2980,7 @@ path_to_devid(const char *path)
|
||||||
static void
|
static void
|
||||||
set_path(zpool_handle_t *zhp, nvlist_t *nv, const char *path)
|
set_path(zpool_handle_t *zhp, nvlist_t *nv, const char *path)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
|
|
||||||
(void) strncpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
|
(void) strncpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
|
||||||
(void) strncpy(zc.zc_value, path, sizeof (zc.zc_value));
|
(void) strncpy(zc.zc_value, path, sizeof (zc.zc_value));
|
||||||
|
@ -3141,7 +3141,7 @@ zbookmark_compare(const void *a, const void *b)
|
||||||
int
|
int
|
||||||
zpool_get_errlog(zpool_handle_t *zhp, nvlist_t **nverrlistp)
|
zpool_get_errlog(zpool_handle_t *zhp, nvlist_t **nverrlistp)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
uint64_t count;
|
uint64_t count;
|
||||||
zbookmark_t *zb = NULL;
|
zbookmark_t *zb = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
@ -3237,7 +3237,7 @@ nomem:
|
||||||
int
|
int
|
||||||
zpool_upgrade(zpool_handle_t *zhp, uint64_t new_version)
|
zpool_upgrade(zpool_handle_t *zhp, uint64_t new_version)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
||||||
|
|
||||||
(void) strcpy(zc.zc_name, zhp->zpool_name);
|
(void) strcpy(zc.zc_name, zhp->zpool_name);
|
||||||
|
@ -3299,7 +3299,7 @@ zpool_stage_history(libzfs_handle_t *hdl, const char *history_str)
|
||||||
static int
|
static int
|
||||||
get_history(zpool_handle_t *zhp, char *buf, uint64_t *off, uint64_t *len)
|
get_history(zpool_handle_t *zhp, char *buf, uint64_t *off, uint64_t *len)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
||||||
|
|
||||||
(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
|
(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
|
||||||
|
@ -3512,7 +3512,7 @@ void
|
||||||
zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj,
|
zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj,
|
||||||
char *pathname, size_t len)
|
char *pathname, size_t len)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
boolean_t mounted = B_FALSE;
|
boolean_t mounted = B_FALSE;
|
||||||
char *mntpnt = NULL;
|
char *mntpnt = NULL;
|
||||||
char dsname[MAXNAMELEN];
|
char dsname[MAXNAMELEN];
|
||||||
|
|
|
@ -58,7 +58,7 @@ extern void zfs_setprop_error(libzfs_handle_t *, zfs_prop_t, int, char *);
|
||||||
static int zfs_receive_impl(libzfs_handle_t *, const char *, recvflags_t,
|
static int zfs_receive_impl(libzfs_handle_t *, const char *, recvflags_t,
|
||||||
int, const char *, nvlist_t *, avl_tree_t *, char **);
|
int, const char *, nvlist_t *, avl_tree_t *, char **);
|
||||||
|
|
||||||
static const zio_cksum_t zero_cksum = { 0 };
|
static const zio_cksum_t zero_cksum = { { 0 } };
|
||||||
|
|
||||||
typedef struct dedup_arg {
|
typedef struct dedup_arg {
|
||||||
int inputfd;
|
int inputfd;
|
||||||
|
@ -868,7 +868,7 @@ static int
|
||||||
dump_ioctl(zfs_handle_t *zhp, const char *fromsnap, boolean_t fromorigin,
|
dump_ioctl(zfs_handle_t *zhp, const char *fromsnap, boolean_t fromorigin,
|
||||||
int outfd, boolean_t enoent_ok, boolean_t *got_enoent, nvlist_t *debugnv)
|
int outfd, boolean_t enoent_ok, boolean_t *got_enoent, nvlist_t *debugnv)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
||||||
nvlist_t *thisdbg;
|
nvlist_t *thisdbg;
|
||||||
|
|
||||||
|
@ -1040,7 +1040,7 @@ dump_filesystem(zfs_handle_t *zhp, void *arg)
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
send_dump_data_t *sdd = arg;
|
send_dump_data_t *sdd = arg;
|
||||||
boolean_t missingfrom = B_FALSE;
|
boolean_t missingfrom = B_FALSE;
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
|
|
||||||
(void) snprintf(zc.zc_name, sizeof (zc.zc_name), "%s@%s",
|
(void) snprintf(zc.zc_name, sizeof (zc.zc_name), "%s@%s",
|
||||||
zhp->zfs_name, sdd->tosnap);
|
zhp->zfs_name, sdd->tosnap);
|
||||||
|
@ -1486,7 +1486,7 @@ recv_rename(libzfs_handle_t *hdl, const char *name, const char *tryname,
|
||||||
int baselen, char *newname, recvflags_t flags)
|
int baselen, char *newname, recvflags_t flags)
|
||||||
{
|
{
|
||||||
static int seq;
|
static int seq;
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
int err;
|
int err;
|
||||||
prop_changelist_t *clp;
|
prop_changelist_t *clp;
|
||||||
zfs_handle_t *zhp;
|
zfs_handle_t *zhp;
|
||||||
|
@ -1559,7 +1559,7 @@ static int
|
||||||
recv_destroy(libzfs_handle_t *hdl, const char *name, int baselen,
|
recv_destroy(libzfs_handle_t *hdl, const char *name, int baselen,
|
||||||
char *newname, recvflags_t flags)
|
char *newname, recvflags_t flags)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
int err = 0;
|
int err = 0;
|
||||||
prop_changelist_t *clp;
|
prop_changelist_t *clp;
|
||||||
zfs_handle_t *zhp;
|
zfs_handle_t *zhp;
|
||||||
|
@ -1787,7 +1787,7 @@ again:
|
||||||
stream_originguid, originguid)) {
|
stream_originguid, originguid)) {
|
||||||
case 1: {
|
case 1: {
|
||||||
/* promote it! */
|
/* promote it! */
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
nvlist_t *origin_nvfs;
|
nvlist_t *origin_nvfs;
|
||||||
char *origin_fsname;
|
char *origin_fsname;
|
||||||
|
|
||||||
|
@ -1859,7 +1859,7 @@ again:
|
||||||
if (0 == nvlist_lookup_nvlist(stream_nvfs, "snapprops",
|
if (0 == nvlist_lookup_nvlist(stream_nvfs, "snapprops",
|
||||||
&props) && 0 == nvlist_lookup_nvlist(props,
|
&props) && 0 == nvlist_lookup_nvlist(props,
|
||||||
stream_snapname, &props)) {
|
stream_snapname, &props)) {
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
|
|
||||||
zc.zc_cookie = B_TRUE; /* received */
|
zc.zc_cookie = B_TRUE; /* received */
|
||||||
(void) snprintf(zc.zc_name, sizeof (zc.zc_name),
|
(void) snprintf(zc.zc_name, sizeof (zc.zc_name),
|
||||||
|
@ -2288,7 +2288,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
|
||||||
dmu_replay_record_t *drr_noswap, const char *sendfs,
|
dmu_replay_record_t *drr_noswap, const char *sendfs,
|
||||||
nvlist_t *stream_nv, avl_tree_t *stream_avl, char **top_zfs)
|
nvlist_t *stream_nv, avl_tree_t *stream_avl, char **top_zfs)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
|
||||||
time_t begin_time;
|
time_t begin_time;
|
||||||
int ioctl_err, ioctl_errno, err;
|
int ioctl_err, ioctl_errno, err;
|
||||||
char *cp;
|
char *cp;
|
||||||
|
@ -2654,7 +2654,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
|
||||||
zcmd_free_nvlists(&zc);
|
zcmd_free_nvlists(&zc);
|
||||||
|
|
||||||
if (err == 0 && snapprops_nvlist) {
|
if (err == 0 && snapprops_nvlist) {
|
||||||
zfs_cmd_t zc2 = { "\0", "\0", "\0", 0 };
|
zfs_cmd_t zc2 = { "\0", "\0", "\0", "\0", 0 };
|
||||||
|
|
||||||
(void) strcpy(zc2.zc_name, zc.zc_value);
|
(void) strcpy(zc2.zc_name, zc.zc_value);
|
||||||
zc2.zc_cookie = B_TRUE; /* received */
|
zc2.zc_cookie = B_TRUE; /* received */
|
||||||
|
|
|
@ -19,6 +19,7 @@ libzpool_la_SOURCES = \
|
||||||
${top_srcdir}/lib/libzpool/util.c \
|
${top_srcdir}/lib/libzpool/util.c \
|
||||||
${top_srcdir}/module/zcommon/zfs_comutil.c \
|
${top_srcdir}/module/zcommon/zfs_comutil.c \
|
||||||
${top_srcdir}/module/zcommon/zfs_deleg.c \
|
${top_srcdir}/module/zcommon/zfs_deleg.c \
|
||||||
|
${top_srcdir}/module/zcommon/zfs_fletcher.c \
|
||||||
${top_srcdir}/module/zcommon/zfs_namecheck.c \
|
${top_srcdir}/module/zcommon/zfs_namecheck.c \
|
||||||
${top_srcdir}/module/zcommon/zfs_prop.c \
|
${top_srcdir}/module/zcommon/zfs_prop.c \
|
||||||
${top_srcdir}/module/zcommon/zpool_prop.c \
|
${top_srcdir}/module/zcommon/zpool_prop.c \
|
||||||
|
@ -27,11 +28,15 @@ libzpool_la_SOURCES = \
|
||||||
${top_srcdir}/module/zcommon/include/sys/fs/zfs.h \
|
${top_srcdir}/module/zcommon/include/sys/fs/zfs.h \
|
||||||
${top_srcdir}/module/zcommon/include/zfs_comutil.h \
|
${top_srcdir}/module/zcommon/include/zfs_comutil.h \
|
||||||
${top_srcdir}/module/zcommon/include/zfs_deleg.h \
|
${top_srcdir}/module/zcommon/include/zfs_deleg.h \
|
||||||
|
${top_srcdir}/module/zcommon/include/zfs_fletcher.h \
|
||||||
${top_srcdir}/module/zcommon/include/zfs_namecheck.h \
|
${top_srcdir}/module/zcommon/include/zfs_namecheck.h \
|
||||||
${top_srcdir}/module/zcommon/include/zfs_prop.h \
|
${top_srcdir}/module/zcommon/include/zfs_prop.h \
|
||||||
${top_srcdir}/module/zfs/arc.c \
|
${top_srcdir}/module/zfs/arc.c \
|
||||||
${top_srcdir}/module/zfs/bplist.c \
|
${top_srcdir}/module/zfs/bplist.c \
|
||||||
|
${top_srcdir}/module/zfs/bpobj.c \
|
||||||
${top_srcdir}/module/zfs/dbuf.c \
|
${top_srcdir}/module/zfs/dbuf.c \
|
||||||
|
${top_srcdir}/module/zfs/ddt.c \
|
||||||
|
${top_srcdir}/module/zfs/ddt_zap.c \
|
||||||
${top_srcdir}/module/zfs/dmu.c \
|
${top_srcdir}/module/zfs/dmu.c \
|
||||||
${top_srcdir}/module/zfs/dmu_object.c \
|
${top_srcdir}/module/zfs/dmu_object.c \
|
||||||
${top_srcdir}/module/zfs/dmu_objset.c \
|
${top_srcdir}/module/zfs/dmu_objset.c \
|
||||||
|
@ -42,18 +47,20 @@ libzpool_la_SOURCES = \
|
||||||
${top_srcdir}/module/zfs/dnode.c \
|
${top_srcdir}/module/zfs/dnode.c \
|
||||||
${top_srcdir}/module/zfs/dnode_sync.c \
|
${top_srcdir}/module/zfs/dnode_sync.c \
|
||||||
${top_srcdir}/module/zfs/dsl_dataset.c \
|
${top_srcdir}/module/zfs/dsl_dataset.c \
|
||||||
|
${top_srcdir}/module/zfs/dsl_deadlist.c \
|
||||||
${top_srcdir}/module/zfs/dsl_deleg.c \
|
${top_srcdir}/module/zfs/dsl_deleg.c \
|
||||||
${top_srcdir}/module/zfs/dsl_dir.c \
|
${top_srcdir}/module/zfs/dsl_dir.c \
|
||||||
${top_srcdir}/module/zfs/dsl_pool.c \
|
${top_srcdir}/module/zfs/dsl_pool.c \
|
||||||
${top_srcdir}/module/zfs/dsl_prop.c \
|
${top_srcdir}/module/zfs/dsl_prop.c \
|
||||||
${top_srcdir}/module/zfs/dsl_scrub.c \
|
${top_srcdir}/module/zfs/dsl_scan.c \
|
||||||
${top_srcdir}/module/zfs/dsl_synctask.c \
|
${top_srcdir}/module/zfs/dsl_synctask.c \
|
||||||
${top_srcdir}/module/zfs/fletcher.c \
|
|
||||||
${top_srcdir}/module/zfs/fm.c \
|
${top_srcdir}/module/zfs/fm.c \
|
||||||
${top_srcdir}/module/zfs/gzip.c \
|
${top_srcdir}/module/zfs/gzip.c \
|
||||||
${top_srcdir}/module/zfs/lzjb.c \
|
${top_srcdir}/module/zfs/lzjb.c \
|
||||||
${top_srcdir}/module/zfs/metaslab.c \
|
${top_srcdir}/module/zfs/metaslab.c \
|
||||||
${top_srcdir}/module/zfs/refcount.c \
|
${top_srcdir}/module/zfs/refcount.c \
|
||||||
|
${top_srcdir}/module/zfs/rrwlock.c \
|
||||||
|
${top_srcdir}/module/zfs/sa.c \
|
||||||
${top_srcdir}/module/zfs/sha256.c \
|
${top_srcdir}/module/zfs/sha256.c \
|
||||||
${top_srcdir}/module/zfs/spa.c \
|
${top_srcdir}/module/zfs/spa.c \
|
||||||
${top_srcdir}/module/zfs/spa_boot.c \
|
${top_srcdir}/module/zfs/spa_boot.c \
|
||||||
|
@ -69,8 +76,8 @@ libzpool_la_SOURCES = \
|
||||||
${top_srcdir}/module/zfs/vdev_cache.c \
|
${top_srcdir}/module/zfs/vdev_cache.c \
|
||||||
${top_srcdir}/module/zfs/vdev_file.c \
|
${top_srcdir}/module/zfs/vdev_file.c \
|
||||||
${top_srcdir}/module/zfs/vdev_label.c \
|
${top_srcdir}/module/zfs/vdev_label.c \
|
||||||
${top_srcdir}/module/zfs/vdev_missing.c \
|
|
||||||
${top_srcdir}/module/zfs/vdev_mirror.c \
|
${top_srcdir}/module/zfs/vdev_mirror.c \
|
||||||
|
${top_srcdir}/module/zfs/vdev_missing.c \
|
||||||
${top_srcdir}/module/zfs/vdev_queue.c \
|
${top_srcdir}/module/zfs/vdev_queue.c \
|
||||||
${top_srcdir}/module/zfs/vdev_raidz.c \
|
${top_srcdir}/module/zfs/vdev_raidz.c \
|
||||||
${top_srcdir}/module/zfs/vdev_root.c \
|
${top_srcdir}/module/zfs/vdev_root.c \
|
||||||
|
@ -78,14 +85,17 @@ libzpool_la_SOURCES = \
|
||||||
${top_srcdir}/module/zfs/zap_leaf.c \
|
${top_srcdir}/module/zfs/zap_leaf.c \
|
||||||
${top_srcdir}/module/zfs/zap_micro.c \
|
${top_srcdir}/module/zfs/zap_micro.c \
|
||||||
${top_srcdir}/module/zfs/zfs_byteswap.c \
|
${top_srcdir}/module/zfs/zfs_byteswap.c \
|
||||||
|
${top_srcdir}/module/zfs/zfs_debug.c \
|
||||||
${top_srcdir}/module/zfs/zfs_fm.c \
|
${top_srcdir}/module/zfs/zfs_fm.c \
|
||||||
${top_srcdir}/module/zfs/zfs_fuid.c \
|
${top_srcdir}/module/zfs/zfs_fuid.c \
|
||||||
|
${top_srcdir}/module/zfs/zfs_sa.c \
|
||||||
${top_srcdir}/module/zfs/zfs_znode.c \
|
${top_srcdir}/module/zfs/zfs_znode.c \
|
||||||
${top_srcdir}/module/zfs/zil.c \
|
${top_srcdir}/module/zfs/zil.c \
|
||||||
${top_srcdir}/module/zfs/zio.c \
|
${top_srcdir}/module/zfs/zio.c \
|
||||||
${top_srcdir}/module/zfs/zio_checksum.c \
|
${top_srcdir}/module/zfs/zio_checksum.c \
|
||||||
${top_srcdir}/module/zfs/zio_compress.c \
|
${top_srcdir}/module/zfs/zio_compress.c \
|
||||||
${top_srcdir}/module/zfs/zio_inject.c \
|
${top_srcdir}/module/zfs/zio_inject.c \
|
||||||
|
${top_srcdir}/module/zfs/zle.c \
|
||||||
${top_srcdir}/module/zfs/include/sys/arc.h \
|
${top_srcdir}/module/zfs/include/sys/arc.h \
|
||||||
${top_srcdir}/module/zfs/include/sys/bplist.h \
|
${top_srcdir}/module/zfs/include/sys/bplist.h \
|
||||||
${top_srcdir}/module/zfs/include/sys/dbuf.h \
|
${top_srcdir}/module/zfs/include/sys/dbuf.h \
|
||||||
|
|
|
@ -14,4 +14,5 @@ ${MODULE}-objs += zfs_prop.o
|
||||||
${MODULE}-objs += zprop_common.o
|
${MODULE}-objs += zprop_common.o
|
||||||
${MODULE}-objs += zfs_namecheck.o
|
${MODULE}-objs += zfs_namecheck.o
|
||||||
${MODULE}-objs += zfs_comutil.o
|
${MODULE}-objs += zfs_comutil.o
|
||||||
|
${MODULE}-objs += zfs_fletcher.o
|
||||||
${MODULE}-objs += zpool_prop.o
|
${MODULE}-objs += zpool_prop.o
|
||||||
|
|
|
@ -11,7 +11,10 @@ obj-m := ${MODULE}.o
|
||||||
|
|
||||||
${MODULE}-objs += arc.o
|
${MODULE}-objs += arc.o
|
||||||
${MODULE}-objs += bplist.o
|
${MODULE}-objs += bplist.o
|
||||||
|
${MODULE}-objs += bpobj.o
|
||||||
${MODULE}-objs += dbuf.o
|
${MODULE}-objs += dbuf.o
|
||||||
|
${MODULE}-objs += ddt.o
|
||||||
|
${MODULE}-objs += ddt_zap.o
|
||||||
${MODULE}-objs += dmu.o
|
${MODULE}-objs += dmu.o
|
||||||
${MODULE}-objs += dmu_object.o
|
${MODULE}-objs += dmu_object.o
|
||||||
${MODULE}-objs += dmu_objset.o
|
${MODULE}-objs += dmu_objset.o
|
||||||
|
@ -22,19 +25,20 @@ ${MODULE}-objs += dmu_zfetch.o
|
||||||
${MODULE}-objs += dnode.o
|
${MODULE}-objs += dnode.o
|
||||||
${MODULE}-objs += dnode_sync.o
|
${MODULE}-objs += dnode_sync.o
|
||||||
${MODULE}-objs += dsl_dataset.o
|
${MODULE}-objs += dsl_dataset.o
|
||||||
|
${MODULE}-objs += dsl_deadlist.o
|
||||||
${MODULE}-objs += dsl_deleg.o
|
${MODULE}-objs += dsl_deleg.o
|
||||||
${MODULE}-objs += dsl_dir.o
|
${MODULE}-objs += dsl_dir.o
|
||||||
${MODULE}-objs += dsl_pool.o
|
${MODULE}-objs += dsl_pool.o
|
||||||
${MODULE}-objs += dsl_prop.o
|
${MODULE}-objs += dsl_prop.o
|
||||||
${MODULE}-objs += dsl_scrub.o
|
${MODULE}-objs += dsl_scan.o
|
||||||
${MODULE}-objs += dsl_synctask.o
|
${MODULE}-objs += dsl_synctask.o
|
||||||
${MODULE}-objs += fletcher.o
|
|
||||||
${MODULE}-objs += fm.o
|
${MODULE}-objs += fm.o
|
||||||
${MODULE}-objs += gzip.o
|
${MODULE}-objs += gzip.o
|
||||||
${MODULE}-objs += lzjb.o
|
${MODULE}-objs += lzjb.o
|
||||||
${MODULE}-objs += metaslab.o
|
${MODULE}-objs += metaslab.o
|
||||||
${MODULE}-objs += refcount.o
|
${MODULE}-objs += refcount.o
|
||||||
${MODULE}-objs += rrwlock.o
|
${MODULE}-objs += rrwlock.o
|
||||||
|
${MODULE}-objs += sa.o
|
||||||
${MODULE}-objs += sha256.o
|
${MODULE}-objs += sha256.o
|
||||||
${MODULE}-objs += spa.o
|
${MODULE}-objs += spa.o
|
||||||
${MODULE}-objs += spa_boot.o
|
${MODULE}-objs += spa_boot.o
|
||||||
|
@ -62,6 +66,7 @@ ${MODULE}-objs += zap_micro.o
|
||||||
${MODULE}-objs += zfs_acl.o
|
${MODULE}-objs += zfs_acl.o
|
||||||
${MODULE}-objs += zfs_byteswap.o
|
${MODULE}-objs += zfs_byteswap.o
|
||||||
${MODULE}-objs += zfs_ctldir.o
|
${MODULE}-objs += zfs_ctldir.o
|
||||||
|
${MODULE}-objs += zfs_debug.o
|
||||||
${MODULE}-objs += zfs_dir.o
|
${MODULE}-objs += zfs_dir.o
|
||||||
${MODULE}-objs += zfs_fm.o
|
${MODULE}-objs += zfs_fm.o
|
||||||
${MODULE}-objs += zfs_fuid.o
|
${MODULE}-objs += zfs_fuid.o
|
||||||
|
@ -69,6 +74,7 @@ ${MODULE}-objs += zfs_ioctl.o
|
||||||
${MODULE}-objs += zfs_log.o
|
${MODULE}-objs += zfs_log.o
|
||||||
${MODULE}-objs += zfs_replay.o
|
${MODULE}-objs += zfs_replay.o
|
||||||
${MODULE}-objs += zfs_rlock.o
|
${MODULE}-objs += zfs_rlock.o
|
||||||
|
${MODULE}-objs += zfs_sa.o
|
||||||
${MODULE}-objs += zfs_vfsops.o
|
${MODULE}-objs += zfs_vfsops.o
|
||||||
${MODULE}-objs += zfs_vnops.o
|
${MODULE}-objs += zfs_vnops.o
|
||||||
${MODULE}-objs += zfs_znode.o
|
${MODULE}-objs += zfs_znode.o
|
||||||
|
@ -77,4 +83,5 @@ ${MODULE}-objs += zio.o
|
||||||
${MODULE}-objs += zio_checksum.o
|
${MODULE}-objs += zio_checksum.o
|
||||||
${MODULE}-objs += zio_compress.o
|
${MODULE}-objs += zio_compress.o
|
||||||
${MODULE}-objs += zio_inject.o
|
${MODULE}-objs += zio_inject.o
|
||||||
|
${MODULE}-objs += zle.o
|
||||||
${MODULE}-objs += zvol.o
|
${MODULE}-objs += zvol.o
|
||||||
|
|
|
@ -1234,10 +1234,12 @@ static void
|
||||||
dsl_scan_ddt(dsl_scan_t *scn, dmu_tx_t *tx)
|
dsl_scan_ddt(dsl_scan_t *scn, dmu_tx_t *tx)
|
||||||
{
|
{
|
||||||
ddt_bookmark_t *ddb = &scn->scn_phys.scn_ddt_bookmark;
|
ddt_bookmark_t *ddb = &scn->scn_phys.scn_ddt_bookmark;
|
||||||
ddt_entry_t dde = { 0 };
|
ddt_entry_t dde;
|
||||||
int error;
|
int error;
|
||||||
uint64_t n = 0;
|
uint64_t n = 0;
|
||||||
|
|
||||||
|
bzero(&dde, sizeof (ddt_entry_t));
|
||||||
|
|
||||||
while ((error = ddt_walk(scn->scn_dp->dp_spa, ddb, &dde)) == 0) {
|
while ((error = ddt_walk(scn->scn_dp->dp_spa, ddb, &dde)) == 0) {
|
||||||
ddt_t *ddt;
|
ddt_t *ddt;
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
static spl_class *zpios_class;
|
static spl_class *zpios_class;
|
||||||
static spl_device *zpios_device;
|
static spl_device *zpios_device;
|
||||||
|
static char *zpios_tag = "zpios_tag";
|
||||||
|
|
||||||
static
|
static
|
||||||
int zpios_upcall(char *path, char *phase, run_args_t *run_args, int rc)
|
int zpios_upcall(char *path, char *phase, run_args_t *run_args, int rc)
|
||||||
|
@ -161,17 +161,26 @@ zpios_dmu_setup(run_args_t *run_args)
|
||||||
{
|
{
|
||||||
zpios_time_t *t = &(run_args->stats.cr_time);
|
zpios_time_t *t = &(run_args->stats.cr_time);
|
||||||
objset_t *os;
|
objset_t *os;
|
||||||
|
char name[32];
|
||||||
uint64_t obj = 0ULL;
|
uint64_t obj = 0ULL;
|
||||||
int i, rc = 0;
|
int i, rc = 0, rc2;
|
||||||
|
|
||||||
(void)zpios_upcall(run_args->pre, PHASE_PRE_CREATE, run_args, 0);
|
(void)zpios_upcall(run_args->pre, PHASE_PRE_CREATE, run_args, 0);
|
||||||
t->start = zpios_timespec_now();
|
t->start = zpios_timespec_now();
|
||||||
|
|
||||||
rc = dmu_objset_open(run_args->pool, DMU_OST_ZFS, DS_MODE_USER, &os);
|
(void)snprintf(name, 32, "%s/id_%d", run_args->pool, run_args->id);
|
||||||
if (rc) {
|
rc = dmu_objset_create(name, DMU_OST_OTHER, 0, NULL, NULL);
|
||||||
zpios_print(run_args->file, "Error dmu_objset_open() "
|
if (rc) {
|
||||||
"failed: %d\n", rc);
|
zpios_print(run_args->file, "Error dmu_objset_create(%s, ...) "
|
||||||
|
"failed: %d\n", name, rc);
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = dmu_objset_own(name, DMU_OST_OTHER, 0, zpios_tag, &os);
|
||||||
|
if (rc) {
|
||||||
|
zpios_print(run_args->file, "Error dmu_objset_own(%s, ...) "
|
||||||
|
"failed: %d\n", name, rc);
|
||||||
|
goto out_destroy;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(run_args->flags & DMU_FPP)) {
|
if (!(run_args->flags & DMU_FPP)) {
|
||||||
|
@ -180,7 +189,7 @@ zpios_dmu_setup(run_args_t *run_args)
|
||||||
rc = -EBADF;
|
rc = -EBADF;
|
||||||
zpios_print(run_args->file, "Error zpios_dmu_"
|
zpios_print(run_args->file, "Error zpios_dmu_"
|
||||||
"object_create() failed, %d\n", rc);
|
"object_create() failed, %d\n", rc);
|
||||||
goto out;
|
goto out_destroy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,6 +222,13 @@ zpios_dmu_setup(run_args_t *run_args)
|
||||||
}
|
}
|
||||||
|
|
||||||
run_args->os = os;
|
run_args->os = os;
|
||||||
|
out_destroy:
|
||||||
|
if (rc) {
|
||||||
|
rc2 = dmu_objset_destroy(name, B_FALSE);
|
||||||
|
if (rc2)
|
||||||
|
zpios_print(run_args->file, "Error dmu_objset_destroy"
|
||||||
|
"(%s, ...) failed: %d\n", name, rc2);
|
||||||
|
}
|
||||||
out:
|
out:
|
||||||
t->stop = zpios_timespec_now();
|
t->stop = zpios_timespec_now();
|
||||||
t->delta = zpios_timespec_sub(t->stop, t->start);
|
t->delta = zpios_timespec_sub(t->stop, t->start);
|
||||||
|
@ -340,15 +356,18 @@ zpios_get_work_item(run_args_t *run_args, dmu_obj_t *obj, __u64 *offset,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
zpios_remove_objects(run_args_t *run_args)
|
zpios_remove_objset(run_args_t *run_args)
|
||||||
{
|
{
|
||||||
zpios_time_t *t = &(run_args->stats.rm_time);
|
zpios_time_t *t = &(run_args->stats.rm_time);
|
||||||
zpios_region_t *region;
|
zpios_region_t *region;
|
||||||
|
char name[32];
|
||||||
int rc = 0, i;
|
int rc = 0, i;
|
||||||
|
|
||||||
(void)zpios_upcall(run_args->pre, PHASE_PRE_REMOVE, run_args, 0);
|
(void)zpios_upcall(run_args->pre, PHASE_PRE_REMOVE, run_args, 0);
|
||||||
t->start = zpios_timespec_now();
|
t->start = zpios_timespec_now();
|
||||||
|
|
||||||
|
(void)snprintf(name, 32, "%s/id_%d", run_args->pool, run_args->id);
|
||||||
|
|
||||||
if (run_args->flags & DMU_REMOVE) {
|
if (run_args->flags & DMU_REMOVE) {
|
||||||
if (run_args->flags & DMU_FPP) {
|
if (run_args->flags & DMU_FPP) {
|
||||||
for (i = 0; i < run_args->region_count; i++) {
|
for (i = 0; i < run_args->region_count; i++) {
|
||||||
|
@ -373,7 +392,14 @@ zpios_remove_objects(run_args_t *run_args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dmu_objset_close(run_args->os);
|
dmu_objset_disown(run_args->os, zpios_tag);
|
||||||
|
|
||||||
|
if (run_args->flags & DMU_REMOVE) {
|
||||||
|
rc = dmu_objset_destroy(name, B_FALSE);
|
||||||
|
if (rc)
|
||||||
|
zpios_print(run_args->file, "Error dmu_objset_destroy"
|
||||||
|
"(%s, ...) failed: %d\n", name, rc);
|
||||||
|
}
|
||||||
|
|
||||||
t->stop = zpios_timespec_now();
|
t->stop = zpios_timespec_now();
|
||||||
t->delta = zpios_timespec_sub(t->stop, t->start);
|
t->delta = zpios_timespec_sub(t->stop, t->start);
|
||||||
|
@ -843,7 +869,7 @@ zpios_do_one_run(struct file *file, zpios_cmd_t *kcmd,
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
rc = zpios_threads_run(run_args);
|
rc = zpios_threads_run(run_args);
|
||||||
zpios_remove_objects(run_args);
|
zpios_remove_objset(run_args);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
@ -1009,61 +1035,71 @@ zpios_ioctl_cfg(struct file *file, unsigned long arg)
|
||||||
static int
|
static int
|
||||||
zpios_ioctl_cmd(struct file *file, unsigned long arg)
|
zpios_ioctl_cmd(struct file *file, unsigned long arg)
|
||||||
{
|
{
|
||||||
zpios_cmd_t kcmd;
|
zpios_cmd_t *kcmd;
|
||||||
int rc = -EINVAL;
|
|
||||||
void *data = NULL;
|
void *data = NULL;
|
||||||
|
int rc = -EINVAL;
|
||||||
|
|
||||||
rc = copy_from_user(&kcmd, (zpios_cfg_t *)arg, sizeof(kcmd));
|
kcmd = kmem_alloc(sizeof(zpios_cmd_t), KM_SLEEP);
|
||||||
|
if (kcmd == NULL) {
|
||||||
|
zpios_print(file, "Unable to kmem_alloc() %ld byte for "
|
||||||
|
"zpios_cmd_t\n", sizeof(zpios_cmd_t));
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = copy_from_user(kcmd, (zpios_cfg_t *)arg, sizeof(zpios_cmd_t));
|
||||||
if (rc) {
|
if (rc) {
|
||||||
zpios_print(file, "Unable to copy command structure "
|
zpios_print(file, "Unable to copy command structure "
|
||||||
"from user to kernel memory, %d\n", rc);
|
"from user to kernel memory, %d\n", rc);
|
||||||
return -EFAULT;
|
goto out_cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kcmd.cmd_magic != ZPIOS_CMD_MAGIC) {
|
if (kcmd->cmd_magic != ZPIOS_CMD_MAGIC) {
|
||||||
zpios_print(file, "Bad command magic 0x%x != 0x%x\n",
|
zpios_print(file, "Bad command magic 0x%x != 0x%x\n",
|
||||||
kcmd.cmd_magic, ZPIOS_CFG_MAGIC);
|
kcmd->cmd_magic, ZPIOS_CFG_MAGIC);
|
||||||
return -EINVAL;
|
rc = -EINVAL;
|
||||||
|
goto out_cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory for any opaque data the caller needed to pass on */
|
/* Allocate memory for any opaque data the caller needed to pass on */
|
||||||
if (kcmd.cmd_data_size > 0) {
|
if (kcmd->cmd_data_size > 0) {
|
||||||
data = (void *)vmem_alloc(kcmd.cmd_data_size, KM_SLEEP);
|
data = (void *)vmem_alloc(kcmd->cmd_data_size, KM_SLEEP);
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
zpios_print(file, "Unable to vmem_alloc() %ld "
|
zpios_print(file, "Unable to vmem_alloc() %ld "
|
||||||
"bytes for data buffer\n",
|
"bytes for data buffer\n",
|
||||||
(long)kcmd.cmd_data_size);
|
(long)kcmd->cmd_data_size);
|
||||||
return -ENOMEM;
|
rc = -ENOMEM;
|
||||||
|
goto out_cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = copy_from_user(data, (void *)(arg + offsetof(zpios_cmd_t,
|
rc = copy_from_user(data, (void *)(arg + offsetof(zpios_cmd_t,
|
||||||
cmd_data_str)), kcmd.cmd_data_size);
|
cmd_data_str)), kcmd->cmd_data_size);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
zpios_print(file, "Unable to copy data buffer "
|
zpios_print(file, "Unable to copy data buffer "
|
||||||
"from user to kernel memory, %d\n", rc);
|
"from user to kernel memory, %d\n", rc);
|
||||||
vmem_free(data, kcmd.cmd_data_size);
|
goto out_data;
|
||||||
return -EFAULT;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = zpios_do_one_run(file, &kcmd, kcmd.cmd_data_size, data);
|
rc = zpios_do_one_run(file, kcmd, kcmd->cmd_data_size, data);
|
||||||
|
|
||||||
if (data != NULL) {
|
if (data != NULL) {
|
||||||
/* If the test failed do not print out the stats */
|
/* If the test failed do not print out the stats */
|
||||||
if (rc)
|
if (rc)
|
||||||
goto cleanup;
|
goto out_data;
|
||||||
|
|
||||||
rc = copy_to_user((void *)(arg + offsetof(zpios_cmd_t,
|
rc = copy_to_user((void *)(arg + offsetof(zpios_cmd_t,
|
||||||
cmd_data_str)), data, kcmd.cmd_data_size);
|
cmd_data_str)), data, kcmd->cmd_data_size);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
zpios_print(file, "Unable to copy data buffer "
|
zpios_print(file, "Unable to copy data buffer "
|
||||||
"from kernel to user memory, %d\n", rc);
|
"from kernel to user memory, %d\n", rc);
|
||||||
rc = -EFAULT;
|
rc = -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
out_data:
|
||||||
vmem_free(data, kcmd.cmd_data_size);
|
vmem_free(data, kcmd->cmd_data_size);
|
||||||
}
|
}
|
||||||
|
out_cmd:
|
||||||
|
kmem_free(kcmd, sizeof(zpios_cmd_t));
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue