diff options
Diffstat (limited to 'fs/ocfs2/acl.c')
-rw-r--r-- | fs/ocfs2/acl.c | 87 |
1 files changed, 25 insertions, 62 deletions
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c index fbeaec762103..e3e47415d851 100644 --- a/fs/ocfs2/acl.c +++ b/fs/ocfs2/acl.c | |||
@@ -331,13 +331,14 @@ cleanup: | |||
331 | return ret; | 331 | return ret; |
332 | } | 332 | } |
333 | 333 | ||
334 | static size_t ocfs2_xattr_list_acl_access(struct inode *inode, | 334 | static size_t ocfs2_xattr_list_acl_access(struct dentry *dentry, |
335 | char *list, | 335 | char *list, |
336 | size_t list_len, | 336 | size_t list_len, |
337 | const char *name, | 337 | const char *name, |
338 | size_t name_len) | 338 | size_t name_len, |
339 | int type) | ||
339 | { | 340 | { |
340 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 341 | struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); |
341 | const size_t size = sizeof(POSIX_ACL_XATTR_ACCESS); | 342 | const size_t size = sizeof(POSIX_ACL_XATTR_ACCESS); |
342 | 343 | ||
343 | if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) | 344 | if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) |
@@ -348,13 +349,14 @@ static size_t ocfs2_xattr_list_acl_access(struct inode *inode, | |||
348 | return size; | 349 | return size; |
349 | } | 350 | } |
350 | 351 | ||
351 | static size_t ocfs2_xattr_list_acl_default(struct inode *inode, | 352 | static size_t ocfs2_xattr_list_acl_default(struct dentry *dentry, |
352 | char *list, | 353 | char *list, |
353 | size_t list_len, | 354 | size_t list_len, |
354 | const char *name, | 355 | const char *name, |
355 | size_t name_len) | 356 | size_t name_len, |
357 | int type) | ||
356 | { | 358 | { |
357 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 359 | struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); |
358 | const size_t size = sizeof(POSIX_ACL_XATTR_DEFAULT); | 360 | const size_t size = sizeof(POSIX_ACL_XATTR_DEFAULT); |
359 | 361 | ||
360 | if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) | 362 | if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) |
@@ -365,19 +367,19 @@ static size_t ocfs2_xattr_list_acl_default(struct inode *inode, | |||
365 | return size; | 367 | return size; |
366 | } | 368 | } |
367 | 369 | ||
368 | static int ocfs2_xattr_get_acl(struct inode *inode, | 370 | static int ocfs2_xattr_get_acl(struct dentry *dentry, const char *name, |
369 | int type, | 371 | void *buffer, size_t size, int type) |
370 | void *buffer, | ||
371 | size_t size) | ||
372 | { | 372 | { |
373 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 373 | struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); |
374 | struct posix_acl *acl; | 374 | struct posix_acl *acl; |
375 | int ret; | 375 | int ret; |
376 | 376 | ||
377 | if (strcmp(name, "") != 0) | ||
378 | return -EINVAL; | ||
377 | if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) | 379 | if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) |
378 | return -EOPNOTSUPP; | 380 | return -EOPNOTSUPP; |
379 | 381 | ||
380 | acl = ocfs2_get_acl(inode, type); | 382 | acl = ocfs2_get_acl(dentry->d_inode, type); |
381 | if (IS_ERR(acl)) | 383 | if (IS_ERR(acl)) |
382 | return PTR_ERR(acl); | 384 | return PTR_ERR(acl); |
383 | if (acl == NULL) | 385 | if (acl == NULL) |
@@ -388,35 +390,16 @@ static int ocfs2_xattr_get_acl(struct inode *inode, | |||
388 | return ret; | 390 | return ret; |
389 | } | 391 | } |
390 | 392 | ||
391 | static int ocfs2_xattr_get_acl_access(struct inode *inode, | 393 | static int ocfs2_xattr_set_acl(struct dentry *dentry, const char *name, |
392 | const char *name, | 394 | const void *value, size_t size, int flags, int type) |
393 | void *buffer, | ||
394 | size_t size) | ||
395 | { | ||
396 | if (strcmp(name, "") != 0) | ||
397 | return -EINVAL; | ||
398 | return ocfs2_xattr_get_acl(inode, ACL_TYPE_ACCESS, buffer, size); | ||
399 | } | ||
400 | |||
401 | static int ocfs2_xattr_get_acl_default(struct inode *inode, | ||
402 | const char *name, | ||
403 | void *buffer, | ||
404 | size_t size) | ||
405 | { | ||
406 | if (strcmp(name, "") != 0) | ||
407 | return -EINVAL; | ||
408 | return ocfs2_xattr_get_acl(inode, ACL_TYPE_DEFAULT, buffer, size); | ||
409 | } | ||
410 | |||
411 | static int ocfs2_xattr_set_acl(struct inode *inode, | ||
412 | int type, | ||
413 | const void *value, | ||
414 | size_t size) | ||
415 | { | 395 | { |
396 | struct inode *inode = dentry->d_inode; | ||
416 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 397 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
417 | struct posix_acl *acl; | 398 | struct posix_acl *acl; |
418 | int ret = 0; | 399 | int ret = 0; |
419 | 400 | ||
401 | if (strcmp(name, "") != 0) | ||
402 | return -EINVAL; | ||
420 | if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) | 403 | if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) |
421 | return -EOPNOTSUPP; | 404 | return -EOPNOTSUPP; |
422 | 405 | ||
@@ -442,38 +425,18 @@ cleanup: | |||
442 | return ret; | 425 | return ret; |
443 | } | 426 | } |
444 | 427 | ||
445 | static int ocfs2_xattr_set_acl_access(struct inode *inode, | ||
446 | const char *name, | ||
447 | const void *value, | ||
448 | size_t size, | ||
449 | int flags) | ||
450 | { | ||
451 | if (strcmp(name, "") != 0) | ||
452 | return -EINVAL; | ||
453 | return ocfs2_xattr_set_acl(inode, ACL_TYPE_ACCESS, value, size); | ||
454 | } | ||
455 | |||
456 | static int ocfs2_xattr_set_acl_default(struct inode *inode, | ||
457 | const char *name, | ||
458 | const void *value, | ||
459 | size_t size, | ||
460 | int flags) | ||
461 | { | ||
462 | if (strcmp(name, "") != 0) | ||
463 | return -EINVAL; | ||
464 | return ocfs2_xattr_set_acl(inode, ACL_TYPE_DEFAULT, value, size); | ||
465 | } | ||
466 | |||
467 | struct xattr_handler ocfs2_xattr_acl_access_handler = { | 428 | struct xattr_handler ocfs2_xattr_acl_access_handler = { |
468 | .prefix = POSIX_ACL_XATTR_ACCESS, | 429 | .prefix = POSIX_ACL_XATTR_ACCESS, |
430 | .flags = ACL_TYPE_ACCESS, | ||
469 | .list = ocfs2_xattr_list_acl_access, | 431 | .list = ocfs2_xattr_list_acl_access, |
470 | .get = ocfs2_xattr_get_acl_access, | 432 | .get = ocfs2_xattr_get_acl, |
471 | .set = ocfs2_xattr_set_acl_access, | 433 | .set = ocfs2_xattr_set_acl, |
472 | }; | 434 | }; |
473 | 435 | ||
474 | struct xattr_handler ocfs2_xattr_acl_default_handler = { | 436 | struct xattr_handler ocfs2_xattr_acl_default_handler = { |
475 | .prefix = POSIX_ACL_XATTR_DEFAULT, | 437 | .prefix = POSIX_ACL_XATTR_DEFAULT, |
438 | .flags = ACL_TYPE_DEFAULT, | ||
476 | .list = ocfs2_xattr_list_acl_default, | 439 | .list = ocfs2_xattr_list_acl_default, |
477 | .get = ocfs2_xattr_get_acl_default, | 440 | .get = ocfs2_xattr_get_acl, |
478 | .set = ocfs2_xattr_set_acl_default, | 441 | .set = ocfs2_xattr_set_acl, |
479 | }; | 442 | }; |