| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. | 2 * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. |
| 3 * | 3 * |
| 4 * See file CREDITS for list of people who contributed to this | 4 * See file CREDITS for list of people who contributed to this |
| 5 * project. | 5 * project. |
| 6 * | 6 * |
| 7 * This program is free software; you can redistribute it and/or | 7 * This program is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU General Public License as | 8 * modify it under the terms of the GNU General Public License as |
| 9 * published by the Free Software Foundation; either version 2 of | 9 * published by the Free Software Foundation; either version 2 of |
| 10 * the License, or (at your option) any later version. | 10 * the License, or (at your option) any later version. |
| (...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 if (empty_blk == NULL) { | 1010 if (empty_blk == NULL) { |
| 1011 empty_blk = malloc(context->block_size); | 1011 empty_blk = malloc(context->block_size); |
| 1012 if (!empty_blk) | 1012 if (!empty_blk) |
| 1013 return -ENOMEM; | 1013 return -ENOMEM; |
| 1014 memset(empty_blk, 0, context->block_size); | 1014 memset(empty_blk, 0, context->block_size); |
| 1015 } | 1015 } |
| 1016 pages_to_write = context->pages_per_blk; | 1016 pages_to_write = context->pages_per_blk; |
| 1017 data = empty_blk; | 1017 data = empty_blk; |
| 1018 } | 1018 } |
| 1019 /* Write the data */ | 1019 /* Write the data */ |
| 1020 » » fwrite(data, 1, | 1020 » » { |
| 1021 » » » pages_to_write * context->page_size, | 1021 » » » size_t bytes = pages_to_write * context->page_size; |
| 1022 » » » context->raw_file); | 1022 |
| 1023 » » » if (fwrite(data, 1, bytes, context->raw_file) != bytes) |
| 1024 » » » » return -1; |
| 1025 » » } |
| 1023 } | 1026 } |
| 1024 | 1027 |
| 1025 free(empty_blk); | 1028 free(empty_blk); |
| 1026 return 0; | 1029 return 0; |
| 1027 } | 1030 } |
| OLD | NEW |