fspacectl: remove unneeded freebsd32 wrapper

fspacectl(2) does not require special handling on freebsd32. The
presence of off_t in a struct does not cause it's size to change
between the native ABI and the 32-bit ABI supported by freebsd32
because off_t is always int64_t on BSD systems.  Further, byte
order only requires handling for paired argument or return registers.

(32-byte alignment of 64-bit objects on i386 can require special
handling, but that situtation does not apply here.)

Reviewed by:	kib, khng, emaste, delphij
Differential Revision:	https://reviews.freebsd.org/D32994
This commit is contained in:
Brooks Davis 2021-11-18 01:02:06 +00:00
parent 4082b189d2
commit fea4a9aff1
8 changed files with 14 additions and 62 deletions

View File

@ -458,9 +458,4 @@ struct ptrace_coredump32 {
uint32_t pc_limit1, pc_limit2;
};
struct spacectl_range32 {
uint32_t r_offset1, r_offset2;
uint32_t r_len1, r_len2;
};
#endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */

View File

@ -3893,37 +3893,3 @@ ofreebsd32_sethostid(struct thread *td, struct ofreebsd32_sethostid_args *uap)
sizeof(hostid), NULL, 0));
}
#endif
int
freebsd32_fspacectl(struct thread *td, struct freebsd32_fspacectl_args *uap)
{
struct spacectl_range rqsr, rmsr;
struct spacectl_range32 rqsr32, rmsr32;
int error, cerror;
error = copyin(uap->rqsr, &rqsr32, sizeof(rqsr32));
if (error != 0)
return (error);
rqsr.r_offset = PAIR32TO64(off_t, rqsr32.r_offset);
rqsr.r_len = PAIR32TO64(off_t, rqsr32.r_len);
error = kern_fspacectl(td, uap->fd, uap->cmd, &rqsr, uap->flags,
&rmsr);
if (uap->rmsr != NULL) {
#if BYTE_ORDER == LITTLE_ENDIAN
rmsr32.r_offset1 = rmsr.r_offset;
rmsr32.r_offset2 = rmsr.r_offset >> 32;
rmsr32.r_len1 = rmsr.r_len;
rmsr32.r_len2 = rmsr.r_len >> 32;
#else
rmsr32.r_offset1 = rmsr.r_offset >> 32;
rmsr32.r_offset2 = rmsr.r_offset;
rmsr32.r_len1 = rmsr.r_len >> 32;
rmsr32.r_len2 = rmsr.r_len;
#endif
cerror = copyout(&rmsr32, uap->rmsr, sizeof(rmsr32));
if (error == 0)
error = cerror;
}
return (error);
}

View File

