]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: split out the remote symlink handling
authorDave Chinner <dchinner@redhat.com>
Wed, 4 Sep 2013 22:05:34 +0000 (22:05 +0000)
committerRich Johnston <rjohnston@sgi.com>
Mon, 16 Sep 2013 20:14:44 +0000 (15:14 -0500)
The remote symlink format definition and manipulation needs to be
shared with userspace, but the in-kernel interfaces do not. Split
the remote symlink format handling out into xfs_symlink_remote.[ch]
fo it can easily be shared with userspace.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Review-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
include/Makefile
include/libxfs.h
include/xfs_format.h
include/xfs_symlink.h [deleted file]
libxfs/Makefile
libxfs/xfs_symlink_remote.c [moved from libxfs/xfs_symlink.c with 83% similarity]

index c86d2ce72185b6b009c08672493b279475720fc5..6a4e521f21e6ac7e969dd6f674b997eb53bcc219 100644 (file)
@@ -39,7 +39,6 @@ QAHFILES = libxfs.h libxlog.h \
        xfs_mount.h \
        xfs_quota_defs.h \
        xfs_sb.h \
-       xfs_symlink.h \
        xfs_trace.h \
        xfs_trans_resv.h \
        xfs_trans_space.h \
index 8ab832d1131d76861a51cca39ebd76b69e38c91f..51a24428651c4f3efb418fcb1da8798bdc514eae 100644 (file)
@@ -61,7 +61,6 @@
 #include <xfs/xfs_btree_trace.h>
 #include <xfs/xfs_bmap.h>
 #include <xfs/xfs_trace.h>
-#include <xfs/xfs_symlink.h>
 
 
 #ifndef ARRAY_SIZE
index 62053744a0a6c3792c3151279e80aab0fef07691..35c08ff54ca079dcf6c718d6b2d6b75bf24f1721 100644 (file)
  * xfs_log_format.h. Everything else goes here.
  */
 
+struct xfs_mount;
+struct xfs_trans;
+struct xfs_inode;
+struct xfs_buf;
+struct xfs_ifork;
+
 /*
  * RealTime Device format definitions
  */
