Print this page
NEX-9338 improve the layout of the crash directory (use sys/uuid.h)
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
NEX-9338 improve the layout of the crash directory
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Steve Peng <steve.peng@nexenta.com>

*** 19,28 **** --- 19,29 ---- * CDDL HEADER END */ /* * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. * Delphix (c) 2012 by Delphix. All rights reserved. + * Copyright 2017 Nexenta Systems, Inc. All rights reserved. */ /* * Dump driver. Provides ioctls to get/set crash dump configuration.
*** 44,53 **** --- 45,55 ---- #include <vm/anon.h> #include <sys/stat.h> #include <sys/conf.h> #include <sys/ddi.h> #include <sys/sunddi.h> + #include <sys/uuid.h> static dev_info_t *dump_devi; static int dump_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
*** 93,103 **** { uint64_t size; uint64_t dumpsize_in_pages; int error = 0; char *pathbuf = kmem_zalloc(MAXPATHLEN, KM_SLEEP); ! char uuidbuf[36 + 1]; size_t len; vnode_t *vp; switch (cmd) { case DIOCGETDUMPSIZE: --- 95,105 ---- { uint64_t size; uint64_t dumpsize_in_pages; int error = 0; char *pathbuf = kmem_zalloc(MAXPATHLEN, KM_SLEEP); ! char uuidbuf[UUID_PRINTABLE_STRING_LENGTH]; size_t len; vnode_t *vp; switch (cmd) { case DIOCGETDUMPSIZE:
*** 180,189 **** --- 182,204 ---- mutex_exit(&dump_lock); VN_RELE(vp); break; case DIOCDUMP: + if ((error = copyinstr((char *)arg, uuidbuf, sizeof (uuidbuf), + &len)) != 0) + break; + + if (len != UUID_PRINTABLE_STRING_LENGTH) { + error = EINVAL; + break; + } + if ((error = dump_update_uuid(uuidbuf)) != 0) { + error = EINVAL; + break; + } + mutex_enter(&dump_lock); if (dumpvp == NULL) error = ENODEV; else if (dumpvp->v_flag & VISSWAP) error = EBUSY;
*** 195,214 **** case DIOCSETUUID: if ((error = copyinstr((char *)arg, uuidbuf, sizeof (uuidbuf), &len)) != 0) break; ! if (len != 37) { error = EINVAL; break; } error = dump_set_uuid(uuidbuf); break; case DIOCGETUUID: ! error = copyoutstr(dump_get_uuid(), (void *)arg, 37, NULL); break; case DIOCRMDEV: mutex_enter(&dump_lock); if (dumpvp != NULL) --- 210,230 ---- case DIOCSETUUID: if ((error = copyinstr((char *)arg, uuidbuf, sizeof (uuidbuf), &len)) != 0) break; ! if (len != UUID_PRINTABLE_STRING_LENGTH) { error = EINVAL; break; } error = dump_set_uuid(uuidbuf); break; case DIOCGETUUID: ! error = copyoutstr(dump_get_uuid(), (void *)arg, ! UUID_PRINTABLE_STRING_LENGTH, NULL); break; case DIOCRMDEV: mutex_enter(&dump_lock); if (dumpvp != NULL)