Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Nov 2021 03:42:33 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Brooks Davis <brooks@freebsd.org>
Cc:        src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: fea4a9aff120 - main - fspacectl: remove unneeded freebsd32 wrapper
Message-ID:  <YZWviZzGhv7N6PBQ@kib.kiev.ua>
In-Reply-To: <202111180102.1AI12U1X035714@gitrepo.freebsd.org>
References:  <202111180102.1AI12U1X035714@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Nov 18, 2021 at 01:02:30AM +0000, Brooks Davis wrote:
> The branch main has been updated by brooks:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=fea4a9aff120f704eb9b348c0279cb75bb715d77
> 
> commit fea4a9aff120f704eb9b348c0279cb75bb715d77
> Author:     Brooks Davis <brooks@FreeBSD.org>
> AuthorDate: 2021-11-18 01:02:06 +0000
> Commit:     Brooks Davis <brooks@FreeBSD.org>
> CommitDate: 2021-11-18 01:02:06 +0000
> 
>     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
> ---
>  sys/compat/freebsd32/freebsd32.h               |  5 ----
>  sys/compat/freebsd32/freebsd32_misc.c          | 34 --------------------------
>  sys/compat/freebsd32/freebsd32_proto.h         |  9 -------
>  sys/compat/freebsd32/freebsd32_syscall.h       |  2 +-
>  sys/compat/freebsd32/freebsd32_syscalls.c      |  2 +-
>  sys/compat/freebsd32/freebsd32_sysent.c        |  2 +-
>  sys/compat/freebsd32/freebsd32_systrace_args.c | 16 ++++++------
>  sys/compat/freebsd32/syscalls.master           |  6 ++---
>  8 files changed, 14 insertions(+), 62 deletions(-)
> 
> diff --git a/sys/compat/freebsd32/freebsd32.h b/sys/compat/freebsd32/freebsd32.h
> index 65e4726b3de6..e5bb253aef78 100644
> --- a/sys/compat/freebsd32/freebsd32.h
> +++ b/sys/compat/freebsd32/freebsd32.h
> @@ -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_ */
> diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
> index eab217283197..69ae3a1cd85d 100644
> --- a/sys/compat/freebsd32/freebsd32_misc.c
> +++ b/sys/compat/freebsd32/freebsd32_misc.c
> @@ -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);
> -}
> diff --git a/sys/compat/freebsd32/freebsd32_proto.h b/sys/compat/freebsd32/freebsd32_proto.h
> index 113a6e704052..9e95d74621da 100644
> --- a/sys/compat/freebsd32/freebsd32_proto.h
> +++ b/sys/compat/freebsd32/freebsd32_proto.h
> @@ -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_
> diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h
> index 4f4e8ac9caf6..ac9f042c3061 100644
> --- a/sys/compat/freebsd32/freebsd32_syscall.h
> +++ b/sys/compat/freebsd32/freebsd32_syscall.h
> @@ -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
> diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c
> index 18291066c7d6..95153d6a94b5 100644
> --- a/sys/compat/freebsd32/freebsd32_syscalls.c
> +++ b/sys/compat/freebsd32/freebsd32_syscalls.c
> @@ -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 */
>  };
> diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c
> index fa167fb60707..69457336de93 100644
> --- a/sys/compat/freebsd32/freebsd32_sysent.c
> +++ b/sys/compat/freebsd32/freebsd32_sysent.c
> @@ -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 */
>  };
> diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c b/sys/compat/freebsd32/freebsd32_systrace_args.c
> index dc383154066e..fb52e939ef79 100644
> --- a/sys/compat/freebsd32/freebsd32_systrace_args.c
> +++ b/sys/compat/freebsd32/freebsd32_systrace_args.c
> @@ -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";
> diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master
> index 6b2d9fe4fae0..9dd902df04af 100644
> --- a/sys/compat/freebsd32/syscalls.master
> +++ b/sys/compat/freebsd32/syscalls.master
> @@ -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
Could you please not commit generated files together with the true source
changes?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YZWviZzGhv7N6PBQ>