Print this page
patch zone-auto-create-be


  56 #define BE_GRUB_SPLASH          "splashimage /boot/solaris.xpm"
  57 #define BE_GRUB_FOREGROUND      "foreground 343434"
  58 #define BE_GRUB_BACKGROUND      "background F7FBFF"
  59 #define BE_GRUB_DEFAULT         "default 0"
  60 #define BE_WHITE_SPACE          " \t\r\n"
  61 #define BE_CAP_FILE             "/boot/grub/capability"
  62 #define BE_INSTALL_GRUB         "/sbin/installgrub"
  63 #define BE_GRUB_STAGE_1         "/boot/grub/stage1"
  64 #define BE_GRUB_STAGE_2         "/boot/grub/stage2"
  65 #define BE_INSTALL_BOOT         "/usr/sbin/installboot"
  66 #define BE_SPARC_BOOTBLK        "/lib/fs/zfs/bootblk"
  67 
  68 #define ZFS_CLOSE(_zhp) \
  69         if (_zhp) { \
  70                 zfs_close(_zhp); \
  71                 _zhp = NULL; \
  72         }
  73 
  74 #define BE_ZONE_PARENTBE_PROPERTY       "org.opensolaris.libbe:parentbe"
  75 #define BE_ZONE_ACTIVE_PROPERTY         "org.opensolaris.libbe:active"
  76 #define BE_ZONE_SUPPORTED_BRANDS        "ipkg labeled"
  77 #define BE_ZONE_SUPPORTED_BRANDS_DELIM  " "
  78 
  79 /* Maximum length for the BE name. */
  80 #define BE_NAME_MAX_LEN         64
  81 
  82 #define MAX(a, b) ((a) > (b) ? (a) : (b))
  83 #define MIN(a, b) ((a) < (b) ? (a) : (b))
  84 
  85 typedef struct be_transaction_data {
  86         char            *obe_name;      /* Original BE name */
  87         char            *obe_root_ds;   /* Original BE root dataset */
  88         char            *obe_zpool;     /* Original BE pool */
  89         char            *obe_snap_name; /* Original BE snapshot name */
  90         char            *obe_altroot;   /* Original BE altroot */
  91         char            *nbe_name;      /* New BE name */
  92         char            *nbe_root_ds;   /* New BE root dataset */
  93         char            *nbe_zpool;     /* New BE pool */
  94         char            *nbe_desc;      /* New BE description */
  95         nvlist_t        *nbe_zfs_props; /* New BE dataset properties */
  96         char            *policy;        /* BE policy type */
  97 } be_transaction_data_t;


 190 char *be_auto_zone_be_name(char *, char *);
 191 char *be_default_policy(void);
 192 boolean_t valid_be_policy(char *);
 193 boolean_t be_valid_auto_snap_name(char *);
 194 boolean_t be_valid_be_name(const char *);
 195 void be_print_err(char *, ...);
 196 int be_find_current_be(be_transaction_data_t *);
 197 int zfs_err_to_be_err(libzfs_handle_t *);
 198 int errno_to_be_err(int);
 199 
 200 /* be_activate.c */
 201 int _be_activate(char *);
 202 int be_activate_current_be(void);
 203 boolean_t be_is_active_on_boot(char *);
 204 
 205 /* be_zones.c */
 206 void be_make_zoneroot(char *, char *, int);
 207 int be_find_active_zone_root(zfs_handle_t *, char *, char *, int);
 208 int be_find_mounted_zone_root(char *, char *, char *, int);
 209 boolean_t be_zone_supported(char *);
 210 zoneBrandList_t *be_get_supported_brandlist(void);
 211 int be_zone_get_parent_uuid(const char *, uuid_t *);
 212 int be_zone_set_parent_uuid(char *, uuid_t);
 213 boolean_t be_zone_compare_uuids(char *);
 214 
 215 /* check architecture functions */
 216 char *be_get_default_isa(void);
 217 char *be_get_platform(void);
 218 boolean_t be_is_isa(char *);
 219 boolean_t be_has_grub(void);
 220 
 221 /* callback functions */
 222 int be_exists_callback(zpool_handle_t *, void *);
 223 int be_find_zpool_callback(zpool_handle_t *, void *);
 224 int be_zpool_find_current_be_callback(zpool_handle_t *, void *);
 225 int be_zfs_find_current_be_callback(zfs_handle_t *, void *);
 226 int be_check_be_roots_callback(zpool_handle_t *, void *);
 227 
 228 /* defaults */
 229 void be_get_defaults(struct be_defaults *defaults);
 230 


  56 #define BE_GRUB_SPLASH          "splashimage /boot/solaris.xpm"
  57 #define BE_GRUB_FOREGROUND      "foreground 343434"
  58 #define BE_GRUB_BACKGROUND      "background F7FBFF"
  59 #define BE_GRUB_DEFAULT         "default 0"
  60 #define BE_WHITE_SPACE          " \t\r\n"
  61 #define BE_CAP_FILE             "/boot/grub/capability"
  62 #define BE_INSTALL_GRUB         "/sbin/installgrub"
  63 #define BE_GRUB_STAGE_1         "/boot/grub/stage1"
  64 #define BE_GRUB_STAGE_2         "/boot/grub/stage2"
  65 #define BE_INSTALL_BOOT         "/usr/sbin/installboot"
  66 #define BE_SPARC_BOOTBLK        "/lib/fs/zfs/bootblk"
  67 
  68 #define ZFS_CLOSE(_zhp) \
  69         if (_zhp) { \
  70                 zfs_close(_zhp); \
  71                 _zhp = NULL; \
  72         }
  73 
  74 #define BE_ZONE_PARENTBE_PROPERTY       "org.opensolaris.libbe:parentbe"
  75 #define BE_ZONE_ACTIVE_PROPERTY         "org.opensolaris.libbe:active"


  76 
  77 /* Maximum length for the BE name. */
  78 #define BE_NAME_MAX_LEN         64
  79 
  80 #define MAX(a, b) ((a) > (b) ? (a) : (b))
  81 #define MIN(a, b) ((a) < (b) ? (a) : (b))
  82 
  83 typedef struct be_transaction_data {
  84         char            *obe_name;      /* Original BE name */
  85         char            *obe_root_ds;   /* Original BE root dataset */
  86         char            *obe_zpool;     /* Original BE pool */
  87         char            *obe_snap_name; /* Original BE snapshot name */
  88         char            *obe_altroot;   /* Original BE altroot */
  89         char            *nbe_name;      /* New BE name */
  90         char            *nbe_root_ds;   /* New BE root dataset */
  91         char            *nbe_zpool;     /* New BE pool */
  92         char            *nbe_desc;      /* New BE description */
  93         nvlist_t        *nbe_zfs_props; /* New BE dataset properties */
  94         char            *policy;        /* BE policy type */
  95 } be_transaction_data_t;


 188 char *be_auto_zone_be_name(char *, char *);
 189 char *be_default_policy(void);
 190 boolean_t valid_be_policy(char *);
 191 boolean_t be_valid_auto_snap_name(char *);
 192 boolean_t be_valid_be_name(const char *);
 193 void be_print_err(char *, ...);
 194 int be_find_current_be(be_transaction_data_t *);
 195 int zfs_err_to_be_err(libzfs_handle_t *);
 196 int errno_to_be_err(int);
 197 
 198 /* be_activate.c */
 199 int _be_activate(char *);
 200 int be_activate_current_be(void);
 201 boolean_t be_is_active_on_boot(char *);
 202 
 203 /* be_zones.c */
 204 void be_make_zoneroot(char *, char *, int);
 205 int be_find_active_zone_root(zfs_handle_t *, char *, char *, int);
 206 int be_find_mounted_zone_root(char *, char *, char *, int);
 207 boolean_t be_zone_supported(char *);

 208 int be_zone_get_parent_uuid(const char *, uuid_t *);
 209 int be_zone_set_parent_uuid(char *, uuid_t);
 210 boolean_t be_zone_compare_uuids(char *);
 211 
 212 /* check architecture functions */
 213 char *be_get_default_isa(void);
 214 char *be_get_platform(void);
 215 boolean_t be_is_isa(char *);
 216 boolean_t be_has_grub(void);
 217 
 218 /* callback functions */
 219 int be_exists_callback(zpool_handle_t *, void *);
 220 int be_find_zpool_callback(zpool_handle_t *, void *);
 221 int be_zpool_find_current_be_callback(zpool_handle_t *, void *);
 222 int be_zfs_find_current_be_callback(zfs_handle_t *, void *);
 223 int be_check_be_roots_callback(zpool_handle_t *, void *);
 224 
 225 /* defaults */
 226 void be_get_defaults(struct be_defaults *defaults);
 227