mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 23:34:05 +08:00
uml: LDT mutex conversion
The ldt.semaphore conforms to the new struct mutex requirments, so I converted it to use the new API and changed the name. Signed-off-by: Daniel Walker <dwalker@mvista.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
2278c5ac9d
commit
01ac835fdd
@ -147,7 +147,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount)
|
|||||||
if (ptrace_ldt)
|
if (ptrace_ldt)
|
||||||
return read_ldt_from_host(ptr, bytecount);
|
return read_ldt_from_host(ptr, bytecount);
|
||||||
|
|
||||||
down(&ldt->semaphore);
|
mutex_lock(&ldt->lock);
|
||||||
if (ldt->entry_count <= LDT_DIRECT_ENTRIES) {
|
if (ldt->entry_count <= LDT_DIRECT_ENTRIES) {
|
||||||
size = LDT_ENTRY_SIZE*LDT_DIRECT_ENTRIES;
|
size = LDT_ENTRY_SIZE*LDT_DIRECT_ENTRIES;
|
||||||
if (size > bytecount)
|
if (size > bytecount)
|
||||||
@ -171,7 +171,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount)
|
|||||||
ptr += size;
|
ptr += size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
up(&ldt->semaphore);
|
mutex_unlock(&ldt->lock);
|
||||||
|
|
||||||
if (bytecount == 0 || err == -EFAULT)
|
if (bytecount == 0 || err == -EFAULT)
|
||||||
goto out;
|
goto out;
|
||||||
@ -229,7 +229,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int func)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ptrace_ldt)
|
if (!ptrace_ldt)
|
||||||
down(&ldt->semaphore);
|
mutex_lock(&ldt->lock);
|
||||||
|
|
||||||
err = write_ldt_entry(mm_idp, func, &ldt_info, &addr, 1);
|
err = write_ldt_entry(mm_idp, func, &ldt_info, &addr, 1);
|
||||||
if (err)
|
if (err)
|
||||||
@ -289,7 +289,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int func)
|
|||||||
err = 0;
|
err = 0;
|
||||||
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
up(&ldt->semaphore);
|
mutex_unlock(&ldt->lock);
|
||||||
out:
|
out:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -396,7 +396,7 @@ long init_new_ldt(struct mm_context *new_mm, struct mm_context *from_mm)
|
|||||||
|
|
||||||
|
|
||||||
if (!ptrace_ldt)
|
if (!ptrace_ldt)
|
||||||
init_MUTEX(&new_mm->ldt.semaphore);
|
mutex_init(&new_mm->ldt.lock);
|
||||||
|
|
||||||
if (!from_mm) {
|
if (!from_mm) {
|
||||||
memset(&desc, 0, sizeof(desc));
|
memset(&desc, 0, sizeof(desc));
|
||||||
@ -456,7 +456,7 @@ long init_new_ldt(struct mm_context *new_mm, struct mm_context *from_mm)
|
|||||||
* i.e., we have to use the stub for modify_ldt, which
|
* i.e., we have to use the stub for modify_ldt, which
|
||||||
* can't handle the big read buffer of up to 64kB.
|
* can't handle the big read buffer of up to 64kB.
|
||||||
*/
|
*/
|
||||||
down(&from_mm->ldt.semaphore);
|
mutex_lock(&from_mm->ldt.lock);
|
||||||
if (from_mm->ldt.entry_count <= LDT_DIRECT_ENTRIES)
|
if (from_mm->ldt.entry_count <= LDT_DIRECT_ENTRIES)
|
||||||
memcpy(new_mm->ldt.u.entries, from_mm->ldt.u.entries,
|
memcpy(new_mm->ldt.u.entries, from_mm->ldt.u.entries,
|
||||||
sizeof(new_mm->ldt.u.entries));
|
sizeof(new_mm->ldt.u.entries));
|
||||||
@ -475,7 +475,7 @@ long init_new_ldt(struct mm_context *new_mm, struct mm_context *from_mm)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
new_mm->ldt.entry_count = from_mm->ldt.entry_count;
|
new_mm->ldt.entry_count = from_mm->ldt.entry_count;
|
||||||
up(&from_mm->ldt.semaphore);
|
mutex_unlock(&from_mm->ldt.lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#ifndef __ASM_LDT_H
|
#ifndef __ASM_LDT_H
|
||||||
#define __ASM_LDT_H
|
#define __ASM_LDT_H
|
||||||
|
|
||||||
#include "asm/semaphore.h"
|
#include <linux/mutex.h>
|
||||||
#include "asm/host_ldt.h"
|
#include "asm/host_ldt.h"
|
||||||
|
|
||||||
extern void ldt_host_info(void);
|
extern void ldt_host_info(void);
|
||||||
@ -27,7 +27,7 @@ struct ldt_entry {
|
|||||||
|
|
||||||
typedef struct uml_ldt {
|
typedef struct uml_ldt {
|
||||||
int entry_count;
|
int entry_count;
|
||||||
struct semaphore semaphore;
|
struct mutex lock;
|
||||||
union {
|
union {
|
||||||
struct ldt_entry * pages[LDT_PAGES_MAX];
|
struct ldt_entry * pages[LDT_PAGES_MAX];
|
||||||
struct ldt_entry entries[LDT_DIRECT_ENTRIES];
|
struct ldt_entry entries[LDT_DIRECT_ENTRIES];
|
||||||
|
Loading…
Reference in New Issue
Block a user