From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOSda-0001aW-3T for qemu-devel@nongnu.org; Wed, 27 Jan 2016 11:08:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOSdW-0001A3-1x for qemu-devel@nongnu.org; Wed, 27 Jan 2016 11:08:06 -0500 References: <1453804705-7205-1-git-send-email-famz@redhat.com> <1453804705-7205-5-git-send-email-famz@redhat.com> From: Eric Blake Message-ID: <56A8EB5A.2030001@redhat.com> Date: Wed, 27 Jan 2016 09:07:54 -0700 MIME-Version: 1.0 In-Reply-To: <1453804705-7205-5-git-send-email-famz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xDJVPhm21LboChRFwCDBpRBVs90CHdBqt" Subject: Re: [Qemu-devel] [RFC PATCH 04/16] block: Move filename_decompose to block.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , qemu-block@nongnu.org, Markus Armbruster , mreitz@redhat.com, vsementsov@parallels.com, Stefan Hajnoczi , jsnow@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --xDJVPhm21LboChRFwCDBpRBVs90CHdBqt Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/26/2016 03:38 AM, Fam Zheng wrote: > With the return value decoupled from VMDK, it can be reused by other bl= ock > code. >=20 > Signed-off-by: Fam Zheng > --- > block.c | 40 ++++++++++++++++++++++++++++++++++++++++ > block/vmdk.c | 40 ---------------------------------------- > include/block/block.h | 2 ++ > 3 files changed, 42 insertions(+), 40 deletions(-) >=20 > +++ b/block.c > @@ -144,6 +144,46 @@ int path_is_absolute(const char *path) > #endif > } > =20 > +int filename_decompose(const char *filename, char *path, char *prefix,= > + char *postfix, size_t buf_len, Error **errp) > +{ > + const char *p, *q; > + > + if (filename =3D=3D NULL || !strlen(filename)) { > + error_setg(errp, "No filename provided"); > + return -EINVAL; > + } > + p =3D strrchr(filename, '/'); > + if (p =3D=3D NULL) { > + p =3D strrchr(filename, '\\'); > + } I know this is just code motion, but it feels like it does the wrong thing on Unix boxes (trying too hard to appease Windows boxes). Is that something that needs to be independently addressed? But as for this patch, the code motion is fine. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --xDJVPhm21LboChRFwCDBpRBVs90CHdBqt Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWqOtbAAoJEKeha0olJ0Nqn+kIAKUxzCFG7r7c1/66z5pWLso7 YM4JEZ5btGCD+l/3ciwwjeCfqUgb8aFvM/sdcF6vWMnhB+epSYHCWiGrUUWk+lxS pVgWmhC/4pR/zENetgjycnJsCrJF/ku74QMMeeZ5P0ScOwSnWXNqhLBvgpQM/RnA EzYQvt6b3C5ct+ywexs71SE/Dl3p1GKsBQW9NicOmcJ8bgD8qFBeqJCd28wPO/bV a2pKoi8yQgGWAfJrIRWE7CNZ216TF5jUDvtTeO06W4Ry3vKdR32ZqaIXl8rTdCLs MFMcQRwpfcnK1mFubeAnibYOGkCDH9xnL0W1J/YjLdF6xmC/K1lpc3qBTDov6TI= =2Y03 -----END PGP SIGNATURE----- --xDJVPhm21LboChRFwCDBpRBVs90CHdBqt--