summaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_inode.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2009-05-22 10:48:59 +0100
committerSteven Whitehouse <swhiteho@redhat.com>2009-05-22 10:48:59 +0100
commit536baf02f650f4547f105386878b4736fbc181e8 (patch)
treeeeb326e76515c074f6eb0ae63deb598605632523 /fs/gfs2/ops_inode.c
parent2286dbfad1fb622ee2691537e5caaedee4618860 (diff)
downloadblackbird-op-linux-536baf02f650f4547f105386878b4736fbc181e8.tar.gz
blackbird-op-linux-536baf02f650f4547f105386878b4736fbc181e8.zip
GFS2: Move gfs2_readlinki into ops_inode.c
Move gfs2_readlinki into ops_inode.c and make it static Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_inode.c')
-rw-r--r--fs/gfs2/ops_inode.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index 5dacd647ff0d..f607f0908cff 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -938,6 +938,61 @@ out:
}
/**
+ * gfs2_readlinki - return the contents of a symlink
+ * @ip: the symlink's inode
+ * @buf: a pointer to the buffer to be filled
+ * @len: a pointer to the length of @buf
+ *
+ * If @buf is too small, a piece of memory is kmalloc()ed and needs
+ * to be freed by the caller.
+ *
+ * Returns: errno
+ */
+
+static int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len)
+{
+ struct gfs2_holder i_gh;
+ struct buffer_head *dibh;
+ unsigned int x;
+ int error;
+
+ gfs2_holder_init(ip->i_gl, LM_ST_SHARED, 0, &i_gh);
+ error = gfs2_glock_nq(&i_gh);
+ if (error) {
+ gfs2_holder_uninit(&i_gh);
+ return error;
+ }
+
+ if (!ip->i_disksize) {
+ gfs2_consist_inode(ip);
+ error = -EIO;
+ goto out;
+ }
+
+ error = gfs2_meta_inode_buffer(ip, &dibh);
+ if (error)
+ goto out;
+
+ x = ip->i_disksize + 1;
+ if (x > *len) {
+ *buf = kmalloc(x, GFP_NOFS);
+ if (!*buf) {
+ error = -ENOMEM;
+ goto out_brelse;
+ }
+ }
+
+ memcpy(*buf, dibh->b_data + sizeof(struct gfs2_dinode), x);
+ *len = x;
+
+out_brelse:
+ brelse(dibh);
+out:
+ gfs2_glock_dq_uninit(&i_gh);
+ return error;
+}
+
+/**
* gfs2_readlink - Read the value of a symlink
* @dentry: the symlink
* @buf: the buffer to read the symlink data into
OpenPOWER on IntegriCloud