~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to include/linux/capability.h

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
355
355
 
356
356
#define CAP_SYSLOG           34
357
357
 
358
 
#define CAP_LAST_CAP         CAP_SYSLOG
 
358
/* Allow triggering something that will wake the system */
 
359
 
 
360
#define CAP_WAKE_ALARM            35
 
361
 
 
362
 
 
363
#define CAP_LAST_CAP         CAP_WAKE_ALARM
359
364
 
360
365
#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
361
366
 
368
373
 
369
374
#ifdef __KERNEL__
370
375
 
 
376
struct dentry;
 
377
struct user_namespace;
 
378
 
 
379
struct user_namespace *current_user_ns(void);
 
380
 
 
381
extern const kernel_cap_t __cap_empty_set;
 
382
extern const kernel_cap_t __cap_full_set;
 
383
extern const kernel_cap_t __cap_init_eff_set;
 
384
 
371
385
/*
372
386
 * Internal kernel functions only
373
387
 */
403
417
 
404
418
# define CAP_EMPTY_SET    ((kernel_cap_t){{ 0, 0 }})
405
419
# define CAP_FULL_SET     ((kernel_cap_t){{ ~0, ~0 }})
406
 
# define CAP_INIT_EFF_SET ((kernel_cap_t){{ ~CAP_TO_MASK(CAP_SETPCAP), ~0 }})
407
420
# define CAP_FS_SET       ((kernel_cap_t){{ CAP_FS_MASK_B0 \
408
421
                                    | CAP_TO_MASK(CAP_LINUX_IMMUTABLE), \
409
422
                                    CAP_FS_MASK_B1 } })
413
426
 
414
427
#endif /* _KERNEL_CAPABILITY_U32S != 2 */
415
428
 
416
 
#define CAP_INIT_INH_SET    CAP_EMPTY_SET
417
 
 
418
429
# define cap_clear(c)         do { (c) = __cap_empty_set; } while (0)
419
 
# define cap_set_full(c)      do { (c) = __cap_full_set; } while (0)
420
 
# define cap_set_init_eff(c)  do { (c) = __cap_init_eff_set; } while (0)
421
430
 
422
431
#define cap_raise(c, flag)  ((c).cap[CAP_TO_INDEX(flag)] |= CAP_TO_MASK(flag))
423
432
#define cap_lower(c, flag)  ((c).cap[CAP_TO_INDEX(flag)] &= ~CAP_TO_MASK(flag))
530
539
                           cap_intersect(permitted, __cap_nfsd_set));
531
540
}
532
541
 
533
 
extern const kernel_cap_t __cap_empty_set;
534
 
extern const kernel_cap_t __cap_full_set;
535
 
extern const kernel_cap_t __cap_init_eff_set;
536
 
 
537
 
/**
538
 
 * has_capability - Determine if a task has a superior capability available
539
 
 * @t: The task in question
540
 
 * @cap: The capability to be tested for
541
 
 *
542
 
 * Return true if the specified task has the given superior capability
543
 
 * currently in effect, false if not.
544
 
 *
545
 
 * Note that this does not set PF_SUPERPRIV on the task.
546
 
 */
547
 
#define has_capability(t, cap) (security_real_capable((t), (cap)) == 0)
548
 
 
549
 
/**
550
 
 * has_capability_noaudit - Determine if a task has a superior capability available (unaudited)
551
 
 * @t: The task in question
552
 
 * @cap: The capability to be tested for
553
 
 *
554
 
 * Return true if the specified task has the given superior capability
555
 
 * currently in effect, false if not, but don't write an audit message for the
556
 
 * check.
557
 
 *
558
 
 * Note that this does not set PF_SUPERPRIV on the task.
559
 
 */
560
 
#define has_capability_noaudit(t, cap) \
561
 
        (security_real_capable_noaudit((t), (cap)) == 0)
562
 
 
563
 
extern int capable(int cap);
 
542
extern bool has_capability(struct task_struct *t, int cap);
 
543
extern bool has_ns_capability(struct task_struct *t,
 
544
                              struct user_namespace *ns, int cap);
 
545
extern bool has_capability_noaudit(struct task_struct *t, int cap);
 
546
extern bool capable(int cap);
 
547
extern bool ns_capable(struct user_namespace *ns, int cap);
 
548
extern bool task_ns_capable(struct task_struct *t, int cap);
 
549
extern bool nsown_capable(int cap);
564
550
 
565
551
/* audit system wants to get cap info from files as well */
566
 
struct dentry;
567
552
extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps);
568
553
 
569
554
#endif /* __KERNEL__ */