View | Details | Raw Unified | Return to bug 124881
Collapse All | Expand All

(-)sys/fs/devfs/devfs.h (+1 lines)
Lines 111-120 Link Here
111
#define	DEVFSIO_RGETNEXT       	_IOWR('D', 4, struct devfs_rule)
111
#define	DEVFSIO_RGETNEXT       	_IOWR('D', 4, struct devfs_rule)
112
112
113
#define	DEVFSIO_SUSE		_IOW('D', 10, devfs_rsnum)
113
#define	DEVFSIO_SUSE		_IOW('D', 10, devfs_rsnum)
114
#define	DEVFSIO_SAPPLY		_IOW('D', 11, devfs_rsnum)
114
#define	DEVFSIO_SAPPLY		_IOW('D', 11, devfs_rsnum)
115
#define	DEVFSIO_SGETNEXT	_IOWR('D', 12, devfs_rsnum)
115
#define	DEVFSIO_SGETNEXT	_IOWR('D', 12, devfs_rsnum)
116
#define	DEVFSIO_SGETCURRENT	_IOWR('D', 13, devfs_rsnum)
116
117
117
/* XXX: DEVFSIO_RS_GET_INFO for refcount, active if any, etc. */
118
/* XXX: DEVFSIO_RS_GET_INFO for refcount, active if any, etc. */
118
119
119
#ifdef _KERNEL
120
#ifdef _KERNEL
120
121
(-)sys/fs/devfs/devfs_rule.c (+3 lines)
Lines 285-294 Link Here
285
			error = ESRCH;
285
			error = ESRCH;
286
			break;
286
			break;
287
		}
287
		}
288
		devfs_ruleset_applydm(ds, dm);
288
		devfs_ruleset_applydm(ds, dm);
289
		break;
289
		break;
290
	case DEVFSIO_SGETCURRENT:
291
		*(devfs_rsnum *)data = dm->dm_ruleset;
292
		break;
290
	case DEVFSIO_SGETNEXT:
293
	case DEVFSIO_SGETNEXT:
291
		rsnum = *(devfs_rsnum *)data;
294
		rsnum = *(devfs_rsnum *)data;
292
		TAILQ_FOREACH(ds, &devfs_rulesets, ds_list) {
295
		TAILQ_FOREACH(ds, &devfs_rulesets, ds_list) {
293
			if (ds->ds_number > rsnum)
296
			if (ds->ds_number > rsnum)
294
				break;
297
				break;
(-)sbin/devfs/rule.c (-1 / +18 lines)
Lines 53-71 Link Here
53
static void rulespec_intok(struct devfs_rule *dr, int ac, char **av,
53
static void rulespec_intok(struct devfs_rule *dr, int ac, char **av,
54
    devfs_rsnum rsnum);
54
    devfs_rsnum rsnum);
55
static void rulespec_outfp(FILE *fp, struct devfs_rule *dr);
55
static void rulespec_outfp(FILE *fp, struct devfs_rule *dr);
56
56
57
static command_t rule_add, rule_apply, rule_applyset;
57
static command_t rule_add, rule_apply, rule_applyset;
58
static command_t rule_del, rule_delset, rule_show, rule_showsets;
58
static command_t rule_del, rule_delset, rule_show, rule_showset, rule_showsets;
59
59
60
static ctbl_t ctbl_rule = {
60
static ctbl_t ctbl_rule = {
61
	{ "add",		rule_add },
61
	{ "add",		rule_add },
62
	{ "apply",		rule_apply },
62
	{ "apply",		rule_apply },
63
	{ "applyset",		rule_applyset },
63
	{ "applyset",		rule_applyset },
64
	{ "del",		rule_del },
64
	{ "del",		rule_del },
65
	{ "delset",		rule_delset },
65
	{ "delset",		rule_delset },
66
	{ "show",		rule_show },
66
	{ "show",		rule_show },
67
	{ "showset",		rule_showset },
67
	{ "showsets",		rule_showsets },
68
	{ "showsets",		rule_showsets },
68
	{ NULL,			NULL }
69
	{ NULL,			NULL }
69
};
70
};
70
71
71
static struct intstr ist_type[] = {
72
static struct intstr ist_type[] = {
Lines 227-236 Link Here
227
	}
228
	}
228
	return (0);
229
	return (0);
229
}
230
}
230
231
231
static int
232
static int
233
rule_showset(int ac, char **av __unused)
234
{
235
	devfs_rsnum rsnum;
236
237
	if (ac != 1)
238
		usage();
239
240
	if (ioctl(mpfd, DEVFSIO_SGETCURRENT, &rsnum) != -1)
241
		printf("%d\n", rsnum);
242
243
	if (errno != 0)
244
		err(1, "ioctl DEVFSIO_SGETCURRENT");
245
	return (0);
246
}
247
248
static int
232
rule_showsets(int ac, char **av __unused)
249
rule_showsets(int ac, char **av __unused)
233
{
250
{
234
	devfs_rsnum rsnum;
251
	devfs_rsnum rsnum;
235
252
236
	if (ac != 1)
253
	if (ac != 1)
(-)sbin/devfs/devfs.8 (+2 lines)
Lines 132-141 Link Here
132
Display the rule number
132
Display the rule number
133
.Ar rulenum ,
133
.Ar rulenum ,
134
or all the rules in the ruleset.
134
or all the rules in the ruleset.
135
The output lines (one line per rule) are expected to be valid
135
The output lines (one line per rule) are expected to be valid
136
.Ar rulespec Ns s .
136
.Ar rulespec Ns s .
137
.It Cm rule showset
138
Display the number of the ruleset associated with the mount-point.
137
.It Cm rule showsets
139
.It Cm rule showsets
138
Report the numbers of existing rulesets.
140
Report the numbers of existing rulesets.
139
.It Cm ruleset Ar ruleset
141
.It Cm ruleset Ar ruleset
140
Set ruleset number
142
Set ruleset number
141
.Ar ruleset
143
.Ar ruleset

Return to bug 124881