diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2009-12-17 21:33:26 -0500 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2009-12-17 21:33:26 -0500 |
commit | a18a4da0233492c15bb7b62a329061cf7dcce7a2 (patch) | |
tree | dbaaefd035ae70ed064288f9afb506ec4330527c /include | |
parent | a4dc9c48f83ebcb68cd99d118cd34c5e265cfd34 (diff) |
Add File Descriptor Attached Shared Objects (FDSO) infrastructure
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/fs.h | 21 | ||||
-rw-r--r-- | include/linux/sched.h | 10 | ||||
-rw-r--r-- | include/litmus/fdso.h | 69 |
3 files changed, 88 insertions, 12 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 2620a8c63571..5c7e0ff370ba 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -15,8 +15,8 @@ | |||
15 | * nr_file rlimit, so it's safe to set up a ridiculously high absolute | 15 | * nr_file rlimit, so it's safe to set up a ridiculously high absolute |
16 | * upper limit on files-per-process. | 16 | * upper limit on files-per-process. |
17 | * | 17 | * |
18 | * Some programs (notably those using select()) may have to be | 18 | * Some programs (notably those using select()) may have to be |
19 | * recompiled to take full advantage of the new limits.. | 19 | * recompiled to take full advantage of the new limits.. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* Fixed constants first: */ | 22 | /* Fixed constants first: */ |
@@ -169,7 +169,7 @@ struct inodes_stat_t { | |||
169 | #define SEL_EX 4 | 169 | #define SEL_EX 4 |
170 | 170 | ||
171 | /* public flags for file_system_type */ | 171 | /* public flags for file_system_type */ |
172 | #define FS_REQUIRES_DEV 1 | 172 | #define FS_REQUIRES_DEV 1 |
173 | #define FS_BINARY_MOUNTDATA 2 | 173 | #define FS_BINARY_MOUNTDATA 2 |
174 | #define FS_HAS_SUBTYPE 4 | 174 | #define FS_HAS_SUBTYPE 4 |
175 | #define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */ | 175 | #define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */ |
@@ -466,7 +466,7 @@ struct iattr { | |||
466 | */ | 466 | */ |
467 | #include <linux/quota.h> | 467 | #include <linux/quota.h> |
468 | 468 | ||
469 | /** | 469 | /** |
470 | * enum positive_aop_returns - aop return codes with specific semantics | 470 | * enum positive_aop_returns - aop return codes with specific semantics |
471 | * | 471 | * |
472 | * @AOP_WRITEPAGE_ACTIVATE: Informs the caller that page writeback has | 472 | * @AOP_WRITEPAGE_ACTIVATE: Informs the caller that page writeback has |
@@ -476,7 +476,7 @@ struct iattr { | |||
476 | * be a candidate for writeback again in the near | 476 | * be a candidate for writeback again in the near |
477 | * future. Other callers must be careful to unlock | 477 | * future. Other callers must be careful to unlock |
478 | * the page if they get this return. Returned by | 478 | * the page if they get this return. Returned by |
479 | * writepage(); | 479 | * writepage(); |
480 | * | 480 | * |
481 | * @AOP_TRUNCATED_PAGE: The AOP method that was handed a locked page has | 481 | * @AOP_TRUNCATED_PAGE: The AOP method that was handed a locked page has |
482 | * unlocked it and the page might have been truncated. | 482 | * unlocked it and the page might have been truncated. |
@@ -715,6 +715,7 @@ static inline int mapping_writably_mapped(struct address_space *mapping) | |||
715 | 715 | ||
716 | struct posix_acl; | 716 | struct posix_acl; |
717 | #define ACL_NOT_CACHED ((void *)(-1)) | 717 | #define ACL_NOT_CACHED ((void *)(-1)) |
718 | struct inode_obj_id_table; | ||
718 | 719 | ||
719 | struct inode { | 720 | struct inode { |
720 | struct hlist_node i_hash; | 721 | struct hlist_node i_hash; |
@@ -783,6 +784,8 @@ struct inode { | |||
783 | struct posix_acl *i_acl; | 784 | struct posix_acl *i_acl; |
784 | struct posix_acl *i_default_acl; | 785 | struct posix_acl *i_default_acl; |
785 | #endif | 786 | #endif |
787 | struct list_head i_obj_list; | ||
788 | struct mutex i_obj_mutex; | ||
786 | void *i_private; /* fs or device private pointer */ | 789 | void *i_private; /* fs or device private pointer */ |
787 | }; | 790 | }; |
788 | 791 | ||
@@ -995,10 +998,10 @@ static inline int file_check_writeable(struct file *filp) | |||
995 | 998 | ||
996 | #define MAX_NON_LFS ((1UL<<31) - 1) | 999 | #define MAX_NON_LFS ((1UL<<31) - 1) |
997 | 1000 | ||
998 | /* Page cache limit. The filesystems should put that into their s_maxbytes | 1001 | /* Page cache limit. The filesystems should put that into their s_maxbytes |
999 | limits, otherwise bad things can happen in VM. */ | 1002 | limits, otherwise bad things can happen in VM. */ |
1000 | #if BITS_PER_LONG==32 | 1003 | #if BITS_PER_LONG==32 |
1001 | #define MAX_LFS_FILESIZE (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) | 1004 | #define MAX_LFS_FILESIZE (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) |
1002 | #elif BITS_PER_LONG==64 | 1005 | #elif BITS_PER_LONG==64 |
1003 | #define MAX_LFS_FILESIZE 0x7fffffffffffffffUL | 1006 | #define MAX_LFS_FILESIZE 0x7fffffffffffffffUL |
1004 | #endif | 1007 | #endif |
@@ -2139,7 +2142,7 @@ extern int may_open(struct path *, int, int); | |||
2139 | 2142 | ||
2140 | extern int kernel_read(struct file *, loff_t, char *, unsigned long); | 2143 | extern int kernel_read(struct file *, loff_t, char *, unsigned long); |
2141 | extern struct file * open_exec(const char *); | 2144 | extern struct file * open_exec(const char *); |
2142 | 2145 | ||
2143 | /* fs/dcache.c -- generic fs support functions */ | 2146 | /* fs/dcache.c -- generic fs support functions */ |
2144 | extern int is_subdir(struct dentry *, struct dentry *); | 2147 | extern int is_subdir(struct dentry *, struct dentry *); |
2145 | extern ino_t find_inode_number(struct dentry *, struct qstr *); | 2148 | extern ino_t find_inode_number(struct dentry *, struct qstr *); |
diff --git a/include/linux/sched.h b/include/linux/sched.h index bb046c0adf99..724814191fe9 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1214,6 +1214,7 @@ struct sched_rt_entity { | |||
1214 | }; | 1214 | }; |
1215 | 1215 | ||
1216 | struct rcu_node; | 1216 | struct rcu_node; |
1217 | struct od_table_entry; | ||
1217 | 1218 | ||
1218 | struct task_struct { | 1219 | struct task_struct { |
1219 | volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ | 1220 | volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ |
@@ -1296,9 +1297,9 @@ struct task_struct { | |||
1296 | unsigned long stack_canary; | 1297 | unsigned long stack_canary; |
1297 | #endif | 1298 | #endif |
1298 | 1299 | ||
1299 | /* | 1300 | /* |
1300 | * pointers to (original) parent process, youngest child, younger sibling, | 1301 | * pointers to (original) parent process, youngest child, younger sibling, |
1301 | * older sibling, respectively. (p->father can be replaced with | 1302 | * older sibling, respectively. (p->father can be replaced with |
1302 | * p->real_parent->pid) | 1303 | * p->real_parent->pid) |
1303 | */ | 1304 | */ |
1304 | struct task_struct *real_parent; /* real parent process */ | 1305 | struct task_struct *real_parent; /* real parent process */ |
@@ -1512,6 +1513,9 @@ struct task_struct { | |||
1512 | /* LITMUS RT parameters and state */ | 1513 | /* LITMUS RT parameters and state */ |
1513 | struct rt_param rt_param; | 1514 | struct rt_param rt_param; |
1514 | 1515 | ||
1516 | /* references to PI semaphores, etc. */ | ||
1517 | struct od_table_entry *od_table; | ||
1518 | |||
1515 | #ifdef CONFIG_LATENCYTOP | 1519 | #ifdef CONFIG_LATENCYTOP |
1516 | int latency_record_count; | 1520 | int latency_record_count; |
1517 | struct latency_record latency_record[LT_SAVECOUNT]; | 1521 | struct latency_record latency_record[LT_SAVECOUNT]; |
@@ -2051,7 +2055,7 @@ static inline int dequeue_signal_lock(struct task_struct *tsk, sigset_t *mask, s | |||
2051 | spin_unlock_irqrestore(&tsk->sighand->siglock, flags); | 2055 | spin_unlock_irqrestore(&tsk->sighand->siglock, flags); |
2052 | 2056 | ||
2053 | return ret; | 2057 | return ret; |
2054 | } | 2058 | } |
2055 | 2059 | ||
2056 | extern void block_all_signals(int (*notifier)(void *priv), void *priv, | 2060 | extern void block_all_signals(int (*notifier)(void *priv), void *priv, |
2057 | sigset_t *mask); | 2061 | sigset_t *mask); |
diff --git a/include/litmus/fdso.h b/include/litmus/fdso.h new file mode 100644 index 000000000000..286e10f86de0 --- /dev/null +++ b/include/litmus/fdso.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* fdso.h - file descriptor attached shared objects | ||
2 | * | ||
3 | * (c) 2007 B. Brandenburg, LITMUS^RT project | ||
4 | */ | ||
5 | |||
6 | #ifndef _LINUX_FDSO_H_ | ||
7 | #define _LINUX_FDSO_H_ | ||
8 | |||
9 | #include <linux/list.h> | ||
10 | #include <asm/atomic.h> | ||
11 | |||
12 | #include <linux/fs.h> | ||
13 | |||
14 | #define MAX_OBJECT_DESCRIPTORS 32 | ||
15 | |||
16 | typedef enum { | ||
17 | MIN_OBJ_TYPE = 0, | ||
18 | |||
19 | FMLP_SEM = 0, | ||
20 | SRP_SEM = 1, | ||
21 | |||
22 | MAX_OBJ_TYPE = 1 | ||
23 | } obj_type_t; | ||
24 | |||
25 | struct inode_obj_id { | ||
26 | struct list_head list; | ||
27 | atomic_t count; | ||
28 | struct inode* inode; | ||
29 | |||
30 | obj_type_t type; | ||
31 | void* obj; | ||
32 | unsigned int id; | ||
33 | }; | ||
34 | |||
35 | |||
36 | struct od_table_entry { | ||
37 | unsigned int used; | ||
38 | |||
39 | struct inode_obj_id* obj; | ||
40 | void* extra; | ||
41 | }; | ||
42 | |||
43 | struct fdso_ops { | ||
44 | void* (*create) (void); | ||
45 | void (*destroy)(void*); | ||
46 | int (*open) (struct od_table_entry*, void* __user); | ||
47 | int (*close) (struct od_table_entry*); | ||
48 | }; | ||
49 | |||
50 | /* translate a userspace supplied od into the raw table entry | ||
51 | * returns NULL if od is invalid | ||
52 | */ | ||
53 | struct od_table_entry* __od_lookup(int od); | ||
54 | |||
55 | /* translate a userspace supplied od into the associated object | ||
56 | * returns NULL if od is invalid | ||
57 | */ | ||
58 | static inline void* od_lookup(int od, obj_type_t type) | ||
59 | { | ||
60 | struct od_table_entry* e = __od_lookup(od); | ||
61 | return e && e->obj->type == type ? e->obj->obj : NULL; | ||
62 | } | ||
63 | |||
64 | #define lookup_fmlp_sem(od)((struct pi_semaphore*) od_lookup(od, FMLP_SEM)) | ||
65 | #define lookup_srp_sem(od) ((struct srp_semaphore*) od_lookup(od, SRP_SEM)) | ||
66 | #define lookup_ics(od) ((struct ics*) od_lookup(od, ICS_ID)) | ||
67 | |||
68 | |||
69 | #endif | ||