5 #include <minix/partition.h>
9 block_ioctl_name(unsigned long req
)
15 NAME(BIOCTRACEGET
); /* big IOCTL, not printing argument */
18 NAME(DIOCEJECT
); /* no argument */
21 NAME(DIOCFLUSH
); /* no argument */
28 NAME(MTIOCGET
); /* TODO: print argument */
29 NAME(MTIOCTOP
); /* TODO: print argument */
38 static const struct flags fbd_flags
[] = {
44 put_fbd_action(struct trace_proc
* proc
, const char * name
, int action
)
46 const char *text
= NULL
;
50 TEXT(FBD_ACTION_CORRUPT
);
51 TEXT(FBD_ACTION_ERROR
);
52 TEXT(FBD_ACTION_MISDIR
);
53 TEXT(FBD_ACTION_LOSTTORN
);
58 put_field(proc
, name
, text
);
60 put_value(proc
, name
, "%d", action
);
63 static const struct flags vnd_flags
[] = {
65 FLAG(VNDIOF_READONLY
),
70 block_ioctl_arg(struct trace_proc
* proc
, unsigned long req
, void * ptr
,
73 struct part_geom
*part
;
74 struct fbd_rule
*rule
;
75 struct vnd_ioctl
*vnd
;
84 put_value(proc
, NULL
, "%zu", *(size_t *)ptr
);
92 if (!valuesonly
&& i
== BTCTL_START
)
93 put_field(proc
, NULL
, "BTCTL_START");
94 else if (!valuesonly
&& i
== BTCTL_STOP
)
95 put_field(proc
, NULL
, "BTCTL_STOP");
97 put_value(proc
, NULL
, "%d", i
);
101 if ((part
= (struct part_geom
*)ptr
) == NULL
)
104 put_value(proc
, "base", "%"PRIu64
, part
->base
);
105 put_value(proc
, "size", "%"PRIu64
, part
->size
);
109 if ((part
= (struct part_geom
*)ptr
) == NULL
)
112 put_value(proc
, "base", "%"PRIu64
, part
->base
);
113 put_value(proc
, "size", "%"PRIu64
, part
->size
);
115 put_value(proc
, "cylinders", "%u", part
->cylinders
);
116 put_value(proc
, "heads", "%u", part
->heads
);
117 put_value(proc
, "sectors", "%u", part
->sectors
);
123 /* Print the old timeout only if verbosity is high enough. */
125 return IF_OUT
| ((verbose
> 0) ? IF_IN
: 0);
127 /* Same action for out and in. */
128 put_value(proc
, NULL
, "%d", *(int *)ptr
);
135 put_value(proc
, NULL
, "%d", *(int *)ptr
);
141 return dir
; /* out or in, depending on the request */
143 put_value(proc
, NULL
, "%d", *(int *)ptr
);
150 put_value(proc
, NULL
, "%d", *(fbd_rulenum_t
*)ptr
);
154 if ((rule
= (struct fbd_rule
*)ptr
) == NULL
)
155 return IF_OUT
| IF_IN
;
158 put_value(proc
, "num", "%d", rule
->num
);
163 * The returned result is the same as what is passed to the
164 * add request, so we can use the same code to print both.
168 if ((rule
= (struct fbd_rule
*)ptr
) == NULL
)
171 if (rule
->start
!= 0 || rule
->end
!= 0 || verbose
> 0) {
172 put_value(proc
, "start", "%"PRIu64
, rule
->start
);
173 put_value(proc
, "end", "%"PRIu64
, rule
->end
);
175 if (rule
->flags
!= (FBD_FLAG_READ
| FBD_FLAG_WRITE
) ||
177 put_flags(proc
, "flags", fbd_flags
, COUNT(fbd_flags
),
178 "0x%x", rule
->flags
);
179 if (rule
->skip
!= 0 || verbose
> 0)
180 put_value(proc
, "skip", "%u", rule
->skip
);
181 if (rule
->count
!= 0 || verbose
> 0)
182 put_value(proc
, "count", "%u", rule
->count
);
183 put_fbd_action(proc
, "action", rule
->action
);
185 return 0; /* TODO: optionally print the union fields */
191 put_value(proc
, NULL
, "%"PRIu32
, *(u32_t
*)ptr
);
195 if ((vnd
= (struct vnd_ioctl
*)ptr
) == NULL
)
196 return IF_OUT
| IF_IN
;
199 put_value(proc
, "vnd_fildes", "%d", vnd
->vnd_fildes
);
200 put_flags(proc
, "vnd_flags", vnd_flags
,
201 COUNT(vnd_flags
), "0x%x", vnd
->vnd_flags
);
202 return 0; /* TODO: print geometry if given */
204 put_value(proc
, "vnd_size", "%"PRIu64
, vnd
->vnd_size
);
209 if ((vnd
= (struct vnd_ioctl
*)ptr
) == NULL
)
212 put_flags(proc
, "vnd_flags", vnd_flags
, COUNT(vnd_flags
),
213 "0x%x", vnd
->vnd_flags
);
217 if ((vnu
= (struct vnd_user
*)ptr
) == NULL
)
220 put_value(proc
, "vnu_unit", "%d", vnu
->vnu_unit
);
221 put_dev(proc
, "vnu_dev", vnu
->vnu_dev
);
222 put_value(proc
, "vnu_ino", "%"PRId64
, vnu
->vnu_ino
);