Commit 8b8f033b authored by Dave Jones's avatar Dave Jones Committed by Dave Jones

[AGPGART] Kill off some typedefs.

Note, I'm leaving behind the ones not in #ifdef __KERNEL__ for now, as I'm
not sure just what userspace stuff that might break.
parent a13100df
......@@ -94,11 +94,12 @@ static void agp_remove_from_pool(agp_memory * temp)
* to each auth'ed client.
*/
static agp_segment_priv *agp_find_seg_in_client(const agp_client * client,
static struct
agp_segment_priv *agp_find_seg_in_client(const struct agp_client *client,
unsigned long offset,
int size, pgprot_t page_prot)
{
agp_segment_priv *seg;
struct agp_segment_priv *seg;
int num_segments, i;
off_t pg_start;
size_t pg_count;
......@@ -119,7 +120,7 @@ static agp_segment_priv *agp_find_seg_in_client(const agp_client * client,
return NULL;
}
static void agp_remove_seg_from_client(agp_client * client)
static void agp_remove_seg_from_client(struct agp_client *client)
{
DBG("client=%p", client);
......@@ -134,10 +135,10 @@ static void agp_remove_seg_from_client(agp_client * client)
}
}
static void agp_add_seg_to_client(agp_client * client,
agp_segment_priv ** seg, int num_segments)
static void agp_add_seg_to_client(struct agp_client *client,
struct agp_segment_priv ** seg, int num_segments)
{
agp_segment_priv **prev_seg;
struct agp_segment_priv **prev_seg;
prev_seg = client->segments;
......@@ -180,20 +181,20 @@ static pgprot_t agp_convert_mmap_flags(int prot)
return temp;
}
static int agp_create_segment(agp_client * client, agp_region * region)
static int agp_create_segment(struct agp_client *client, struct agp_region *region)
{
agp_segment_priv **ret_seg;
agp_segment_priv *seg;
agp_segment *user_seg;
struct agp_segment_priv **ret_seg;
struct agp_segment_priv *seg;
struct agp_segment *user_seg;
size_t i;
seg = kmalloc((sizeof(agp_segment_priv) * region->seg_count), GFP_KERNEL);
seg = kmalloc((sizeof(struct agp_segment_priv) * region->seg_count), GFP_KERNEL);
if (seg == NULL) {
kfree(region->seg_list);
region->seg_list = NULL;
return -ENOMEM;
}
memset(seg, 0, (sizeof(agp_segment_priv) * region->seg_count));
memset(seg, 0, (sizeof(struct agp_segment_priv) * region->seg_count));
user_seg = region->seg_list;
for (i = 0; i < region->seg_count; i++) {
......@@ -233,9 +234,9 @@ static void agp_insert_into_pool(agp_memory * temp)
/* File private list routines */
agp_file_private *agp_find_private(pid_t pid)
struct agp_file_private *agp_find_private(pid_t pid)
{
agp_file_private *curr;
struct agp_file_private *curr;
curr = agp_fe.file_priv_list;
......@@ -248,9 +249,9 @@ agp_file_private *agp_find_private(pid_t pid)
return NULL;
}
void agp_insert_file_private(agp_file_private * priv)
void agp_insert_file_private(struct agp_file_private * priv)
{
agp_file_private *prev;
struct agp_file_private *prev;
prev = agp_fe.file_priv_list;
......@@ -260,10 +261,10 @@ void agp_insert_file_private(agp_file_private * priv)
agp_fe.file_priv_list = priv;
}
void agp_remove_file_private(agp_file_private * priv)
void agp_remove_file_private(struct agp_file_private * priv)
{
agp_file_private *next;
agp_file_private *prev;
struct agp_file_private *next;
struct agp_file_private *prev;
next = priv->next;
prev = priv->prev;
......@@ -312,9 +313,9 @@ static agp_memory *agp_allocate_memory_wrap(size_t pg_count, u32 type)
* controllers
*/
static agp_controller *agp_find_controller_by_pid(pid_t id)
static struct agp_controller *agp_find_controller_by_pid(pid_t id)
{
agp_controller *controller;
struct agp_controller *controller;
controller = agp_fe.controllers;
......@@ -327,24 +328,24 @@ static agp_controller *agp_find_controller_by_pid(pid_t id)
return NULL;
}
static agp_controller *agp_create_controller(pid_t id)
static struct agp_controller *agp_create_controller(pid_t id)
{
agp_controller *controller;
struct agp_controller *controller;
controller = kmalloc(sizeof(agp_controller), GFP_KERNEL);
controller = kmalloc(sizeof(struct agp_controller), GFP_KERNEL);
if (controller == NULL)
return NULL;
memset(controller, 0, sizeof(agp_controller));
memset(controller, 0, sizeof(struct agp_controller));
controller->pid = id;
return controller;
}
static int agp_insert_controller(agp_controller * controller)
static int agp_insert_controller(struct agp_controller *controller)
{
agp_controller *prev_controller;
struct agp_controller *prev_controller;
prev_controller = agp_fe.controllers;
controller->next = prev_controller;
......@@ -357,15 +358,15 @@ static int agp_insert_controller(agp_controller * controller)
return 0;
}
static void agp_remove_all_clients(agp_controller * controller)
static void agp_remove_all_clients(struct agp_controller *controller)
{
agp_client *client;
agp_client *temp;
struct agp_client *client;
struct agp_client *temp;
client = controller->clients;
while (client) {
agp_file_private *priv;
struct agp_file_private *priv;
temp = client;
agp_remove_seg_from_client(temp);
......@@ -380,7 +381,7 @@ static void agp_remove_all_clients(agp_controller * controller)
}
}
static void agp_remove_all_memory(agp_controller * controller)
static void agp_remove_all_memory(struct agp_controller *controller)
{
agp_memory *memory;
agp_memory *temp;
......@@ -394,10 +395,10 @@ static void agp_remove_all_memory(agp_controller * controller)
}
}
static int agp_remove_controller(agp_controller * controller)
static int agp_remove_controller(struct agp_controller *controller)
{
agp_controller *prev_controller;
agp_controller *next_controller;
struct agp_controller *prev_controller;
struct agp_controller *next_controller;
prev_controller = controller->prev;
next_controller = controller->next;
......@@ -426,14 +427,14 @@ static int agp_remove_controller(agp_controller * controller)
return 0;
}
static void agp_controller_make_current(agp_controller * controller)
static void agp_controller_make_current(struct agp_controller *controller)
{
agp_client *clients;
struct agp_client *clients;
clients = controller->clients;
while (clients != NULL) {
agp_file_private *priv;
struct agp_file_private *priv;
priv = agp_find_private(clients->pid);
......@@ -447,16 +448,16 @@ static void agp_controller_make_current(agp_controller * controller)
agp_fe.current_controller = controller;
}
static void agp_controller_release_current(agp_controller * controller,
agp_file_private * controller_priv)
static void agp_controller_release_current(struct agp_controller *controller,
struct agp_file_private *controller_priv)
{
agp_client *clients;
struct agp_client *clients;
clear_bit(AGP_FF_IS_VALID, &controller_priv->access_flags);
clients = controller->clients;
while (clients != NULL) {
agp_file_private *priv;
struct agp_file_private *priv;
priv = agp_find_private(clients->pid);
......@@ -476,10 +477,10 @@ static void agp_controller_release_current(agp_controller * controller,
* These routines are for managing the list of auth'ed clients.
*/
static agp_client *agp_find_client_in_controller(agp_controller * controller,
pid_t id)
static struct agp_client
*agp_find_client_in_controller(struct agp_controller *controller, pid_t id)
{
agp_client *client;
struct agp_client *client;
if (controller == NULL)
return NULL;
......@@ -495,9 +496,9 @@ static agp_client *agp_find_client_in_controller(agp_controller * controller,
return NULL;
}
static agp_controller *agp_find_controller_for_client(pid_t id)
static struct agp_controller *agp_find_controller_for_client(pid_t id)
{
agp_controller *controller;
struct agp_controller *controller;
controller = agp_fe.controllers;
......@@ -510,9 +511,9 @@ static agp_controller *agp_find_controller_for_client(pid_t id)
return NULL;
}
static agp_client *agp_find_client_by_pid(pid_t id)
static struct agp_client *agp_find_client_by_pid(pid_t id)
{
agp_client *temp;
struct agp_client *temp;
if (agp_fe.current_controller == NULL)
return NULL;
......@@ -521,9 +522,9 @@ static agp_client *agp_find_client_by_pid(pid_t id)
return temp;
}
static void agp_insert_client(agp_client * client)
static void agp_insert_client(struct agp_client *client)
{
agp_client *prev_client;
struct agp_client *prev_client;
prev_client = agp_fe.current_controller->clients;
client->next = prev_client;
......@@ -535,16 +536,16 @@ static void agp_insert_client(agp_client * client)
agp_fe.current_controller->num_clients++;
}
static agp_client *agp_create_client(pid_t id)
static struct agp_client *agp_create_client(pid_t id)
{
agp_client *new_client;
struct agp_client *new_client;
new_client = kmalloc(sizeof(agp_client), GFP_KERNEL);
new_client = kmalloc(sizeof(struct agp_client), GFP_KERNEL);
if (new_client == NULL)
return NULL;
memset(new_client, 0, sizeof(agp_client));
memset(new_client, 0, sizeof(struct agp_client));
new_client->pid = id;
agp_insert_client(new_client);
return new_client;
......@@ -552,10 +553,10 @@ static agp_client *agp_create_client(pid_t id)
static int agp_remove_client(pid_t id)
{
agp_client *client;
agp_client *prev_client;
agp_client *next_client;
agp_controller *controller;
struct agp_client *client;
struct agp_client *prev_client;
struct agp_client *next_client;
struct agp_controller *controller;
controller = agp_find_controller_for_client(id);
if (controller == NULL)
......@@ -593,8 +594,8 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
{
unsigned int size, current_size;
unsigned long offset;
agp_client *client;
agp_file_private *priv = (agp_file_private *) file->private_data;
struct agp_client *client;
struct agp_file_private *priv = file->private_data;
agp_kern_info kerninfo;
down(&(agp_fe.agp_mutex));
......@@ -667,22 +668,20 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
static int agp_release(struct inode *inode, struct file *file)
{
agp_file_private *priv = (agp_file_private *) file->private_data;
struct agp_file_private *priv = file->private_data;
down(&(agp_fe.agp_mutex));
DBG("priv=%p", priv);
if (test_bit(AGP_FF_IS_CONTROLLER, &priv->access_flags)) {
agp_controller *controller;
struct agp_controller *controller;
controller = agp_find_controller_by_pid(priv->my_pid);
if (controller != NULL) {
if (controller == agp_fe.current_controller) {
agp_controller_release_current(controller,
priv);
}
if (controller == agp_fe.current_controller)
agp_controller_release_current(controller, priv);
agp_remove_controller(controller);
controller = NULL;
}
......@@ -693,7 +692,7 @@ static int agp_release(struct inode *inode, struct file *file)
agp_remove_file_private(priv);
kfree(priv);
(agp_file_private *) file->private_data = NULL;
file->private_data = NULL;
up(&(agp_fe.agp_mutex));
return 0;
}
......@@ -701,8 +700,8 @@ static int agp_release(struct inode *inode, struct file *file)
static int agp_open(struct inode *inode, struct file *file)
{
int minor = minor(inode->i_rdev);
agp_file_private *priv;
agp_client *client;
struct agp_file_private *priv;
struct agp_client *client;
int rc = -ENXIO;
down(&(agp_fe.agp_mutex));
......@@ -710,11 +709,11 @@ static int agp_open(struct inode *inode, struct file *file)
if (minor != AGPGART_MINOR)
goto err_out;
priv = kmalloc(sizeof(agp_file_private), GFP_KERNEL);
priv = kmalloc(sizeof(struct agp_file_private), GFP_KERNEL);
if (priv == NULL)
goto err_out_nomem;
memset(priv, 0, sizeof(agp_file_private));
memset(priv, 0, sizeof(struct agp_file_private));
set_bit(AGP_FF_ALLOW_CLIENT, &priv->access_flags);
priv->my_pid = current->pid;
......@@ -754,9 +753,9 @@ static ssize_t agp_write(struct file *file, const char *buf,
return -EINVAL;
}
static int agpioc_info_wrap(agp_file_private * priv, unsigned long arg)
static int agpioc_info_wrap(struct agp_file_private *priv, unsigned long arg)
{
agp_info userinfo;
struct agp_info userinfo;
agp_kern_info kerninfo;
agp_copy_info(&kerninfo);
......@@ -771,16 +770,16 @@ static int agpioc_info_wrap(agp_file_private * priv, unsigned long arg)
userinfo.pg_total = userinfo.pg_system = kerninfo.max_memory;
userinfo.pg_used = kerninfo.current_memory;
if (copy_to_user((void *) arg, &userinfo, sizeof(agp_info)))
if (copy_to_user((void *) arg, &userinfo, sizeof(struct agp_info)))
return -EFAULT;
return 0;
}
static int agpioc_acquire_wrap(agp_file_private * priv, unsigned long arg)
static int agpioc_acquire_wrap(struct agp_file_private *priv, unsigned long arg)
{
int ret;
agp_controller *controller;
struct agp_controller *controller;
DBG("");
......@@ -817,36 +816,36 @@ static int agpioc_acquire_wrap(agp_file_private * priv, unsigned long arg)
return 0;
}
static int agpioc_release_wrap(agp_file_private * priv, unsigned long arg)
static int agpioc_release_wrap(struct agp_file_private *priv, unsigned long arg)
{
DBG("");
agp_controller_release_current(agp_fe.current_controller, priv);
return 0;
}
static int agpioc_setup_wrap(agp_file_private * priv, unsigned long arg)
static int agpioc_setup_wrap(struct agp_file_private *priv, unsigned long arg)
{
agp_setup mode;
struct agp_setup mode;
DBG("");
if (copy_from_user(&mode, (void *) arg, sizeof(agp_setup)))
if (copy_from_user(&mode, (void *) arg, sizeof(struct agp_setup)))
return -EFAULT;
agp_enable(mode.agp_mode);
return 0;
}
static int agpioc_reserve_wrap(agp_file_private * priv, unsigned long arg)
static int agpioc_reserve_wrap(struct agp_file_private *priv, unsigned long arg)
{
agp_region reserve;
agp_client *client;
agp_file_private *client_priv;
struct agp_region reserve;
struct agp_client *client;
struct agp_file_private *client_priv;
DBG("");
if (copy_from_user(&reserve, (void *) arg, sizeof(agp_region)))
if (copy_from_user(&reserve, (void *) arg, sizeof(struct agp_region)))
return -EFAULT;
if ((unsigned) reserve.seg_count >= ~0U/sizeof(agp_segment))
if ((unsigned) reserve.seg_count >= ~0U/sizeof(struct agp_segment))
return -EFAULT;
client = agp_find_client_by_pid(reserve.pid);
......@@ -865,19 +864,19 @@ static int agpioc_reserve_wrap(agp_file_private * priv, unsigned long arg)
}
return agp_remove_client(reserve.pid);
} else {
agp_segment *segment;
struct agp_segment *segment;
if (reserve.seg_count >= 16384)
return -EINVAL;
segment = kmalloc((sizeof(agp_segment) * reserve.seg_count),
segment = kmalloc((sizeof(struct agp_segment) * reserve.seg_count),
GFP_KERNEL);
if (segment == NULL)
return -ENOMEM;
if (copy_from_user(segment, (void *) reserve.seg_list,
sizeof(agp_segment) * reserve.seg_count)) {
sizeof(struct agp_segment) * reserve.seg_count)) {
kfree(segment);
return -EFAULT;
}
......@@ -904,20 +903,20 @@ static int agpioc_reserve_wrap(agp_file_private * priv, unsigned long arg)
return -EINVAL;
}
static int agpioc_protect_wrap(agp_file_private * priv, unsigned long arg)
static int agpioc_protect_wrap(struct agp_file_private *priv, unsigned long arg)
{
DBG("");
/* This function is not currently implemented */
return -EINVAL;
}
static int agpioc_allocate_wrap(agp_file_private * priv, unsigned long arg)
static int agpioc_allocate_wrap(struct agp_file_private *priv, unsigned long arg)
{
agp_memory *memory;
agp_allocate alloc;
struct agp_allocate alloc;
DBG("");
if (copy_from_user(&alloc, (void *) arg, sizeof(agp_allocate)))
if (copy_from_user(&alloc, (void *) arg, sizeof(struct agp_allocate)))
return -EFAULT;
memory = agp_allocate_memory_wrap(alloc.pg_count, alloc.type);
......@@ -928,14 +927,14 @@ static int agpioc_allocate_wrap(agp_file_private * priv, unsigned long arg)
alloc.key = memory->key;
alloc.physical = memory->physical;
if (copy_to_user((void *) arg, &alloc, sizeof(agp_allocate))) {
if (copy_to_user((void *) arg, &alloc, sizeof(struct agp_allocate))) {
agp_free_memory_wrap(memory);
return -EFAULT;
}
return 0;
}
static int agpioc_deallocate_wrap(agp_file_private * priv, unsigned long arg)
static int agpioc_deallocate_wrap(struct agp_file_private *priv, unsigned long arg)
{
agp_memory *memory;
......@@ -949,13 +948,13 @@ static int agpioc_deallocate_wrap(agp_file_private * priv, unsigned long arg)
return 0;
}
static int agpioc_bind_wrap(agp_file_private * priv, unsigned long arg)
static int agpioc_bind_wrap(struct agp_file_private *priv, unsigned long arg)
{
agp_bind bind_info;
struct agp_bind bind_info;
agp_memory *memory;
DBG("");
if (copy_from_user(&bind_info, (void *) arg, sizeof(agp_bind)))
if (copy_from_user(&bind_info, (void *) arg, sizeof(struct agp_bind)))
return -EFAULT;
memory = agp_find_mem_by_key(bind_info.key);
......@@ -966,13 +965,13 @@ static int agpioc_bind_wrap(agp_file_private * priv, unsigned long arg)
return agp_bind_memory(memory, bind_info.pg_start);
}
static int agpioc_unbind_wrap(agp_file_private * priv, unsigned long arg)
static int agpioc_unbind_wrap(struct agp_file_private *priv, unsigned long arg)
{
agp_memory *memory;
agp_unbind unbind;
struct agp_unbind unbind;
DBG("");
if (copy_from_user(&unbind, (void *) arg, sizeof(agp_unbind)))
if (copy_from_user(&unbind, (void *) arg, sizeof(struct agp_unbind)))
return -EFAULT;
memory = agp_find_mem_by_key(unbind.key);
......@@ -986,7 +985,7 @@ static int agpioc_unbind_wrap(agp_file_private * priv, unsigned long arg)
static int agp_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
agp_file_private *curr_priv = (agp_file_private *) file->private_data;
struct agp_file_private *curr_priv = file->private_data;
int ret_val = -ENOTTY;
DBG("priv=%p, cmd=%x", curr_priv, cmd);
......
......@@ -27,17 +27,19 @@
#ifndef _AGP_H
#define _AGP_H 1
#include <linux/agp_backend.h>
#define AGPIOC_BASE 'A'
#define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, agp_info*)
#define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, struct agp_info*)
#define AGPIOC_ACQUIRE _IO (AGPIOC_BASE, 1)
#define AGPIOC_RELEASE _IO (AGPIOC_BASE, 2)
#define AGPIOC_SETUP _IOW (AGPIOC_BASE, 3, agp_setup*)
#define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, agp_region*)
#define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, agp_region*)
#define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, agp_allocate*)
#define AGPIOC_SETUP _IOW (AGPIOC_BASE, 3, struct agp_setup*)
#define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, struct agp_region*)
#define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, struct agp_region*)
#define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, struct agp_allocate*)
#define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int)
#define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, agp_bind*)
#define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, agp_unbind*)
#define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, struct agp_bind*)
#define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, struct agp_unbind*)
#define AGP_DEVICE "/dev/agpgart"
......@@ -112,15 +114,7 @@ typedef struct _agp_unbind {
#define AGPGART_MINOR 175
#ifndef _AGP_BACKEND_H
struct _agp_version {
u16 major;
u16 minor;
} agp_version;
#endif
typedef struct _agp_info {
struct agp_info {
struct agp_version version; /* version of the driver */
u32 bridge_id; /* bridge vendor/device */
u32 agp_mode; /* mode info of bridge */
......@@ -129,34 +123,34 @@ typedef struct _agp_info {
size_t pg_total; /* max pages (swap + system) */
size_t pg_system; /* max pages (system) */
size_t pg_used; /* current pages used */
} agp_info;
};
typedef struct _agp_setup {
struct agp_setup {
u32 agp_mode; /* mode info of bridge */
} agp_setup;
};
/*
* The "prot" down below needs still a "sleep" flag somehow ...
*/
typedef struct _agp_segment {
struct agp_segment {
off_t pg_start; /* starting page to populate */
size_t pg_count; /* number of pages */
int prot; /* prot flags for mmap */
} agp_segment;
};
typedef struct _agp_segment_priv {
struct agp_segment_priv {
off_t pg_start;
size_t pg_count;
pgprot_t prot;
} agp_segment_priv;
};
typedef struct _agp_region {
struct agp_region {
pid_t pid; /* pid of process */
size_t seg_count; /* number of segments */
struct _agp_segment *seg_list;
} agp_region;
struct agp_segment *seg_list;
};
typedef struct _agp_allocate {
struct agp_allocate {
int key; /* tag of allocation */
size_t pg_count; /* number of pages */
u32 type; /* 0 == normal, other devspec */
......@@ -164,34 +158,34 @@ typedef struct _agp_allocate {
* need a phys address of the
* actual page behind the gatt
* table) */
} agp_allocate;
};
typedef struct _agp_bind {
struct agp_bind {
int key; /* tag of allocation */
off_t pg_start; /* starting page to populate */
} agp_bind;
};
typedef struct _agp_unbind {
struct agp_unbind {
int key; /* tag of allocation */
u32 priority; /* priority for paging out */
} agp_unbind;
};
typedef struct _agp_client {
struct _agp_client *next;
struct _agp_client *prev;
struct agp_client {
struct agp_client *next;
struct agp_client *prev;
pid_t pid;
int num_segments;
agp_segment_priv **segments;
} agp_client;
struct agp_segment_priv **segments;
};
typedef struct _agp_controller {
struct _agp_controller *next;
struct _agp_controller *prev;
struct agp_controller {
struct agp_controller *next;
struct agp_controller *prev;
pid_t pid;
int num_clients;
agp_memory *pool;
agp_client *clients;
} agp_controller;
struct agp_client *clients;
};
#define AGP_FF_ALLOW_CLIENT 0
#define AGP_FF_ALLOW_CONTROLLER 1
......@@ -199,18 +193,18 @@ typedef struct _agp_controller {
#define AGP_FF_IS_CONTROLLER 3
#define AGP_FF_IS_VALID 4
typedef struct _agp_file_private {
struct _agp_file_private *next;
struct _agp_file_private *prev;
struct agp_file_private {
struct agp_file_private *next;
struct agp_file_private *prev;
pid_t my_pid;
long access_flags; /* long req'd for set_bit --RR */
} agp_file_private;
};
struct agp_front_data {
struct semaphore agp_mutex;
agp_controller *current_controller;
agp_controller *controllers;
agp_file_private *file_priv_list;
struct agp_controller *current_controller;
struct agp_controller *controllers;
struct agp_file_private *file_priv_list;
u8 used_by_controller;
u8 backend_acquired;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment