forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/fs/jfs/jfs_logmgr.c
....@@ -1,20 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (C) International Business Machines Corp., 2000-2004
34 * Portions Copyright (C) Christoph Hellwig, 2001-2002
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13
- * the GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, write to the Free Software
17
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
185 */
196
207 /*
....@@ -1092,8 +1079,7 @@
10921079 mutex_lock(&jfs_log_mutex);
10931080 list_for_each_entry(log, &jfs_external_logs, journal_list) {
10941081 if (log->bdev->bd_dev == sbi->logdev) {
1095
- if (memcmp(log->uuid, sbi->loguuid,
1096
- sizeof(log->uuid))) {
1082
+ if (!uuid_equal(&log->uuid, &sbi->loguuid)) {
10971083 jfs_warn("wrong uuid on JFS journal");
10981084 mutex_unlock(&jfs_log_mutex);
10991085 return -EINVAL;
....@@ -1130,7 +1116,7 @@
11301116 }
11311117
11321118 log->bdev = bdev;
1133
- memcpy(log->uuid, sbi->loguuid, sizeof(log->uuid));
1119
+ uuid_copy(&log->uuid, &sbi->loguuid);
11341120
11351121 /*
11361122 * initialize log:
....@@ -1336,7 +1322,7 @@
13361322 jfs_info("lmLogInit: inline log:0x%p base:0x%Lx size:0x%x",
13371323 log, (unsigned long long)log->base, log->size);
13381324 } else {
1339
- if (memcmp(logsuper->uuid, log->uuid, 16)) {
1325
+ if (!uuid_equal(&logsuper->uuid, &log->uuid)) {
13401326 jfs_warn("wrong uuid on JFS log device");
13411327 rc = -EINVAL;
13421328 goto errout20;
....@@ -1733,7 +1719,7 @@
17331719 int i;
17341720 struct logsuper *logsuper;
17351721 struct lbuf *bpsuper;
1736
- char *uuid = sbi->uuid;
1722
+ uuid_t *uuid = &sbi->uuid;
17371723
17381724 /*
17391725 * insert/remove file system device to log active file system list.
....@@ -1744,8 +1730,8 @@
17441730 logsuper = (struct logsuper *) bpsuper->l_ldata;
17451731 if (activate) {
17461732 for (i = 0; i < MAX_ACTIVE; i++)
1747
- if (!memcmp(logsuper->active[i].uuid, NULL_UUID, 16)) {
1748
- memcpy(logsuper->active[i].uuid, uuid, 16);
1733
+ if (uuid_is_null(&logsuper->active[i].uuid)) {
1734
+ uuid_copy(&logsuper->active[i].uuid, uuid);
17491735 sbi->aggregate = i;
17501736 break;
17511737 }
....@@ -1756,8 +1742,9 @@
17561742 }
17571743 } else {
17581744 for (i = 0; i < MAX_ACTIVE; i++)
1759
- if (!memcmp(logsuper->active[i].uuid, uuid, 16)) {
1760
- memcpy(logsuper->active[i].uuid, NULL_UUID, 16);
1745
+ if (uuid_equal(&logsuper->active[i].uuid, uuid)) {
1746
+ uuid_copy(&logsuper->active[i].uuid,
1747
+ &uuid_null);
17611748 break;
17621749 }
17631750 if (i == MAX_ACTIVE) {