• Home
  • Raw
  • Download

Lines Matching +full:mode +full:- +full:capable

2  * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
44 return a->show ? a->show(sdp, buf) : 0; in gfs2_attr_show()
52 return a->store ? a->store(sdp, buf, len) : len; in gfs2_attr_store()
66 MAJOR(sdp->sd_vfs->s_dev), MINOR(sdp->sd_vfs->s_dev)); in id_show()
71 return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_fsname); in fsname_show()
76 struct super_block *s = sdp->sd_vfs; in uuid_show()
79 if (uuid_is_null(&s->s_uuid)) in uuid_show()
81 return snprintf(buf, PAGE_SIZE, "%pUB\n", &s->s_uuid); in uuid_show()
86 struct super_block *sb = sdp->sd_vfs; in freeze_show()
87 int frozen = (sb->s_writers.frozen == SB_UNFROZEN) ? 0 : 1; in freeze_show()
100 if (!capable(CAP_SYS_ADMIN)) in freeze_store()
101 return -EPERM; in freeze_store()
105 error = thaw_super(sdp->sd_vfs); in freeze_store()
108 error = freeze_super(sdp->sd_vfs); in freeze_store()
111 return -EINVAL; in freeze_store()
124 unsigned int b = test_bit(SDF_SHUTDOWN, &sdp->sd_flags); in withdraw_show()
132 if (!capable(CAP_SYS_ADMIN)) in withdraw_store()
133 return -EPERM; in withdraw_store()
140 return -EINVAL; in withdraw_store()
152 if (!capable(CAP_SYS_ADMIN)) in statfs_sync_store()
153 return -EPERM; in statfs_sync_store()
160 return -EINVAL; in statfs_sync_store()
162 gfs2_statfs_sync(sdp->sd_vfs, 0); in statfs_sync_store()
171 if (!capable(CAP_SYS_ADMIN)) in quota_sync_store()
172 return -EPERM; in quota_sync_store()
179 return -EINVAL; in quota_sync_store()
181 gfs2_quota_sync(sdp->sd_vfs, 0); in quota_sync_store()
192 if (!capable(CAP_SYS_ADMIN)) in quota_refresh_user_store()
193 return -EPERM; in quota_refresh_user_store()
201 return -EINVAL; in quota_refresh_user_store()
214 if (!capable(CAP_SYS_ADMIN)) in quota_refresh_group_store()
215 return -EPERM; in quota_refresh_group_store()
223 return -EINVAL; in quota_refresh_group_store()
236 char mode[16]; in demote_rq_store() local
239 if (!capable(CAP_SYS_ADMIN)) in demote_rq_store()
240 return -EPERM; in demote_rq_store()
243 mode); in demote_rq_store()
245 return -EINVAL; in demote_rq_store()
247 if (strcmp(mode, "EX") == 0) in demote_rq_store()
249 else if ((strcmp(mode, "CW") == 0) || (strcmp(mode, "DF") == 0)) in demote_rq_store()
251 else if ((strcmp(mode, "PR") == 0) || (strcmp(mode, "SH") == 0)) in demote_rq_store()
254 return -EINVAL; in demote_rq_store()
257 return -EINVAL; in demote_rq_store()
263 return -EINVAL; in demote_rq_store()
264 if (!test_and_set_bit(SDF_DEMOTE, &sdp->sd_flags)) in demote_rq_store()
275 #define GFS2_ATTR(name, mode, show, store) \ argument
276 static struct gfs2_attr gfs2_attr_##name = __ATTR(name, mode, show, store)
323 const struct lm_lockops *ops = sdp->sd_lockstruct.ls_ops; in proto_name_show()
324 return sprintf(buf, "%s\n", ops->lm_proto_name); in proto_name_show()
329 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in block_show()
333 if (test_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags)) in block_show()
341 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in block_store()
349 set_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags); in block_store()
351 clear_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags); in block_store()
355 return -EINVAL; in block_store()
362 int val = completion_done(&sdp->sd_wdack) ? 1 : 0; in wdack_show()
376 !strcmp(sdp->sd_lockstruct.ls_ops->lm_proto_name, "lock_dlm")) in wdack_store()
377 complete(&sdp->sd_wdack); in wdack_store()
379 return -EINVAL; in wdack_store()
385 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in lkfirst_show()
386 return sprintf(buf, "%d\n", ls->ls_first); in lkfirst_show()
396 return -EINVAL; in lkfirst_store()
397 rv = wait_for_completion_killable(&sdp->sd_locking_init); in lkfirst_store()
400 spin_lock(&sdp->sd_jindex_spin); in lkfirst_store()
401 rv = -EBUSY; in lkfirst_store()
402 if (test_bit(SDF_NOJOURNALID, &sdp->sd_flags) == 0) in lkfirst_store()
404 rv = -EINVAL; in lkfirst_store()
405 if (sdp->sd_args.ar_spectator) in lkfirst_store()
407 if (sdp->sd_lockstruct.ls_ops->lm_mount == NULL) in lkfirst_store()
409 sdp->sd_lockstruct.ls_first = first; in lkfirst_store()
412 spin_unlock(&sdp->sd_jindex_spin); in lkfirst_store()
418 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in first_done_show()
419 return sprintf(buf, "%d\n", !!test_bit(DFL_FIRST_MOUNT_DONE, &ls->ls_recover_flags)); in first_done_show()
428 wait_for_completion(&sdp->sd_journal_ready); in gfs2_recover_set()
430 spin_lock(&sdp->sd_jindex_spin); in gfs2_recover_set()
431 rv = -EBUSY; in gfs2_recover_set()
439 if (sdp->sd_jdesc->jd_jid == jid && !sdp->sd_args.ar_spectator) in gfs2_recover_set()
441 rv = -ENOENT; in gfs2_recover_set()
442 list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) { in gfs2_recover_set()
443 if (jd->jd_jid != jid && !sdp->sd_args.ar_spectator) in gfs2_recover_set()
449 spin_unlock(&sdp->sd_jindex_spin); in gfs2_recover_set()
460 return -EINVAL; in recover_store()
462 if (test_bit(SDF_NORECOVERY, &sdp->sd_flags)) { in recover_store()
463 rv = -ESHUTDOWN; in recover_store()
474 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in recover_done_show()
475 return sprintf(buf, "%d\n", ls->ls_recover_jid_done); in recover_done_show()
480 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in recover_status_show()
481 return sprintf(buf, "%d\n", ls->ls_recover_jid_status); in recover_status_show()
486 return sprintf(buf, "%d\n", sdp->sd_lockstruct.ls_jid); in jid_show()
496 return -EINVAL; in jid_store()
497 rv = wait_for_completion_killable(&sdp->sd_locking_init); in jid_store()
500 spin_lock(&sdp->sd_jindex_spin); in jid_store()
501 rv = -EINVAL; in jid_store()
502 if (sdp->sd_lockstruct.ls_ops->lm_mount == NULL) in jid_store()
504 rv = -EBUSY; in jid_store()
505 if (test_bit(SDF_NOJOURNALID, &sdp->sd_flags) == 0) in jid_store()
508 if (sdp->sd_args.ar_spectator && jid > 0) in jid_store()
509 rv = jid = -EINVAL; in jid_store()
510 sdp->sd_lockstruct.ls_jid = jid; in jid_store()
511 clear_bit(SDF_NOJOURNALID, &sdp->sd_flags); in jid_store()
513 wake_up_bit(&sdp->sd_flags, SDF_NOJOURNALID); in jid_store()
515 spin_unlock(&sdp->sd_jindex_spin); in jid_store()
552 sdp->sd_tune.gt_quota_scale_num, in quota_scale_show()
553 sdp->sd_tune.gt_quota_scale_den); in quota_scale_show()
559 struct gfs2_tune *gt = &sdp->sd_tune; in quota_scale_store()
562 if (!capable(CAP_SYS_ADMIN)) in quota_scale_store()
563 return -EPERM; in quota_scale_store()
566 return -EINVAL; in quota_scale_store()
568 spin_lock(&gt->gt_spin); in quota_scale_store()
569 gt->gt_quota_scale_num = x; in quota_scale_store()
570 gt->gt_quota_scale_den = y; in quota_scale_store()
571 spin_unlock(&gt->gt_spin); in quota_scale_store()
578 struct gfs2_tune *gt = &sdp->sd_tune; in tune_set()
582 if (!capable(CAP_SYS_ADMIN)) in tune_set()
583 return -EPERM; in tune_set()
590 return -EINVAL; in tune_set()
592 spin_lock(&gt->gt_spin); in tune_set()
594 spin_unlock(&gt->gt_spin); in tune_set()
604 return snprintf(buf, PAGE_SIZE, "%u\n", sdp->sd_tune.gt_##name); \
611 return tune_set(sdp, &sdp->sd_tune.gt_##name, check_zero, buf, len); \
648 struct super_block *sb = sdp->sd_vfs; in gfs2_sys_fs_add()
656 sprintf(spectator, "SPECTATOR=%d", sdp->sd_args.ar_spectator ? 1 : 0); in gfs2_sys_fs_add()
658 sdp->sd_kobj.kset = gfs2_kset; in gfs2_sys_fs_add()
659 error = kobject_init_and_add(&sdp->sd_kobj, &gfs2_ktype, NULL, in gfs2_sys_fs_add()
660 "%s", sdp->sd_table_name); in gfs2_sys_fs_add()
666 error = sysfs_create_group(&sdp->sd_kobj, &tune_group); in gfs2_sys_fs_add()
670 error = sysfs_create_group(&sdp->sd_kobj, &lock_module_group); in gfs2_sys_fs_add()
674 error = sysfs_create_link(&sdp->sd_kobj, in gfs2_sys_fs_add()
675 &disk_to_dev(sb->s_bdev->bd_disk)->kobj, in gfs2_sys_fs_add()
680 kobject_uevent_env(&sdp->sd_kobj, KOBJ_ADD, envp); in gfs2_sys_fs_add()
684 sysfs_remove_group(&sdp->sd_kobj, &lock_module_group); in gfs2_sys_fs_add()
686 sysfs_remove_group(&sdp->sd_kobj, &tune_group); in gfs2_sys_fs_add()
688 free_percpu(sdp->sd_lkstats); in gfs2_sys_fs_add()
691 kobject_put(&sdp->sd_kobj); in gfs2_sys_fs_add()
694 sb->s_fs_info = NULL; in gfs2_sys_fs_add()
700 sysfs_remove_link(&sdp->sd_kobj, "device"); in gfs2_sys_fs_del()
701 sysfs_remove_group(&sdp->sd_kobj, &tune_group); in gfs2_sys_fs_del()
702 sysfs_remove_group(&sdp->sd_kobj, &lock_module_group); in gfs2_sys_fs_del()
703 kobject_put(&sdp->sd_kobj); in gfs2_sys_fs_del()
710 struct super_block *s = sdp->sd_vfs; in gfs2_uevent()
712 add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name); in gfs2_uevent()
713 add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name); in gfs2_uevent()
714 if (!test_bit(SDF_NOJOURNALID, &sdp->sd_flags)) in gfs2_uevent()
715 add_uevent_var(env, "JOURNALID=%d", sdp->sd_lockstruct.ls_jid); in gfs2_uevent()
716 if (!uuid_is_null(&s->s_uuid)) in gfs2_uevent()
717 add_uevent_var(env, "UUID=%pUB", &s->s_uuid); in gfs2_uevent()
729 return -ENOMEM; in gfs2_sys_init()