From: cem@kernel.org
To: linux-xfs@vger.kernel.org
Cc: djwong@kernel.org, hch@lst.de, hch@infradead.org
Subject: [PATCH 2/3] libfrog: remove libattr dependency
Date: Tue, 27 Aug 2024 13:50:23 +0200 [thread overview]
Message-ID: <20240827115032.406321-3-cem@kernel.org> (raw)
In-Reply-To: <20240827115032.406321-1-cem@kernel.org>
From: Carlos Maiolino <cem@kernel.org>
Get rid of libfrog's libattr dependency, and move the needed local
definitions to a new header - libfrog/attr.h
We could keep the ATTR_ENTRY definition local to fsprops.h, but we'll
add more content to it in the next patch.
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
---
libfrog/Makefile | 7 ++-----
libfrog/attr.h | 18 ++++++++++++++++++
libfrog/fsprops.c | 7 +++----
3 files changed, 23 insertions(+), 9 deletions(-)
create mode 100644 libfrog/attr.h
diff --git a/libfrog/Makefile b/libfrog/Makefile
index acddc894e..8581c146b 100644
--- a/libfrog/Makefile
+++ b/libfrog/Makefile
@@ -21,6 +21,7 @@ crc32.c \
file_exchange.c \
fsgeom.c \
fsproperties.c \
+fsprops.c \
getparents.c \
histogram.c \
list_sort.c \
@@ -49,6 +50,7 @@ div64.h \
file_exchange.h \
fsgeom.h \
fsproperties.h \
+fsprops.h \
getparents.h \
histogram.h \
logging.h \
@@ -62,11 +64,6 @@ workqueue.h
LSRCFILES += gen_crc32table.c
-ifeq ($(HAVE_LIBATTR),yes)
-CFILES+=fsprops.c
-HFILES+=fsprops.h
-endif
-
LDIRT = gen_crc32table crc32table.h
default: ltdepend $(LTLIBRARY)
diff --git a/libfrog/attr.h b/libfrog/attr.h
new file mode 100644
index 000000000..9110499f2
--- /dev/null
+++ b/libfrog/attr.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2024 Red Hat, Inc. All Rights Reserved.
+ * Author: Carlos Maiolino <cmaiolino@redhat.com>
+ */
+#ifndef __LIBFROG_ATTR_H__
+#define __LIBFROG_ATTR_H__
+
+/*
+ * Those definitions come from libattr
+ *
+ * We are redifining here so we don't need to keep libattr as a dependency anymore
+ */
+#define ATTR_ENTRY(buffer, index) \
+ ((struct xfs_attrlist_ent *) \
+ &((char *)buffer)[ ((struct xfs_attrlist *)(buffer))->al_offset[index] ])
+
+#endif /* __LIBFROG_ATTR_H__ */
diff --git a/libfrog/fsprops.c b/libfrog/fsprops.c
index 05a584a56..ea47c66ed 100644
--- a/libfrog/fsprops.c
+++ b/libfrog/fsprops.c
@@ -10,8 +10,7 @@
#include "libfrog/bulkstat.h"
#include "libfrog/fsprops.h"
#include "libfrog/fsproperties.h"
-
-#include <attr/attributes.h>
+#include "libfrog/attr.h"
/*
* Given an xfd and a mount table path, get us the handle for the root dir so
@@ -70,7 +69,7 @@ fsprops_walk_names(
{
struct xfs_attrlist_cursor cur = { };
char attrbuf[XFS_XATTR_LIST_MAX];
- struct attrlist *attrlist = (struct attrlist *)attrbuf;
+ struct xfs_attrlist *attrlist = (struct xfs_attrlist *)attrbuf;
int ret;
memset(attrbuf, 0, XFS_XATTR_LIST_MAX);
@@ -81,7 +80,7 @@ fsprops_walk_names(
unsigned int i;
for (i = 0; i < attrlist->al_count; i++) {
- struct attrlist_ent *ent = ATTR_ENTRY(attrlist, i);
+ struct xfs_attrlist_ent *ent = ATTR_ENTRY(attrlist, i);
const char *p =
attr_name_to_fsprop_name(ent->a_name);
--
2.46.0
next prev parent reply other threads:[~2024-08-27 11:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-27 11:50 [PATCH 0/3] Get rid of libattr dependency cem
2024-08-27 11:50 ` [PATCH 1/3] libhandle: Remove " cem
2024-08-27 12:12 ` Christoph Hellwig
2024-08-27 14:44 ` Darrick J. Wong
2024-08-28 4:33 ` Christoph Hellwig
2024-08-27 14:41 ` Darrick J. Wong
2024-08-28 4:34 ` Christoph Hellwig
2024-08-29 13:18 ` Carlos Maiolino
2024-08-27 11:50 ` cem [this message]
2024-08-27 12:15 ` [PATCH 2/3] libfrog: remove " Christoph Hellwig
2024-08-27 12:24 ` Carlos Maiolino
2024-08-27 11:50 ` [PATCH 3/3] scrub: Remove " cem
2024-08-27 12:16 ` Christoph Hellwig
2024-08-27 12:27 ` Carlos Maiolino
2024-08-27 14:36 ` Darrick J. Wong
2024-08-28 4:35 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240827115032.406321-3-cem@kernel.org \
--to=cem@kernel.org \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox