}
int
-block_ioctl(struct tcb *tcp, long code, long arg)
+block_ioctl(struct tcb *tcp, const unsigned int code, long arg)
{
switch (code) {
/* take arg as a value, not as a pointer */
typedef struct ioctlent {
const char *symbol;
- unsigned long code;
+ unsigned int code;
} struct_ioctlent;
/* Trace Control Block */
extern const char *sprint_open_modes(int);
extern void print_loff_t(struct tcb *, long);
-extern const struct_ioctlent *ioctl_lookup(unsigned long);
+extern const struct_ioctlent *ioctl_lookup(const unsigned int);
extern const struct_ioctlent *ioctl_next_match(const struct_ioctlent *);
-extern int ioctl_decode(struct tcb *, long, long);
-extern int term_ioctl(struct tcb *, long, long);
-extern int sock_ioctl(struct tcb *, long, long);
-extern int proc_ioctl(struct tcb *, int, int);
-extern int rtc_ioctl(struct tcb *, long, long);
-extern int scsi_ioctl(struct tcb *, long, long);
-extern int block_ioctl(struct tcb *, long, long);
-extern int v4l2_ioctl(struct tcb *, unsigned long, long);
-extern int mtd_ioctl(struct tcb *, long, long);
-extern int ubi_ioctl(struct tcb *, long, long);
-extern int loop_ioctl(struct tcb *, long, long);
-extern int ptp_ioctl(struct tcb *, long, long);
+extern int ioctl_decode(struct tcb *, const unsigned int, long);
+extern int block_ioctl(struct tcb *, const unsigned int, long);
+extern int loop_ioctl(struct tcb *, const unsigned int, long);
+extern int mtd_ioctl(struct tcb *, const unsigned int, long);
+extern int ptp_ioctl(struct tcb *, const unsigned int, long);
+extern int rtc_ioctl(struct tcb *, const unsigned int, long);
+extern int scsi_ioctl(struct tcb *, const unsigned int, long);
+extern int sock_ioctl(struct tcb *, const unsigned int, long);
+extern int term_ioctl(struct tcb *, const unsigned int, long);
+extern int ubi_ioctl(struct tcb *, const unsigned int, long);
+extern int v4l2_ioctl(struct tcb *, const unsigned int, long);
extern int tv_nz(const struct timeval *);
extern int tv_cmp(const struct timeval *, const struct timeval *);
static int
compare(const void *a, const void *b)
{
- unsigned long code1 = (unsigned long) a;
- unsigned long code2 = ((struct_ioctlent *) b)->code;
+ const unsigned int code1 = (const unsigned long) a;
+ const unsigned int code2 = ((struct_ioctlent *) b)->code;
return (code1 > code2) ? 1 : (code1 < code2) ? -1 : 0;
}
const struct_ioctlent *
-ioctl_lookup(unsigned long code)
+ioctl_lookup(unsigned int code)
{
struct_ioctlent *iop;
code &= (_IOC_NRMASK<<_IOC_NRSHIFT) | (_IOC_TYPEMASK<<_IOC_TYPESHIFT);
- iop = bsearch((void*)code, ioctlent,
+ iop = bsearch((const void *) (const unsigned long) code, ioctlent,
nioctlents, sizeof(ioctlent[0]), compare);
while (iop > ioctlent) {
iop--;
const struct_ioctlent *
ioctl_next_match(const struct_ioctlent *iop)
{
- unsigned long code;
-
- code = iop->code;
+ const unsigned int code = iop->code;
iop++;
if (iop < ioctlent + nioctlents && iop->code == code)
return iop;
}
int
-ioctl_decode(struct tcb *tcp, long code, long arg)
+ioctl_decode(struct tcb *tcp, unsigned int code, long arg)
{
- switch ((code >> 8) & 0xff) {
+ switch (_IOC_TYPE(code)) {
#if defined(ALPHA) || defined(POWERPC)
case 'f': case 't': case 'T':
#else /* !ALPHA */
struct ioctlent {
const char* header;
const char* name;
- unsigned long code;
+ unsigned int code;
};
struct ioctlent ioctls[] = {
int nioctls = sizeof(ioctls) / sizeof(ioctls[0]);
int compare(const void* a, const void* b) {
- unsigned long code1 = ((struct ioctlent *) a)->code;
- unsigned long code2 = ((struct ioctlent *) b)->code;
+ unsigned int code1 = ((struct ioctlent *) a)->code;
+ unsigned int code2 = ((struct ioctlent *) b)->code;
const char *name1 = ((struct ioctlent *) a)->name;
const char *name2 = ((struct ioctlent *) b)->name;
return (code1 > code2) ? 1 : (code1 < code2) ? -1 : strcmp(name1, name2);
for (i = 0; i < nioctls; i++)
if (i == 0 || ioctls[i-1].code != ioctls[i].code ||
is_not_prefix(ioctls[i-1].name, ioctls[i].name))
- printf("\t{\"%s\",\t\"%s\",\t%#06lx},\n",
+ printf("\t{\"%s\",\t\"%s\",\t%#06x},\n",
ioctls[i].header, ioctls[i].name, ioctls[i].code);
return 0;
#include "xlat/loop_flags_options.h"
#include "xlat/loop_crypt_type_options.h"
-int loop_ioctl(struct tcb *tcp, long code, long arg)
+int
+loop_ioctl(struct tcb *tcp, const unsigned int code, long arg)
{
struct loop_info info;
struct loop_info64 info64;
#include "xlat/mtd_otp_options.h"
#include "xlat/mtd_nandecc_options.h"
-int mtd_ioctl(struct tcb *tcp, long code, long arg)
+int
+mtd_ioctl(struct tcb *tcp, const unsigned int code, long arg)
{
struct mtd_info_user minfo;
struct erase_info_user einfo;
#include "xlat/ubi_volume_types.h"
#include "xlat/ubi_volume_props.h"
-int ubi_ioctl(struct tcb *tcp, long code, long arg)
+int
+ubi_ioctl(struct tcb *tcp, const unsigned int code, long arg)
{
struct ubi_mkvol_req mkvol;
struct ubi_rsvol_req rsvol;
#include "xlat/ptp_flags_options.h"
-int ptp_ioctl(struct tcb *tcp, long code, long arg)
+int
+ptp_ioctl(struct tcb *tcp, const unsigned int code, long arg)
{
if (!verbose(tcp))
return 0;
}
int
-scsi_ioctl(struct tcb *tcp, long code, long arg)
+scsi_ioctl(struct tcb *tcp, const unsigned int code, long arg)
{
switch (code) {
case SG_IO:
}
int
-sock_ioctl(struct tcb *tcp, long code, long arg)
+sock_ioctl(struct tcb *tcp, const unsigned int code, long arg)
{
struct ifreq ifr;
struct ifconf ifc;
#include "xlat/baud_options.h"
#include "xlat/modem_flags.h"
-int term_ioctl(struct tcb *tcp, long code, long arg)
+int
+term_ioctl(struct tcb *tcp, const unsigned int code, long arg)
{
struct termios tios;
struct termio tio;
}
int
-rtc_ioctl(struct tcb *tcp, long code, long arg)
+rtc_ioctl(struct tcb *tcp, const unsigned int code, long arg)
{
switch (code) {
case RTC_ALM_SET:
}
int
-v4l2_ioctl(struct tcb *tcp, unsigned long code, long arg)
+v4l2_ioctl(struct tcb *tcp, const unsigned int code, long arg)
{
if (!verbose(tcp))
return 0;