From owner-svn-src-stable-10@freebsd.org Mon Oct 5 08:18:32 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FF04A0E492; Mon, 5 Oct 2015 08:18:32 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1843C2FA; Mon, 5 Oct 2015 08:18:32 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t958IVp0009921; Mon, 5 Oct 2015 08:18:31 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t958IVQ0009920; Mon, 5 Oct 2015 08:18:31 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201510050818.t958IVQ0009920@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 5 Oct 2015 08:18:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288710 - stable/10/usr.sbin/sesutil X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Oct 2015 08:18:32 -0000 Author: bapt Date: Mon Oct 5 08:18:31 2015 New Revision: 288710 URL: https://svnweb.freebsd.org/changeset/base/288710 Log: MFC 287473,287485,287493,287494 Add a new sesutil(8) utility This is an utility for managing SCSI Enclosure Services (SES) device. For now only one command is supported "locate" which will change the test of the external LED associated to a given disk. Usage if the following: sesutil locate disk [on|off] Disk can be a device name: "da12" or a special keyword: "all". Reviewed by: mav Relnotes: yes Sponsored by: gandi.net Added: stable/10/usr.sbin/sesutil/ - copied from r287473, head/usr.sbin/sesutil/ Modified: stable/10/usr.sbin/sesutil/sesutil.c Modified: stable/10/usr.sbin/sesutil/sesutil.c ============================================================================== --- head/usr.sbin/sesutil/sesutil.c Sat Sep 5 00:06:01 2015 (r287473) +++ stable/10/usr.sbin/sesutil/sesutil.c Mon Oct 5 08:18:31 2015 (r288710) @@ -83,13 +83,13 @@ do_locate(int fd, unsigned int idx, bool static bool disk_match(const char *devnames, const char *disk, size_t len) { - const char *devname; + const char *dname; - devname = devnames; - while ((devname = strstr(devname, disk)) != NULL) { - if (devname[len] == '\0' || devname[len] == ',') + dname = devnames; + while ((dname = strstr(dname, disk)) != NULL) { + if (dname[len] == '\0' || dname[len] == ',') return (true); - devname++; + dname++; } return (false); } @@ -104,7 +104,7 @@ locate(int argc, char **argv) size_t len, i; int fd, nobj, j; bool all = false; - bool locate; + bool onoff; if (argc != 2) { errx(EXIT_FAILURE, "usage: %s locate [disk] [on|off]", @@ -114,9 +114,9 @@ locate(int argc, char **argv) disk = argv[0]; if (strcmp(argv[1], "on") == 0) { - locate = true; + onoff = true; } else if (strcmp(argv[1], "off") == 0) { - locate = false; + onoff = false; } else { errx(EXIT_FAILURE, "usage: %s locate [disk] [on|off]", getprogname()); @@ -165,17 +165,16 @@ locate(int argc, char **argv) continue; if (objdn.elm_names_len > 0) { if (all) { - do_locate(fd, objdn.elm_idx, locate); + do_locate(fd, objdn.elm_idx, onoff); continue; } if (disk_match(objdn.elm_devnames, disk, len)) { - do_locate(fd, objdn.elm_idx, locate); + do_locate(fd, objdn.elm_idx, onoff); break; } } } close(fd); - i++; } globfree(&g);