From patchwork Mon Mar 10 18:29:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 14010478 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88E59231CB0 for ; Mon, 10 Mar 2025 18:30:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741631403; cv=none; b=ladFyUkSY0Rxj8CkesVBT8KKhdcTBNd4Qz78OZWY4Fum25ZO662BKAQtu20WjNzb+F3XVOTgHsiGJtLT5VLAVueDFsf40Gt1BN+bt20Z2D4w+Gf1/5r2ZJShtqJyKiVe815WbzJ9bfk+VSW9k4MkQaaSZFwiE1bXnJUwdok1Bxc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741631403; c=relaxed/simple; bh=VYSVv4yNw9347y+x8jQEySXy8gxfcTIB6IESovcXVCU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ET0lWweSF1dUknd3Wumv/RX9bIsZZEuXLdAFu9qW6MfDm97RkY6hRI1UJbZVY8cDZ1/FiEpqOlfIEUm/SQaf8DEJdHNuu4hlYnJ9G5vL5AWKqNYJzZnkvuyncbRVgzxGPt/J6Yx3idXzGm8etEbyq/bPXliQnMWCngkN20rQCeQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=hh8QWVRf; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hh8QWVRf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741631400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lii5EujfPvNNsPbeqiE48YpxIfm/oF3ZDpwp8hB+9VA=; b=hh8QWVRfARE2pVu0wSfr9qUX0qTMgm6RM02DTFn6ztWihbx3r/inz4dspRpj4nTbp7huL0 xQDHGL+8Kv+AXZ+A20mpV2Z3AxYmj+Zq8NMe2fmKrpKNpkSjNpKZXK6nD/otmsArrIDODm jwOjrAELZdfvaPzwx11H4/KDiugCBq8= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-604-Erss-XWQMLGu3mFFF2I4jA-1; Mon, 10 Mar 2025 14:29:59 -0400 X-MC-Unique: Erss-XWQMLGu3mFFF2I4jA-1 X-Mimecast-MFC-AGG-ID: Erss-XWQMLGu3mFFF2I4jA_1741631398 Received: by mail-il1-f198.google.com with SMTP id e9e14a558f8ab-3d05b1ae6e3so41460945ab.0 for ; Mon, 10 Mar 2025 11:29:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741631398; x=1742236198; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lii5EujfPvNNsPbeqiE48YpxIfm/oF3ZDpwp8hB+9VA=; b=A+/jW9vQvpqdVPzZKLkNw1NQ6xwNyITgFm0PE/YEwrh64jpAE4M2hWbvlRox/I+j40 lgZKmlCLS3SfgyjI1WPL7eD498H2cbAI8vbC3zOn18XJQ2g/jueGH1mA9uvLSQbpBgRI NWoWvkGsmKQnL5/k+AZaNPvo9QSmQboNamqb7AagV3072CntSeVM7rDmVlCXnf7d5ZuQ +RES9GihjQBkSwwbQ6siSEQrXv0tJrXjCQjfXx1ttfYAJR5CXNmhCWjZfIPJgcRkSgPZ z6zvz0laB+Wp20Wu1V7RR3HGxEHO5DdatQqnkOhxL2ZphWN1zfKmX6ga1AlTC+bJDK9U 4W1Q== X-Gm-Message-State: AOJu0Yywt7S6mC4wzYD31Ld01V6VFCC0P9KL3Iy4t8KntZI5FDanJui6 j/4vp3pwZQraq7uUYn482YP5e0kUddqtXn9jFUUaruynSWWBpoBo+h49/sevDyeyGbUnAkVJGQP aMfNB60v0Glje4ORbMVj8xY3kXuX7GAleLu7MyiYyffmTe5Q3Pny9SnOFPn8hlkflVvyMq1Nd5X FBm+JeaSDrRYDijVqaN4esT5D5QS3F1mO3sMexpCnC X-Gm-Gg: ASbGncttuyENXxK+/0xltCq3qF6LwMcJ3r28z2ipVptywuhvis4bFQs33F3xMiqfbno v4jPdSF6zo64Ye7LjSnmg3820eDDgexPUoHjoWEmeEK/Le/FT8+ArjVbSax4jsdEnA9dnQtuSkR g7PWalVFMMdSytEgJ8uCshM8jDJhQdkV64/UNBYeuW8WLxjMa000yXfxAVjJ2FGsajLYRvMYfb6 FbXfwboGFbvtUH9P/qrPwR2vDq/ZkPCuG8zSXbr23DuDURfc5ldxY3jzd5+AAxlm80ruEO3RQqk RgcY8+E4sEo9z82htz+zUTaRQnLXqgY= X-Received: by 2002:a05:6e02:1b0e:b0:3d3:fbae:397c with SMTP id e9e14a558f8ab-3d441a071a2mr119586385ab.17.1741631398248; Mon, 10 Mar 2025 11:29:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGRxzneOY5qszBxNnfIDpMV8qhIfn5u0R0LNOOwytoCPZkw3codr1LjCBPKsXNeEkJVwAzvJw== X-Received: by 2002:a05:6e02:1b0e:b0:3d3:fbae:397c with SMTP id e9e14a558f8ab-3d441a071a2mr119586205ab.17.1741631397859; Mon, 10 Mar 2025 11:29:57 -0700 (PDT) Received: from fedora-rawhide.sandeen.net ([65.128.97.82]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4f222ee2efdsm1587512173.13.2025.03.10.11.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Mar 2025 11:29:57 -0700 (PDT) From: Eric Sandeen To: fstests@vger.kernel.org Cc: djwong@kernel.org, hch@infradead.org, Eric Sandeen , Christoph Hellwig Subject: [PATCH 1/7] fstests: enable sparse checking with make C=[12] Date: Mon, 10 Mar 2025 13:29:03 -0500 Message-ID: <20250310182954.1396724-2-sandeen@redhat.com> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250310182954.1396724-1-sandeen@redhat.com> References: <20250310182954.1396724-1-sandeen@redhat.com> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Enable "make C=1" sparse checking when files get rebuilt. To check all files, run "make clean" first. Enable "make C=2" sparse checking of all files without rebuilding them. Signed-off-by: Eric Sandeen Reviewed-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- Makefile | 14 ++++++++++++++ include/buildrules | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/Makefile b/Makefile index f955f0d3..a48d8d62 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,20 @@ else Q = @ endif +CHECK=sparse +CHECK_OPTS=-Wsparse-all -Wbitwise -Wno-transparent-union -Wno-return-void -Wno-undef \ + -Wno-non-pointer-null -D__CHECK_ENDIAN__ -D__linux__ + +ifeq ("$(origin C)", "command line") + CHECK_CMD=$(CHECK) $(CHECK_OPTS) + CHECKSRC=$(C) +else + CHECK_CMD=@true + CHECKSRC=0 +endif + +export CHECK_CMD CHECKSRC + MAKEOPTS = --no-print-directory Q=$(Q) TOPDIR = . diff --git a/include/buildrules b/include/buildrules index bf187662..6c2b7e18 100644 --- a/include/buildrules +++ b/include/buildrules @@ -35,6 +35,21 @@ endif # Standard targets # +ifeq ($(CHECKSRC),2) + +# Check every .c file with sparse CHECK_CMD, do not call compiler +$(LTCOMMAND) $(LTLIBRARY) : $(SUBDIRS) $(OBJECTS) +.PHONY: $(LTCOMMAND) $(LTLIBRARY) + +%.lo %.o : %.c FORCE + @echo " [CHECK] $<" + $(Q)$(CHECK_CMD) $(CFLAGS) $< + +FORCE: + +else +# Regular build, possibly calling sparse CHECK_CMD as well + ifdef LTCOMMAND $(LTCOMMAND) : $(SUBDIRS) $(OBJECTS) $(LTDEPENDENCIES) @echo " [LD] $*" @@ -49,12 +64,16 @@ $(LTLIBRARY) : $(SUBDIRS) $(LTOBJECTS) %.lo: %.c @echo " [CC] $@" $(Q)$(LTCOMPILE) -c $< + $(Q)$(CHECK_CMD) $(CFLAGS) $< else + %.o: %.c @echo " [CC] $@" $(Q)$(CC) $(CFLAGS) -c $< + $(Q)$(CHECK_CMD) $(CFLAGS) $< endif +endif ifdef POTHEAD %.pot: $(XGETTEXTFILES) From patchwork Mon Mar 10 18:29:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 14010479 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9582B235362 for ; Mon, 10 Mar 2025 18:30:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741631404; cv=none; b=Zhs9UXnYWWENTpaLeZTOPBxYKkivMOYYtdgoOR8k/EHHXHiGyk21PGgGCjMs4JXTsK8PgKzZYNTHYtHA47WuwvtkEtC8QH1HDCB2rXNS/1WQayRe+6OPsJATAwsxgkvlOi7Einsw7H6Zk6R4c49CnfPdKM6dzrvfHmY0fUFtnZo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741631404; c=relaxed/simple; bh=WS4EwsfvJ826l9lDnqXQvWZtH5N0//w9etJh3qHGl1g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KlKGtUsaoowxAhz2QPG3BvPO8TPvVTqDIf3Q9DUIDajJZE2xBMlqLDUbbAHG9LmXiPesP8hXvBhMgF83RjtAlTIL1c6RRnvZibJg6zFXV/J/4kJ/mHmOvhA6Tmr5wBXSK1OrPP3qUL56P8MyczqxXij5yUeczsTY60NlvI0Q7mQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=fTUK6K/Q; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fTUK6K/Q" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741631401; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KkjA4WUBCvVFZmIEojLDsEz1KcGqMNnupoSBqInwxNU=; b=fTUK6K/Q+Xg0/0RNlN6jV96l30rhoRrvyPTslBaTzcOEnbKmZv+EEJbCRkFEJDk4RntLbG 3mBt+uzOupcz1nO5O6K3iSb7LPMaKe1ThnqHCn25JPfC/pYzH3p4o0z+Tzy7igeWcJTPrd JILjyEThofqZ+0Ax9FU5GEXBK/IDC7I= Received: from mail-il1-f199.google.com (mail-il1-f199.google.com [209.85.166.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-669-q0Z42G-vNf6hfE823P4Zlg-1; Mon, 10 Mar 2025 14:30:00 -0400 X-MC-Unique: q0Z42G-vNf6hfE823P4Zlg-1 X-Mimecast-MFC-AGG-ID: q0Z42G-vNf6hfE823P4Zlg_1741631399 Received: by mail-il1-f199.google.com with SMTP id e9e14a558f8ab-3d43621bb7eso42535025ab.1 for ; Mon, 10 Mar 2025 11:30:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741631399; x=1742236199; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KkjA4WUBCvVFZmIEojLDsEz1KcGqMNnupoSBqInwxNU=; b=njHm6SWK8XEe8bUhXAEs8zLPTsNSy1HgEDNE4+zfi62XOHyR7tFT6ZaRb149jMMFUT pfOdigRkhkOEQaQsc9SYPyrl3UzK7PpN0vYr1InR7mrcTpCm3hcFS3DILZ/3wz9TZXwG SqQ7QiTksqaJ/WMgCCX/WAbEcPRhykcR+ehCZ2EVQ2C2l+uPblfCwCHqJ5k69hMC/r1b Z6NqUKrmp+u3DcDitPXMsEL9q30r4hprpPTf6llVBiXktXWedOjEB9ectji9fkgpy2tm 2TO5Bx9B3T8FYdf+DgV993cZQYCnY/3yrYAmwV0UML8o3WqgmQSbJvplPb15CqKyRkx8 hPxg== X-Gm-Message-State: AOJu0Yw3rwafvhRx3YsPVUbYRx/1Vs6eN3YEgR6+u77iXcRDL12shlsv E5vsNaDojlXoGv9Mk9upejsDbP7H4dApcY8EPAiuPw40SzlZqhHPXEnao0sW298QO7ifrT8cIdR +lmkcKwPOoigyWKorAkoxKMolvLJHw3a2JbcGlCvLXIRUdPAEZA3NBHEhxDDMBWmYEoZXPyEgko G08SvDcn15hSZhQJdtmtGUDWy+RRKfZkbanOubAuBy X-Gm-Gg: ASbGncsWsfDO8oYwx7PxXFikiFE4XDM16ApS2+LEwzaBSO2x80AOWiKGcBC/r2FfJP/ 2d+Q42vFhXBbplo/jxyeW/ARBzTrT6/83Iz8SEoaGL5pjblUZG+2tJ5gcnm5+Sa6xomNYgTxakP lv/2v8G8JqExKalx4nH78j6hc5Q6DD0yoLtxi9sGtQs8DKjuZZ/Ybqel4VtWOD0kI77vPRmCDjX QFR5lv1orrFm/YswJ1aNZ8BEgI7oqS+fb3pvw5dcRaWQDngJOei3TNAN6eKsSoRvY/ncSFw8Fxt 2pfZ0yOe6VCrrOdVkrq27XYLfLF/MVg= X-Received: by 2002:a05:6e02:ecd:b0:3d4:2a80:74fb with SMTP id e9e14a558f8ab-3d46915efcemr5134685ab.3.1741631399340; Mon, 10 Mar 2025 11:29:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHliH1cGCLJ8JRAt2P9BNK6iQMPs87HW08aavU6UJxJR8utRmkIbi99MWddUNoZkwlZS0RGvQ== X-Received: by 2002:a05:6e02:ecd:b0:3d4:2a80:74fb with SMTP id e9e14a558f8ab-3d46915efcemr5134475ab.3.1741631398917; Mon, 10 Mar 2025 11:29:58 -0700 (PDT) Received: from fedora-rawhide.sandeen.net ([65.128.97.82]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4f222ee2efdsm1587512173.13.2025.03.10.11.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Mar 2025 11:29:58 -0700 (PDT) From: Eric Sandeen To: fstests@vger.kernel.org Cc: djwong@kernel.org, hch@infradead.org, Eric Sandeen Subject: [PATCH 2/7] treewide: check for #ifdef __linux__ not linux Date: Mon, 10 Mar 2025 13:29:04 -0500 Message-ID: <20250310182954.1396724-3-sandeen@redhat.com> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250310182954.1396724-1-sandeen@redhat.com> References: <20250310182954.1396724-1-sandeen@redhat.com> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There are several #ifdef linux guards in the code, which caused a few sparse warnings, because while gcc defines both linux and __linux__, sparse defines only __linux__. So, switch our guards to check for __linux__ which hch says "is the preferred version these days." Signed-off-by: Eric Sandeen Reviewed-by: Christoph Hellwig --- include/tlibio.h | 6 +++--- include/write_log.h | 2 +- lib/str_to_bytes.c | 2 +- lib/tlibio.c | 12 ++++++------ lib/write_log.c | 2 +- ltp/doio.c | 8 ++++---- ltp/iogen.c | 6 +++--- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/tlibio.h b/include/tlibio.h index 12649cf5..4f462ff1 100644 --- a/include/tlibio.h +++ b/include/tlibio.h @@ -11,7 +11,7 @@ #define LIO_IO_SYNCV 00020 /* single-buffer readv/writev */ #define LIO_IO_SYNCP 00040 /* pread/pwrite */ -#ifdef linux +#ifdef __linux__ #define LIO_IO_TYPES 00021 /* all io types */ #endif /* linux */ @@ -21,14 +21,14 @@ #define LIO_WAIT_SIGPAUSE 00100000 /* call pause */ #define LIO_WAIT_SIGACTIVE 00200000 /* spin waiting for signal */ -#ifdef linux +#ifdef __linux__ #define LIO_WAIT_TYPES 00300000 /* all wait types, except nowait */ #endif /* linux */ /* meta wait io */ /* 00 000 0000 */ -#ifdef linux +#ifdef __linux__ /* all signal wait types */ #define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE) #endif /* linux */ diff --git a/include/write_log.h b/include/write_log.h index 025ebac0..6b088416 100644 --- a/include/write_log.h +++ b/include/write_log.h @@ -79,7 +79,7 @@ struct wlog_rec { */ struct wlog_rec_disk { -#ifdef linux +#ifdef __linux__ uint w_offset : 32; /* file offset */ uint w_extra0 : 32; /* EXTRA BITS IN WORD 0 */ #endif diff --git a/lib/str_to_bytes.c b/lib/str_to_bytes.c index 2f6b2b92..89bc7d31 100644 --- a/lib/str_to_bytes.c +++ b/lib/str_to_bytes.c @@ -31,7 +31,7 @@ * ****************************************************************************/ -#if linux +#ifdef __linux__ #define B_MULT DEV_BSIZE /* block size */ #endif diff --git a/lib/tlibio.c b/lib/tlibio.c index 5b810059..ae936f41 100644 --- a/lib/tlibio.c +++ b/lib/tlibio.c @@ -74,7 +74,7 @@ #endif -#ifndef linux +#ifndef __linux__ static void lio_async_signal_handler(); #endif @@ -351,7 +351,7 @@ lio_help2(char *prefix) return; } -#ifndef linux +#ifndef __linux__ /*********************************************************************** * This is an internal signal handler. * If the handler is called, it will increment the Received_signal @@ -453,7 +453,7 @@ char **errmsg; /* char pointer that will be updated to point to err message */ long wrd; /* to allow future features, use zero for now */ { int ret = 0; /* syscall return or used to get random method */ -#ifndef linux +#ifndef __linux__ int omethod = method; int listio_cmd; /* Holds the listio/lio_listio cmd */ #endif @@ -650,7 +650,7 @@ char **errmsg; /* char pointer that will be updated to point to err message */ long wrd; /* to allow future features, use zero for now */ { int ret = 0; /* syscall return or used to get random method */ -#ifndef linux +#ifndef __linux__ int listio_cmd; /* Holds the listio/lio_listio cmd */ int omethod = method; #endif @@ -797,7 +797,7 @@ long wrd; /* to allow future features, use zero for now */ } /* end of lio_read_buffer */ -#ifndef linux +#ifndef __linux__ /*********************************************************************** * This function will check that async io was successful. * It can also be used to check sync listio since it uses the @@ -998,7 +998,7 @@ lio_wait4asyncio(int method, int fd, aiocb_t *aiocbp) } /* end of lio_wait4asyncio */ -#endif /* ifndef linux */ +#endif /* ifndef __linux__ */ #if UNIT_TEST /*********************************************************************** diff --git a/lib/write_log.c b/lib/write_log.c index cdc72593..7c58a95f 100644 --- a/lib/write_log.c +++ b/lib/write_log.c @@ -49,7 +49,7 @@ #include "write_log.h" #ifndef BSIZE -#ifdef linux +#ifdef __linux__ #define BSIZE DEV_BSIZE #else #define BSIZE BBSIZE diff --git a/ltp/doio.c b/ltp/doio.c index fd64df0f..ba080a0b 100644 --- a/ltp/doio.c +++ b/ltp/doio.c @@ -222,7 +222,7 @@ int parse_cmdline( int, char **, char * ); int lock_file_region( char *, int, int, int, int ); struct fd_cache *alloc_fdcache(char *, int); int aio_register( int, int, int ); -#ifndef linux +#ifndef __linux__ int aio_wait(int); #endif @@ -1990,7 +1990,7 @@ do_rw(req) /* * If the syscall was async, wait for I/O to complete */ -#ifndef linux +#ifndef __linux__ if(sy->sy_flags & SY_ASYNC) { for(i=0; i < nents; i++) { aio_wait(s->aioid[i]); @@ -2425,7 +2425,7 @@ int nbytes; static int mturn = 0; /* which memory type to use */ struct memalloc *M; char filename[255]; -#ifdef linux +#ifdef __linux__ struct shmid_ds shm_ds; bzero( &shm_ds, sizeof(struct shmid_ds) ); #endif @@ -2997,7 +2997,7 @@ int aio_id; return 0; } -#ifndef linux +#ifndef __linux__ int aio_wait(aio_id) int aio_id; diff --git a/ltp/iogen.c b/ltp/iogen.c index 0c8b97e9..416dedbc 100644 --- a/ltp/iogen.c +++ b/ltp/iogen.c @@ -128,7 +128,7 @@ void startup_info(FILE *stream, int seed); */ struct strmap Aio_Strat_Map[] = { -#ifndef linux +#ifndef __linux__ { "poll", A_POLL }, { "signal", A_SIGNAL }, #else @@ -1610,7 +1610,7 @@ FILE *stream; { usage(stream); fprintf(stream, "\n"); -#ifndef linux +#ifndef __linux__ fprintf(stream, "\t-a aio_type,... Async io completion types to choose. Supported types\n"); fprintf(stream, "\t are: poll, signal, suspend, and callback.\n"); fprintf(stream, "\t Default is all of the above.\n"); @@ -1643,7 +1643,7 @@ FILE *stream; fprintf(stream, "\t-q Quiet mode. Normally iogen spits out info\n"); fprintf(stream, "\t about test files, options, etc. before starting.\n"); fprintf(stream, "\t-s syscall,... Syscalls to do. Supported syscalls are\n"); -#ifdef linux +#ifdef __linux__ fprintf(stream, "\t read, write, pread, pwrite, readv, writev,\n"); fprintf(stream, "\t mmread, mmwrite, fsync2, fdatasync,\n"); fprintf(stream, "\t Default is 'read,write,readv,writev,mmread,mmwrite'.\n"); From patchwork Mon Mar 10 18:29:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 14010483 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D261230BE3 for ; Mon, 10 Mar 2025 18:30:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741631410; cv=none; b=C9QWI3dIcTY6IzqY5f8ZEuCkp5g/xoXZyL+gfj25Ej/GtpyIPsQt4utLkWvAzv1p6tjS7BlE6VJolfHcNPbsrNHRnkGj66jmAL1d9+0SMc/OflGnufeHpEOky4pzccdMJPipMguJXWfAwoAEVeMR2/4+RpS4X2LxNK3PTM1/AnM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741631410; c=relaxed/simple; bh=6BH5yt3osiJtkzyCO5oY+3/ucp8lB0ASapJ0CARQObM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LpHwvuebT7M8NeWpcsTAPUCX3x4mAyfHE3Ltc8mRR/LeoafXVFKQ3IVQtKjKflCRMukTWWzO19PtWf0Yn+26xbnEaVrfb3zKMY8LDpH/b/GpTbZ1QL7wMQsDKATXt5eJgW1RtMV2nsub8sthK83fV2OnM3lr6wXT1EYlP/TY+Yg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=bhrEne5y; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bhrEne5y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741631406; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rziwJjit7JQME4r6bAEFuHDDFZDuiZXHo0HgqqvKEEs=; b=bhrEne5yIxT6cnKIIAJv8U0EmiWYlJ9sjFo3JpggCPtUTK3if1QC0AvIghYRZfbRngWRsC s3RYCOpC3gP5zhdOSqMRj0rv+8gjL9xvjeEXCG2sTeSGeTjsS4JbRoM/IR/YWtR4bMBmFY kZcFclrHrr2tGdwd+ai/Q+3GecPtz/Y= Received: from mail-il1-f197.google.com (mail-il1-f197.google.com [209.85.166.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-193-YjYY1jISP2aQe1smDNykSw-1; Mon, 10 Mar 2025 14:30:03 -0400 X-MC-Unique: YjYY1jISP2aQe1smDNykSw-1 X-Mimecast-MFC-AGG-ID: YjYY1jISP2aQe1smDNykSw_1741631401 Received: by mail-il1-f197.google.com with SMTP id e9e14a558f8ab-3d443811f04so29520755ab.1 for ; Mon, 10 Mar 2025 11:30:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741631401; x=1742236201; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rziwJjit7JQME4r6bAEFuHDDFZDuiZXHo0HgqqvKEEs=; b=Ong9HQDw8DVdK5aDDWkn4HhadJI1IXb/5BoyDPruN2/Uz+IHp2FzLUxxgEKxcOtLWd LHTaxaMqbIjEinfsPduXKauAeORkvlLY37oDX8mfYxC12a4EvwtOn+kmdCnIkDoXSTLv 6jf7quIP48CWvE+9BmZBG6iaVx6uV9P/nZSKlpsXpo/5r6BC41+Rxep5OrBaKUH2XqjN tak2TyeO+EXg+TZuc71F6+HsKZoJZRAS9BIh9fKVs3gr0mmCp9pW06jxFf/5qLgtcMXr TkLTOZOJNJcvIgcAxja/6qv/MNI+iyZvFtlDnFd5WN3xB+Rp6AqEc4pAXs8ICuxp7u04 1kXg== X-Gm-Message-State: AOJu0Yws/dyqrTeGQ+TAPaC8maPZbrLAD1uhvnFqHwR67IjjJ+gUoKI3 Kn1+DlI+rhnuah3p8VkiOzXWSbfQphGZ+Zxi8oAPl24T4A+/zF1KAMKSrJOsHf+86dvXYf2iGY7 ejiqlxnRwNr6fNHhJ91xr9anpJiTU/sDaGE1n7RXaiXcejjj7CIxFlE82BSIxYbmh8k26DeWGmX YCcp6/oSH8VP9E5Vs3bRwJuB+CHPYv0jMq9RIYMpYt X-Gm-Gg: ASbGnctUWUd3Xi1mbaxHZndsMzi9gT7tnSC80H4QIEWANbEOMKWhC/+D6K2awEkrPWP tU+j0fLDUknuHvTA3FllsenPa5D2HQ3nq1ornn6b3H9f9b2yTBm9XnBALMP7LVppghh7diOWUAZ h0+ig9X90BOD+FK8DjZEXOET70EF6L+U/NdzjRKSWE1joujLWIGTIKA1VNWIB7Z5arKhonQARea fN06Of5QOygSsG/VsmeAU+qhAkQ798qHCek6qDBDR0mMqJRrUqCrrRHxt1VoJ5+DYgfpRc8fTXH cZLYVF+ASSYc7TjF+2sNj6keNjMXVII= X-Received: by 2002:a05:6e02:3041:b0:3d4:3ab3:e1a4 with SMTP id e9e14a558f8ab-3d441a13db1mr209516925ab.22.1741631400782; Mon, 10 Mar 2025 11:30:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFdwZl1wAoX5Q1V9wiOVYY7YPyPmxEqE1CxLgu+1sFnd8NQhLBVqI8f1pd83vV2b8vfFc8NNw== X-Received: by 2002:a05:6e02:3041:b0:3d4:3ab3:e1a4 with SMTP id e9e14a558f8ab-3d441a13db1mr209516555ab.22.1741631400215; Mon, 10 Mar 2025 11:30:00 -0700 (PDT) Received: from fedora-rawhide.sandeen.net ([65.128.97.82]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4f222ee2efdsm1587512173.13.2025.03.10.11.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Mar 2025 11:29:59 -0700 (PDT) From: Eric Sandeen To: fstests@vger.kernel.org Cc: djwong@kernel.org, hch@infradead.org, Eric Sandeen , Christoph Hellwig Subject: [PATCH 3/7] lib: Fix non-ANSI function declarations Date: Mon, 10 Mar 2025 13:29:05 -0500 Message-ID: <20250310182954.1396724-4-sandeen@redhat.com> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250310182954.1396724-1-sandeen@redhat.com> References: <20250310182954.1396724-1-sandeen@redhat.com> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 lib/ was full of non-ANSI function declarations, fix them to make sparse happier. Signed-off-by: Eric Sandeen Reviewed-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- lib/dataascii.c | 59 +++++++++++++++++++++----------------------- lib/databin.c | 28 ++++++++++----------- lib/datapid.c | 32 +++++++++--------------- lib/file_lock.c | 12 ++------- lib/forker.c | 19 ++++++--------- lib/pattern.c | 14 ++--------- lib/random_range.c | 61 ++++++++++++++-------------------------------- lib/str_to_bytes.c | 9 +++---- lib/tlibio.c | 50 ++++++++++++++++++------------------- lib/write_log.c | 32 ++++++++---------------- 10 files changed, 119 insertions(+), 197 deletions(-) diff --git a/lib/dataascii.c b/lib/dataascii.c index e2509f8d..d11609ee 100644 --- a/lib/dataascii.c +++ b/lib/dataascii.c @@ -17,18 +17,18 @@ static char Errmsg[80]; int -dataasciigen(listofchars, buffer, bsize, offset) -char *listofchars; /* a null terminated list of characters */ -char *buffer; -int bsize; -int offset; +dataasciigen( + char *listofchars, /* a null terminated list of characters */ + char *buffer, + int bsize, + int offset) { - int cnt; - int total; - int ind; /* index into CHARS array */ - char *chr; - int chars_size; - char *charlist; + int cnt; + int total; + int ind; /* index into CHARS array */ + char *chr; + int chars_size; + char *charlist; chr=buffer; total=offset+bsize; @@ -52,19 +52,19 @@ int offset; } /* end of dataasciigen */ int -dataasciichk(listofchars, buffer, bsize, offset, errmsg) -char *listofchars; /* a null terminated list of characters */ -char *buffer; -int bsize; -int offset; -char **errmsg; +dataasciichk( + char *listofchars, /* a null terminated list of characters */ + char *buffer, + int bsize, + int offset, + char **errmsg) { - int cnt; - int total; - int ind; /* index into CHARS array */ - char *chr; - int chars_size; - char *charlist; + int cnt; + int total; + int ind; /* index into CHARS array */ + char *chr; + int chars_size; + char *charlist; chr=buffer; total=offset+bsize; @@ -104,15 +104,12 @@ char **errmsg; * main for doing unit testing ***********************************************************************/ int -main(ac, ag) -int ac; -char **ag; +main(int ac, char **ag) { - -int size=1023; -char *buffer; -int ret; -char *errmsg; + int size=1023; + char *buffer; + int ret; + char *errmsg; if ((buffer=(char *)malloc(size)) == NULL ) { perror("malloc"); diff --git a/lib/databin.c b/lib/databin.c index 8a36dff3..000d0d1a 100644 --- a/lib/databin.c +++ b/lib/databin.c @@ -16,13 +16,13 @@ static char Errmsg[80]; void -databingen (mode, buffer, bsize, offset) -int mode; /* either a, c, r, o, z or C */ -unsigned char *buffer; /* buffer pointer */ -int bsize; /* size of buffer */ -int offset; /* offset into the file where buffer starts */ +databingen( + int mode, /* either a, c, r, o, z or C */ + unsigned char *buffer, /* buffer pointer */ + int bsize, /* size of buffer */ + int offset) /* offset into the file where buffer starts */ { -int ind; + int ind; switch (mode) { @@ -63,12 +63,12 @@ int ind; * < 0 : no error ***********************************************************************/ int -databinchk(mode, buffer, bsize, offset, errmsg) -int mode; /* either a, c, r, z, o, or C */ -unsigned char *buffer; /* buffer pointer */ -int bsize; /* size of buffer */ -int offset; /* offset into the file where buffer starts */ -char **errmsg; +databinchk( + int mode, /* either a, c, r, z, o, or C */ + unsigned char *buffer, /* buffer pointer */ + int bsize, /* size of buffer */ + int offset, /* offset into the file where buffer starts */ + char **errmsg) { int cnt; unsigned char *chr; @@ -138,9 +138,7 @@ char **errmsg; * main for doing unit testing ***********************************************************************/ int -main(ac, ag) -int ac; -char **ag; +main(int ac, char **ag) { int size=1023; diff --git a/lib/datapid.c b/lib/datapid.c index 15af8871..6786323d 100644 --- a/lib/datapid.c +++ b/lib/datapid.c @@ -57,15 +57,13 @@ static char Errmsg[80]; * Thus, offset 8 is in middle of word 1 ***********************************************************************/ int -datapidgen(pid, buffer, bsize, offset) -int pid; -char *buffer; -int bsize; -int offset; +datapidgen( + int pid, + char *buffer, + int bsize, + int offset) { return -1; /* not support on non-64 bits word machines */ - - } /*********************************************************************** @@ -73,12 +71,7 @@ int offset; * ***********************************************************************/ int -datapidchk(pid, buffer, bsize, offset, errmsg) -int pid; -char *buffer; -int bsize; -int offset; -char **errmsg; +datapidchk(int pid, char *buffer, int bsize, int offset, char **errmsg) { if ( errmsg != NULL ) { *errmsg = Errmsg; @@ -94,15 +87,12 @@ char **errmsg; * main for doing unit testing ***********************************************************************/ int -main(ac, ag) -int ac; -char **ag; +main( int ac, char **ag) { - -int size=1234; -char *buffer; -int ret; -char *errmsg; + int size=1234; + char *buffer; + int ret; + char *errmsg; if ((buffer=(char *)malloc(size)) == NULL ) { perror("malloc"); diff --git a/lib/file_lock.c b/lib/file_lock.c index f0791489..6d87e281 100644 --- a/lib/file_lock.c +++ b/lib/file_lock.c @@ -34,10 +34,7 @@ static char errmsg[256]; * It will loop if the LOCK_NB flags is NOT set. ***********************************************************************/ int -file_lock(fd, flags, errormsg) -int fd; -int flags; -char **errormsg; +file_lock(int fd, int flags, char **errormsg) { register int cmd, ret; struct flock flocks; @@ -109,12 +106,7 @@ char **errormsg; * It will loop if the LOCK_NB flags is NOT set. ***********************************************************************/ int -record_lock(fd, flags, start, len, errormsg) -int fd; -int flags; -int start; -int len; -char **errormsg; +record_lock(int fd, int flags, int start, int len, char **errormsg) { register int cmd, ret; struct flock flocks; diff --git a/lib/forker.c b/lib/forker.c index 63d8fcdb..10920ddb 100644 --- a/lib/forker.c +++ b/lib/forker.c @@ -105,8 +105,7 @@ int Forker_npids=0; /* number of entries in Forker_pids */ * !0 : if fork failed, the return value will be the errno. ***********************************************************************/ int -background(prefix) -char *prefix; +background(char *prefix) { switch (fork()) { case -1: @@ -131,12 +130,12 @@ char *prefix; * ***********************************************************************/ int -forker(ncopies, mode, prefix) -int ncopies; -int mode; /* 0 - all childern of parent, 1 - only 1 direct child */ -char *prefix; /* if ! NULL, an message will be printed to stderr */ - /* if fork fails. The prefix (program name) will */ - /* preceed the message */ +forker( + int ncopies, + int mode, /* 0: all childern of parent, 1: only 1 direct child */ + char *prefix) /* if ! NULL, an message will be printed to stderr */ + /* if fork fails. The prefix (program name) will */ + /* preceed the message */ { int cnt; int pid; @@ -210,9 +209,7 @@ char *prefix; /* if ! NULL, an message will be printed to stderr */ */ int -main(argc, argv) -int argc; -char **argv; +main(int argc, char **argv) { int ncopies=1; int mode=0; diff --git a/lib/pattern.c b/lib/pattern.c index d622b935..20bbdc97 100644 --- a/lib/pattern.c +++ b/lib/pattern.c @@ -12,12 +12,7 @@ */ int -pattern_check(buf, buflen, pat, patlen, patshift) -char *buf; -int buflen; -char *pat; -int patlen; -int patshift; +pattern_check(char *buf, int buflen, char *pat, int patlen, int patshift) { int nb, ncmp, nleft; char *cp; @@ -79,12 +74,7 @@ int patshift; } int -pattern_fill(buf, buflen, pat, patlen, patshift) -char *buf; -int buflen; -char *pat; -int patlen; -int patshift; +pattern_fill(char *buf, int buflen, char *pat, int patlen, int patshift) { int trans, ncopied, nleft; char *cp; diff --git a/lib/random_range.c b/lib/random_range.c index 3fa01f0d..680bf71c 100644 --- a/lib/random_range.c +++ b/lib/random_range.c @@ -73,14 +73,14 @@ static int str_to_int(); static long long divider(long long, long long, long long, long long); int -parse_ranges(str, defmin, defmax, defmult, parse_func, rangeptr, errptr) -char *str; -int defmin; -int defmax; -int defmult; -int (*parse_func)(); -char **rangeptr; -char **errptr; +parse_ranges( + char *str, + int defmin, + int defmax, + int defmult, + int (*parse_func)(), + char **rangeptr, + char **errptr) { int ncommas; char *tmpstr, *cp, *tok, *n1str, *n2str, *multstr; @@ -194,9 +194,7 @@ char **errptr; */ static int -str_to_int(str, ip) -char *str; -int *ip; +str_to_int(char *str, int *ip) { char c; @@ -214,25 +212,19 @@ int *ip; */ int -range_min(rbuf, r) -char *rbuf; -int r; +range_min(char *rbuf, int r) { return ((struct range *)rbuf)[r].min; } int -range_max(rbuf, r) -char *rbuf; -int r; +range_max(char *rbuf, int r) { return ((struct range *)rbuf)[r].max; } int -range_mult(rbuf, r) -char *rbuf; -int r; +range_mult(char *rbuf, int r) { return ((struct range *)rbuf)[r].mult; } @@ -263,11 +255,7 @@ int r; *****************************************************************************/ long -random_range(min, max, mult, errp) -int min; -int max; -int mult; -char **errp; +random_range(int min, int max, int mult, char **errp) { int r, nmults, orig_min, orig_max, orig_mult, tmp; extern long lrand48(); @@ -333,11 +321,7 @@ char **errp; * Just like random_range, but all values are longs. */ long -random_rangel(min, max, mult, errp) -long min; -long max; -long mult; -char **errp; +random_range1(long min, long max, long mult, char **errp) { long r, nmults, orig_min, orig_max, orig_mult, tmp; extern long lrand48(); @@ -424,11 +408,7 @@ char **errp; * Attempts to be just like random_range, but everything is long long (64 bit) */ long long -random_rangell(min, max, mult, errp) -long long min; -long long max; -long long mult; -char **errp; +random_rangell(long long min, long long max, long long mult, char **errp) { long long r, nmults, orig_min, orig_max, orig_mult, tmp; long long randnum; @@ -588,8 +568,7 @@ printf(" diff = %lld, half = %lld, med = %lld\n", diff, half, med); *****************************************************************************/ void -random_range_seed(s) -long s; +random_range_seed(long s) { extern void srand48(); @@ -652,9 +631,7 @@ random_bit(long mask) /* * The following is a unit test main function for random_bit(). */ -main(argc, argv) -int argc; -char **argv; +main(int argc, char **argv) { int ind; int cnt, iter; @@ -695,9 +672,7 @@ char **argv; #define MEG 1024*1024*1024 #define GIG 1073741824 int -main(argc, argv) -int argc; -char **argv; +main(int argc, char **argv) { int ind; int cnt, iter=10; diff --git a/lib/str_to_bytes.c b/lib/str_to_bytes.c index 89bc7d31..2586b006 100644 --- a/lib/str_to_bytes.c +++ b/lib/str_to_bytes.c @@ -42,8 +42,7 @@ #define T_MULT 1099511627776 /* tera or 2^40 */ int -str_to_bytes(s) -char *s; +str_to_bytes(char *s) { char mult, junk; int nconv; @@ -77,8 +76,7 @@ char *s; } long -str_to_lbytes(s) -char *s; +str_to_lbytes(char *s) { char mult, junk; long nconv; @@ -117,8 +115,7 @@ char *s; */ long long -str_to_llbytes(s) -char *s; +str_to_llbytes(char *s) { char mult, junk; long nconv; diff --git a/lib/tlibio.c b/lib/tlibio.c index ae936f41..17ab34ee 100644 --- a/lib/tlibio.c +++ b/lib/tlibio.c @@ -143,13 +143,13 @@ static int Debug_level = 0; ***********************************************************************/ int -stride_bounds(offset, stride, nstrides, bytes_per_stride, min, max) -int offset; -int stride; -int nstrides; -int bytes_per_stride; -int *min; -int *max; +stride_bounds( + int offset, + int stride, + int nstrides, + int bytes_per_stride, + int *min, + int *max) { int nbytes, min_byte, max_byte; @@ -443,14 +443,14 @@ lio_random_methods(long curr_mask) * (rrl 04/96) ***********************************************************************/ int -lio_write_buffer(fd, method, buffer, size, sig, errmsg, wrd) -int fd; /* open file descriptor */ -int method; /* contains io type and wait method bitmask */ -char *buffer; /* pointer to buffer */ -int size; /* the size of the io */ -int sig; /* signal to use if async io */ -char **errmsg; /* char pointer that will be updated to point to err message */ -long wrd; /* to allow future features, use zero for now */ +lio_write_buffer( + int fd, /* open file descriptor */ + int method, /* contains io type and wait method bitmask */ + char *buffer, /* pointer to buffer */ + int size, /* the size of the io */ + int sig, /* signal to use if async io */ + char **errmsg, /* char pointer that will be updated to point to err message */ + long wrd) /* to allow future features, use zero for now */ { int ret = 0; /* syscall return or used to get random method */ #ifndef __linux__ @@ -640,14 +640,14 @@ long wrd; /* to allow future features, use zero for now */ * (rrl 04/96) ***********************************************************************/ int -lio_read_buffer(fd, method, buffer, size, sig, errmsg, wrd) -int fd; /* open file descriptor */ -int method; /* contains io type and wait method bitmask */ -char *buffer; /* pointer to buffer */ -int size; /* the size of the io */ -int sig; /* signal to use if async io */ -char **errmsg; /* char pointer that will be updated to point to err message */ -long wrd; /* to allow future features, use zero for now */ +lio_read_buffer( + int fd, /* open file descriptor */ + int method, /* contains io type and wait method bitmask */ + char *buffer, /* pointer to buffer */ + int size, /* the size of the io */ + int sig, /* signal to use if async io */ + char **errmsg, /* char pointer that will be updated to point to err message */ + long wrd) /* to allow future features, use zero for now */ { int ret = 0; /* syscall return or used to get random method */ #ifndef __linux__ @@ -1031,9 +1031,7 @@ struct unit_info_t { }; int -main(argc, argv) -int argc; -char **argv; +main(int argc, char **argv) { extern char *optarg; extern int optind; diff --git a/lib/write_log.c b/lib/write_log.c index 7c58a95f..32567a1c 100644 --- a/lib/write_log.c +++ b/lib/write_log.c @@ -87,10 +87,7 @@ static int wlog_rec_unpack(); */ int -wlog_open(wfile, trunc, mode) -struct wlog_file *wfile; -int trunc; -int mode; +wlog_open(struct wlog_file *wfile, int trunc, int mode) { int omask, oflags; @@ -138,8 +135,7 @@ int mode; */ int -wlog_close(wfile) -struct wlog_file *wfile; +wlog_close(struct wlog_file *wfile) { close(wfile->w_afd); close(wfile->w_rfd); @@ -173,10 +169,7 @@ struct wlog_file *wfile; */ int -wlog_record_write(wfile, wrec, offset) -struct wlog_file *wfile; -struct wlog_rec *wrec; -long offset; +wlog_record_write(struct wlog_file *wfile, struct wlog_rec *wrec, long offset) { int reclen; char wbuf[WLOG_REC_MAX_SIZE + 2]; @@ -221,11 +214,11 @@ long offset; */ int -wlog_scan_backward(wfile, nrecs, func, data) -struct wlog_file *wfile; -int nrecs; -int (*func)(); -long data; +wlog_scan_backward( + struct wlog_file *wfile, + int nrecs, + int (*func)(), + long data) { int fd, leftover, nbytes, offset, recnum, reclen; char buf[BSIZE*32], *bufend, *cp, *bufstart; @@ -351,10 +344,7 @@ long data; */ static int -wlog_rec_pack(wrec, buf, flag) -struct wlog_rec *wrec; -char *buf; -int flag; +wlog_rec_pack(struct wlog_rec *wrec, char *buf, int flag) { char *file, *host, *pattern; struct wlog_rec_disk *wrecd; @@ -400,9 +390,7 @@ int flag; } static int -wlog_rec_unpack(wrec, buf) -struct wlog_rec *wrec; -char *buf; +wlog_rec_unpack(struct wlog_rec *wrec, char *buf) { char *file, *host, *pattern; struct wlog_rec_disk *wrecd; From patchwork Mon Mar 10 18:29:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 14010480 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C7102356AB for ; Mon, 10 Mar 2025 18:30:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741631406; cv=none; b=Kco7Ujr9uMG+0rsDetm5cofT22ykVG7wRsvSx8ZY9HcPfl7XpdgoAHPf9NkogSG2KDqgG7wcdb+OGRUH9Ykdl+Fxbiy4efp08QdK5cdldgUfPaJJ5QqBpCQNBa8JHVHZ+OEyVoJJkpQmjYPEyZLUbSCypLJVuLl2IKcke0xFB88= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741631406; c=relaxed/simple; bh=0t9BCgW7QPQlncTRz5pkKuwmjAjcun4gJbJwI+1/oGI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BL78QzqIPPgJnXszcoE4cwnQzChFD00pmbyiHCK0LVd7LSD/+pIifoLDqFI8dbDSq7b4heUmMKR4gGMGIQ/dpd0HLjMAkzAVHO8ENwOo3XG/czBXTPF4XO/IQadFUZDoFZDejVYdJ3bPUtrjn1HfZdFONmm4jBuba0yuKzWIBuk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=P24MmAbz; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="P24MmAbz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741631403; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vZYxbXAxz4FnZhUraCDTh0jfDoW7Ipx7CtPh87NNppI=; b=P24MmAbz177kOMHsGmflr+vYuPs9FJUj3Ge+tkoRPHDfr84zxHUk7upQB4xSpIdNQg0jCG TPMW1DrhFJurc+VELBSM/FflER/h2F1AFg+XWNqKMkIrxEgiiWsJ3FMZTWwaPKenUSgcTc LHkEuDcRP4lQlMNyoKhDmTYa0RFFb24= Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-300-MUIr3eQDPB6Rxb1Xjm5w4w-1; Mon, 10 Mar 2025 14:30:02 -0400 X-MC-Unique: MUIr3eQDPB6Rxb1Xjm5w4w-1 X-Mimecast-MFC-AGG-ID: MUIr3eQDPB6Rxb1Xjm5w4w_1741631401 Received: by mail-io1-f70.google.com with SMTP id ca18e2360f4ac-85b37197e83so164190439f.2 for ; Mon, 10 Mar 2025 11:30:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741631401; x=1742236201; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vZYxbXAxz4FnZhUraCDTh0jfDoW7Ipx7CtPh87NNppI=; b=J9Ei4/ph3v0j0GEiVee1lRPshyCQPjanJCC+Q0oRumQtUsU1B4HUhbCo+rxTrbyBjm 9oMkZPGQmZlaCFMD0si4navjuumZISnoOMW+kN012wx+ehjDreXpOvluObyIsTsxShdk 97fxkXoM7cYb38CtDG8C9YZxQQTtQ1AjZGkh0g9NrvXSO+a85LD8FUtlnby+6m758nqr rCyMYkeb/PrygdgS3nHOq3LsH7sqzISUoRMjrBzq/MgKMHQPKGAVq59A7hH7hA6Nijc0 3TAOmx2HpN+qiSg61v+y2B0LDbk/CZraodY+C8eoTCCjDu4uazGM0vbT6eWCLEgZfOYM W04w== X-Gm-Message-State: AOJu0YwOpgEVDCD7EhtWzTawpZFaMK2uoIDkpSjHy9qluC+oLEurZwLb 7sXcrl3iuTSIpl5Q0gkXRq/Hb4gOHSo0FwTJmdpD4mS0YB9uW90UNh3aXI+l1UL/RKtsoPspKwq ea4DSsiscLSIDOjrlgw+v9Vwk3lBpTIARK1m6OMt+xW/y5aFM4euTh+L51sOxn1OO6AqnRS+rAV sgP7A/v7KGlyHww4xmX1al94OjLlhI7zvS3sSub9hA X-Gm-Gg: ASbGncsny7WW72TxVR9WktQxdYYq7cpduR33sLaaeEEOKrhovHu1s+NdTnzZ0YCjv/X ICkWyfOa/DmBPfJWto3cJeVV/RyuPufvapg56LQu6mrVrbVq6+BRocjzaxw/e5hIQWMO6rriNyY q98uD4qrI3fYyxUySN09h8vjTvA3Av4HR2kNRBtOLV1tKzpGSIXc+ygZ94QfeC2Hn1Rob3SYBiC xf8uXv3//FDAQ/IoqSxAQGbXYwCiNpLYmrbnn3xNWu3TOD52JG5IhDxYXSx5sx1eNV+1X3gfyJO tfGQMHWy2ylTghPeB5+RCADADo2zgBs= X-Received: by 2002:a05:6602:6a8a:b0:85b:4afc:11d1 with SMTP id ca18e2360f4ac-85b4afc1399mr633957639f.5.1741631401335; Mon, 10 Mar 2025 11:30:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF315xHqr/2TzlOLv2q9RJN26/2xg2p2aaZqB3teqvXqtKfchY9hLoULhA3ca7yFlGesQ0n2w== X-Received: by 2002:a05:6602:6a8a:b0:85b:4afc:11d1 with SMTP id ca18e2360f4ac-85b4afc1399mr633953839f.5.1741631400964; Mon, 10 Mar 2025 11:30:00 -0700 (PDT) Received: from fedora-rawhide.sandeen.net ([65.128.97.82]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4f222ee2efdsm1587512173.13.2025.03.10.11.30.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Mar 2025 11:30:00 -0700 (PDT) From: Eric Sandeen To: fstests@vger.kernel.org Cc: djwong@kernel.org, hch@infradead.org, Eric Sandeen , Christoph Hellwig Subject: [PATCH 4/7] lib: fix empty arg function prototypes Date: Mon, 10 Mar 2025 13:29:06 -0500 Message-ID: <20250310182954.1396724-5-sandeen@redhat.com> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250310182954.1396724-1-sandeen@redhat.com> References: <20250310182954.1396724-1-sandeen@redhat.com> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Several function prototypes used () when in fact they take arguments. Fix those to make sparse happy. Signed-off-by: Eric Sandeen Reviewed-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- include/random_range.h | 2 +- include/write_log.h | 2 +- lib/random_range.c | 6 ++---- lib/string_to_tokens.c | 1 - lib/tlibio.c | 2 +- lib/write_log.c | 2 +- 6 files changed, 6 insertions(+), 9 deletions(-) diff --git a/include/random_range.h b/include/random_range.h index b47aef9e..c352c5a9 100644 --- a/include/random_range.h +++ b/include/random_range.h @@ -6,7 +6,7 @@ #ifndef _RANDOM_RANGE_H_ #define _RANDOM_RANGE_H_ -int parse_ranges ( char *, int, int, int, int (*)(), char **, char ** ); +int parse_ranges ( char *, int, int, int, int (*)(char *, int *), char **, char ** ); int range_min ( char *, int ); int range_max ( char *, int ); int range_mult ( char *, int ); diff --git a/include/write_log.h b/include/write_log.h index 6b088416..a7ad2ee4 100644 --- a/include/write_log.h +++ b/include/write_log.h @@ -125,7 +125,7 @@ extern int wlog_close(struct wlog_file *wfile); extern int wlog_record_write(struct wlog_file *wfile, struct wlog_rec *wrec, long offset); extern int wlog_scan_backward(struct wlog_file *wfile, int nrecs, - int (*func)(struct wlog_rec *rec), + int (*func)(struct wlog_rec *rec, long data), long data); #else int wlog_open(); diff --git a/lib/random_range.c b/lib/random_range.c index 680bf71c..0b38eb7f 100644 --- a/lib/random_range.c +++ b/lib/random_range.c @@ -69,7 +69,7 @@ struct range { * parse_range() returns -1 on error, or the number of ranges parsed. */ -static int str_to_int(); +static int str_to_int(char *str, int *ip); static long long divider(long long, long long, long long, long long); int @@ -78,7 +78,7 @@ parse_ranges( int defmin, int defmax, int defmult, - int (*parse_func)(), + int (*parse_func)(char *str, int *ip), char **rangeptr, char **errptr) { @@ -570,8 +570,6 @@ printf(" diff = %lld, half = %lld, med = %lld\n", diff, half, med); void random_range_seed(long s) { - extern void srand48(); - srand48(s); } diff --git a/lib/string_to_tokens.c b/lib/string_to_tokens.c index 08df9fcc..8383ed4c 100644 --- a/lib/string_to_tokens.c +++ b/lib/string_to_tokens.c @@ -54,7 +54,6 @@ int string_to_tokens(char *arg_string, char *arg_array[], int array_size, char *separator) { int num_toks = 0; /* number of tokens found */ - char *strtok(); if ( arg_array == NULL || array_size <= 1 || separator == NULL ) return -1; diff --git a/lib/tlibio.c b/lib/tlibio.c index 17ab34ee..75f10cec 100644 --- a/lib/tlibio.c +++ b/lib/tlibio.c @@ -75,7 +75,7 @@ #ifndef __linux__ -static void lio_async_signal_handler(); +static void lio_async_signal_handler(int sig); #endif /* diff --git a/lib/write_log.c b/lib/write_log.c index 32567a1c..eb3fa2b3 100644 --- a/lib/write_log.c +++ b/lib/write_log.c @@ -217,7 +217,7 @@ int wlog_scan_backward( struct wlog_file *wfile, int nrecs, - int (*func)(), + int (*func)(struct wlog_rec *, long data), long data) { int fd, leftover, nbytes, offset, recnum, reclen; From patchwork Mon Mar 10 18:29:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 14010481 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EEA82356AA for ; Mon, 10 Mar 2025 18:30:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741631407; cv=none; b=cNV5HgSrXFUKcT21cBfhcaJ5Pq9+DQx5CFU04u00dVLwjx1B1B3IAgf9OcykGaaQuPtFpmU7RA0tg9Ijmhf1xVrxMqc9tVAbS4hzdiP/2wPHyUZG8YCHv93zkfTB9AAIeCYic2Ze+JRG43TZz2nEeofwJ6qEF8CJ54VN4B2Mt4A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741631407; c=relaxed/simple; bh=jBdY0mo2vgWMSmvDnelDdrM9/pN4RUvOPj9hbeyurr4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ndwHX9ygggfMogmOF4qn8oY5wKUjS6OiSKbCF/pf2hzu0RVbhRauJKsvB6GLwjDWGyAbLnn6IV+NOtqSTgVSpdDLfr3T9nTWMVRfo1En2Qt0qVlqULzdWfHV2BNHkhq5lekPqHiFjssgOMZuwrPgKuxaINEGYcEpSDbWe1WBMfw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=LxlqdLT6; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LxlqdLT6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741631404; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7Oz2FBjvUAa5LzJk847xEj48krMp/+FjZ6+AxKkihX4=; b=LxlqdLT6lr4RXu/+zCwd69tKS/IioOeobQ2Evx9kdKDKeTqhBbrgnoXie97P+bTZRg379O oDXz4SPPlJlULF4e7fizuJ04w5LDiWIBXohwCLhWVZ2hoHIi4h5j8Cjlp3eGUecmldx2YX MceM71KStdhuWYIpwObDqnLv+8BawsQ= Received: from mail-il1-f199.google.com (mail-il1-f199.google.com [209.85.166.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-663-0jbiRh5PMNavDqD-r_OnCQ-1; Mon, 10 Mar 2025 14:30:03 -0400 X-MC-Unique: 0jbiRh5PMNavDqD-r_OnCQ-1 X-Mimecast-MFC-AGG-ID: 0jbiRh5PMNavDqD-r_OnCQ_1741631402 Received: by mail-il1-f199.google.com with SMTP id e9e14a558f8ab-3d2a6b4b2d4so83201495ab.2 for ; Mon, 10 Mar 2025 11:30:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741631402; x=1742236202; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7Oz2FBjvUAa5LzJk847xEj48krMp/+FjZ6+AxKkihX4=; b=D2viTYyyzemNXe4QNrrj6jKL/ZBb+1FMCQn4La8sR68Bgexp8fhychSgqd3TE7A7bl A9yzfN1DbnDDO+4ZmNz0fM9P7ZTprAJQkNWvLWijeKVVEg3ylGgs9nxa5EF7ef+AN11f gITLZawshKzeF2NA3vzUz79jQ+JVTvW1zbbCl7Rrh3ggCB2+ebhpqpoUUoIDRKqIkx/m 1xiVEyTbryjrL+YjJJhGBDloqfR1//+h09t5cLFx63q46Tk+ix7oi//pwFOqxQ3xmdkB bmG2sUnusxfbe76xnmGLlTFaE73kTNtUtH2HXJHLENJusv9vvm4KtiMCoerA3bjwC7tn vrgA== X-Gm-Message-State: AOJu0YwKY9Y66BwFq8eM6uqgyH3wmDAsr/zXOtjHMmzjR+9ivptcjnaQ TCAuADfCXLF33vnLUzMW86mnKo4OE/csYVfnFZ3VOtZaJKwGZUS97GoW3A/dbeVDzKPlHOcUU0P Gvet1jVJ4fi6SO7XGgLCOKzfcJGuqtJqqris5vcmA+a7GgV782/P6YkHk6Kk5QBQwWbS+3gjwOk Zvbvsf7N+2036kN1+cL4HyUIceWkAizSOakaqrMSmh X-Gm-Gg: ASbGncs99j4J+fEoasmEeLnDL7BpX0Om6ep3tra/eSTHel81SaKi+pu+UPZSXdnpchp RcgXTFWAZJRalCAUM/RKht/32k0id/+hOiq58VKlRf1LDbjnKLwgHaoe4XutejNFdt0hNY2kujq rL3eHr+RsLsYJSDf4mh7it8BE6MOY8EwBpXDS9TmAihmDl8wGQQkMSqRyW0aVGJL9rLm4A5PRTP gC9vqk7YlirHfarJmegOc9LjW/YSCsEfSQ4i2aP840Rls729YG7p0RU34y2tujXA+0/ZzG8L/+S an4B/CNTFnRuJpsjHKtLCY+754N0qnI= X-Received: by 2002:a05:6e02:1aaa:b0:3d4:3d63:e076 with SMTP id e9e14a558f8ab-3d44192e5f9mr204817935ab.18.1741631402439; Mon, 10 Mar 2025 11:30:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH2EZ2cRwM+hF1ITF8lv8BIyCdRDQqEuqubnekLrwUN1QPAwEX/+WpOGaaYvc1Tk/EI87Wk2w== X-Received: by 2002:a05:6e02:1aaa:b0:3d4:3d63:e076 with SMTP id e9e14a558f8ab-3d44192e5f9mr204817585ab.18.1741631401962; Mon, 10 Mar 2025 11:30:01 -0700 (PDT) Received: from fedora-rawhide.sandeen.net ([65.128.97.82]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4f222ee2efdsm1587512173.13.2025.03.10.11.30.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Mar 2025 11:30:01 -0700 (PDT) From: Eric Sandeen To: fstests@vger.kernel.org Cc: djwong@kernel.org, hch@infradead.org, Eric Sandeen , Christoph Hellwig Subject: [PATCH 5/7] lib: replace aiocb_t with struct aiocb Date: Mon, 10 Mar 2025 13:29:07 -0500 Message-ID: <20250310182954.1396724-6-sandeen@redhat.com> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250310182954.1396724-1-sandeen@redhat.com> References: <20250310182954.1396724-1-sandeen@redhat.com> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 aiocb_t isn't defined anywhere, use struct aiocb instead, to make sparse happy. Signed-off-by: Eric Sandeen Reviewed-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- lib/tlibio.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/tlibio.c b/lib/tlibio.c index 75f10cec..9d852ff0 100644 --- a/lib/tlibio.c +++ b/lib/tlibio.c @@ -42,6 +42,7 @@ * */ +#include #include #include #include @@ -810,7 +811,7 @@ lio_read_buffer( * (rrl 04/96) ***********************************************************************/ int -lio_check_asyncio(char *io_type, int size, aiocb_t *aiocbp, int method) +lio_check_asyncio(char *io_type, int size, const struct aiocb *aiocbp, int method) { int ret; int cnt = 1; @@ -895,9 +896,10 @@ lio_check_asyncio(char *io_type, int size, aiocb_t *aiocbp, int method) * (rrl 04/96) ***********************************************************************/ int -lio_wait4asyncio(int method, int fd, aiocb_t *aiocbp) +lio_wait4asyncio(int method, int fd, const struct aiocb *aiocbp) { - int cnt; + struct aiocb *const aioary[1]; + int cnt, ret; if ( (method & LIO_WAIT_RECALL) || ((method & LIO_WAIT_TYPES) == 0) ){ From patchwork Mon Mar 10 18:29:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 14010482 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4B9B155393 for ; Mon, 10 Mar 2025 18:30:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741631408; cv=none; b=XdYE5RvbbJZ7k2ogHiScRF4AvBY3hMcPZtUl1elLndMpnybheuE+HXBY4hWhq8MvcbDj/01mtSftKzK1Ziuyd3N0RPkes9Rmcx7/QnSeTBeDUnjC4iae3uPgdg4vMce0fG8t1MuzHDn6bykEDaS/KSvk8KfvzUBqQE92Vbj+0Sk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741631408; c=relaxed/simple; bh=9Q7Py2bnLyippDA+94RMm4w8ETYur8LkWSMq+msM2Mk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JOQYxCKVXIpD+9XoyrjvZVanNiCis7ppZpn1cImPWQqbBiiKGE6rE9HGOYyuazuXi44yNg5d4ZbNhmZJoczO0hRb+AKTnp4vyONnmEMNun5vgDHYUklQFAh9NQeljyHkI+a68MY/LlmBHUNzIdwJNXrPRtBKZzFNHtDzm2UuIjU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=B5tFzkth; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="B5tFzkth" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741631405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CWnkmrJjEm4LokhSnpmQEw676unRv8bGBzQ8jrQXABY=; b=B5tFzkth2JtMA9sVOjxUhfVDF4yZ/we5reTmOwKecdfzIDuDTtVFomweMTRMyO1qmWIjb9 UiIJ3JiWpF9HjuthTUwcLPEP69thIIccVvSPGKijhSDZP1+0GN4GilAxbq6BLIu4O6WhrJ qddnjTYSdH1CinK1JU8T10a4uTGHkGw= Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-407-v0-CcqOsPXa4XUpOJMJvLA-1; Mon, 10 Mar 2025 14:30:04 -0400 X-MC-Unique: v0-CcqOsPXa4XUpOJMJvLA-1 X-Mimecast-MFC-AGG-ID: v0-CcqOsPXa4XUpOJMJvLA_1741631404 Received: by mail-io1-f72.google.com with SMTP id ca18e2360f4ac-85ad875acccso1032795039f.3 for ; Mon, 10 Mar 2025 11:30:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741631403; x=1742236203; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CWnkmrJjEm4LokhSnpmQEw676unRv8bGBzQ8jrQXABY=; b=RigXcPVexn6kIZrRH0Mux2jPvSMMMKYIgOzz1BCSRCHqFYWT85yQJzYJWGd/a431yp 2pgH5zkt9T8bEuPkzv1vq9qcBw47DgP8QBuI4mMNWzqCzNXiYxEvM2nK+kwgx5O3OXmR XacEHaJ8Fkmssv/KaiGPTj/PtPSFp+MoaLmCD9Bt0m65Q3wbvLqfRJ5ZtNc7Wix0GDmO qcyn+SHYMSGU378pKlrtJ69/gCeROxw+rLkmj6cEiHa3tEd075w6FqvgWUhtg2R+acoi abyVkuZZtZ1XnT/j+vzRnFPuvUELoSIoZffgRR7u0A9se45CbqIVhVfvcolvom4SVrqv HvjQ== X-Gm-Message-State: AOJu0Yx/1lSIAY8kJ53HWZx/dxPRf9IV3tQTiKMx79w0OOI1yZ5OIrXp jBSJFeV4NBkvnRaGUOXbBDzjxzhsMUGpnTv0nq/UozsUuE4rLlO5vCi3fltVhrBOH0v28snXWER e8ZGT1tkYAXQPYMLlWZPvMy8D6IXe1Le/tq1M4/6ZXH5sqDrrMoGgaQM30CcdR75QD3Z2UE6oR3 26bwz79qX3y5RfrjGUlbCaNddzs/FubghFGU5ChnvL X-Gm-Gg: ASbGncupJ9SHcKwOUzLfQl1CSy/qJkBAbkwL0G0qw+Cm3A93nKhj/FPrXOUOAy503E5 1Hb64czL2Dgq36JTe616f6xnI8jMtLdetTlSM+dpL12XYJDx3Dc8Esx0RPul+QzJGKMa/RIleoy fDPPWINWUpn+IvTmrmqkGE2dUkwrWKGXf6+lh8mT5DesyxD7eWYIGWPyvaOY+siTab8uilWOvtH 9iaYMtS59pYls5xcRkQ+oLAFlYaJQhZ0af+iB/V1QNRhWSTTfXrjb5CI3zzdIfe2q/ujF6Hi922 HYR/vTy/VPzlQJVPhRvIi6S1LuiGGK4= X-Received: by 2002:a05:6e02:1b0a:b0:3d0:4a82:3f43 with SMTP id e9e14a558f8ab-3d46890d179mr9240385ab.5.1741631403619; Mon, 10 Mar 2025 11:30:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERwb88aMen7Qjf3hR8EUXwCKhaZxCe+vgMvJ4c4hyvS2ei3zdTgqaeP9XGdsBXap9djA5RnA== X-Received: by 2002:a05:6e02:1b0a:b0:3d0:4a82:3f43 with SMTP id e9e14a558f8ab-3d46890d179mr9240195ab.5.1741631403239; Mon, 10 Mar 2025 11:30:03 -0700 (PDT) Received: from fedora-rawhide.sandeen.net ([65.128.97.82]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4f222ee2efdsm1587512173.13.2025.03.10.11.30.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Mar 2025 11:30:02 -0700 (PDT) From: Eric Sandeen To: fstests@vger.kernel.org Cc: djwong@kernel.org, hch@infradead.org, Eric Sandeen , Christoph Hellwig Subject: [PATCH 6/7] lib: make a few symbols static Date: Mon, 10 Mar 2025 13:29:08 -0500 Message-ID: <20250310182954.1396724-7-sandeen@redhat.com> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250310182954.1396724-1-sandeen@redhat.com> References: <20250310182954.1396724-1-sandeen@redhat.com> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There are a few symbols in lib/tlibio.c which should be static, and sparse notices this so fix it. Signed-off-by: Eric Sandeen Reviewed-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- lib/tlibio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tlibio.c b/lib/tlibio.c index 9d852ff0..73851fd8 100644 --- a/lib/tlibio.c +++ b/lib/tlibio.c @@ -82,6 +82,7 @@ static void lio_async_signal_handler(int sig); /* * Define the structure as used in lio_parse_arg1 and lio_help1 */ +static struct lio_info_type Lio_info1[] = { { "s", LIO_IO_SYNC, "sync i/o" }, { "p", LIO_IO_ASYNC|LIO_WAIT_SIGACTIVE, "async i/o using a loop to wait for a signal" }, @@ -101,6 +102,7 @@ struct lio_info_type Lio_info1[] = { /* * Define the structure used by lio_parse_arg2 and lio_help2 */ +static struct lio_info_type Lio_info2[] = { { "sync", LIO_IO_SYNC, "sync i/o (read/write)"}, { "async", LIO_IO_ASYNC, "async i/o (reada/writea/aio_read/aio_write)" }, @@ -120,7 +122,7 @@ struct lio_info_type Lio_info2[] = { "all random i/o types and wait methods (except nowait)" }, }; -char Lio_SysCall[PATH_MAX]; /* string containing last i/o system call */ +static char Lio_SysCall[PATH_MAX]; /* string containing last i/o system call */ static volatile int Received_signal = 0; /* number of signals received */ static volatile int Rec_signal; From patchwork Mon Mar 10 18:29:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 14010484 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 834CD155393 for ; Mon, 10 Mar 2025 18:30:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741631410; cv=none; b=mNxIgnmwOiGmekzF2+sj+9x4TFmZWILUoblyIeSu/X+1zdDWxX4jt2nBVzV0bqc/PNiSE54DTm198UAdujr1IT08gUxc8+TFsldqQnniZLlHbC/ERqwfsjoNeHDR1i3yS0O54lHkJyJelOYfj+pOCwXjfD5Gq6khfhYxUmXS4Xw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741631410; c=relaxed/simple; bh=g9AMFS2pLaNP2/8ZfsPeL96KOZZ1HNSrFxF4UmyQbWc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SYeQK9ymg9FEPKwHQf0zQOmh2Cio6MyJUZUOVQioJGlSxWrIB/E7khsSUrrPVSQQGEOs4/smHQmoLmi8u4WzyhtkboOFnuhv4b7EIwBfFlfbxebblmfudfJ9y7rkt1oBcU8h9QntR+vOQWOalqDbFqC0XWELNQmirWwBc9MzKrI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=SsVQ5b5/; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SsVQ5b5/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741631407; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d/BbupdrNsXT+97/gNmiatqpkKXDA1TzNydLm0ut1UM=; b=SsVQ5b5//mG9w4QBHdch9Vl/lRZ/PcRm2nDn5+aLvdWzgz4z751/0Wd4G69Mewp29QfOiu w8U43nYi5Ka82x02ZW36YEUhQLTtiDU2LwC2oObxLw57W0c2cv2vfUeTbCP4c6g8ZKmTNu iAyFYhsmPSP0SLEwUUISAoPAD3rn/i0= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-138-h0FmcPhHO0mrDjEikMI3Ew-1; Mon, 10 Mar 2025 14:30:06 -0400 X-MC-Unique: h0FmcPhHO0mrDjEikMI3Ew-1 X-Mimecast-MFC-AGG-ID: h0FmcPhHO0mrDjEikMI3Ew_1741631405 Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-8555eff9e0dso366295539f.2 for ; Mon, 10 Mar 2025 11:30:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741631405; x=1742236205; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d/BbupdrNsXT+97/gNmiatqpkKXDA1TzNydLm0ut1UM=; b=pTTSRk2peU2GUwE+6SoZBtFUp0Nabx9eHIJsTAS2+0ogizJl4Y2CbvLl/LXh+2uDf4 eezX2VlgmEyNGxR1E6NF31i6GEmYY1HeEjEbh0OBbtWBpestVTNRAbwhrf2N+7k4cXAi w6R6RbwTTSDEJFmydW1XQeyy9WkuW+OyUf0+2nDH1/ZSzrI8DqK/jKiAsDGZ8Z/TKd/P Tcj3OruIHpc2p8aKB+px+ATQrRbU6pjKxTXD21nkHw4gZty7hDNd5VP+aQgZpkKyTY1V AKN8WmQNgwrVh0Nti71RSlEuGmVkCr7qqiROIvuG7khjlt1lCrOhZKVVooG9Bam9AVe/ SjrA== X-Gm-Message-State: AOJu0YxhOC7bE/jhh+HcKh9VeCNAJcgAE71tTZANMxDHfKzekwNyeq0z KEPebRyoAZu4L2z0plSg0LEoI4ZkYzoATJDIFGZ7hPKRzgC+Zn7u46bdFAsdkebz0hS0+iRxTRP iTSkhK9ApheHwf7FlFaXUwqdh04t13gnM57gogyNhgOykQpzvmLPBJ34vKFc3CXkz4WHI4kkdlh xfQIbHFde4/Tj8RDdir6PLX1SfPzSaPf1BQKt+xs23 X-Gm-Gg: ASbGncveisAcWVGP/aG2r3sNhKrPZ/l0iPWAFYh+VVFLX/iepiY5xFfobfF7XaIj7XF Iwg95ZBHucQh6gBK9qRQcyMG4nCgSJDDhz1PAMwhdd3Yxoa5qp0nPbr+mzaCMjhlbsls4kgt4+1 8xlHE6J8VUd9uuCcFVZMFmGhusOuHz3LhX119AF42I8xLE0cEkUAvnOXFazXNC5fMdeRPgfLgQU ChYHaQzwq9tkpUMn+BZU2D8BXLV7MUqZGO6AX03/cv9S2QTlI4U3V64J6pGfT43c5BtoNKM/AOi XcvLwQK1EhErUJLpFa+NW42hsj4ubko= X-Received: by 2002:a05:6602:6a94:b0:85a:e24f:2b53 with SMTP id ca18e2360f4ac-85b1cfcec5amr1684262639f.1.1741631405213; Mon, 10 Mar 2025 11:30:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFY22Sv0sKUQnvx3uMpuKtabliRmvifkl/tQX5zQISLBzQuUFAIHxRk1AHRE3beMpWpX6dhAg== X-Received: by 2002:a05:6602:6a94:b0:85a:e24f:2b53 with SMTP id ca18e2360f4ac-85b1cfcec5amr1684258839f.1.1741631404549; Mon, 10 Mar 2025 11:30:04 -0700 (PDT) Received: from fedora-rawhide.sandeen.net ([65.128.97.82]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4f222ee2efdsm1587512173.13.2025.03.10.11.30.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Mar 2025 11:30:03 -0700 (PDT) From: Eric Sandeen To: fstests@vger.kernel.org Cc: djwong@kernel.org, hch@infradead.org, Eric Sandeen , Christoph Hellwig Subject: [PATCH 7/7] lib: remove random.c Date: Mon, 10 Mar 2025 13:29:09 -0500 Message-ID: <20250310182954.1396724-8-sandeen@redhat.com> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250310182954.1396724-1-sandeen@redhat.com> References: <20250310182954.1396724-1-sandeen@redhat.com> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 sparse points out that lots of things in random.c could be static, and upon doing so we realize that nothing in this file is used. Which is unsurprising since these are all part of the standard C library ... so just remove the file. Signed-off-by: Eric Sandeen Reviewed-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- lib/Makefile | 5 +- lib/random.c | 224 --------------------------------------------------- 2 files changed, 2 insertions(+), 227 deletions(-) delete mode 100644 lib/random.c diff --git a/lib/Makefile b/lib/Makefile index 53540ca7..ce4381a2 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -11,13 +11,12 @@ LT_REVISION = 0 LT_AGE = 0 # -# Everything (except for random.c) copied directly from LTP. +# Everything copied directly from LTP. # Refer to http://ltp.sourceforge.net/ for complete source. # CFILES = dataascii.c databin.c datapid.c file_lock.c forker.c \ pattern.c open_flags.c random_range.c string_to_tokens.c \ - str_to_bytes.c tlibio.c write_log.c \ - random.c + str_to_bytes.c tlibio.c write_log.c default: depend $(LTLIBRARY) diff --git a/lib/random.c b/lib/random.c deleted file mode 100644 index d5c81be8..00000000 --- a/lib/random.c +++ /dev/null @@ -1,224 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * random.c -- pseudo random number generator - * Copyright (C) 1994 Chris Wallace (csw@bruce.cs.monash.edu.au) - */ - -#include - -/* - * modified by dxm@sgi.com so that this file acts as a drop in replacement - * for srandom and random. - */ - -/* - * A random number generator called as a function by - * random (iseed) or irandm (iseed) - * The parameter should be a pointer to a 2-element int32_t vector. - * The first function returns a double uniform in 0 .. 1. - * The second returns a int32_t integer uniform in 0 .. 2**31-1 - * Both update iseed[] in exactly the same way. - * iseed[] must be a 2-element integer vector. - * The initial value of the second element may be anything. - * - * The period of the random sequence is 2**32 * (2**32-1) - * The table mt[0:127] is defined by mt[i] = 69069 ** (128-i) - */ - -#define MASK ((int32_t) 593970775) -/* or in hex, 23674657 */ - -#define SCALE ((double) 1.0 / (1024.0 * 1024.0 * 1024.0 * 2.0)) -/* i.e. 2 to power -31 */ - -static int32_t mt [128] = { - 902906369, - 2030498053, - -473499623, - 1640834941, - 723406961, - 1993558325, - -257162999, - -1627724755, - 913952737, - 278845029, - 1327502073, - -1261253155, - 981676113, - -1785280363, - 1700077033, - 366908557, - -1514479167, - -682799163, - 141955545, - -830150595, - 317871153, - 1542036469, - -946413879, - -1950779155, - 985397153, - 626515237, - 530871481, - 783087261, - -1512358895, - 1031357269, - -2007710807, - -1652747955, - -1867214463, - 928251525, - 1243003801, - -2132510467, - 1874683889, - -717013323, - 218254473, - -1628774995, - -2064896159, - 69678053, - 281568889, - -2104168611, - -165128239, - 1536495125, - -39650967, - 546594317, - -725987007, - 1392966981, - 1044706649, - 687331773, - -2051306575, - 1544302965, - -758494647, - -1243934099, - -75073759, - 293132965, - -1935153095, - 118929437, - 807830417, - -1416222507, - -1550074071, - -84903219, - 1355292929, - -380482555, - -1818444007, - -204797315, - 170442609, - -1636797387, - 868931593, - -623503571, - 1711722209, - 381210981, - -161547783, - -272740131, - -1450066095, - 2116588437, - 1100682473, - 358442893, - -1529216831, - 2116152005, - -776333095, - 1265240893, - -482278607, - 1067190005, - 333444553, - 86502381, - 753481377, - 39000101, - 1779014585, - 219658653, - -920253679, - 2029538901, - 1207761577, - -1515772851, - -236195711, - 442620293, - 423166617, - -1763648515, - -398436623, - -1749358155, - -538598519, - -652439379, - 430550625, - -1481396507, - 2093206905, - -1934691747, - -962631983, - 1454463253, - -1877118871, - -291917555, - -1711673279, - 201201733, - -474645415, - -96764739, - -1587365199, - 1945705589, - 1303896393, - 1744831853, - 381957665, - 2135332261, - -55996615, - -1190135011, - 1790562961, - -1493191723, - 475559465, - 69069 - }; - -double -_random (int32_t is [2]) -{ - int32_t it, leh, nit; - - it = is [0]; - leh = is [1]; - if (it <= 0) - it = (it + it) ^ MASK; - else - it = it + it; - nit = it - 1; -/* to ensure all-ones pattern omitted */ - leh = leh * mt[nit & 127] + nit; - is [0] = it; is [1] = leh; - if (leh < 0) leh = ~leh; - return (SCALE * ((int32_t) (leh | 1))); -} - - - -int32_t -_irandm (int32_t is [2]) -{ - int32_t it, leh, nit; - - it = is [0]; - leh = is [1]; - if (it <= 0) - it = (it + it) ^ MASK; - else - it = it + it; - nit = it - 1; -/* to ensure all-ones pattern omitted */ - leh = leh * mt[nit & 127] + nit; - is [0] = it; is [1] = leh; - if (leh < 0) leh = ~leh; - return (leh); -} - -/* - * make this a drop in replacement for random and srandom - * - * XXX not thread safe I guess. - */ - -static int32_t saved_seed[2]; - -long random(void) -{ - return _irandm(saved_seed); -} - -void srandom(unsigned seed) -{ - saved_seed[0]=seed; - saved_seed[1]=0; - _irandm(saved_seed); -} -