xfs_xattr.c (5d2d4a9f603a47403395408f64b1261ca61f6d50) xfs_xattr.c (d9041681dd2f5334529a68868c9266631c384de4)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2008 Christoph Hellwig.
4 * Portions Copyright (C) 2000-2008 Silicon Graphics, Inc.
5 */
6
7#include "xfs.h"
8#include "xfs_shared.h"

--- 122 unchanged lines hidden (view full) ---

131 .attr_filter = handler->flags,
132 .name = name,
133 .namelen = strlen(name),
134 .value = value,
135 .valuelen = size,
136 };
137 int error;
138
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2008 Christoph Hellwig.
4 * Portions Copyright (C) 2000-2008 Silicon Graphics, Inc.
5 */
6
7#include "xfs.h"
8#include "xfs_shared.h"

--- 122 unchanged lines hidden (view full) ---

131 .attr_filter = handler->flags,
132 .name = name,
133 .namelen = strlen(name),
134 .value = value,
135 .valuelen = size,
136 };
137 int error;
138
139 if (xfs_ifork_zapped(XFS_I(inode), XFS_ATTR_FORK))
140 return -EIO;
141
139 error = xfs_attr_get(&args);
140 if (error)
141 return error;
142 return args.valuelen;
143}
144
145static int
146xfs_xattr_set(const struct xattr_handler *handler,

--- 142 unchanged lines hidden (view full) ---

289 struct dentry *dentry,
290 char *data,
291 size_t size)
292{
293 struct xfs_attr_list_context context;
294 struct inode *inode = d_inode(dentry);
295 int error;
296
142 error = xfs_attr_get(&args);
143 if (error)
144 return error;
145 return args.valuelen;
146}
147
148static int
149xfs_xattr_set(const struct xattr_handler *handler,

--- 142 unchanged lines hidden (view full) ---

292 struct dentry *dentry,
293 char *data,
294 size_t size)
295{
296 struct xfs_attr_list_context context;
297 struct inode *inode = d_inode(dentry);
298 int error;
299
300 if (xfs_ifork_zapped(XFS_I(inode), XFS_ATTR_FORK))
301 return -EIO;
302
297 /*
298 * First read the regular on-disk attributes.
299 */
300 memset(&context, 0, sizeof(context));
301 context.dp = XFS_I(inode);
302 context.resynch = 1;
303 context.buffer = size ? data : NULL;
304 context.bufsize = size;
305 context.firstu = context.bufsize;
306 context.put_listent = xfs_xattr_put_listent;
307
308 error = xfs_attr_list(&context);
309 if (error)
310 return error;
311 if (context.count < 0)
312 return -ERANGE;
313
314 return context.count;
315}
303 /*
304 * First read the regular on-disk attributes.
305 */
306 memset(&context, 0, sizeof(context));
307 context.dp = XFS_I(inode);
308 context.resynch = 1;
309 context.buffer = size ? data : NULL;
310 context.bufsize = size;
311 context.firstu = context.bufsize;
312 context.put_listent = xfs_xattr_put_listent;
313
314 error = xfs_attr_list(&context);
315 if (error)
316 return error;
317 if (context.count < 0)
318 return -ERANGE;
319
320 return context.count;
321}