xfs
[Top] [All Lists]

[PATCH] xfsprogs: replace umode_t with xfs_mode_t

To: xfs@xxxxxxxxxxx
Subject: [PATCH] xfsprogs: replace umode_t with xfs_mode_t
From: "Michael L. Semon" <mlsemon35@xxxxxxxxx>
Date: Thu, 13 Jun 2013 15:46:35 -0400
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=Ovi2VgTpaPoF2nDojQzVz8/n/t4Hu+iEX5q1mwh6124=; b=JEg4xcNwT4AAms3sgmPWg8Pw9AQsGwLNyxRaMsxvoW+KdXPSFgSB9362R5gXZYRYn5 vI96I7qpkczu7K3rhFLb61BVrggEePdd85/GOLduLZnY/Tt3YSIwG9nef+ilJ4p7h8Wm KjRHUfSTfRFiJWW/MASThC8xj6kZDkVvazMMCyGRhSd2ktBGpXXSTNOjhBWk/IkvYTT5 qqsvNVl85Br2AraVZh+cVy/kD8mr5CU3MBcFnum9/4hmCW66NjbIk6IkIO71/ciKI+YE k/JutZ7iXDhIYbemJ9f7tNxH1IGyg8zBvobDKZJdF2REUhLqOm2eG7Fy3vAwmgyR2TxD HnEQ==
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130509 Thunderbird/17.0.6
This patch was made after applying the most recent 3.11-related 
patchset for xfsprogs.  It was applied against the crc-dev branch, 
in order to get CRC-enabled xfsprogs to build without complaining 
about a lack of "umode_t".  The systems used were both 32-bit 
slackware-current systems, against public kernel headers of kernel 
3.8.x and 3.9.x vintage.

This is an "idea" patch, a way of getting CRC-enabled xfsprogs to 
build on kernels later than 3.2 while staying within the conventions 
of my test systems.  The idea may be bad, and the XFS crew might be 
solving it in a different way while moving header files and functions.

Anyway, I don't know how the Debian and Red Hat crews solve header-
related issues like these, so comments and flames are welcome.  In 
particular, I'm open to a better name than "xfs_mode_t" that does 
not match the grep term "umode_t".

Thanks!

Michael

>From 6f34f385d3e6e748999f26638bd8608b5ff8f022 Mon Sep 17 00:00:00 2001
From: "Michael L. Semon" <mlsemon35@xxxxxxxxx>
Date: Thu, 13 Jun 2013 03:08:30 -0400
Subject: [PATCH] xfsprogs: replace umode_t with xfs_mode_t

umode_t has not been exported to the public kernel headers by
the kernel `make headers_install` process since about 3.2.0-rc7.
For that matter, a `grep -rl umode_t /usr/include` can return nothing,
as if authors are avoiding the term "umode_t" altogether.  Follow this
convention by changing umode_t to xfs_mode_t.

The simple hack way through this problem is to do this instead:

typedef unsigned short umode_t;

However, when xfsprogs is installed by `make install-qa`, this can
be exported to /usr/include, which is not desired behavior.

Signed-off-by: Michael L. Semon <mlsemon35@xxxxxxxxx>
---
 include/xfs_ialloc.h  | 8 +++++++-
 include/xfs_symlink.h | 3 ++-
 libxfs/xfs_ialloc.c   | 4 ++--
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/include/xfs_ialloc.h b/include/xfs_ialloc.h
index 68c0732..2cc3e93 100644
--- a/include/xfs_ialloc.h
+++ b/include/xfs_ialloc.h
@@ -25,6 +25,12 @@ struct xfs_mount;
 struct xfs_trans;
 
 /*
+ * Provide a replacement for a variable that has not been exported 
+ * to public kernel headers since about kernel 3.2.0-rc7.
+ */
+typedef unsigned short xfs_mode_t;
+
+/*
  * Allocation parameters for inode allocation.
  */
 #define        XFS_IALLOC_INODES(mp)   (mp)->m_ialloc_inos
@@ -72,7 +78,7 @@ int                                   /* error */
 xfs_dialloc(
        struct xfs_trans *tp,           /* transaction pointer */
        xfs_ino_t       parent,         /* parent inode (directory) */
-       umode_t         mode,           /* mode bits for new inode */
+       xfs_mode_t      mode,           /* mode bits for new inode */
        int             okalloc,        /* ok to allocate more space */
        struct xfs_buf  **agbp,         /* buf for a.g. inode header */
        xfs_ino_t       *inop);         /* inode number allocated */
diff --git a/include/xfs_symlink.h b/include/xfs_symlink.h
index 4818edf..93801ec 100644
--- a/include/xfs_symlink.h
+++ b/include/xfs_symlink.h
@@ -59,7 +59,8 @@ extern const struct xfs_buf_ops xfs_symlink_buf_ops;
 #ifdef __KERNEL__
 
 int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name,
-               const char *target_path, umode_t mode, struct xfs_inode **ipp);
+               const char *target_path, xfs_mode_t mode, 
+               struct xfs_inode **ipp);
 int xfs_readlink(struct xfs_inode *ip, char *link);
 int xfs_inactive_symlink_rmt(struct xfs_inode *ip, struct xfs_trans **tpp);
 
diff --git a/libxfs/xfs_ialloc.c b/libxfs/xfs_ialloc.c
index ce32dfa..2ce06c8 100644
--- a/libxfs/xfs_ialloc.c
+++ b/libxfs/xfs_ialloc.c
@@ -490,7 +490,7 @@ STATIC xfs_agnumber_t
 xfs_ialloc_ag_select(
        xfs_trans_t     *tp,            /* transaction pointer */
        xfs_ino_t       parent,         /* parent directory inode number */
-       umode_t         mode,           /* bits set to indicate file type */
+       xfs_mode_t      mode,           /* bits set to indicate file type */
        int             okalloc)        /* ok to allocate more space */
 {
        xfs_agnumber_t  agcount;        /* number of ag's in the filesystem */
@@ -936,7 +936,7 @@ int
 xfs_dialloc(
        struct xfs_trans        *tp,
        xfs_ino_t               parent,
-       umode_t                 mode,
+       xfs_mode_t              mode,
        int                     okalloc,
        struct xfs_buf          **IO_agbp,
        xfs_ino_t               *inop)
-- 
1.8.2

<Prev in Thread] Current Thread [Next in Thread>