nfit.c (9fb1a1903345fea598f48277576a3589a972b72e) nfit.c (5e096ef3b29e6113a7aa6a7dc4871987efa99bcb)
1/*
2 * Copyright(c) 2013-2015 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but

--- 330 unchanged lines hidden (view full) ---

339 memcpy(ars_status, ars_state->ars_status,
340 ars_state->ars_status->out_length);
341 *cmd_rc = 0;
342 }
343 spin_unlock(&ars_state->lock);
344 return 0;
345}
346
1/*
2 * Copyright(c) 2013-2015 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but

--- 330 unchanged lines hidden (view full) ---

339 memcpy(ars_status, ars_state->ars_status,
340 ars_state->ars_status->out_length);
341 *cmd_rc = 0;
342 }
343 spin_unlock(&ars_state->lock);
344 return 0;
345}
346
347static int nfit_test_cmd_clear_error(struct nd_cmd_clear_error *clear_err,
347static int nfit_test_cmd_clear_error(struct nfit_test *t,
348 struct nd_cmd_clear_error *clear_err,
348 unsigned int buf_len, int *cmd_rc)
349{
350 const u64 mask = NFIT_TEST_CLEAR_ERR_UNIT - 1;
351 if (buf_len < sizeof(*clear_err))
352 return -EINVAL;
353
354 if ((clear_err->address & mask) || (clear_err->length & mask))
355 return -EINVAL;
356
349 unsigned int buf_len, int *cmd_rc)
350{
351 const u64 mask = NFIT_TEST_CLEAR_ERR_UNIT - 1;
352 if (buf_len < sizeof(*clear_err))
353 return -EINVAL;
354
355 if ((clear_err->address & mask) || (clear_err->length & mask))
356 return -EINVAL;
357
357 /*
358 * Report 'all clear' success for all commands even though a new
359 * scrub will find errors again. This is enough to have the
360 * error removed from the 'badblocks' tracking in the pmem
361 * driver.
362 */
358 badrange_forget(&t->badrange, clear_err->address, clear_err->length);
363 clear_err->status = 0;
364 clear_err->cleared = clear_err->length;
365 *cmd_rc = 0;
366 return 0;
367}
368
369struct region_search_spa {
370 u64 addr;

--- 311 unchanged lines hidden (view full) ---

682 rc = nfit_test_cmd_ars_start(t, ars_state, buf,
683 buf_len, cmd_rc);
684 break;
685 case ND_CMD_ARS_STATUS:
686 rc = nfit_test_cmd_ars_status(ars_state, buf, buf_len,
687 cmd_rc);
688 break;
689 case ND_CMD_CLEAR_ERROR:
359 clear_err->status = 0;
360 clear_err->cleared = clear_err->length;
361 *cmd_rc = 0;
362 return 0;
363}
364
365struct region_search_spa {
366 u64 addr;

--- 311 unchanged lines hidden (view full) ---

678 rc = nfit_test_cmd_ars_start(t, ars_state, buf,
679 buf_len, cmd_rc);
680 break;
681 case ND_CMD_ARS_STATUS:
682 rc = nfit_test_cmd_ars_status(ars_state, buf, buf_len,
683 cmd_rc);
684 break;
685 case ND_CMD_CLEAR_ERROR:
690 rc = nfit_test_cmd_clear_error(buf, buf_len, cmd_rc);
686 rc = nfit_test_cmd_clear_error(t, buf, buf_len, cmd_rc);
691 break;
692 default:
693 return -ENOTTY;
694 }
695 }
696
697 return rc;
698}

--- 1548 unchanged lines hidden ---
687 break;
688 default:
689 return -ENOTTY;
690 }
691 }
692
693 return rc;
694}

--- 1548 unchanged lines hidden ---