extern BlueSkyFS *fs;
-static int null_int;
-static void *null_result = (void *)&null_int;
-
/* Check that a string is a valid file name. We require that it be valid
* UTF-8, that it not be empty, and that it not contain embedded forward
* slashes. Also checks that the length of the string is not more than the
void nfsproc3_null_3_svc(void *argp, RPCRequest *req)
{
- async_rpc_send_reply(req, null_result);
+ async_rpc_send_reply(req, NULL);
}
void nfsproc3_getattr_3_svc(nfs_fh3 *argp, RPCRequest *req)
{
- static getattr3res result;
+ getattr3res result;
+ memset(&result, 0, sizeof(result));
BlueSkyInode *inode = lookup_fh(argp);
if (inode != NULL) {
void nfsproc3_setattr_3_svc(setattr3args *argp, RPCRequest *req)
{
- static wccstat3 result;
+ wccstat3 result;
+ memset(&result, 0, sizeof(result));
result.wccstat3_u.wcc.before.present = FALSE;
result.wccstat3_u.wcc.after.present = FALSE;
void nfsproc3_lookup_3_svc(diropargs3 *argp, RPCRequest *req)
{
- static lookup3res result;
+ lookup3res result;
+ memset(&result, 0, sizeof(result));
BlueSkyInode *dir = lookup_fh(&argp->dir);
if (dir == NULL) {
result.lookup3res_u.resok.obj_attributes.present = TRUE;
encode_fattr3(&result.lookup3res_u.resok.obj_attributes.post_op_attr_u.attributes, inode);
- static uint64_t fh_bytes;
+ uint64_t fh_bytes;
fh_bytes = GUINT64_TO_BE(inum);
result.lookup3res_u.resok.object.data.data_len = 8;
result.lookup3res_u.resok.object.data.data_val = (char *)&fh_bytes;
void nfsproc3_access_3_svc(access3args *argp, RPCRequest *req)
{
- static access3res result;
+ access3res result;
+ memset(&result, 0, sizeof(result));
BlueSkyInode *inode = lookup_fh(&argp->object);
if (inode == NULL) {
void nfsproc3_readlink_3_svc(nfs_fh3 *argp, RPCRequest *req)
{
- static readlink3res result;
+ readlink3res result;
memset(&result, 0, sizeof(result));
BlueSkyInode *inode = lookup_fh(argp);
void nfsproc3_read_3_svc(read3args *argp, RPCRequest *req)
{
- static read3res result;
- static char buf[32768];
+ read3res result;
+ memset(&result, 0, sizeof(result));
+ char buf[32768];
BlueSkyInode *inode = lookup_fh(&argp->file);
if (inode == NULL) {
void nfsproc3_write_3_svc(write3args *argp, RPCRequest *req)
{
- static write3res result;
+ write3res result;
+ memset(&result, 0, sizeof(result));
struct wcc_data wcc;
memset(&wcc, 0, sizeof(wcc));
void nfsproc3_create_3_svc(create3args *argp, RPCRequest *req)
{
- static diropres3 result;
+ diropres3 result;
+ memset(&result, 0, sizeof(result));
struct wcc_data wcc;
memset(&wcc, 0, sizeof(wcc));
encode_fattr3(&result.diropres3_u.resok.obj_attributes.post_op_attr_u.attributes, file);
result.diropres3_u.resok.dir_wcc = wcc;
- static uint64_t fh_bytes;
+ uint64_t fh_bytes;
fh_bytes = GUINT64_TO_BE(file->inum);
result.diropres3_u.resok.obj.present = TRUE;
result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_len = 8;
void nfsproc3_mkdir_3_svc(mkdir3args *argp, RPCRequest *req)
{
- static diropres3 result;
+ diropres3 result;
+ memset(&result, 0, sizeof(result));
struct wcc_data wcc;
memset(&wcc, 0, sizeof(wcc));
encode_fattr3(&result.diropres3_u.resok.obj_attributes.post_op_attr_u.attributes, file);
result.diropres3_u.resok.dir_wcc = wcc;
- static uint64_t fh_bytes;
+ uint64_t fh_bytes;
fh_bytes = GUINT64_TO_BE(file->inum);
result.diropres3_u.resok.obj.present = TRUE;
result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_len = 8;
void nfsproc3_symlink_3_svc(symlink3args *argp, RPCRequest *req)
{
- static diropres3 result;
+ diropres3 result;
+ memset(&result, 0, sizeof(result));
struct wcc_data wcc;
memset(&wcc, 0, sizeof(wcc));
encode_fattr3(&result.diropres3_u.resok.obj_attributes.post_op_attr_u.attributes, file);
result.diropres3_u.resok.dir_wcc = wcc;
- static uint64_t fh_bytes;
+ uint64_t fh_bytes;
fh_bytes = GUINT64_TO_BE(file->inum);
result.diropres3_u.resok.obj.present = TRUE;
result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_len = 8;
void nfsproc3_mknod_3_svc(mknod3args *argp, RPCRequest *req)
{
- static diropres3 result;
+ diropres3 result;
+ memset(&result, 0, sizeof(result));
result.status = NFS3ERR_NOTSUPP;
void nfsproc3_remove_3_svc(diropargs3 *argp, RPCRequest *req)
{
- static wccstat3 result;
-
- result.wccstat3_u.wcc.before.present = FALSE;
- result.wccstat3_u.wcc.after.present = FALSE;
+ wccstat3 result;
+ memset(&result, 0, sizeof(result));
BlueSkyInode *dir = lookup_fh(&argp->dir);
if (dir == NULL) {
void nfsproc3_rmdir_3_svc(diropargs3 *argp, RPCRequest *req)
{
- static wccstat3 result;
-
- result.wccstat3_u.wcc.before.present = FALSE;
- result.wccstat3_u.wcc.after.present = FALSE;
+ wccstat3 result;
+ memset(&result, 0, sizeof(result));
BlueSkyInode *dir = lookup_fh(&argp->dir);
if (dir == NULL) {
void nfsproc3_rename_3_svc(rename3args *argp, RPCRequest *req)
{
- static rename3res result;
+ rename3res result;
+ memset(&result, 0, sizeof(result));
wcc_data *wcc1 = &result.rename3res_u.res.fromdir_wcc;
wcc_data *wcc2 = &result.rename3res_u.res.todir_wcc;
- memset(wcc1, 0, sizeof(*wcc1));
- memset(wcc2, 0, sizeof(*wcc2));
BlueSkyInode *dir1 = lookup_fh(&argp->from.dir);
if (dir1 == NULL) {
void nfsproc3_link_3_svc(link3args *argp, RPCRequest *req)
{
- static link3res result;
+ link3res result;
+ memset(&result, 0, sizeof(result));
struct wcc_data wcc;
memset(&wcc, 0, sizeof(wcc));
#define MAX_READDIR_DIRENTS 64
void nfsproc3_readdir_3_svc(readdir3args *argp, RPCRequest *req)
{
- static readdir3res result;
+ readdir3res result;
+ memset(&result, 0, sizeof(result));
BlueSkyInode *dir = lookup_fh(&argp->dir);
if (dir == NULL) {
memset(result.readdir3res_u.resok.cookieverf, 0,
sizeof(result.readdir3res_u.resok.cookieverf));
- static entry3 dirents[MAX_READDIR_DIRENTS];
+ entry3 dirents[MAX_READDIR_DIRENTS];
int count = 0;
BlueSkyDirent start = {NULL, NULL, argp->cookie, 0};
* attributes/fh3: 88 + 8 + filehandle size
*/
size_t dircount = 88 + 16, attrcount = 0;
- static readdirplus3res result;
+ readdirplus3res result;
+ memset(&result, 0, sizeof(result));
BlueSkyInode *dir = lookup_fh(&argp->dir);
if (dir == NULL) {
memset(result.readdirplus3res_u.resok.cookieverf, 0,
sizeof(result.readdirplus3res_u.resok.cookieverf));
- static entryplus3 dirents[MAX_READDIR_DIRENTS];
- static uint64_t fh_bytes[MAX_READDIR_DIRENTS];
+ entryplus3 dirents[MAX_READDIR_DIRENTS];
+ uint64_t fh_bytes[MAX_READDIR_DIRENTS];
int count = 0;
/* TODO: Handle dircount, maxcount arguments from client. */
void nfsproc3_fsstat_3_svc(nfs_fh3 *argp, RPCRequest *req)
{
- static fsstat3res result;
+ fsstat3res result;
+ memset(&result, 0, sizeof(result));
BlueSkyInode *inode = lookup_fh(argp);
if (inode == NULL) {
void nfsproc3_fsinfo_3_svc(nfs_fh3 *argp, RPCRequest *req)
{
- static fsinfo3res result;
+ fsinfo3res result;
+ memset(&result, 0, sizeof(result));
BlueSkyInode *inode = bluesky_get_inode(fs, 1);
result.status = NFS3_OK;
void nfsproc3_pathconf_3_svc(nfs_fh3 *argp, RPCRequest *req)
{
- static pathconf3res result;
+ pathconf3res result;
+ memset(&result, 0, sizeof(result));
BlueSkyInode *inode = bluesky_get_inode(fs, 1);
result.status = NFS3_OK;
void nfsproc3_commit_3_svc(commit3args *argp, RPCRequest *req)
{
- static commit3res result;
+ commit3res result;
+ memset(&result, 0, sizeof(result));
result.status = NFS3ERR_NOTSUPP;