[AFS]: Clean up the AFS sources

Clean up the AFS sources.

Also remove references to AFS keys.  RxRPC keys are used instead.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David Howells
2007-04-26 15:49:28 -07:00
committed by David S. Miller
parent 17926a7932
commit ec26815ad8
36 changed files with 506 additions and 906 deletions
-2
View File
@@ -2,8 +2,6 @@
# Makefile for Red Hat Linux AFS client.
#
#CFLAGS += -finstrument-functions
kafs-objs := \
callback.o \
cell.o \
+4 -8
View File
@@ -1,4 +1,4 @@
/* cache.h: AFS local cache management interface
/* AFS local cache management interface
*
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
@@ -9,8 +9,8 @@
* 2 of the License, or (at your option) any later version.
*/
#ifndef _LINUX_AFS_CACHE_H
#define _LINUX_AFS_CACHE_H
#ifndef AFS_CACHE_H
#define AFS_CACHE_H
#undef AFS_CACHING_SUPPORT
@@ -20,8 +20,4 @@
#endif
#include "types.h"
#ifdef __KERNEL__
#endif /* __KERNEL__ */
#endif /* _LINUX_AFS_CACHE_H */
#endif /* AFS_CACHE_H */
+3 -6
View File
@@ -21,7 +21,6 @@
#include "internal.h"
#include "cmservice.h"
/*****************************************************************************/
/*
* allow the fileserver to request callback state (re-)initialisation
*/
@@ -79,9 +78,8 @@ int SRXAFSCM_InitCallBackState(struct afs_server *server)
_leave(" = 0");
return 0;
} /* end SRXAFSCM_InitCallBackState() */
}
/*****************************************************************************/
/*
* allow the fileserver to break callback promises
*/
@@ -156,9 +154,8 @@ int SRXAFSCM_CallBack(struct afs_server *server, size_t count,
_leave(" = 0");
return 0;
} /* end SRXAFSCM_CallBack() */
}
/*****************************************************************************/
/*
* allow the fileserver to see if the cache manager is still alive
*/
@@ -166,4 +163,4 @@ int SRXAFSCM_Probe(struct afs_server *server)
{
_debug("SRXAFSCM_Probe(%p)\n", server);
return 0;
} /* end SRXAFSCM_Probe() */
}
+18 -33
View File
@@ -1,4 +1,4 @@
/* cell.c: AFS cell and server record management
/* AFS cell and server record management
*
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
@@ -44,7 +44,6 @@ struct cachefs_index_def afs_cache_cell_index_def = {
};
#endif
/*****************************************************************************/
/*
* create a cell record
* - "name" is the name of the cell
@@ -137,16 +136,15 @@ int afs_cell_create(const char *name, char *vllist, struct afs_cell **_cell)
_leave(" = 0 (%p)", cell);
return 0;
badaddr:
badaddr:
printk(KERN_ERR "kAFS: bad VL server IP address: '%s'\n", vllist);
error:
error:
up_write(&afs_cells_sem);
kfree(cell);
_leave(" = %d", ret);
return ret;
} /* end afs_cell_create() */
}
/*****************************************************************************/
/*
* initialise the cell database from module parameters
*/
@@ -199,10 +197,8 @@ int afs_cell_init(char *rootcell)
_leave(" = %d", ret);
return ret;
}
} /* end afs_cell_init() */
/*****************************************************************************/
/*
* lookup a cell record
*/
@@ -234,8 +230,7 @@ int afs_cell_lookup(const char *name, unsigned namesz, struct afs_cell **_cell)
if (cell)
ret = 0;
}
else {
} else {
read_lock(&afs_cells_lock);
cell = afs_cell_root;
@@ -247,8 +242,7 @@ int afs_cell_lookup(const char *name, unsigned namesz, struct afs_cell **_cell)
* for other reasons.
*/
ret = -EDESTADDRREQ;
}
else {
} else {
afs_get_cell(cell);
ret = 0;
}
@@ -259,10 +253,8 @@ int afs_cell_lookup(const char *name, unsigned namesz, struct afs_cell **_cell)
*_cell = cell;
_leave(" = %d (%p)", ret, cell);
return ret;
}
} /* end afs_cell_lookup() */
/*****************************************************************************/
/*
* try and get a cell record
*/
@@ -281,9 +273,8 @@ struct afs_cell *afs_get_cell_maybe(struct afs_cell **_cell)
write_unlock(&afs_cells_lock);
return cell;
} /* end afs_get_cell_maybe() */
}
/*****************************************************************************/
/*
* destroy a cell record
*/
@@ -315,9 +306,8 @@ void afs_put_cell(struct afs_cell *cell)
BUG_ON(!list_empty(&cell->vl_graveyard));
_leave(" [unused]");
} /* end afs_put_cell() */
}
/*****************************************************************************/
/*
* destroy a cell record
*/
@@ -359,9 +349,8 @@ static void afs_cell_destroy(struct afs_cell *cell)
kfree(cell);
_leave(" [destroyed]");
} /* end afs_cell_destroy() */
}
/*****************************************************************************/
/*
* lookup the server record corresponding to an Rx RPC peer
*/
@@ -411,7 +400,7 @@ int afs_server_find_by_peer(const struct rxrpc_peer *peer,
return -ENOENT;
/* we found it in the graveyard - resurrect it */
found_dead_server:
found_dead_server:
list_move_tail(&server->link, &cell->sv_list);
afs_get_server(server);
afs_kafstimod_del_timer(&server->timeout);
@@ -419,20 +408,18 @@ int afs_server_find_by_peer(const struct rxrpc_peer *peer,
goto success;
/* we found it - increment its ref count and return it */
found_server:
found_server:
afs_get_server(server);
success:
success:
write_unlock(&cell->sv_lock);
read_unlock(&afs_cells_lock);
*_server = server;
_leave(" = 0 (s=%p c=%p)", server, cell);
return 0;
}
} /* end afs_server_find_by_peer() */
/*****************************************************************************/
/*
* purge in-memory cell database on module unload or afs_init() failure
* - the timeout daemon is stopped before calling this
@@ -520,9 +507,8 @@ void afs_cell_purge(void)
}
_leave("");
} /* end afs_cell_purge() */
}
/*****************************************************************************/
/*
* match a cell record obtained from the cache
*/
@@ -542,10 +528,9 @@ static cachefs_match_val_t afs_cell_cache_match(void *target,
_leave(" = FAILED");
return CACHEFS_MATCH_FAILED;
} /* end afs_cell_cache_match() */
}
#endif
/*****************************************************************************/
/*
* update a cell record in the cache
*/
@@ -563,5 +548,5 @@ static void afs_cell_cache_update(void *source, void *entry)
cell->vl_addrs,
min(sizeof(ccell->vl_servers), sizeof(cell->vl_addrs)));
} /* end afs_cell_cache_update() */
}
#endif
+11 -19
View File
@@ -1,4 +1,4 @@
/* cell.h: AFS cell record
/* AFS cell record
*
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
@@ -9,8 +9,8 @@
* 2 of the License, or (at your option) any later version.
*/
#ifndef _LINUX_AFS_CELL_H
#define _LINUX_AFS_CELL_H
#ifndef AFS_CELL_H
#define AFS_CELL_H
#include "types.h"
#include "cache.h"
@@ -19,22 +19,18 @@
extern volatile int afs_cells_being_purged; /* T when cells are being purged by rmmod */
/*****************************************************************************/
/*
* entry in the cached cell catalogue
*/
struct afs_cache_cell
{
struct afs_cache_cell {
char name[64]; /* cell name (padded with NULs) */
struct in_addr vl_servers[15]; /* cached cell VL servers */
};
/*****************************************************************************/
/*
* AFS cell record
*/
struct afs_cell
{
struct afs_cell {
atomic_t usage;
struct list_head link; /* main cell list link */
struct list_head proc_link; /* /proc cell list link */
@@ -61,18 +57,14 @@ struct afs_cell
char name[0]; /* cell name - must go last */
};
extern int afs_cell_init(char *rootcell);
extern int afs_cell_create(const char *name, char *vllist, struct afs_cell **_cell);
extern int afs_cell_lookup(const char *name, unsigned nmsize, struct afs_cell **_cell);
extern int afs_cell_init(char *);
extern int afs_cell_create(const char *, char *, struct afs_cell **);
extern int afs_cell_lookup(const char *, unsigned, struct afs_cell **);
#define afs_get_cell(C) do { atomic_inc(&(C)->usage); } while(0)
extern struct afs_cell *afs_get_cell_maybe(struct afs_cell **_cell);
extern void afs_put_cell(struct afs_cell *cell);
extern struct afs_cell *afs_get_cell_maybe(struct afs_cell **);
extern void afs_put_cell(struct afs_cell *);
extern void afs_cell_purge(void);
#endif /* _LINUX_AFS_CELL_H */
#endif /* AFS_CELL_H */
+14 -32
View File
@@ -1,4 +1,4 @@
/* cmservice.c: AFS Cache Manager Service
/* AFS Cache Manager Service
*
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
@@ -106,7 +106,6 @@ static DEFINE_SPINLOCK(afscm_calls_lock);
static DEFINE_SPINLOCK(kafscmd_attention_lock);
static int kafscmd_die;
/*****************************************************************************/
/*
* AFS Cache Manager kernel thread
*/
@@ -177,10 +176,8 @@ static int kafscmd(void *arg)
/* and that's all */
complete_and_exit(&kafscmd_dead, 0);
}
} /* end kafscmd() */
/*****************************************************************************/
/*
* handle a call coming in to the cache manager
* - if I want to keep the call, I must increment its usage count
@@ -202,10 +199,8 @@ static int afscm_new_call(struct rxrpc_call *call)
_leave(" = 0");
return 0;
}
} /* end afscm_new_call() */
/*****************************************************************************/
/*
* queue on the kafscmd queue for attention
*/
@@ -226,9 +221,8 @@ static void afscm_attention(struct rxrpc_call *call)
wake_up(&kafscmd_sleepq);
_leave(" {u=%d}", atomic_read(&call->usage));
} /* end afscm_attention() */
}
/*****************************************************************************/
/*
* handle my call being aborted
* - clean up, dequeue and put my ref to the call
@@ -266,9 +260,8 @@ static void afscm_error(struct rxrpc_call *call)
wake_up(&kafscmd_sleepq);
_leave("");
} /* end afscm_error() */
}
/*****************************************************************************/
/*
* map afs abort codes to/from Linux error codes
* - called with call->lock held
@@ -285,9 +278,8 @@ static void afscm_aemap(struct rxrpc_call *call)
default:
break;
}
} /* end afscm_aemap() */
}
/*****************************************************************************/
/*
* start the cache manager service if not already started
*/
@@ -316,18 +308,16 @@ int afscm_start(void)
return 0;
kill:
kill:
kafscmd_die = 1;
wake_up(&kafscmd_sleepq);
wait_for_completion(&kafscmd_dead);
out:
out:
up_write(&afscm_sem);
return ret;
}
} /* end afscm_start() */
/*****************************************************************************/
/*
* stop the cache manager service
*/
@@ -394,10 +384,8 @@ void afscm_stop(void)
}
up_write(&afscm_sem);
}
} /* end afscm_stop() */
/*****************************************************************************/
/*
* handle the fileserver breaking a set of callbacks
*/
@@ -460,8 +448,7 @@ static void _SRXAFSCM_CallBack(struct rxrpc_call *call)
pcb->version = ntohl(*bp++);
pcb->expiry = ntohl(*bp++);
pcb->type = ntohl(*bp++);
}
else {
} else {
pcb->version = 0;
pcb->expiry = 0;
pcb->type = AFSCM_CB_UNTYPED;
@@ -512,10 +499,8 @@ static void _SRXAFSCM_CallBack(struct rxrpc_call *call)
afs_put_server(server);
_leave(" = %d", ret);
}
} /* end _SRXAFSCM_CallBack() */
/*****************************************************************************/
/*
* handle the fileserver asking us to initialise our callback state
*/
@@ -580,10 +565,8 @@ static void _SRXAFSCM_InitCallBackState(struct rxrpc_call *call)
afs_put_server(server);
_leave(" = %d", ret);
}
} /* end _SRXAFSCM_InitCallBackState() */
/*****************************************************************************/
/*
* handle a probe from a fileserver
*/
@@ -648,5 +631,4 @@ static void _SRXAFSCM_Probe(struct rxrpc_call *call)
afs_put_server(server);
_leave(" = %d", ret);
} /* end _SRXAFSCM_Probe() */
}
+8 -9
View File
@@ -1,4 +1,4 @@
/* cmservice.h: AFS Cache Manager Service declarations
/* AFS Cache Manager Service declarations
*
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
@@ -9,8 +9,8 @@
* 2 of the License, or (at your option) any later version.
*/
#ifndef _LINUX_AFS_CMSERVICE_H
#define _LINUX_AFS_CMSERVICE_H
#ifndef AFS_CMSERVICE_H
#define AFS_CMSERVICE_H
#include <rxrpc/transport.h>
#include "types.h"
@@ -20,10 +20,9 @@ extern int afscm_start(void);
extern void afscm_stop(void);
/* cache manager server functions */
extern int SRXAFSCM_InitCallBackState(struct afs_server *server);
extern int SRXAFSCM_CallBack(struct afs_server *server,
size_t count,
struct afs_callback callbacks[]);
extern int SRXAFSCM_Probe(struct afs_server *server);
extern int SRXAFSCM_InitCallBackState(struct afs_server *);
extern int SRXAFSCM_CallBack(struct afs_server *, size_t,
struct afs_callback[]);
extern int SRXAFSCM_Probe(struct afs_server *);
#endif /* _LINUX_AFS_CMSERVICE_H */
#endif /* AFS_CMSERVICE_H */
+18 -32
View File
@@ -112,7 +112,6 @@ struct afs_dir_lookup_cookie {
int found;
};
/*****************************************************************************/
/*
* check that a directory page is valid
*/
@@ -157,13 +156,11 @@ static inline void afs_dir_check_page(struct inode *dir, struct page *page)
SetPageChecked(page);
return;
error:
error:
SetPageChecked(page);
SetPageError(page);
}
} /* end afs_dir_check_page() */
/*****************************************************************************/
/*
* discard a page cached in the pagecache
*/
@@ -171,10 +168,8 @@ static inline void afs_dir_put_page(struct page *page)
{
kunmap(page);
page_cache_release(page);
}
} /* end afs_dir_put_page() */
/*****************************************************************************/
/*
* get a page into the pagecache
*/
@@ -197,12 +192,11 @@ static struct page *afs_dir_get_page(struct inode *dir, unsigned long index)
}
return page;
fail:
fail:
afs_dir_put_page(page);
return ERR_PTR(-EIO);
} /* end afs_dir_get_page() */
}
/*****************************************************************************/
/*
* open an AFS directory file
*/
@@ -218,10 +212,8 @@ static int afs_dir_open(struct inode *inode, struct file *file)
_leave(" = 0");
return 0;
}
} /* end afs_dir_open() */
/*****************************************************************************/
/*
* deal with one block in an AFS directory
*/
@@ -316,9 +308,8 @@ static int afs_dir_iterate_block(unsigned *fpos,
_leave(" = 1 [more]");
return 1;
} /* end afs_dir_iterate_block() */
}
/*****************************************************************************/
/*
* read an AFS directory
*/
@@ -377,12 +368,11 @@ static int afs_dir_iterate(struct inode *dir, unsigned *fpos, void *cookie,
ret = 0;
}
out:
out:
_leave(" = %d", ret);
return ret;
} /* end afs_dir_iterate() */
}
/*****************************************************************************/
/*
* read an AFS directory
*/
@@ -399,9 +389,8 @@ static int afs_dir_readdir(struct file *file, void *cookie, filldir_t filldir)
_leave(" = %d", ret);
return ret;
} /* end afs_dir_readdir() */
}
/*****************************************************************************/
/*
* search the directory for a name
* - if afs_dir_iterate_block() spots this function, it'll pass the FID
@@ -426,9 +415,8 @@ static int afs_dir_lookup_filldir(void *_cookie, const char *name, int nlen,
_leave(" = -1 [found]");
return -1;
} /* end afs_dir_lookup_filldir() */
}
/*****************************************************************************/
/*
* look up an entry in a directory
*/
@@ -498,9 +486,8 @@ static struct dentry *afs_dir_lookup(struct inode *dir, struct dentry *dentry,
dentry->d_inode->i_version);
return NULL;
} /* end afs_dir_lookup() */
}
/*****************************************************************************/
/*
* check that a dentry lookup hit has found a valid entry
* - NOTE! the hit can be a negative hit too, so we can't assume we have an
@@ -605,18 +592,18 @@ static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
(void *) (unsigned long) AFS_FS_I(dir)->status.version;
}
out_valid:
out_valid:
dput(parent);
_leave(" = 1 [valid]");
return 1;
/* the dirent, if it exists, now points to a different vnode */
not_found:
not_found:
spin_lock(&dentry->d_lock);
dentry->d_flags |= DCACHE_NFSFS_RENAMED;
spin_unlock(&dentry->d_lock);
out_bad:
out_bad:
if (inode) {
/* don't unhash if we have submounts */
if (have_submounts(dentry))
@@ -633,9 +620,8 @@ static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
_leave(" = 0 [bad]");
return 0;
} /* end afs_d_revalidate() */
}
/*****************************************************************************/
/*
* allow the VFS to enquire as to whether a dentry should be unhashed (mustn't
* sleep)
@@ -657,7 +643,7 @@ static int afs_d_delete(struct dentry *dentry)
_leave(" = 0 [keep]");
return 0;
zap:
zap:
_leave(" = 1 [zap]");
return 1;
} /* end afs_d_delete() */
}
+8 -6
View File
@@ -1,4 +1,4 @@
/* errors.h: AFS abort/error codes
/* AFS abort/error codes
*
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
@@ -9,12 +9,14 @@
* 2 of the License, or (at your option) any later version.
*/
#ifndef _LINUX_AFS_ERRORS_H
#define _LINUX_AFS_ERRORS_H
#ifndef AFS_ERRORS_H
#define AFS_ERRORS_H
#include "types.h"
/* file server abort codes */
/*
* file server abort codes
*/
typedef enum {
VSALVAGE = 101, /* volume needs salvaging */
VNOVNODE = 102, /* no such file/dir (vnode) */
@@ -29,6 +31,6 @@ typedef enum {
VMOVED = 111, /* volume moved to new server - ask this FS where */
} afs_rxfs_abort_t;
extern int afs_abort_to_error(int abortcode);
extern int afs_abort_to_error(int);
#endif /* _LINUX_AFS_ERRORS_H */
#endif /* AFS_ERRORS_H */
+6 -14
View File
@@ -40,7 +40,6 @@ const struct address_space_operations afs_fs_aops = {
.invalidatepage = afs_file_invalidatepage,
};
/*****************************************************************************/
/*
* deal with notification that a page was read from the cache
*/
@@ -58,10 +57,9 @@ static void afs_file_readpage_read_complete(void *cookie_data,
SetPageUptodate(page);
unlock_page(page);
} /* end afs_file_readpage_read_complete() */
}
#endif
/*****************************************************************************/
/*
* deal with notification that a page was written to the cache
*/
@@ -74,11 +72,9 @@ static void afs_file_readpage_write_complete(void *cookie_data,
_enter("%p,%p,%p,%d", cookie_data, page, data, error);
unlock_page(page);
} /* end afs_file_readpage_write_complete() */
}
#endif
/*****************************************************************************/
/*
* AFS read page from file (or symlink)
*/
@@ -184,10 +180,8 @@ static int afs_file_readpage(struct file *file, struct page *page)
_leave(" = %d", ret);
return ret;
}
} /* end afs_file_readpage() */
/*****************************************************************************/
/*
* get a page cookie for the specified page
*/
@@ -202,10 +196,9 @@ int afs_cache_get_page_cookie(struct page *page,
_leave(" = %d", ret);
return ret;
} /* end afs_cache_get_page_cookie() */
}
#endif
/*****************************************************************************/
/*
* invalidate part or all of a page
*/
@@ -240,9 +233,8 @@ static void afs_file_invalidatepage(struct page *page, unsigned long offset)
}
_leave(" = %d", ret);
} /* end afs_file_invalidatepage() */
}
/*****************************************************************************/
/*
* release a page and cleanup its private data
*/
@@ -267,4 +259,4 @@ static int afs_file_releasepage(struct page *page, gfp_t gfp_flags)
_leave(" = 0");
return 0;
} /* end afs_file_releasepage() */
}
+32 -41
View File
@@ -29,7 +29,6 @@
#define FSGETROOTVOLUME 151 /* AFS Get root volume name */
#define FSLOOKUP 161 /* AFS lookup file in directory */
/*****************************************************************************/
/*
* map afs abort codes to/from Linux error codes
* - called with call->lock held
@@ -46,9 +45,8 @@ static void afs_rxfs_aemap(struct rxrpc_call *call)
default:
break;
}
} /* end afs_rxfs_aemap() */
}
/*****************************************************************************/
/*
* get the root volume name from a fileserver
* - this operation doesn't seem to work correctly in OpenAFS server 1.2.2
@@ -162,23 +160,22 @@ int afs_rxfs_get_root_volume(struct afs_server *server,
BUG();
}
abort:
abort:
set_current_state(TASK_UNINTERRUPTIBLE);
rxrpc_call_abort(call, ret);
schedule();
out_unwait:
out_unwait:
set_current_state(TASK_RUNNING);
remove_wait_queue(&call->waitq, &myself);
rxrpc_put_call(call);
out_put_conn:
out_put_conn:
afs_server_release_fsconn(server, conn);
out:
out:
kleave("");
return ret;
} /* end afs_rxfs_get_root_volume() */
}
#endif
/*****************************************************************************/
/*
* get information about a volume
*/
@@ -275,26 +272,24 @@ int afs_rxfs_get_volume_info(struct afs_server *server,
/* success */
ret = 0;
out_unwait:
out_unwait:
set_current_state(TASK_RUNNING);
remove_wait_queue(&call->waitq, &myself);
rxrpc_put_call(call);
out_put_conn:
out_put_conn:
afs_server_release_fsconn(server, conn);
out:
out:
_leave("");
return ret;
abort:
abort:
set_current_state(TASK_UNINTERRUPTIBLE);
rxrpc_call_abort(call, ret);
schedule();
goto out_unwait;
} /* end afs_rxfs_get_volume_info() */
}
#endif
/*****************************************************************************/
/*
* fetch the status information for a file
*/
@@ -401,24 +396,23 @@ int afs_rxfs_fetch_file_status(struct afs_server *server,
/* success */
ret = 0;
out_unwait:
out_unwait:
set_current_state(TASK_RUNNING);
remove_wait_queue(&call->waitq, &myself);
rxrpc_put_call(call);
out_put_conn:
out_put_conn:
afs_server_release_callslot(server, &callslot);
out:
out:
_leave("");
return ret;
abort:
abort:
set_current_state(TASK_UNINTERRUPTIBLE);
rxrpc_call_abort(call, ret);
schedule();
goto out_unwait;
} /* end afs_rxfs_fetch_file_status() */
}
/*****************************************************************************/
/*
* fetch the contents of a file or directory
*/
@@ -547,31 +541,29 @@ int afs_rxfs_fetch_file_data(struct afs_server *server,
/* success */
ret = 0;
out_unwait:
out_unwait:
set_current_state(TASK_RUNNING);
remove_wait_queue(&call->waitq,&myself);
rxrpc_put_call(call);
out_put_conn:
out_put_conn:
afs_server_release_callslot(server, &callslot);
out:
out:
_leave(" = %d", ret);
return ret;
read_failed:
read_failed:
if (ret == -ECONNABORTED) {
ret = call->app_errno;
goto out_unwait;
}
abort:
abort:
set_current_state(TASK_UNINTERRUPTIBLE);
rxrpc_call_abort(call, ret);
schedule();
goto out_unwait;
}
} /* end afs_rxfs_fetch_file_data() */
/*****************************************************************************/
/*
* ask the AFS fileserver to discard a callback request on a file
*/
@@ -655,24 +647,23 @@ int afs_rxfs_give_up_callback(struct afs_server *server,
BUG();
}
out_unwait:
out_unwait:
set_current_state(TASK_RUNNING);
remove_wait_queue(&call->waitq, &myself);
rxrpc_put_call(call);
out_put_conn:
out_put_conn:
afs_server_release_callslot(server, &callslot);
out:
out:
_leave("");
return ret;
abort:
abort:
set_current_state(TASK_UNINTERRUPTIBLE);
rxrpc_call_abort(call, ret);
schedule();
goto out_unwait;
} /* end afs_rxfs_give_up_callback() */
}
/*****************************************************************************/
/*
* look a filename up in a directory
* - this operation doesn't seem to work correctly in OpenAFS server 1.2.2
@@ -818,20 +809,20 @@ int afs_rxfs_lookup(struct afs_server *server,
/* success */
ret = 0;
out_unwait:
out_unwait:
set_current_state(TASK_RUNNING);
remove_wait_queue(&call->waitq, &myself);
rxrpc_put_call(call);
out_put_conn:
out_put_conn:
afs_server_release_fsconn(server, conn);
out:
out:
kleave("");
return ret;
abort:
abort:
set_current_state(TASK_UNINTERRUPTIBLE);
rxrpc_call_abort(call, ret);
schedule();
goto out_unwait;
} /* end afs_rxfs_lookup() */
}
#endif
+24 -24
View File
@@ -1,4 +1,4 @@
/* fsclient.h: AFS File Server client stub declarations
/* AFS File Server client stub declarations
*
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
@@ -9,18 +9,18 @@
* 2 of the License, or (at your option) any later version.
*/
#ifndef _LINUX_AFS_FSCLIENT_H
#define _LINUX_AFS_FSCLIENT_H
#ifndef AFS_FSCLIENT_H
#define AFS_FSCLIENT_H
#include "server.h"
extern int afs_rxfs_get_volume_info(struct afs_server *server,
const char *name,
struct afs_volume_info *vinfo);
extern int afs_rxfs_get_volume_info(struct afs_server *,
const char *,
struct afs_volume_info *);
extern int afs_rxfs_fetch_file_status(struct afs_server *server,
struct afs_vnode *vnode,
struct afs_volsync *volsync);
extern int afs_rxfs_fetch_file_status(struct afs_server *,
struct afs_vnode *,
struct afs_volsync *);
struct afs_rxfs_fetch_descriptor {
struct afs_fid fid; /* file ID to fetch */
@@ -30,25 +30,25 @@ struct afs_rxfs_fetch_descriptor {
size_t actual; /* actual size sent back by server */
};
extern int afs_rxfs_fetch_file_data(struct afs_server *server,
struct afs_vnode *vnode,
struct afs_rxfs_fetch_descriptor *desc,
struct afs_volsync *volsync);
extern int afs_rxfs_fetch_file_data(struct afs_server *,
struct afs_vnode *,
struct afs_rxfs_fetch_descriptor *,
struct afs_volsync *);
extern int afs_rxfs_give_up_callback(struct afs_server *server,
struct afs_vnode *vnode);
extern int afs_rxfs_give_up_callback(struct afs_server *,
struct afs_vnode *);
/* this doesn't appear to work in OpenAFS server */
extern int afs_rxfs_lookup(struct afs_server *server,
struct afs_vnode *dir,
const char *filename,
struct afs_vnode *vnode,
struct afs_volsync *volsync);
extern int afs_rxfs_lookup(struct afs_server *,
struct afs_vnode *,
const char *,
struct afs_vnode *,
struct afs_volsync *);
/* this is apparently mis-implemented in OpenAFS server */
extern int afs_rxfs_get_root_volume(struct afs_server *server,
char *buf,
size_t *buflen);
extern int afs_rxfs_get_root_volume(struct afs_server *,
char *,
size_t *);
#endif /* _LINUX_AFS_FSCLIENT_H */
#endif /* AFS_FSCLIENT_H */
+10 -19
View File
@@ -29,7 +29,6 @@ struct afs_iget_data {
struct afs_volume *volume; /* volume on which resides */
};
/*****************************************************************************/
/*
* map the AFS file status to the inode member variables
*/
@@ -87,9 +86,8 @@ static int afs_inode_map_status(struct afs_vnode *vnode)
}
return 0;
} /* end afs_inode_map_status() */
}
/*****************************************************************************/
/*
* attempt to fetch the status of an inode, coelescing multiple simultaneous
* fetches
@@ -107,10 +105,8 @@ static int afs_inode_fetch_status(struct inode *inode)
ret = afs_inode_map_status(vnode);
return ret;
}
} /* end afs_inode_fetch_status() */
/*****************************************************************************/
/*
* iget5() comparator
*/
@@ -120,9 +116,8 @@ static int afs_iget5_test(struct inode *inode, void *opaque)
return inode->i_ino == data->fid.vnode &&
inode->i_version == data->fid.unique;
} /* end afs_iget5_test() */
}
/*****************************************************************************/
/*
* iget5() inode initialiser
*/
@@ -137,9 +132,8 @@ static int afs_iget5_set(struct inode *inode, void *opaque)
vnode->volume = data->volume;
return 0;
} /* end afs_iget5_set() */
}
/*****************************************************************************/
/*
* inode retrieval
*/
@@ -169,7 +163,7 @@ inline int afs_iget(struct super_block *sb, struct afs_fid *fid,
/* deal with an existing inode */
if (!(inode->i_state & I_NEW)) {
ret = afs_vnode_fetch_status(vnode);
if (ret==0)
if (ret == 0)
*_inode = inode;
else
iput(inode);
@@ -204,16 +198,15 @@ inline int afs_iget(struct super_block *sb, struct afs_fid *fid,
return 0;
/* failure */
bad_inode:
bad_inode:
make_bad_inode(inode);
unlock_new_inode(inode);
iput(inode);
_leave(" = %d [bad]", ret);
return ret;
} /* end afs_iget() */
}
/*****************************************************************************/
/*
* read the attributes of an inode
*/
@@ -235,8 +228,7 @@ int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry,
_leave(" = %d [%d %p]",
ret, atomic_read(&dentry->d_count), dentry->d_inode);
return ret;
}
else if (ret < 0) {
} else if (ret < 0) {
make_bad_inode(inode);
_leave(" = %d", ret);
return ret;
@@ -252,9 +244,8 @@ int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry,
vnode->cb_type);
return 0;
} /* end afs_inode_getattr() */
}
/*****************************************************************************/
/*
* clear an AFS inode
*/
@@ -282,4 +273,4 @@ void afs_clear_inode(struct inode *inode)
#endif
_leave("");
} /* end afs_clear_inode() */
}
+13 -23
View File
@@ -1,4 +1,4 @@
/* internal.h: internal AFS stuff
/* internal AFS stuff
*
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
@@ -73,26 +73,16 @@ extern const struct address_space_operations afs_fs_aops;
extern const struct inode_operations afs_file_inode_operations;
#ifdef AFS_CACHING_SUPPORT
extern int afs_cache_get_page_cookie(struct page *page,
struct cachefs_page **_page_cookie);
extern int afs_cache_get_page_cookie(struct page *, struct cachefs_page **);
#endif
/*
* inode.c
*/
extern int afs_iget(struct super_block *sb, struct afs_fid *fid,
struct inode **_inode);
extern int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat);
extern void afs_clear_inode(struct inode *inode);
/*
* key_afs.c
*/
#ifdef CONFIG_KEYS
extern int afs_key_register(void);
extern void afs_key_unregister(void);
#endif
extern int afs_iget(struct super_block *, struct afs_fid *, struct inode **);
extern int afs_inode_getattr(struct vfsmount *, struct dentry *,
struct kstat *);
extern void afs_clear_inode(struct inode *);
/*
* main.c
@@ -110,7 +100,7 @@ extern struct afs_timer afs_mntpt_expiry_timer;
extern struct afs_timer_ops afs_mntpt_expiry_timer_ops;
extern unsigned long afs_mntpt_expiry_timeout;
extern int afs_mntpt_check_symlink(struct afs_vnode *vnode);
extern int afs_mntpt_check_symlink(struct afs_vnode *);
/*
* super.c
@@ -123,17 +113,17 @@ extern void afs_fs_exit(void);
extern struct list_head afs_cb_hash_tbl[];
extern spinlock_t afs_cb_hash_lock;
#define afs_cb_hash(SRV,FID) \
afs_cb_hash_tbl[((unsigned long)(SRV) + \
(FID)->vid + (FID)->vnode + (FID)->unique) % \
AFS_CB_HASH_COUNT]
#define afs_cb_hash(SRV, FID) \
afs_cb_hash_tbl[((unsigned long)(SRV) + \
(FID)->vid + (FID)->vnode + (FID)->unique) & \
(AFS_CB_HASH_COUNT - 1)]
/*
* proc.c
*/
extern int afs_proc_init(void);
extern void afs_proc_cleanup(void);
extern int afs_proc_cell_setup(struct afs_cell *cell);
extern void afs_proc_cell_remove(struct afs_cell *cell);
extern int afs_proc_cell_setup(struct afs_cell *);
extern void afs_proc_cell_remove(struct afs_cell *);
#endif /* AFS_INTERNAL_H */
+7 -15
View File
@@ -1,4 +1,4 @@
/* kafsasyncd.c: AFS asynchronous operation daemon
/* AFS asynchronous operation daemon
*
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
@@ -50,7 +50,6 @@ static void kafsasyncd_null_call_error_func(struct rxrpc_call *call)
{
}
/*****************************************************************************/
/*
* start the async daemon
*/
@@ -65,9 +64,8 @@ int afs_kafsasyncd_start(void)
wait_for_completion(&kafsasyncd_alive);
return ret;
} /* end afs_kafsasyncd_start() */
}
/*****************************************************************************/
/*
* stop the async daemon
*/
@@ -77,10 +75,8 @@ void afs_kafsasyncd_stop(void)
kafsasyncd_die = 1;
wake_up(&kafsasyncd_sleepq);
wait_for_completion(&kafsasyncd_dead);
}
} /* end afs_kafsasyncd_stop() */
/*****************************************************************************/
/*
* probing daemon
*/
@@ -187,10 +183,8 @@ static int kafsasyncd(void *arg)
/* and that's all */
_leave("");
complete_and_exit(&kafsasyncd_dead, 0);
}
} /* end kafsasyncd() */
/*****************************************************************************/
/*
* begin an operation
* - place operation on busy queue
@@ -209,9 +203,8 @@ void afs_kafsasyncd_begin_op(struct afs_async_op *op)
spin_unlock(&kafsasyncd_async_lock);
_leave("");
} /* end afs_kafsasyncd_begin_op() */
}
/*****************************************************************************/
/*
* request attention for an operation
* - move to attention queue
@@ -229,9 +222,8 @@ void afs_kafsasyncd_attend_op(struct afs_async_op *op)
wake_up(&kafsasyncd_sleepq);
_leave("");
} /* end afs_kafsasyncd_attend_op() */
}
/*****************************************************************************/
/*
* terminate an operation
* - remove from either queue
@@ -252,4 +244,4 @@ void afs_kafsasyncd_terminate_op(struct afs_async_op *op)
wake_up(&kafsasyncd_sleepq);
_leave("");
} /* end afs_kafsasyncd_terminate_op() */
}
+10 -12
View File
@@ -1,4 +1,4 @@
/* kafsasyncd.h: AFS asynchronous operation daemon
/* AFS asynchronous operation daemon
*
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
@@ -9,24 +9,22 @@
* 2 of the License, or (at your option) any later version.
*/
#ifndef _LINUX_AFS_KAFSASYNCD_H
#define _LINUX_AFS_KAFSASYNCD_H
#ifndef AFS_KAFSASYNCD_H
#define AFS_KAFSASYNCD_H
#include "types.h"
struct afs_async_op;
struct afs_async_op_ops {
void (*attend)(struct afs_async_op *op);
void (*discard)(struct afs_async_op *op);
void (*attend)(struct afs_async_op *);
void (*discard)(struct afs_async_op *);
};
/*****************************************************************************/
/*
* asynchronous operation record
*/
struct afs_async_op
{
struct afs_async_op {
struct list_head link;
struct afs_server *server; /* server being contacted */
struct rxrpc_call *call; /* RxRPC call performing op */
@@ -45,8 +43,8 @@ static inline void afs_async_op_init(struct afs_async_op *op,
extern int afs_kafsasyncd_start(void);
extern void afs_kafsasyncd_stop(void);
extern void afs_kafsasyncd_begin_op(struct afs_async_op *op);
extern void afs_kafsasyncd_attend_op(struct afs_async_op *op);
extern void afs_kafsasyncd_terminate_op(struct afs_async_op *op);
extern void afs_kafsasyncd_begin_op(struct afs_async_op *);
extern void afs_kafsasyncd_attend_op(struct afs_async_op *);
extern void afs_kafsasyncd_terminate_op(struct afs_async_op *);
#endif /* _LINUX_AFS_KAFSASYNCD_H */
#endif /* AFS_KAFSASYNCD_H */
+10 -21
View File
@@ -1,4 +1,4 @@
/* kafstimod.c: AFS timeout daemon
/* AFS timeout daemon
*
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
@@ -30,7 +30,6 @@ static DEFINE_SPINLOCK(kafstimod_lock);
static int kafstimod(void *arg);
/*****************************************************************************/
/*
* start the timeout daemon
*/
@@ -45,9 +44,8 @@ int afs_kafstimod_start(void)
wait_for_completion(&kafstimod_alive);
return ret;
} /* end afs_kafstimod_start() */
}
/*****************************************************************************/
/*
* stop the timeout daemon
*/
@@ -57,10 +55,8 @@ void afs_kafstimod_stop(void)
kafstimod_die = 1;
wake_up(&kafstimod_sleepq);
wait_for_completion(&kafstimod_dead);
}
} /* end afs_kafstimod_stop() */
/*****************************************************************************/
/*
* timeout processing daemon
*/
@@ -77,7 +73,7 @@ static int kafstimod(void *arg)
complete(&kafstimod_alive);
/* loop around looking for things to attend to */
loop:
loop:
set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&kafstimod_sleepq, &myself);
@@ -101,8 +97,7 @@ static int kafstimod(void *arg)
spin_lock(&kafstimod_lock);
if (list_empty(&kafstimod_list)) {
timeout = MAX_SCHEDULE_TIMEOUT;
}
else {
} else {
timer = list_entry(kafstimod_list.next,
struct afs_timer, link);
timeout = timer->timo_jif;
@@ -110,10 +105,7 @@ static int kafstimod(void *arg)
if (time_before_eq((unsigned long) timeout, jif))
goto immediate;
else {
timeout = (long) timeout - (long) jiffies;
}
timeout = (long) timeout - (long) jiffies;
}
spin_unlock(&kafstimod_lock);
@@ -126,7 +118,7 @@ static int kafstimod(void *arg)
* - we come here with the lock held and timer pointing to the expired
* entry
*/
immediate:
immediate:
remove_wait_queue(&kafstimod_sleepq, &myself);
set_current_state(TASK_RUNNING);
@@ -141,10 +133,8 @@ static int kafstimod(void *arg)
_debug("@@@ End Timeout");
goto loop;
}
} /* end kafstimod() */
/*****************************************************************************/
/*
* (re-)queue a timer
*/
@@ -176,9 +166,8 @@ void afs_kafstimod_add_timer(struct afs_timer *timer, unsigned long timeout)
wake_up(&kafstimod_sleepq);
_leave("");
} /* end afs_kafstimod_add_timer() */
}
/*****************************************************************************/
/*
* dequeue a timer
* - returns 0 if the timer was deleted or -ENOENT if it wasn't queued
@@ -202,4 +191,4 @@ int afs_kafstimod_del_timer(struct afs_timer *timer)
_leave(" = %d", ret);
return ret;
} /* end afs_kafstimod_del_timer() */
}
+8 -12
View File
@@ -1,4 +1,4 @@
/* kafstimod.h: AFS timeout daemon
/* AFS timeout daemon
*
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
@@ -9,8 +9,8 @@
* 2 of the License, or (at your option) any later version.
*/
#ifndef _LINUX_AFS_KAFSTIMOD_H
#define _LINUX_AFS_KAFSTIMOD_H
#ifndef AFS_KAFSTIMOD_H
#define AFS_KAFSTIMOD_H
#include "types.h"
@@ -18,15 +18,13 @@ struct afs_timer;
struct afs_timer_ops {
/* called when the front of the timer queue has timed out */
void (*timed_out)(struct afs_timer *timer);
void (*timed_out)(struct afs_timer *);
};
/*****************************************************************************/
/*
* AFS timer/timeout record
*/
struct afs_timer
{
struct afs_timer {
struct list_head link; /* link in timer queue */
unsigned long timo_jif; /* timeout time */
const struct afs_timer_ops *ops; /* timeout expiry function */
@@ -41,9 +39,7 @@ static inline void afs_timer_init(struct afs_timer *timer,
extern int afs_kafstimod_start(void);
extern void afs_kafstimod_stop(void);
extern void afs_kafstimod_add_timer(struct afs_timer *, unsigned long);
extern int afs_kafstimod_del_timer(struct afs_timer *);
extern void afs_kafstimod_add_timer(struct afs_timer *timer,
unsigned long timeout);
extern int afs_kafstimod_del_timer(struct afs_timer *timer);
#endif /* _LINUX_AFS_KAFSTIMOD_H */
#endif /* AFS_KAFSTIMOD_H */
+16 -78
View File
@@ -1,4 +1,4 @@
/* main.c: AFS client file system
/* AFS client file system
*
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
@@ -62,7 +62,6 @@ struct cachefs_netfs afs_cache_netfs = {
};
#endif
/*****************************************************************************/
/*
* initialise the AFS client FS module
*/
@@ -86,12 +85,6 @@ static int __init afs_init(void)
/* we want to be able to cache */
ret = cachefs_register_netfs(&afs_cache_netfs,
&afs_cache_cell_index_def);
if (ret < 0)
goto error;
#endif
#ifdef CONFIG_KEYS_TURNED_OFF
ret = afs_key_register();
if (ret < 0)
goto error_cache;
#endif
@@ -99,58 +92,55 @@ static int __init afs_init(void)
/* initialise the cell DB */
ret = afs_cell_init(rootcell);
if (ret < 0)
goto error_keys;
goto error_cell_init;
/* start the timeout daemon */
ret = afs_kafstimod_start();
if (ret < 0)
goto error_keys;
goto error_kafstimod;
/* start the async operation daemon */
ret = afs_kafsasyncd_start();
if (ret < 0)
goto error_kafstimod;
goto error_kafsasyncd;
/* create the RxRPC transport */
ret = rxrpc_create_transport(7001, &afs_transport);
if (ret < 0)
goto error_kafsasyncd;
goto error_transport;
afs_transport->peer_ops = &afs_peer_ops;
/* register the filesystems */
ret = afs_fs_init();
if (ret < 0)
goto error_transport;
goto error_fs;
return ret;
error_transport:
error_fs:
rxrpc_put_transport(afs_transport);
error_kafsasyncd:
error_transport:
afs_kafsasyncd_stop();
error_kafstimod:
error_kafsasyncd:
afs_kafstimod_stop();
error_keys:
#ifdef CONFIG_KEYS_TURNED_OFF
afs_key_unregister();
error_cache:
#endif
error_kafstimod:
error_cell_init:
#ifdef AFS_CACHING_SUPPORT
cachefs_unregister_netfs(&afs_cache_netfs);
error:
error_cache:
#endif
afs_cell_purge();
afs_proc_cleanup();
printk(KERN_ERR "kAFS: failed to register: %d\n", ret);
return ret;
} /* end afs_init() */
}
/* XXX late_initcall is kludgy, but the only alternative seems to create
* a transport upon the first mount, which is worse. Or is it?
*/
late_initcall(afs_init); /* must be called after net/ to create socket */
/*****************************************************************************/
/*
* clean up on module removal
*/
@@ -163,19 +153,14 @@ static void __exit afs_exit(void)
afs_kafstimod_stop();
afs_kafsasyncd_stop();
afs_cell_purge();
#ifdef CONFIG_KEYS_TURNED_OFF
afs_key_unregister();
#endif
#ifdef AFS_CACHING_SUPPORT
cachefs_unregister_netfs(&afs_cache_netfs);
#endif
afs_proc_cleanup();
} /* end afs_exit() */
}
module_exit(afs_exit);
/*****************************************************************************/
/*
* notification that new peer record is being added
* - called from krxsecd
@@ -208,9 +193,8 @@ static int afs_adding_peer(struct rxrpc_peer *peer)
afs_put_server(server);
return 0;
} /* end afs_adding_peer() */
}
/*****************************************************************************/
/*
* notification that a peer record is being discarded
* - called from krxiod or krxsecd
@@ -236,50 +220,4 @@ static void afs_discarding_peer(struct rxrpc_peer *peer)
spin_unlock(&afs_server_peer_lock);
_leave("");
} /* end afs_discarding_peer() */
/*****************************************************************************/
/*
* clear the dead space between task_struct and kernel stack
* - called by supplying -finstrument-functions to gcc
*/
#if 0
void __cyg_profile_func_enter (void *this_fn, void *call_site)
__attribute__((no_instrument_function));
void __cyg_profile_func_enter (void *this_fn, void *call_site)
{
asm volatile(" movl %%esp,%%edi \n"
" andl %0,%%edi \n"
" addl %1,%%edi \n"
" movl %%esp,%%ecx \n"
" subl %%edi,%%ecx \n"
" shrl $2,%%ecx \n"
" movl $0xedededed,%%eax \n"
" rep stosl \n"
:
: "i"(~(THREAD_SIZE - 1)), "i"(sizeof(struct thread_info))
: "eax", "ecx", "edi", "memory", "cc"
);
}
void __cyg_profile_func_exit(void *this_fn, void *call_site)
__attribute__((no_instrument_function));
void __cyg_profile_func_exit(void *this_fn, void *call_site)
{
asm volatile(" movl %%esp,%%edi \n"
" andl %0,%%edi \n"
" addl %1,%%edi \n"
" movl %%esp,%%ecx \n"
" subl %%edi,%%ecx \n"
" shrl $2,%%ecx \n"
" movl $0xdadadada,%%eax \n"
" rep stosl \n"
:
: "i"(~(THREAD_SIZE - 1)), "i"(sizeof(struct thread_info))
: "eax", "ecx", "edi", "memory", "cc"
);
}
#endif
+2 -4
View File
@@ -1,4 +1,4 @@
/* misc.c: miscellaneous bits
/* miscellaneous bits
*
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
@@ -15,7 +15,6 @@
#include "errors.h"
#include "internal.h"
/*****************************************************************************/
/*
* convert an AFS abort code to a Linux error number
*/
@@ -35,5 +34,4 @@ int afs_abort_to_error(int abortcode)
case VMOVED: return -ENXIO;
default: return -EIO;
}
} /* end afs_abort_to_error() */
}

Some files were not shown because too many files have changed in this diff Show More