X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=cmd%2Fzinject%2Ftranslate.c;h=b2ccb673a1936930e5b5528ad1c52bd9bf34a959;hb=f27eacc7529a5e397382425219f1fb20602563ea;hp=996075283c9121968b74800a5485146cab7f33e5;hpb=e75c13c353571efaa9b4e047f16969ec13a518f5;p=zfs.git diff --git a/cmd/zinject/translate.c b/cmd/zinject/translate.c index 9960752..b2ccb67 100644 --- a/cmd/zinject/translate.c +++ b/cmd/zinject/translate.c @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -114,8 +115,12 @@ parse_pathname(const char *inpath, char *dataset, char *relpath, return (-1); } +#ifdef HAVE_SETMNTENT + if ((fp = setmntent(MNTTAB, "r")) == NULL) { +#else if ((fp = fopen(MNTTAB, "r")) == NULL) { - (void) fprintf(stderr, "cannot open /etc/mnttab\n"); +#endif + (void) fprintf(stderr, "cannot open /etc/mtab\n"); return (-1); } @@ -476,6 +481,20 @@ translate_device(const char *pool, const char *device, err_type_t label_type, &record->zi_guid) == 0); } + /* + * Device faults can take on three different forms: + * 1). delayed or hanging I/O + * 2). zfs label faults + * 3). generic disk faults + */ + if (record->zi_timer != 0) { + record->zi_cmd = ZINJECT_DELAY_IO; + } else if (label_type != TYPE_INVAL) { + record->zi_cmd = ZINJECT_LABEL_FAULT; + } else { + record->zi_cmd = ZINJECT_DEVICE_FAULT; + } + switch (label_type) { default: break;