From owner-svn-src-all@freebsd.org Thu Apr 21 20:57:17 2016 Return-Path: Delivered-To: svn-src-all@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 356E2B1805F; Thu, 21 Apr 2016 20:57:17 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pa0-x233.google.com (mail-pa0-x233.google.com [IPv6:2607:f8b0:400e:c03::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0F1371FDA; Thu, 21 Apr 2016 20:57:16 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pa0-x233.google.com with SMTP id zm5so32465594pac.0; Thu, 21 Apr 2016 13:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=oY4He3oYvunKLDCOlAW67DBT1NUdIulNS3njvXnLEFw=; b=dgwp1hR7EoIrwHN2laIz4BTMqTJLm4+P/HrSHUVoT9b9YvAKCmsWDYCLBnfCRqqwkV g1tWTfo9sElP6C1KYffotySM9gKqF3b1ZSxbTHU3ZrcajZrPc8qEB+bGwitEd18xXuDR SD9ellZzzUqOq0we04nFBdSh7bLp6/QeXk8G0EZHGJgPpC1iSRav0oxksmtpUtRfesG+ O6m3Ov2PjQpAiIPNP/AL5J0UdgVSsx5b64bPQS0zV7l/7GVknOHEldPyGBQe41K3NmQE lj62FYmNNUqez+pdrJzmRlLogaE6y4kEaqmeXR1aNMVMnO82TUZBi9/EyXkgISRCXX8R XsrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=oY4He3oYvunKLDCOlAW67DBT1NUdIulNS3njvXnLEFw=; b=RY5kEuwGTBt9/3W6VOhRQlE4TilcVTOHZMdaJnvkdobx4UFSbmCuaW+Or5q78aV00J u0eoGuzEWnuvqmcIm4t3zE7gIqqNdaLZVGhkKFDOuWy0CFA8R7OVG29Lff942iV+TGPj 7vtVWPVjhpkdpO6qRypBPxcHHGujP8gmbPYv8RokEPPUHT6h5hZdplRywc/wS3wn53IW yO8ILcCaJsdS8BEHaNazshaBg6PIOVVh4YErX08Sn+gG9gii5LJ8EzSz/cg2LaRTRLml tvcY6q0gDvDzswdPE5qk/lR2taKNkr/il6rVaKG/0KlzK4r/gkosXguLEDEk2d4cv/yi Ks9Q== X-Gm-Message-State: AOPr4FXsi9f+BePrHHfdi+wZJr4TqvMERWfVbLpbOuDGwyQVc/UYs+cYp5zY1h50b3Gp4A== X-Received: by 10.66.250.132 with SMTP id zc4mr23641586pac.130.1461272236205; Thu, 21 Apr 2016 13:57:16 -0700 (PDT) Received: from [192.168.100.108] ([199.231.240.59]) by smtp.gmail.com with ESMTPSA id q70sm3099962pfj.81.2016.04.21.13.57.13 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 21 Apr 2016 13:57:14 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: svn commit: r298420 - head/sys/geom From: "Ngie Cooper (yaneurabeya)" In-Reply-To: Date: Thu, 21 Apr 2016 12:18:09 -0700 Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <201604211643.u3LGhFpR057982@repo.freebsd.org> To: Alan Somers X-Mailer: Apple Mail (2.2104) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2016 20:57:17 -0000 > On Apr 21, 2016, at 10:26, Alan Somers wrote: >=20 >=20 >=20 > On Thu, Apr 21, 2016 at 11:09 AM, Ngie Cooper = wrote: > On Thu, Apr 21, 2016 at 10:08 AM, Ngie Cooper = wrote: > > On Thu, Apr 21, 2016 at 9:43 AM, Alan Somers = wrote: > >> Author: asomers > >> Date: Thu Apr 21 16:43:15 2016 > >> New Revision: 298420 > >> URL: https://svnweb.freebsd.org/changeset/base/298420 > >> > >> Log: > >> Notify userspace listeners when geom disk attributes have changed > >> > >> sys/geom/geom_disk.c: > >> disk_attr_changed(): Generate a devctl event of type = GEOM: for > >> every call. > >> > >> MFC after: 4 weeks > >> Sponsored by: Spectra Logic Corp > >> Differential Revision: https://reviews.freebsd.org/D5952 > >> > >> Modified: > >> head/sys/geom/geom_disk.c > >> > >> Modified: head/sys/geom/geom_disk.c > >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > >> --- head/sys/geom/geom_disk.c Thu Apr 21 16:33:42 2016 = (r298419) > >> +++ head/sys/geom/geom_disk.c Thu Apr 21 16:43:15 2016 = (r298420) > >> @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); > >> #include > >> #include > >> #include > >> +#include > >> #include > >> #include > >> #include > >> @@ -839,11 +840,14 @@ disk_attr_changed(struct disk *dp, const > >> { > >> struct g_geom *gp; > >> struct g_provider *pp; > >> + char devnamebuf[128]; > > > > Why 128? Also, why not sbuf? > > > >> gp =3D dp->d_geom; > >> if (gp !=3D NULL) > >> LIST_FOREACH(pp, &gp->provider, provider) > >> (void)g_attr_changed(pp, attr, flag); > >> + snprintf(devnamebuf, 128, "devname=3D%s%d", dp->d_name, = dp->d_unit); > > > > Why not sizeof(devnamebuf) ? >=20 > Also: this doesn't NUL terminate devnamebuf; it really should > (otherwise, boom... crash in geom)... >=20 > snprintf(3) says "The output is always null-terminated." and it looks = like the kernel version does the same thing at subr_prf.c:560. Am I = missing something? Derp. Forgot that NUL termination occurs with snprintf as long as the = buffer size is specified and is correct. Please ignore this part..=