@@ -123,5 +129,41 @@ typedef struct xfs_dqblk {
 
 #define XFS_DQUOT_CRC_OFF      offsetof(struct xfs_dqblk, dd_crc)
 
+/*
+ * Remote symlink format and access functions.
+ */
+#define XFS_SYMLINK_MAGIC      0x58534c4d      /* XSLM */
+
+struct xfs_dsymlink_hdr {
+       __be32  sl_magic;
+       __be32  sl_offset;
+       __be32  sl_bytes;
+       __be32  sl_crc;
+       uuid_t  sl_uuid;
+       __be64  sl_owner;
+       __be64  sl_blkno;
+       __be64  sl_lsn;
+};
+
+/*
+ * The maximum pathlen is 1024 bytes. Since the minimum file system
+ * blocksize is 512 bytes, we can get a max of 3 extents back from
+ * bmapi when crc headers are taken into account.
+ */
+#define XFS_SYMLINK_MAPS 3
+
+#define XFS_SYMLINK_BUF_SPACE(mp, bufsize)     \
+       ((bufsize) - (xfs_sb_version_hascrc(&(mp)->m_sb) ? \
+                       sizeof(struct xfs_dsymlink_hdr) : 0))
+
+int xfs_symlink_blocks(struct xfs_mount *mp, int pathlen);
+int xfs_symlink_hdr_set(struct xfs_mount *mp, xfs_ino_t ino, uint32_t offset,
+                       uint32_t size, struct xfs_buf *bp);
+bool xfs_symlink_hdr_ok(struct xfs_mount *mp, xfs_ino_t ino, uint32_t offset,
+                       uint32_t size, struct xfs_buf *bp);
+void xfs_symlink_local_to_remote(struct xfs_trans *tp, struct xfs_buf *bp,
+                                struct xfs_inode *ip, struct xfs_ifork *ifp);
+
+extern const struct xfs_buf_ops xfs_symlink_buf_ops;
 
 #endif /* __XFS_FORMAT_H__ */
diff --git a/include/xfs_symlink.h b/include/xfs_symlink.h
deleted file mode 100644 (file)
index e85dfd1..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2012 Red Hat, Inc. All rights reserved.
- */
-#ifndef __XFS_SYMLINK_H
-#define __XFS_SYMLINK_H 1
-
-#define XFS_SYMLINK_MAGIC      0x58534c4d      /* XSLM */
-
-struct xfs_dsymlink_hdr {
-       __be32  sl_magic;
-       __be32  sl_offset;
-       __be32  sl_bytes;
-       __be32  sl_crc;
-       uuid_t  sl_uuid;
-       __be64  sl_owner;
-       __be64  sl_blkno;
-       __be64  sl_lsn;
-};
-
-/*
- * The maximum pathlen is 1024 bytes. Since the minimum file system
- * blocksize is 512 bytes, we can get a max of 3 extents back from
- * bmapi when crc headers are taken into account.
- */
-#define XFS_SYMLINK_MAPS 3
-
-#define XFS_SYMLINK_BUF_SPACE(mp, bufsize)     \
-       ((bufsize) - (xfs_sb_version_hascrc(&(mp)->m_sb) ? \
-                       sizeof(struct xfs_dsymlink_hdr) : 0))
-
-int xfs_symlink_blocks(struct xfs_mount *mp, int pathlen);
-bool xfs_symlink_hdr_ok(struct xfs_mount *mp, xfs_ino_t ino, uint32_t offset,
-                       uint32_t size, struct xfs_buf *bp);
-void xfs_symlink_local_to_remote(struct xfs_trans *tp, struct xfs_buf *bp,
-                                struct xfs_inode *ip, struct xfs_ifork *ifp);
-
-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);
-int xfs_readlink(struct xfs_inode *ip, char *link);
-int xfs_inactive_symlink_rmt(struct xfs_inode *ip, struct xfs_trans **tpp);
-
-#endif /* __KERNEL__ */
-#endif /* __XFS_SYMLINK_H */
index b7df144eb61ec9b369089667bf7f8f2ed78d0b69..6ba38f9699f06f632585772d6866d5d7048ad7a2 100644 (file)
@@ -23,7 +23,7 @@ CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \
        xfs_dir2_node.c xfs_dir2_data.c xfs_dir2_sf.c xfs_bmap.c \
        xfs_mount.c xfs_rtalloc.c xfs_attr.c xfs_attr_remote.c \
        crc32.c \
-       xfs_symlink.c \
+       xfs_symlink_remote.c \
        xfs_trans_resv.c
 
 CFILES += $(PKG_PLATFORM).c
similarity index 83%
rename from libxfs/xfs_symlink.c
rename to libxfs/xfs_symlink_remote.c
index f2e69f93a9a84bd74b8fa38f79d25982f537cb78..539db0cb90293f46863aee4a92f0a7b177602bdd 100644 (file)
@@ -1,9 +1,22 @@
 /*
- * Copyright 2013 Red Hat, Inc.
+ * Copyright (c) 2000-2006 Silicon Graphics, Inc.
+ * Copyright (c) 2012-2013 Red Hat, Inc.
  * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
-#include "xfs.h"
+#include <xfs.h>
 
 /*
  * Each contiguous block has a header, so it is not just a simple pathlen
@@ -19,9 +32,6 @@ xfs_symlink_blocks(
        return (pathlen + buflen - 1) / buflen;
 }
 
-/*
- * This is used by mkfs/proto.c to create symlinks.
- */
 int
 xfs_symlink_hdr_set(
        struct xfs_mount        *mp,
@@ -70,7 +80,6 @@ xfs_symlink_hdr_ok(
 
        /* ok */
        return true;
-
 }
 
 static bool