All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] PM: remove deprecated user ioctls
@ 2010-01-27 10:57 Jiri Slaby
  2010-01-27 10:57 ` [PATCH 2/2] PM / Hibernate: swap, remove useless check from swsusp_read Jiri Slaby
  2010-01-27 11:22 ` [PATCH 1/2] PM: remove deprecated user ioctls Pavel Machek
  0 siblings, 2 replies; 4+ messages in thread
From: Jiri Slaby @ 2010-01-27 10:57 UTC (permalink / raw)
  To: rjw; +Cc: linux-kernel, jirislaby, Pavel Machek

They were deprecated and removed from exported headers more than 2
years ago.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Pavel Machek <pavel@ucw.cz>
---
 kernel/power/user.c |   73 ---------------------------------------------------
 1 files changed, 0 insertions(+), 73 deletions(-)

diff --git a/kernel/power/user.c b/kernel/power/user.c
index bf0014d..d7d6347 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -29,29 +29,6 @@
 
 #include "power.h"
 
-/*
- * NOTE: The SNAPSHOT_SET_SWAP_FILE and SNAPSHOT_PMOPS ioctls are obsolete and
- * will be removed in the future.  They are only preserved here for
- * compatibility with existing userland utilities.
- */
-#define SNAPSHOT_SET_SWAP_FILE	_IOW(SNAPSHOT_IOC_MAGIC, 10, unsigned int)
-#define SNAPSHOT_PMOPS		_IOW(SNAPSHOT_IOC_MAGIC, 12, unsigned int)
-
-#define PMOPS_PREPARE	1
-#define PMOPS_ENTER	2
-#define PMOPS_FINISH	3
-
-/*
- * NOTE: The following ioctl definitions are wrong and have been replaced with
- * correct ones.  They are only preserved here for compatibility with existing
- * userland utilities and will be removed in the future.
- */
-#define SNAPSHOT_ATOMIC_SNAPSHOT	_IOW(SNAPSHOT_IOC_MAGIC, 3, void *)
-#define SNAPSHOT_SET_IMAGE_SIZE		_IOW(SNAPSHOT_IOC_MAGIC, 6, unsigned long)
-#define SNAPSHOT_AVAIL_SWAP		_IOR(SNAPSHOT_IOC_MAGIC, 7, void *)
-#define SNAPSHOT_GET_SWAP_PAGE		_IOR(SNAPSHOT_IOC_MAGIC, 8, void *)
-
-
 #define SNAPSHOT_MINOR	231
 
 static struct snapshot_data {
@@ -247,7 +224,6 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
 		break;
 
 	case SNAPSHOT_CREATE_IMAGE:
-	case SNAPSHOT_ATOMIC_SNAPSHOT:
 		if (data->mode != O_RDONLY || !data->frozen  || data->ready) {
 			error = -EPERM;
 			break;
@@ -276,7 +252,6 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
 		break;
 
 	case SNAPSHOT_PREF_IMAGE_SIZE:
-	case SNAPSHOT_SET_IMAGE_SIZE:
 		image_size = arg;
 		break;
 
@@ -291,14 +266,12 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
 		break;
 
 	case SNAPSHOT_AVAIL_SWAP_SIZE:
-	case SNAPSHOT_AVAIL_SWAP:
 		size = count_swap_pages(data->swap, 1);
 		size <<= PAGE_SHIFT;
 		error = put_user(size, (loff_t __user *)arg);
 		break;
 
 	case SNAPSHOT_ALLOC_SWAP_PAGE:
-	case SNAPSHOT_GET_SWAP_PAGE:
 		if (data->swap < 0 || data->swap >= MAX_SWAPFILES) {
 			error = -ENODEV;
 			break;
@@ -320,26 +293,6 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
 		free_all_swap_pages(data->swap);
 		break;
 
-	case SNAPSHOT_SET_SWAP_FILE: /* This ioctl is deprecated */
-		if (!swsusp_swap_in_use()) {
-			/*
-			 * User space encodes device types as two-byte values,
-			 * so we need to recode them
-			 */
-			if (old_decode_dev(arg)) {
-				data->swap = swap_type_of(old_decode_dev(arg),
-							0, NULL);
-				if (data->swap < 0)
-					error = -ENODEV;
-			} else {
-				data->swap = -1;
-				error = -EINVAL;
-			}
-		} else {
-			error = -EPERM;
-		}
-		break;
-
 	case SNAPSHOT_S2RAM:
 		if (!data->frozen) {
 			error = -EPERM;
@@ -361,32 +314,6 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
 			error = hibernation_platform_enter();
 		break;
 
-	case SNAPSHOT_PMOPS: /* This ioctl is deprecated */
-		error = -EINVAL;
-
-		switch (arg) {
-
-		case PMOPS_PREPARE:
-			data->platform_support = 1;
-			error = 0;
-			break;
-
-		case PMOPS_ENTER:
-			if (data->platform_support)
-				error = hibernation_platform_enter();
-			break;
-
-		case PMOPS_FINISH:
-			if (data->platform_support)
-				error = 0;
-			break;
-
-		default:
-			printk(KERN_ERR "SNAPSHOT_PMOPS: invalid argument %ld\n", arg);
-
-		}
-		break;
-
 	case SNAPSHOT_SET_SWAP_AREA:
 		if (swsusp_swap_in_use()) {
 			error = -EPERM;
-- 
1.6.6.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] PM / Hibernate: swap, remove useless check from swsusp_read
  2010-01-27 10:57 [PATCH 1/2] PM: remove deprecated user ioctls Jiri Slaby
@ 2010-01-27 10:57 ` Jiri Slaby
  2010-01-27 11:22 ` [PATCH 1/2] PM: remove deprecated user ioctls Pavel Machek
  1 sibling, 0 replies; 4+ messages in thread
From: Jiri Slaby @ 2010-01-27 10:57 UTC (permalink / raw)
  To: rjw; +Cc: linux-kernel, jirislaby

It will never reach here if the sws_resume_bdev is erratic.
swsusp_read is called only from software_resume, but after
swsusp_check which would catch the error state.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/power/swap.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 09b2b0a..1d57573 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -657,10 +657,6 @@ int swsusp_read(unsigned int *flags_p)
 	struct swsusp_info *header;
 
 	*flags_p = swsusp_header->flags;
-	if (IS_ERR(resume_bdev)) {
-		pr_debug("PM: Image device not initialised\n");
-		return PTR_ERR(resume_bdev);
-	}
 
 	memset(&snapshot, 0, sizeof(struct snapshot_handle));
 	error = snapshot_write_next(&snapshot, PAGE_SIZE);
-- 
1.6.6.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] PM: remove deprecated user ioctls
  2010-01-27 10:57 [PATCH 1/2] PM: remove deprecated user ioctls Jiri Slaby
  2010-01-27 10:57 ` [PATCH 2/2] PM / Hibernate: swap, remove useless check from swsusp_read Jiri Slaby
@ 2010-01-27 11:22 ` Pavel Machek
  2010-01-27 11:29   ` Jiri Slaby
  1 sibling, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2010-01-27 11:22 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: rjw, linux-kernel, jirislaby

> They were deprecated and removed from exported headers more than 2
> years ago.

Should not this go through feature removal schedule etc...? Add
printks when someone uses deprecated ioctl?
									Pavel

> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Rafael J. Wysocki <rjw@sisk.pl>
> Cc: Pavel Machek <pavel@ucw.cz>
> ---
>  kernel/power/user.c |   73 ---------------------------------------------------
>  1 files changed, 0 insertions(+), 73 deletions(-)
> 
> diff --git a/kernel/power/user.c b/kernel/power/user.c
> index bf0014d..d7d6347 100644
> --- a/kernel/power/user.c
> +++ b/kernel/power/user.c
> @@ -29,29 +29,6 @@
>  
>  #include "power.h"
>  
> -/*
> - * NOTE: The SNAPSHOT_SET_SWAP_FILE and SNAPSHOT_PMOPS ioctls are obsolete and
> - * will be removed in the future.  They are only preserved here for
> - * compatibility with existing userland utilities.
> - */
> -#define SNAPSHOT_SET_SWAP_FILE	_IOW(SNAPSHOT_IOC_MAGIC, 10, unsigned int)
> -#define SNAPSHOT_PMOPS		_IOW(SNAPSHOT_IOC_MAGIC, 12, unsigned int)
> -
> -#define PMOPS_PREPARE	1
> -#define PMOPS_ENTER	2
> -#define PMOPS_FINISH	3
> -
> -/*
> - * NOTE: The following ioctl definitions are wrong and have been replaced with
> - * correct ones.  They are only preserved here for compatibility with existing
> - * userland utilities and will be removed in the future.
> - */
> -#define SNAPSHOT_ATOMIC_SNAPSHOT	_IOW(SNAPSHOT_IOC_MAGIC, 3, void *)
> -#define SNAPSHOT_SET_IMAGE_SIZE		_IOW(SNAPSHOT_IOC_MAGIC, 6, unsigned long)
> -#define SNAPSHOT_AVAIL_SWAP		_IOR(SNAPSHOT_IOC_MAGIC, 7, void *)
> -#define SNAPSHOT_GET_SWAP_PAGE		_IOR(SNAPSHOT_IOC_MAGIC, 8, void *)
> -
> -
>  #define SNAPSHOT_MINOR	231
>  
>  static struct snapshot_data {
> @@ -247,7 +224,6 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
>  		break;
>  
>  	case SNAPSHOT_CREATE_IMAGE:
> -	case SNAPSHOT_ATOMIC_SNAPSHOT:
>  		if (data->mode != O_RDONLY || !data->frozen  || data->ready) {
>  			error = -EPERM;
>  			break;
> @@ -276,7 +252,6 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
>  		break;
>  
>  	case SNAPSHOT_PREF_IMAGE_SIZE:
> -	case SNAPSHOT_SET_IMAGE_SIZE:
>  		image_size = arg;
>  		break;
>  
> @@ -291,14 +266,12 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
>  		break;
>  
>  	case SNAPSHOT_AVAIL_SWAP_SIZE:
> -	case SNAPSHOT_AVAIL_SWAP:
>  		size = count_swap_pages(data->swap, 1);
>  		size <<= PAGE_SHIFT;
>  		error = put_user(size, (loff_t __user *)arg);
>  		break;
>  
>  	case SNAPSHOT_ALLOC_SWAP_PAGE:
> -	case SNAPSHOT_GET_SWAP_PAGE:
>  		if (data->swap < 0 || data->swap >= MAX_SWAPFILES) {
>  			error = -ENODEV;
>  			break;
> @@ -320,26 +293,6 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
>  		free_all_swap_pages(data->swap);
>  		break;
>  
> -	case SNAPSHOT_SET_SWAP_FILE: /* This ioctl is deprecated */
> -		if (!swsusp_swap_in_use()) {
> -			/*
> -			 * User space encodes device types as two-byte values,
> -			 * so we need to recode them
> -			 */
> -			if (old_decode_dev(arg)) {
> -				data->swap = swap_type_of(old_decode_dev(arg),
> -							0, NULL);
> -				if (data->swap < 0)
> -					error = -ENODEV;
> -			} else {
> -				data->swap = -1;
> -				error = -EINVAL;
> -			}
> -		} else {
> -			error = -EPERM;
> -		}
> -		break;
> -
>  	case SNAPSHOT_S2RAM:
>  		if (!data->frozen) {
>  			error = -EPERM;
> @@ -361,32 +314,6 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
>  			error = hibernation_platform_enter();
>  		break;
>  
> -	case SNAPSHOT_PMOPS: /* This ioctl is deprecated */
> -		error = -EINVAL;
> -
> -		switch (arg) {
> -
> -		case PMOPS_PREPARE:
> -			data->platform_support = 1;
> -			error = 0;
> -			break;
> -
> -		case PMOPS_ENTER:
> -			if (data->platform_support)
> -				error = hibernation_platform_enter();
> -			break;
> -
> -		case PMOPS_FINISH:
> -			if (data->platform_support)
> -				error = 0;
> -			break;
> -
> -		default:
> -			printk(KERN_ERR "SNAPSHOT_PMOPS: invalid argument %ld\n", arg);
> -
> -		}
> -		break;
> -
>  	case SNAPSHOT_SET_SWAP_AREA:
>  		if (swsusp_swap_in_use()) {
>  			error = -EPERM;

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] PM: remove deprecated user ioctls
  2010-01-27 11:22 ` [PATCH 1/2] PM: remove deprecated user ioctls Pavel Machek
@ 2010-01-27 11:29   ` Jiri Slaby
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Slaby @ 2010-01-27 11:29 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Jiri Slaby, rjw, linux-kernel

On 01/27/2010 12:22 PM, Pavel Machek wrote:
>> They were deprecated and removed from exported headers more than 2
>> years ago.
> 
> Should not this go through feature removal schedule etc...? Add
> printks when someone uses deprecated ioctl?

Yeah, likely. I though about that it was moved out of exported headers,
but I realized just now that already compiled binaries are not affected
and users won't spot (only packagers do).

thanks,
-- 
js

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-01-27 11:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-27 10:57 [PATCH 1/2] PM: remove deprecated user ioctls Jiri Slaby
2010-01-27 10:57 ` [PATCH 2/2] PM / Hibernate: swap, remove useless check from swsusp_read Jiri Slaby
2010-01-27 11:22 ` [PATCH 1/2] PM: remove deprecated user ioctls Pavel Machek
2010-01-27 11:29   ` Jiri Slaby

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.