17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
5fbac2b2vikram * Common Development and Distribution License (the "License").
6fbac2b2vikram * You may not use this file except in compliance with the License.
77c478bdstevel@tonic-gate *
87c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bdstevel@tonic-gate * See the License for the specific language governing permissions
117c478bdstevel@tonic-gate * and limitations under the License.
127c478bdstevel@tonic-gate *
137c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bdstevel@tonic-gate *
197c478bdstevel@tonic-gate * CDDL HEADER END
207c478bdstevel@tonic-gate */
217c478bdstevel@tonic-gate
227c478bdstevel@tonic-gate/*
235f10ef6Yuri Pankov * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
249adfa60Matthew Ahrens * Copyright 2012 Milan Jurik. All rights reserved.
259adfa60Matthew Ahrens * Copyright (c) 2015 by Delphix. All rights reserved.
262dc2358Toomas Soome * Copyright 2016 Toomas Soome <tsoome@me.com>
272b987d4Alexander Eremin * Copyright 2017 Nexenta Systems, Inc.
285850749Andy Fiddaman * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
296debd3fAlexander Eremin */
306debd3fAlexander Eremin
316debd3fAlexander Eremin/*
327c478bdstevel@tonic-gate * bootadm(1M) is a new utility for managing bootability of
337c478bdstevel@tonic-gate * Solaris *Newboot* environments. It has two primary tasks:
3475383e3Andy Fiddaman *	- Allow end users to manage bootability of Newboot Solaris instances
357c478bdstevel@tonic-gate *	- Provide services to other subsystems in Solaris (primarily Install)
367c478bdstevel@tonic-gate */
377c478bdstevel@tonic-gate
387c478bdstevel@tonic-gate/* Headers */
397c478bdstevel@tonic-gate#include <stdio.h>
407c478bdstevel@tonic-gate#include <errno.h>
417c478bdstevel@tonic-gate#include <stdlib.h>
427c478bdstevel@tonic-gate#include <string.h>
437c478bdstevel@tonic-gate#include <unistd.h>
447c478bdstevel@tonic-gate#include <sys/types.h>
457c478bdstevel@tonic-gate#include <sys/stat.h>
4644da779William Kucharski#include <alloca.h>
477c478bdstevel@tonic-gate#include <stdarg.h>
487c478bdstevel@tonic-gate#include <limits.h>
497c478bdstevel@tonic-gate#include <signal.h>
507c478bdstevel@tonic-gate#include <sys/wait.h>
517c478bdstevel@tonic-gate#include <sys/mnttab.h>
52f904d32Jerry Gilliam#include <sys/mntent.h>
537c478bdstevel@tonic-gate#include <sys/statvfs.h>
547c478bdstevel@tonic-gate#include <libnvpair.h>
557c478bdstevel@tonic-gate#include <ftw.h>
567c478bdstevel@tonic-gate#include <fcntl.h>
577c478bdstevel@tonic-gate#include <strings.h>
582449e17sherrym#include <utime.h>
597c478bdstevel@tonic-gate#include <sys/systeminfo.h>
607c478bdstevel@tonic-gate#include <sys/dktp/fdisk.h>
6158091fdsetje#include <sys/param.h>
62eb2bd66vikram#include <dirent.h>
63eb2bd66vikram#include <ctype.h>
64eb2bd66vikram#include <libgen.h>
65e7cbe64gw#include <sys/sysmacros.h>
664884749Enrico Perla - Sun Microsystems#include <sys/elf.h>
67963390bvikram#include <libscf.h>
684884749Enrico Perla - Sun Microsystems#include <zlib.h>
694884749Enrico Perla - Sun Microsystems#include <sys/lockfs.h>
704884749Enrico Perla - Sun Microsystems#include <sys/filio.h>
716debd3fAlexander Eremin#include <libbe.h>
72fa0c327Toomas Soome#include <deflt.h>
73e998e51Sheshadri Vasudevan#ifdef i386
74e998e51Sheshadri Vasudevan#include <libfdisk.h>
75e998e51Sheshadri Vasudevan#endif
76986fd29setje
7779c28b7Toomas Soome#if !defined(_OBP)
782449e17sherrym#include <sys/ucode.h>
792449e17sherrym#endif
807c478bdstevel@tonic-gate
817c478bdstevel@tonic-gate#include <pwd.h>
827c478bdstevel@tonic-gate#include <grp.h>
837c478bdstevel@tonic-gate#include <device_info.h>
84eb2bd66vikram#include <sys/vtoc.h>
85eb2bd66vikram#include <sys/efi_partition.h>
8689c3ee4Gangadhar Mylapuram#include <regex.h>
877c478bdstevel@tonic-gate#include <locale.h>
88c7c0ceaToomas Soome#include <sys/mkdev.h>
897c478bdstevel@tonic-gate
90ae115bcmrj#include "bootadm.h"
917c478bdstevel@tonic-gate
927c478bdstevel@tonic-gate#ifndef TEXT_DOMAIN
937c478bdstevel@tonic-gate#define	TEXT_DOMAIN	"SUNW_OST_OSCMD"
947c478bdstevel@tonic-gate#endif	/* TEXT_DOMAIN */
957c478bdstevel@tonic-gate
967c478bdstevel@tonic-gate/* Type definitions */
977c478bdstevel@tonic-gate
987c478bdstevel@tonic-gate/* Primary subcmds */
997c478bdstevel@tonic-gatetypedef enum {
1007c478bdstevel@tonic-gate	BAM_MENU = 3,
101c7c0ceaToomas Soome	BAM_ARCHIVE,
102c7c0ceaToomas Soome	BAM_INSTALL
1037c478bdstevel@tonic-gate} subcmd_t;
1047c478bdstevel@tonic-gate
1057c478bdstevel@tonic-gate#define	LINE_INIT	0	/* lineNum initial value */
1067c478bdstevel@tonic-gate#define	ENTRY_INIT	-1	/* entryNum initial value */
1077c478bdstevel@tonic-gate#define	ALL_ENTRIES	-2	/* selects all boot entries */
1087c478bdstevel@tonic-gate
1091a902efHans Rosenfeld#define	PARTNO_NOTFOUND -1	/* Solaris partition not found */
1101a902efHans Rosenfeld#define	PARTNO_EFI	-2	/* EFI partition table found */
1111a902efHans Rosenfeld
1127c478bdstevel@tonic-gate#define	GRUB_DIR		"/boot/grub"
113963390bvikram#define	GRUB_STAGE2		GRUB_DIR "/stage2"
1147c478bdstevel@tonic-gate#define	GRUB_MENU		"/boot/grub/menu.lst"
1157c478bdstevel@tonic-gate#define	MENU_TMP		"/boot/grub/menu.lst.tmp"
116963390bvikram#define	GRUB_BACKUP_MENU	"/etc/lu/GRUB_backup_menu"
1171a96bf6Toomas Soome#define	RAMDISK_SPECIAL		"/devices/ramdisk"
11840541d5vikram#define	STUBBOOT		"/stubboot"
119eb2bd66vikram#define	MULTIBOOT		"/platform/i86pc/multiboot"
120eb2bd66vikram#define	GRUBSIGN_DIR		"/boot/grub/bootsign"
121eb2bd66vikram#define	GRUBSIGN_BACKUP		"/etc/bootsign"
122eb2bd66vikram#define	GRUBSIGN_UFS_PREFIX	"rootfs"
123eb2bd66vikram#define	GRUBSIGN_ZFS_PREFIX	"pool_"
124eb2bd66vikram#define	GRUBSIGN_LU_PREFIX	"BE_"
125eb2bd66vikram#define	UFS_SIGNATURE_LIST	"/var/run/grub_ufs_signatures"
126eb2bd66vikram#define	ZFS_LEGACY_MNTPT	"/tmp/bootadm_mnt_zfs_legacy"
127eb2bd66vikram
12875383e3Andy Fiddaman/* SMF */
12975383e3Andy Fiddaman#define	BOOT_ARCHIVE_FMRI	"system/boot-archive:default"
13075383e3Andy Fiddaman#define	SCF_PG_CONFIG		"config"
13175383e3Andy Fiddaman#define	SCF_PROPERTY_FORMAT	"format"
13275383e3Andy Fiddaman
133fa0c327Toomas Soome/* BE defaults */
134fa0c327Toomas Soome#define	BE_DEFAULTS		"/etc/default/be"
135fa0c327Toomas Soome#define	BE_DFLT_BE_HAS_GRUB	"BE_HAS_GRUB="
136fa0c327Toomas Soome
137eb2bd66vikram#define	BOOTADM_RDONLY_TEST	"BOOTADM_RDONLY_TEST"
1387c478bdstevel@tonic-gate
1397c478bdstevel@tonic-gate/* lock related */
1407c478bdstevel@tonic-gate#define	BAM_LOCK_FILE		"/var/run/bootadm.lock"
1417c478bdstevel@tonic-gate#define	LOCK_FILE_PERMS		(S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)
1427c478bdstevel@tonic-gate
143986fd29setje#define	CREATE_RAMDISK		"boot/solaris/bin/create_ramdisk"
144986fd29setje#define	CREATE_DISKMAP		"boot/solaris/bin/create_diskmap"
145986fd29setje#define	EXTRACT_BOOT_FILELIST	"boot/solaris/bin/extract_boot_filelist"
1467c478bdstevel@tonic-gate#define	GRUBDISK_MAP		"/var/run/solaris_grubdisk.map"
1477c478bdstevel@tonic-gate
148b610f78vikram#define	GRUB_slice		"/etc/lu/GRUB_slice"
149b610f78vikram#define	GRUB_root		"/etc/lu/GRUB_root"
150fbac2b2vikram#define	GRUB_fdisk		"/etc/lu/GRUB_fdisk"
151fbac2b2vikram#define	GRUB_fdisk_target	"/etc/lu/GRUB_fdisk_target"
152963390bvikram#define	FINDROOT_INSTALLGRUB	"/etc/lu/installgrub.findroot"
153963390bvikram#define	LULIB			"/usr/lib/lu/lulib"
154963390bvikram#define	LULIB_PROPAGATE_FILE	"lulib_propagate_file"
155963390bvikram#define	CKSUM			"/usr/bin/cksum"
156963390bvikram#define	LU_MENU_CKSUM		"/etc/lu/menu.cksum"
157963390bvikram#define	BOOTADM			"/sbin/bootadm"
158b610f78vikram
159b610f78vikram#define	INSTALLGRUB		"/sbin/installgrub"
160b610f78vikram#define	STAGE1			"/boot/grub/stage1"
161b610f78vikram#define	STAGE2			"/boot/grub/stage2"
162b610f78vikram
1632b987d4Alexander Eremin#define	ETC_SYSTEM_DIR		"etc/system.d"
1642b987d4Alexander Eremin#define	SELF_ASSEMBLY		"etc/system.d/.self-assembly"
1652b987d4Alexander Eremin
1667c478bdstevel@tonic-gate/*
1677c478bdstevel@tonic-gate * Default file attributes
1687c478bdstevel@tonic-gate */
1697c478bdstevel@tonic-gate#define	DEFAULT_DEV_MODE	0644	/* default permissions */
1707c478bdstevel@tonic-gate#define	DEFAULT_DEV_UID		0	/* user root */
1717c478bdstevel@tonic-gate#define	DEFAULT_DEV_GID		3	/* group sys */
1727c478bdstevel@tonic-gate
1737c478bdstevel@tonic-gate/*
1747c478bdstevel@tonic-gate * Menu related
1757c478bdstevel@tonic-gate * menu_cmd_t and menu_cmds must be kept in sync
1767c478bdstevel@tonic-gate */
177ae115bcmrjchar *menu_cmds[] = {
1787c478bdstevel@tonic-gate	"default",	/* DEFAULT_CMD */
1797c478bdstevel@tonic-gate	"timeout",	/* TIMEOUT_CMD */
1807c478bdstevel@tonic-gate	"title",	/* TITLE_CMD */
1817c478bdstevel@tonic-gate	"root",		/* ROOT_CMD */
1827c478bdstevel@tonic-gate	"kernel",	/* KERNEL_CMD */
183ae115bcmrj	"kernel$",	/* KERNEL_DOLLAR_CMD */
1847c478bdstevel@tonic-gate	"module",	/* MODULE_CMD */
185ae115bcmrj	"module$",	/* MODULE_DOLLAR_CMD */
1867c478bdstevel@tonic-gate	" ",		/* SEP_CMD */
1877c478bdstevel@tonic-gate	"#",		/* COMMENT_CMD */
188ae115bcmrj	"chainloader",	/* CHAINLOADER_CMD */
189ae115bcmrj	"args",		/* ARGS_CMD */
190eb2bd66vikram	"findroot",	/* FINDROOT_CMD */
19144da779William Kucharski	"bootfs",	/* BOOTFS_CMD */
1927c478bdstevel@tonic-gate	NULL
1937c478bdstevel@tonic-gate};
1947c478bdstevel@tonic-gate
19575383e3Andy Fiddamanchar *bam_formats[] = {
19675383e3Andy Fiddaman	"hsfs",
19775383e3Andy Fiddaman	"ufs",
19875383e3Andy Fiddaman	"cpio",
19975383e3Andy Fiddaman	"ufs-nocompress",
20075383e3Andy Fiddaman	NULL
20175383e3Andy Fiddaman};
20275383e3Andy Fiddaman#define	BAM_FORMAT_UNSET -1
20375383e3Andy Fiddaman#define	BAM_FORMAT_HSFS 0
20475383e3Andy Fiddamanshort bam_format = BAM_FORMAT_UNSET;
20575383e3Andy Fiddaman
2067c478bdstevel@tonic-gate#define	OPT_ENTRY_NUM	"entry"
2077c478bdstevel@tonic-gate
2087c478bdstevel@tonic-gate/*
209eb2bd66vikram * exec_cmd related
2107c478bdstevel@tonic-gate */
2117c478bdstevel@tonic-gatetypedef struct {
2127c478bdstevel@tonic-gate	line_t *head;
2137c478bdstevel@tonic-gate	line_t *tail;
2147c478bdstevel@tonic-gate} filelist_t;
2157c478bdstevel@tonic-gate
2167c478bdstevel@tonic-gate#define	BOOT_FILE_LIST	"boot/solaris/filelist.ramdisk"
2177c478bdstevel@tonic-gate#define	ETC_FILE_LIST	"etc/boot/solaris/filelist.ramdisk"
2187c478bdstevel@tonic-gate
2197c478bdstevel@tonic-gate#define	FILE_STAT	"boot/solaris/filestat.ramdisk"
2207c478bdstevel@tonic-gate#define	FILE_STAT_TMP	"boot/solaris/filestat.ramdisk.tmp"
2217c478bdstevel@tonic-gate#define	DIR_PERMS	(S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
2227c478bdstevel@tonic-gate#define	FILE_STAT_MODE	(S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)
2237c478bdstevel@tonic-gate
2244a9df87Enrico Perla - Sun Microsystems#define	FILE_STAT_TIMESTAMP	"boot/solaris/timestamp.cache"
2254a9df87Enrico Perla - Sun Microsystems
2267c478bdstevel@tonic-gate/* Globals */
227ae115bcmrjint bam_verbose;
228ae115bcmrjint bam_force;
229eb2bd66vikramint bam_debug;
23075383e3Andy Fiddamanint bam_skip_lock;
2317c478bdstevel@tonic-gatestatic char *prog;
2327c478bdstevel@tonic-gatestatic subcmd_t bam_cmd;
233c262cbbToomas Soomechar *bam_root;
234c262cbbToomas Soomeint bam_rootlen;
2357c478bdstevel@tonic-gatestatic int bam_root_readonly;
236c262cbbToomas Soomeint bam_alt_root;
2374884749Enrico Perla - Sun Microsystemsstatic int bam_extend = 0;
2384884749Enrico Perla - Sun Microsystemsstatic int bam_purge = 0;
2397c478bdstevel@tonic-gatestatic char *bam_subcmd;
2407c478bdstevel@tonic-gatestatic char *bam_opt;
2417c478bdstevel@tonic-gatestatic char **bam_argv;
242c7c0ceaToomas Soomestatic char *bam_pool;
2437c478bdstevel@tonic-gatestatic int bam_argc;
2447c478bdstevel@tonic-gatestatic int bam_check;
2455eea609Enrico Perla - Sun Microsystemsstatic int bam_saved_check;
2467c478bdstevel@tonic-gatestatic int bam_smf_check;
2477c478bdstevel@tonic-gatestatic int bam_lock_fd = -1;
248e7cbe64gwstatic int bam_zfs;
249c7c0ceaToomas Soomestatic int bam_mbr;
250c262cbbToomas Soomechar rootbuf[PATH_MAX] = "/";
2512b987d4Alexander Ereminstatic char self_assembly[PATH_MAX];
252b610f78vikramstatic int bam_update_all;
253d876c67jgstatic int bam_alt_platform;
254d876c67jgstatic char *bam_platform;
255cedc7e5Enrico Perla - Sun Microsystemsstatic char *bam_home_env = NULL;
2567c478bdstevel@tonic-gate
2577c478bdstevel@tonic-gate/* function prototypes */
258986fd29setjestatic void parse_args_internal(int, char *[]);
259986fd29setjestatic void parse_args(int, char *argv[]);
260986fd29setjestatic error_t bam_menu(char *, char *, int, char *[]);
261c7c0ceaToomas Soomestatic error_t bam_install(char *, char *);
262986fd29setjestatic error_t bam_archive(char *, char *);
2637c478bdstevel@tonic-gate
2647c478bdstevel@tonic-gatestatic void bam_lock(void);
2657c478bdstevel@tonic-gatestatic void bam_unlock(void);
2667c478bdstevel@tonic-gate
267986fd29setjestatic int exec_cmd(char *, filelist_t *);
268986fd29setjestatic error_t read_globals(menu_t *, char *, char *, int);
269eb2bd66vikramstatic int menu_on_bootdisk(char *os_root, char *menu_root);
270986fd29setjestatic menu_t *menu_read(char *);
271986fd29setjestatic error_t menu_write(char *, menu_t *);
272986fd29setjestatic void linelist_free(line_t *);
273986fd29setjestatic void menu_free(menu_t *);
274986fd29setjestatic void filelist_free(filelist_t *);
275986fd29setjestatic error_t list2file(char *, char *, char *, line_t *);
276986fd29setjestatic error_t list_entry(menu_t *, char *, char *);
27744da779William Kucharskistatic error_t list_setting(menu_t *, char *, char *);
278986fd29setjestatic error_t delete_all_entries(menu_t *, char *, char *);
279eb2bd66vikramstatic error_t update_entry(menu_t *mp, char *menu_root, char *opt);
280eb2bd66vikramstatic error_t update_temp(menu_t *mp, char *dummy, char *opt);
281986fd29setje
282c7c0ceaToomas Soomestatic error_t install_bootloader(void);
283986fd29setjestatic error_t update_archive(char *, char *);
284986fd29setjestatic error_t list_archive(char *, char *);
285986fd29setjestatic error_t update_all(char *, char *);
286986fd29setjestatic error_t read_list(char *, filelist_t *);
287986fd29setjestatic error_t set_option(menu_t *, char *, char *);
288986fd29setjestatic error_t set_kernel(menu_t *, menu_cmd_t, char *, char *, size_t);
289eb2bd66vikramstatic error_t get_kernel(menu_t *, menu_cmd_t, char *, size_t);
2902b987d4Alexander Ereminstatic error_t build_etc_system_dir(char *);
291986fd29setjestatic char *expand_path(const char *);
292986fd29setje
293986fd29setjestatic long s_strtol(char *);
294986fd29setjestatic int s_fputs(char *, FILE *);
295986fd29setje
2967c478bdstevel@tonic-gatestatic int is_amd64(void);
2977975540setjestatic char *get_machine(void);
2987c478bdstevel@tonic-gatestatic void append_to_flist(filelist_t *, char *);
299eb2bd66vikramstatic int ufs_add_to_sign_list(char *sign);
300963390bvikramstatic error_t synchronize_BE_menu(void);
3017c478bdstevel@tonic-gate
30279c28b7Toomas Soome#if !defined(_OBP)
3032449e17sherrymstatic void ucode_install();
3042449e17sherrym#endif
3052449e17sherrym
3067c478bdstevel@tonic-gate/* Menu related sub commands */
3077c478bdstevel@tonic-gatestatic subcmd_defn_t menu_subcmds[] = {
308eb2bd66vikram	"set_option",		OPT_ABSENT,	set_option, 0,	/* PUB */
3091a97e40vikram	"list_entry",		OPT_OPTIONAL,	list_entry, 1,	/* PUB */
3101a97e40vikram	"delete_all_entries",	OPT_ABSENT,	delete_all_entries, 0, /* PVT */
3111a97e40vikram	"update_entry",		OPT_REQ,	update_entry, 0, /* menu */
3121a97e40vikram	"update_temp",		OPT_OPTIONAL,	update_temp, 0,	/* reboot */
313ae115bcmrj	"upgrade",		OPT_ABSENT,	upgrade_menu, 0, /* menu */
31444da779William Kucharski	"list_setting",		OPT_OPTIONAL,	list_setting, 1, /* menu */
31544da779William Kucharski	"disable_hypervisor",	OPT_ABSENT,	cvt_to_metal, 0, /* menu */
31644da779William Kucharski	"enable_hypervisor",	OPT_ABSENT,	cvt_to_hyper, 0, /* menu */
3171a97e40vikram	NULL,			0,		NULL, 0	/* must be last */
3187c478bdstevel@tonic-gate};
3197c478bdstevel@tonic-gate
3207c478bdstevel@tonic-gate/* Archive related sub commands */
3217c478bdstevel@tonic-gatestatic subcmd_defn_t arch_subcmds[] = {
3221a97e40vikram	"update",		OPT_ABSENT,	update_archive, 0, /* PUB */
3231a97e40vikram	"update_all",		OPT_ABSENT,	update_all, 0,	/* PVT */
3241a97e40vikram	"list",			OPT_OPTIONAL,	list_archive, 1, /* PUB */
3251a97e40vikram	NULL,			0,		NULL, 0	/* must be last */
3267c478bdstevel@tonic-gate};
3277c478bdstevel@tonic-gate
328c7c0ceaToomas Soome/* Install related sub commands */
329c7c0ceaToomas Soomestatic subcmd_defn_t inst_subcmds[] = {
330c7c0ceaToomas Soome	"install_bootloader",	OPT_ABSENT,	install_bootloader, 0, /* PUB */
331c7c0ceaToomas Soome	NULL,			0,		NULL, 0	/* must be last */
332c7c0ceaToomas Soome};
333c7c0ceaToomas Soome
33475383e3Andy Fiddaman#define	build_path(buf, len, root, prefix, suffix) \
33575383e3Andy Fiddaman    snprintf((buf), (len), "%s%s%s%s%s", (root), (prefix), get_machine(), \
33675383e3Andy Fiddaman    is_flag_on(IS_SPARC_TARGET) ? "" : "/amd64", (suffix))
3374884749Enrico Perla - Sun Microsystems
3384884749Enrico Perla - Sun Microsystems/*
3394884749Enrico Perla - Sun Microsystems * Directory specific flags:
3404884749Enrico Perla - Sun Microsystems * NEED_UPDATE : the specified archive needs to be updated
34175383e3Andy Fiddaman * NO_EXTEND   : don't extend the specified archive, but recreate it
3424884749Enrico Perla - Sun Microsystems */
3434884749Enrico Perla - Sun Microsystems#define	NEED_UPDATE		0x00000001
34475383e3Andy Fiddaman#define	NO_EXTEND		0x00000002
3454884749Enrico Perla - Sun Microsystems
34675383e3Andy Fiddaman#define	set_dir_flag(f)		(walk_arg.dirinfo.flags |= (f))
34775383e3Andy Fiddaman#define	unset_dir_flag(f)	(walk_arg.dirinfo.flags &= ~(f))
34875383e3Andy Fiddaman#define	is_dir_flag_on(f)	(walk_arg.dirinfo.flags & (f) ? 1 : 0)
3494884749Enrico Perla - Sun Microsystems
35075383e3Andy Fiddaman#define	get_cachedir()		(walk_arg.dirinfo.cdir_path)
35175383e3Andy Fiddaman#define	get_updatedir()		(walk_arg.dirinfo.update_path)
35275383e3Andy Fiddaman#define	get_count()		(walk_arg.dirinfo.count)
35375383e3Andy Fiddaman#define	has_cachedir()		(walk_arg.dirinfo.has_dir)
35475383e3Andy Fiddaman#define	set_dir_present()	(walk_arg.dirinfo.has_dir = 1)
3554884749Enrico Perla - Sun Microsystems
3564884749Enrico Perla - Sun Microsystems/*
3574884749Enrico Perla - Sun Microsystems * dirinfo_t (specific cache directory information):
358