From patchwork Thu Jul 23 19:46:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40159 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6FA1A385043F; Thu, 23 Jul 2020 19:47:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6FA1A385043F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1595533624; bh=NCnTvp8YBYPQGaZGH4OESIHuarayvFxWJ8NdWMP7JH4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=oiDFb3gtD24g2wHnElTO3QEmHBdbezJMcwnF7jjOj7MCsXMGQ2Wu+/45GUnfYq9kh J+KFxQ+Jb0OKvWQ7uS7favThstkX6ueyZGzzhiV7wrmWkWL79MWPf2ItO5PN5kOf3P tSKHgwuX7gCAivhVvJqzqW5Qip+PDS7yIETHOe2A= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by sourceware.org (Postfix) with ESMTPS id D95AF38618AD for ; Thu, 23 Jul 2020 19:47:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D95AF38618AD Received: by mail-qk1-x744.google.com with SMTP id l6so6556525qkc.6 for ; Thu, 23 Jul 2020 12:47:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NCnTvp8YBYPQGaZGH4OESIHuarayvFxWJ8NdWMP7JH4=; b=c1cYqsHR90KmdU2auUrwclqOdb1CrhrkiAxuFMiVm3+MlfE98vVr5pkEcyqbSrc/3N S9bmIQeVJ2qt1ZvByKWfEGARJfEZZ2d5i4yfPgSenZ8C7s6uo+j8KkYmX7AmJm7EoUdv RVcb43BHICfjjPYaopwOkV1hnauG0cBBvx29llc9JQXV+tsQ/wVIoaFizXNinR7t6QXY EPmzc6F5Y1XtqJyhoCWodAMWaAuvDVyuH+YLOPmfDOfSeft38Isdnc0pF0o48/eU1u2m 6vj63LK9eNltTvSPNlwqAMvzkxXSytPBryXeNlfEczv4iSErkNkLSRYq7+jtJk/IV8Q8 no+Q== X-Gm-Message-State: AOAM530v0iBZ/kwE0l9f4AJj3icLafu7CZH6RZDpWwA2a4rsWLCQV3c+ JVQiCNMiepPVAEFQ7/Dmt4iozsc5dEk= X-Google-Smtp-Source: ABdhPJwDr+mgP3gH68h/xDwUnnOXJ1GlT0HHOwwsZd5nf66+mdJ8AS3ORTDQZovZkKkTFvEGxtWNSA== X-Received: by 2002:a05:620a:16af:: with SMTP id s15mr6360102qkj.304.1595533620191; Thu, 23 Jul 2020 12:47:00 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id k56sm3570639qtk.61.2020.07.23.12.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 12:46:59 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 07/16] Linux: Consolidate xmknod Date: Thu, 23 Jul 2020 16:46:32 -0300 Message-Id: <20200723194641.1949404-8-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> References: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The __NR_mknodat syscall is supported on all kernels, so the generic implementation is used as default. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski --- sysdeps/unix/sysv/linux/generic/xmknod.c | 54 ------------------------ sysdeps/unix/sysv/linux/xmknod.c | 8 ++-- 2 files changed, 3 insertions(+), 59 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/generic/xmknod.c diff --git a/sysdeps/unix/sysv/linux/generic/xmknod.c b/sysdeps/unix/sysv/linux/generic/xmknod.c deleted file mode 100644 index a51fcbee22..0000000000 --- a/sysdeps/unix/sysv/linux/generic/xmknod.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#include -#include -#include -#include -#include - -#include -#include - -/* Create a device file named PATH, with permission and special bits MODE - and device number DEV (which can be constructed from major and minor - device numbers with the `makedev' macro above). */ -int -__xmknod (int vers, const char *path, mode_t mode, dev_t *dev) -{ - unsigned long long int k_dev; - - if (vers != _MKNOD_VER) - { - __set_errno (EINVAL); - return -1; - } - - /* We must convert the value to dev_t type used by the kernel. */ - k_dev = (*dev) & ((1ULL << 32) - 1); - if (k_dev != *dev) - { - __set_errno (EINVAL); - return -1; - } - - return INLINE_SYSCALL (mknodat, 4, AT_FDCWD, path, mode, - (unsigned int) k_dev); -} -weak_alias (__xmknod, _xmknod) -libc_hidden_def (__xmknod) diff --git a/sysdeps/unix/sysv/linux/xmknod.c b/sysdeps/unix/sysv/linux/xmknod.c index 5d0ae97c34..42809d4c57 100644 --- a/sysdeps/unix/sysv/linux/xmknod.c +++ b/sysdeps/unix/sysv/linux/xmknod.c @@ -16,13 +16,10 @@ License along with the GNU C Library; if not, see . */ -#include -#include #include #include - +#include #include -#include /* Create a device file named PATH, with permission and special bits MODE and device number DEV (which can be constructed from major and minor @@ -40,7 +37,8 @@ __xmknod (int vers, const char *path, mode_t mode, dev_t *dev) if (k_dev != *dev) return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); - return INLINE_SYSCALL (mknod, 3, path, mode, (unsigned int) k_dev); + return INLINE_SYSCALL_CALL (mknodat, AT_FDCWD, path, mode, + (unsigned int) k_dev); } weak_alias (__xmknod, _xmknod)