@ -772,13 +772,6 @@ struct freebsd32_aio_writev_args {
struct freebsd32_aio_readv_args {
char aiocbp_l_[PADL_(struct aiocb32 *)]; struct aiocb32 * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *)];
};
struct freebsd32_fspacectl_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];
char rqsr_l_[PADL_(const struct spacectl_range32 *)]; const struct spacectl_range32 * rqsr; char rqsr_r_[PADR_(const struct spacectl_range32 *)];
char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
char rmsr_l_[PADL_(struct spacectl_range32 *)]; struct spacectl_range32 * rmsr; char rmsr_r_[PADR_(struct spacectl_range32 *)];
};
#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
#define PAD64_REQUIRED
#endif
@ -929,7 +922,6 @@ int freebsd32_cpuset_setdomain(struct thread *, struct freebsd32_cpuset_setdomai
int freebsd32___sysctlbyname(struct thread *, struct freebsd32___sysctlbyname_args *);
int freebsd32_aio_writev(struct thread *, struct freebsd32_aio_writev_args *);
int freebsd32_aio_readv(struct thread *, struct freebsd32_aio_readv_args *);
int freebsd32_fspacectl(struct thread *, struct freebsd32_fspacectl_args *);
#ifdef COMPAT_43
@ -1560,7 +1552,6 @@ int freebsd11_freebsd32_fstatat(struct thread *, struct freebsd11_freebsd32_fsta
#define FREEBSD32_SYS_AUE_freebsd32___sysctlbyname AUE_SYSCTL
#define FREEBSD32_SYS_AUE_freebsd32_aio_writev AUE_AIO_WRITEV
#define FREEBSD32_SYS_AUE_freebsd32_aio_readv AUE_AIO_READV
#define FREEBSD32_SYS_AUE_freebsd32_fspacectl AUE_FSPACECTL
#undef PAD_
#undef PADL_

View File

@ -512,6 +512,6 @@
#define FREEBSD32_SYS___specialfd 577
#define FREEBSD32_SYS_freebsd32_aio_writev 578
#define FREEBSD32_SYS_freebsd32_aio_readv 579
#define FREEBSD32_SYS_freebsd32_fspacectl 580
#define FREEBSD32_SYS_fspacectl 580
#define FREEBSD32_SYS_sched_getcpu 581
#define FREEBSD32_SYS_MAXSYSCALL 582

View File

@ -621,6 +621,6 @@ const char *freebsd32_syscallnames[] = {
"__specialfd", /* 577 = __specialfd */
"freebsd32_aio_writev", /* 578 = freebsd32_aio_writev */
"freebsd32_aio_readv", /* 579 = freebsd32_aio_readv */
"freebsd32_fspacectl", /* 580 = freebsd32_fspacectl */
"fspacectl", /* 580 = fspacectl */
"sched_getcpu", /* 581 = sched_getcpu */
};

View File

@ -674,6 +674,6 @@ struct sysent freebsd32_sysent[] = {
{ .sy_narg = AS(__specialfd_args), .sy_call = (sy_call_t *)sys___specialfd, .sy_auevent = AUE_SPECIALFD, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 577 = __specialfd */
{ .sy_narg = AS(freebsd32_aio_writev_args), .sy_call = (sy_call_t *)freebsd32_aio_writev, .sy_auevent = AUE_AIO_WRITEV, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 578 = freebsd32_aio_writev */
{ .sy_narg = AS(freebsd32_aio_readv_args), .sy_call = (sy_call_t *)freebsd32_aio_readv, .sy_auevent = AUE_AIO_READV, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 579 = freebsd32_aio_readv */
{ .sy_narg = AS(freebsd32_fspacectl_args), .sy_call = (sy_call_t *)freebsd32_fspacectl, .sy_auevent = AUE_FSPACECTL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 580 = freebsd32_fspacectl */
{ .sy_narg = AS(fspacectl_args), .sy_call = (sy_call_t *)sys_fspacectl, .sy_auevent = AUE_FSPACECTL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 580 = fspacectl */
{ .sy_narg = 0, .sy_call = (sy_call_t *)sys_sched_getcpu, .sy_auevent = AUE_NULL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 581 = sched_getcpu */
};

View File

@ -3446,14 +3446,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
*n_args = 1;
break;
}
/* freebsd32_fspacectl */
/* fspacectl */
case 580: {
struct freebsd32_fspacectl_args *p = params;
struct fspacectl_args *p = params;
iarg[0] = p->fd; /* int */
iarg[1] = p->cmd; /* int */
uarg[2] = (intptr_t)p->rqsr; /* const struct spacectl_range32 * */
uarg[2] = (intptr_t)p->rqsr; /* const struct spacectl_range * */
iarg[3] = p->flags; /* int */
uarg[4] = (intptr_t)p->rmsr; /* struct spacectl_range32 * */
uarg[4] = (intptr_t)p->rmsr; /* struct spacectl_range * */
*n_args = 5;
break;
}
@ -9305,7 +9305,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
};
break;
/* freebsd32_fspacectl */
/* fspacectl */
case 580:
switch (ndx) {
case 0:
@ -9315,13 +9315,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "int";
break;
case 2:
p = "userland const struct spacectl_range32 *";
p = "userland const struct spacectl_range *";
break;
case 3:
p = "int";
break;
case 4:
p = "userland struct spacectl_range32 *";
p = "userland struct spacectl_range *";
break;
default:
break;
@ -11272,7 +11272,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
if (ndx == 0 || ndx == 1)
p = "int";
break;
/* freebsd32_fspacectl */
/* fspacectl */
case 580:
if (ndx == 0 || ndx == 1)
p = "int";

View File

@ -1199,10 +1199,10 @@
struct aiocb32 *aiocbp); }
579 AUE_AIO_READV STD { int freebsd32_aio_readv( \
struct aiocb32 *aiocbp); }
580 AUE_FSPACECTL STD { int freebsd32_fspacectl(int fd, \
580 AUE_FSPACECTL NOPROTO { int fspacectl(int fd, \
int cmd, \
const struct spacectl_range32 *rqsr, \
const struct spacectl_range *rqsr, \
int flags, \
struct spacectl_range32 *rmsr); }
struct spacectl_range *rmsr); }
581 AUE_NULL NOPROTO { int sched_getcpu(void); }
; vim: syntax=off