aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/snapshot.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2006-09-26 02:32:46 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-26 11:48:58 -0400
commitfb13a28b0f5ada60861868c4fa48a12bd0cb8dea (patch)
treee0a4611621f2d5abc94f0b0ea5a2c41f2962e5e1 /kernel/power/snapshot.c
parentae83c5eef59ffe6eb61110b8c8fd1ea3e0881712 (diff)
[PATCH] swsusp: struct snapshot_handle cleanup
Add comments describing struct snapshot_handle and its members, change the confusing name of its member 'page' to 'cur'. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/power/snapshot.c')
-rw-r--r--kernel/power/snapshot.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 979096c2777..81fe8de9e60 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -555,7 +555,7 @@ static inline struct pbe *pack_orig_addresses(unsigned long *buf, struct pbe *pb
555 555
556int snapshot_read_next(struct snapshot_handle *handle, size_t count) 556int snapshot_read_next(struct snapshot_handle *handle, size_t count)
557{ 557{
558 if (handle->page > nr_meta_pages + nr_copy_pages) 558 if (handle->cur > nr_meta_pages + nr_copy_pages)
559 return 0; 559 return 0;
560 if (!buffer) { 560 if (!buffer) {
561 /* This makes the buffer be freed by swsusp_free() */ 561 /* This makes the buffer be freed by swsusp_free() */
@@ -568,8 +568,8 @@ int snapshot_read_next(struct snapshot_handle *handle, size_t count)
568 handle->buffer = buffer; 568 handle->buffer = buffer;
569 handle->pbe = pagedir_nosave; 569 handle->pbe = pagedir_nosave;
570 } 570 }
571 if (handle->prev < handle->page) { 571 if (handle->prev < handle->cur) {
572 if (handle->page <= nr_meta_pages) { 572 if (handle->cur <= nr_meta_pages) {
573 handle->pbe = pack_orig_addresses(buffer, handle->pbe); 573 handle->pbe = pack_orig_addresses(buffer, handle->pbe);
574 if (!handle->pbe) 574 if (!handle->pbe)
575 handle->pbe = pagedir_nosave; 575 handle->pbe = pagedir_nosave;
@@ -577,15 +577,15 @@ int snapshot_read_next(struct snapshot_handle *handle, size_t count)
577 handle->buffer = (void *)handle->pbe->address; 577 handle->buffer = (void *)handle->pbe->address;
578 handle->pbe = handle->pbe->next; 578 handle->pbe = handle->pbe->next;
579 } 579 }
580 handle->prev = handle->page; 580 handle->prev = handle->cur;
581 } 581 }
582 handle->buf_offset = handle->page_offset; 582 handle->buf_offset = handle->cur_offset;
583 if (handle->page_offset + count >= PAGE_SIZE) { 583 if (handle->cur_offset + count >= PAGE_SIZE) {
584 count = PAGE_SIZE - handle->page_offset; 584 count = PAGE_SIZE - handle->cur_offset;
585 handle->page_offset = 0; 585 handle->cur_offset = 0;
586 handle->page++; 586 handle->cur++;
587 } else { 587 } else {
588 handle->page_offset += count; 588 handle->cur_offset += count;
589 } 589 }
590 handle->offset += count; 590 handle->offset += count;
591 return count; 591 return count;
@@ -820,7 +820,7 @@ int snapshot_write_next(struct snapshot_handle *handle, size_t count)
820{ 820{
821 int error = 0; 821 int error = 0;
822 822
823 if (handle->prev && handle->page > nr_meta_pages + nr_copy_pages) 823 if (handle->prev && handle->cur > nr_meta_pages + nr_copy_pages)
824 return 0; 824 return 0;
825 if (!buffer) { 825 if (!buffer) {
826 /* This makes the buffer be freed by swsusp_free() */ 826 /* This makes the buffer be freed by swsusp_free() */
@@ -831,7 +831,7 @@ int snapshot_write_next(struct snapshot_handle *handle, size_t count)
831 if (!handle->offset) 831 if (!handle->offset)
832 handle->buffer = buffer; 832 handle->buffer = buffer;
833 handle->sync_read = 1; 833 handle->sync_read = 1;
834 if (handle->prev < handle->page) { 834 if (handle->prev < handle->cur) {
835 if (!handle->prev) { 835 if (!handle->prev) {
836 error = load_header(handle, 836 error = load_header(handle,
837 (struct swsusp_info *)buffer); 837 (struct swsusp_info *)buffer);
@@ -854,15 +854,15 @@ int snapshot_write_next(struct snapshot_handle *handle, size_t count)
854 handle->buffer = get_buffer(handle); 854 handle->buffer = get_buffer(handle);
855 handle->sync_read = 0; 855 handle->sync_read = 0;
856 } 856 }
857 handle->prev = handle->page; 857 handle->prev = handle->cur;
858 } 858 }
859 handle->buf_offset = handle->page_offset; 859 handle->buf_offset = handle->cur_offset;
860 if (handle->page_offset + count >= PAGE_SIZE) { 860 if (handle->cur_offset + count >= PAGE_SIZE) {
861 count = PAGE_SIZE - handle->page_offset; 861 count = PAGE_SIZE - handle->cur_offset;
862 handle->page_offset = 0; 862 handle->cur_offset = 0;
863 handle->page++; 863 handle->cur++;
864 } else { 864 } else {
865 handle->page_offset += count; 865 handle->cur_offset += count;
866 } 866 }
867 handle->offset += count; 867 handle->offset += count;
868 return count; 868 return count;
@@ -871,5 +871,5 @@ int snapshot_write_next(struct snapshot_handle *handle, size_t count)
871int snapshot_image_loaded(struct snapshot_handle *handle) 871int snapshot_image_loaded(struct snapshot_handle *handle)
872{ 872{
873 return !(!handle->pbe || handle->pbe->next || !nr_copy_pages || 873 return !(!handle->pbe || handle->pbe->next || !nr_copy_pages ||
874 handle->page <= nr_meta_pages + nr_copy_pages); 874 handle->cur <= nr_meta_pages + nr_copy_pages);
875} 875}