From: Ronnie Sahlberg Date: Sun, 29 Jun 2014 21:41:28 +0000 (-0700) Subject: Merge pull request #82 from plieven/readahead X-Git-Tag: upstream/1.9.6^2~26 X-Git-Url: https://git.piment-noir.org/?p=deb_libnfs.git;a=commitdiff_plain;h=be243cfa9bedd8ac1b350a3af7c48d01800d8679;hp=3ca2aac9a4aceac602684847f756428439bf814d Merge pull request #82 from plieven/readahead add readahead support --- diff --git a/COPYING b/COPYING index 306c29d..17a553e 100644 --- a/COPYING +++ b/COPYING @@ -1,13 +1,18 @@ Libnfs components fall under two separate licences -The lib and include directories -=============================== +The library sources and include directories +=========================================== The nfs client library itself, i.e. the lib and include directories, is licenced under GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. +The protocol definition, .x, files +================================== +These are based on old RFCs and studying how wireshark dissects various packets. +These are distributed under the simplified BSD licence. + The examples directory ================================ The utility and example applications using this library, i.e. the diff --git a/aros/aros_compat.h b/aros/aros_compat.h index 76de2ac..2089bc8 100644 --- a/aros/aros_compat.h +++ b/aros/aros_compat.h @@ -1,3 +1,20 @@ +/* + Copyright (C) 2013 by Ronnie Sahlberg + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, see . +*/ + #ifndef AROS_COMPAT_H #define AROS_COMPAT_H diff --git a/include/nfsc/libnfs.h b/include/nfsc/libnfs.h index f2d8cb0..dfa2185 100644 --- a/include/nfsc/libnfs.h +++ b/include/nfsc/libnfs.h @@ -785,6 +785,7 @@ struct nfsdirent { struct timeval ctime; uint32_t uid; uint32_t gid; + uint32_t nlink; }; /* * nfs_readdir() never blocks, so no special sync/async versions are available diff --git a/lib/init.c b/lib/init.c index 99ec159..d41c4f8 100644 --- a/lib/init.c +++ b/lib/init.c @@ -1,7 +1,10 @@ /* Copyright (C) 2010 by Ronnie Sahlberg - + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -241,7 +244,7 @@ void rpc_destroy_context(struct rpc_context *rpc) while((pdu = rpc->outqueue.head) != NULL) { pdu->cb(rpc, RPC_STATUS_CANCEL, NULL, pdu->private_data); - rpc->outqueue.head = pdu->next; + LIBNFS_LIST_REMOVE(&rpc->outqueue.head, pdu); rpc_free_pdu(rpc, pdu); } @@ -250,7 +253,7 @@ void rpc_destroy_context(struct rpc_context *rpc) while((pdu = q->head) != NULL) { pdu->cb(rpc, RPC_STATUS_CANCEL, NULL, pdu->private_data); - rpc->outqueue.head = pdu->next; + LIBNFS_LIST_REMOVE(&q->head, pdu); rpc_free_pdu(rpc, pdu); } } diff --git a/lib/libnfs.c b/lib/libnfs.c index d54a542..41b8a2b 100644 --- a/lib/libnfs.c +++ b/lib/libnfs.c @@ -69,6 +69,7 @@ #include #include #include "libnfs-zdr.h" +#include "slist.h" #include "libnfs.h" #include "libnfs-raw.h" #include "libnfs-raw-mount.h" @@ -76,7 +77,13 @@ #include "libnfs-raw-portmap.h" #include "libnfs-private.h" +#define MAX_DIR_CACHE 1024 + struct nfsdir { + struct nfs_fh3 fh; + fattr3 attr; + struct nfsdir *next; + struct nfsdirent *entries; struct nfsdirent *current; }; @@ -107,6 +114,7 @@ struct nfs_context { uint64_t readmax; uint64_t writemax; char *cwd; + struct nfsdir *dircache; }; void nfs_free_nfsdir(struct nfsdir *nfsdir) @@ -119,11 +127,42 @@ void nfs_free_nfsdir(struct nfsdir *nfsdir) free(nfsdir->entries); nfsdir->entries = dirent; } + free(nfsdir->fh.data.data_val); free(nfsdir); } +static void nfs_dircache_add(struct nfs_context *nfs, struct nfsdir *nfsdir) +{ + int i; + LIBNFS_LIST_ADD(&nfs->dircache, nfsdir); + + for (nfsdir = nfs->dircache, i = 0; nfsdir; nfsdir = nfsdir->next, i++) { + if (i > MAX_DIR_CACHE) { + LIBNFS_LIST_REMOVE(&nfs->dircache, nfsdir); + nfs_free_nfsdir(nfsdir); + break; + } + } +} + +static struct nfsdir *nfs_dircache_find(struct nfs_context *nfs, struct nfs_fh3 *fh) +{ + struct nfsdir *nfsdir; + + for (nfsdir = nfs->dircache; nfsdir; nfsdir = nfsdir->next) { + if (nfsdir->fh.data.data_len == fh->data.data_len && + !memcmp(nfsdir->fh.data.data_val, fh->data.data_val, fh->data.data_len)) { + LIBNFS_LIST_REMOVE(&nfs->dircache, nfsdir); + return nfsdir; + } + } + + return NULL; +} + struct nfs_cb_data; -typedef int (*continue_func)(struct nfs_context *nfs, struct nfs_cb_data *data); +typedef int (*continue_func)(struct nfs_context *nfs, fattr3 *attr, + struct nfs_cb_data *data); struct nfs_cb_data { struct nfs_context *nfs; @@ -157,7 +196,7 @@ struct nfs_mcb_data { int update_pos; }; -static int nfs_lookup_path_async_internal(struct nfs_context *nfs, struct nfs_cb_data *data, struct nfs_fh3 *fh); +static int nfs_lookup_path_async_internal(struct nfs_context *nfs, fattr3 *attr, struct nfs_cb_data *data, struct nfs_fh3 *fh); void nfs_set_auth(struct nfs_context *nfs, struct AUTH *auth) { @@ -390,6 +429,12 @@ void nfs_destroy_context(struct nfs_context *nfs) nfs->rootfh.data.data_val = NULL; } + while (nfs->dircache) { + struct nfsdir *nfsdir = nfs->dircache; + LIBNFS_LIST_REMOVE(&nfs->dircache, nfsdir); + nfs_free_nfsdir(nfsdir); + } + free(nfs); } @@ -652,9 +697,6 @@ static void free_nfs_cb_data(struct nfs_cb_data *data) } - - - static void nfs_mount_10_cb(struct rpc_context *rpc, int status, void *command_data, void *private_data) { struct nfs_cb_data *data = private_data; @@ -860,6 +902,7 @@ static void nfs_lookup_path_1_cb(struct rpc_context *rpc, int status, void *comm struct nfs_cb_data *data = private_data; struct nfs_context *nfs = data->nfs; LOOKUP3res *res; + fattr3 *attr; assert(rpc->magic == RPC_CONTEXT_MAGIC); @@ -882,15 +925,17 @@ static void nfs_lookup_path_1_cb(struct rpc_context *rpc, int status, void *comm return; } - if (nfs_lookup_path_async_internal(nfs, data, &res->LOOKUP3res_u.resok.object) != 0) { - rpc_set_error(nfs->rpc, "Failed to create lookup pdu"); - data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data); - free_nfs_cb_data(data); - return; - } + attr = res->LOOKUP3res_u.resok.obj_attributes.attributes_follow ? + &res->LOOKUP3res_u.resok.obj_attributes.post_op_attr_u.attributes : + NULL; + + /* This function will always invoke the callback and cleanup + * for failures. So no need to check the return value. + */ + nfs_lookup_path_async_internal(nfs, attr, data, &res->LOOKUP3res_u.resok.object); } -static int nfs_lookup_path_async_internal(struct nfs_context *nfs, struct nfs_cb_data *data, struct nfs_fh3 *fh) +static int nfs_lookup_path_async_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data, struct nfs_fh3 *fh) { char *path, *slash; LOOKUP3args args; @@ -929,11 +974,10 @@ static int nfs_lookup_path_async_internal(struct nfs_context *nfs, struct nfs_cb if (slash != NULL) { *slash = '/'; } - data->continue_cb(nfs, data); + data->continue_cb(nfs, attr, data); return 0; } - memset(&args, 0, sizeof(LOOKUP3args)); args.what.dir = *fh; args.what.name = path; @@ -1050,9 +1094,45 @@ static int nfs_normalize_path(struct nfs_context *nfs, char *path) return 0; } +static void nfs_lookup_path_getattr_cb(struct rpc_context *rpc, int status, void *command_data, void *private_data) +{ + struct nfs_cb_data *data = private_data; + struct nfs_context *nfs = data->nfs; + GETATTR3res *res; + fattr3 *attr; + + assert(rpc->magic == RPC_CONTEXT_MAGIC); + + if (status == RPC_STATUS_ERROR) { + data->cb(-EFAULT, nfs, command_data, data->private_data); + free_nfs_cb_data(data); + return; + } + if (status == RPC_STATUS_CANCEL) { + data->cb(-EINTR, nfs, "Command was cancelled", data->private_data); + free_nfs_cb_data(data); + return; + } + + res = command_data; + if (res->status != NFS3_OK) { + rpc_set_error(nfs->rpc, "NFS: GETATTR of %s failed with %s(%d)", data->saved_path, nfsstat3_to_str(res->status), nfsstat3_to_errno(res->status)); + data->cb(nfsstat3_to_errno(res->status), nfs, rpc_get_error(nfs->rpc), data->private_data); + free_nfs_cb_data(data); + return; + } + + attr = &res->GETATTR3res_u.resok.obj_attributes; + /* This function will always invoke the callback and cleanup + * for failures. So no need to check the return value. + */ + nfs_lookup_path_async_internal(nfs, attr, data, &nfs->rootfh); +} + static int nfs_lookuppath_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data, continue_func continue_cb, void *continue_data, void (*free_continue_data)(void *), int continue_int) { struct nfs_cb_data *data; + struct GETATTR3args args; if (path[0] == '\0') { path = "."; @@ -1098,18 +1178,27 @@ static int nfs_lookuppath_async(struct nfs_context *nfs, const char *path, nfs_c } data->path = data->saved_path; - - if (nfs_lookup_path_async_internal(nfs, data, &nfs->rootfh) != 0) { - /* return 0 here since the callback will be invoked if there is a failure */ + if (data->path[0]) { + /* This function will always invoke the callback and cleanup + * for failures. So no need to check the return value. + */ + nfs_lookup_path_async_internal(nfs, NULL, data, &nfs->rootfh); return 0; } + + /* We have a request for "", so just perform a GETATTR3 so we can + * return the attributes to the caller. + */ + memset(&args, 0, sizeof(GETATTR3args)); + args.object = nfs->rootfh; + if (rpc_nfs3_getattr_async(nfs->rpc, nfs_lookup_path_getattr_cb, &args, data) != 0) { + free_nfs_cb_data(data); + return -1; + } return 0; } - - - /* * Async stat() */ @@ -1171,7 +1260,7 @@ static void nfs_stat_1_cb(struct rpc_context *rpc, int status, void *command_dat free_nfs_cb_data(data); } -static int nfs_stat_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_stat_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { struct GETATTR3args args; @@ -1251,7 +1340,7 @@ static void nfs_stat64_1_cb(struct rpc_context *rpc, int status, void *command_d free_nfs_cb_data(data); } -static int nfs_stat64_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_stat64_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { struct GETATTR3args args; @@ -1431,7 +1520,7 @@ static void nfs_open_cb(struct rpc_context *rpc, int status, void *command_data, free_nfs_cb_data(data); } -static int nfs_open_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_open_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { int nfsmode = 0; ACCESS3args args; @@ -1475,7 +1564,7 @@ int nfs_open_async(struct nfs_context *nfs, const char *path, int flags, nfs_cb /* * Async chdir() */ -static int nfs_chdir_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_chdir_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { /* steal saved_path */ free(nfs->cwd); @@ -2224,7 +2313,7 @@ int nfs_ftruncate_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t l /* * Async truncate() */ -static int nfs_truncate_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_truncate_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { uint64_t offset = data->continue_int; struct nfsfh nfsfh; @@ -2295,7 +2384,7 @@ static void nfs_mkdir_cb(struct rpc_context *rpc, int status, void *command_data free_nfs_cb_data(data); } -static int nfs_mkdir_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_mkdir_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { char *str = data->continue_data; MKDIR3args args; @@ -2386,7 +2475,7 @@ static void nfs_rmdir_cb(struct rpc_context *rpc, int status, void *command_data free_nfs_cb_data(data); } -static int nfs_rmdir_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_rmdir_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { char *str = data->continue_data; RMDIR3args args; @@ -2531,7 +2620,7 @@ static void nfs_creat_1_cb(struct rpc_context *rpc, int status, void *command_da return; } -static int nfs_creat_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_creat_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { char *str = data->continue_data; CREATE3args args; @@ -2622,7 +2711,7 @@ static void nfs_unlink_cb(struct rpc_context *rpc, int status, void *command_dat free_nfs_cb_data(data); } -static int nfs_unlink_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_unlink_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { char *str = data->continue_data; struct REMOVE3args args; @@ -2721,7 +2810,7 @@ static void nfs_mknod_cb(struct rpc_context *rpc, int status, void *command_data free_nfs_cb_data(data); } -static int nfs_mknod_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_mknod_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { struct mknod_cb_data *cb_data = data->continue_data; char *str = cb_data->path; @@ -2869,6 +2958,7 @@ static void nfs_opendir3_cb(struct rpc_context *rpc, int status, void *command_d nfsdirent->ctime.tv_usec = attributes->ctime.nseconds/1000; nfsdirent->uid = attributes->uid; nfsdirent->gid = attributes->gid; + nfsdirent->nlink = attributes->nlink; } } @@ -2975,6 +3065,9 @@ static void nfs_opendir2_cb(struct rpc_context *rpc, int status, void *command_d return; } + if (res->READDIR3res_u.resok.dir_attributes.attributes_follow) + nfsdir->attr = res->READDIR3res_u.resok.dir_attributes.post_op_attr_u.attributes; + /* steal the dirhandle */ nfsdir->current = nfsdir->entries; @@ -3106,6 +3199,7 @@ static void nfs_opendir_cb(struct rpc_context *rpc, int status, void *command_da nfsdirent->ctime.tv_usec = entry->name_attributes.post_op_attr_u.attributes.ctime.nseconds/1000; nfsdirent->uid = entry->name_attributes.post_op_attr_u.attributes.uid; nfsdirent->gid = entry->name_attributes.post_op_attr_u.attributes.gid; + nfsdirent->nlink = entry->name_attributes.post_op_attr_u.attributes.nlink; } nfsdirent->next = nfsdir->entries; @@ -3135,6 +3229,9 @@ static void nfs_opendir_cb(struct rpc_context *rpc, int status, void *command_da return; } + if (res->READDIRPLUS3res_u.resok.dir_attributes.attributes_follow) + nfsdir->attr = res->READDIRPLUS3res_u.resok.dir_attributes.post_op_attr_u.attributes; + /* steal the dirhandle */ data->continue_data = NULL; nfsdir->current = nfsdir->entries; @@ -3143,9 +3240,34 @@ static void nfs_opendir_cb(struct rpc_context *rpc, int status, void *command_da free_nfs_cb_data(data); } -static int nfs_opendir_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_opendir_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { READDIRPLUS3args args; + struct nfsdir *nfsdir = data->continue_data;; + struct nfsdir *cached; + + cached = nfs_dircache_find(nfs, &data->fh); + if (cached) { + if (attr && attr->mtime.seconds == cached->attr.mtime.seconds) { + cached->current = cached->entries; + data->cb(0, nfs, cached, data->private_data); + free_nfs_cb_data(data); + return 0; + } else { + /* cache must be stale */ + nfs_free_nfsdir(cached); + } + } + + nfsdir->fh.data.data_len = data->fh.data.data_len; + nfsdir->fh.data.data_val = malloc(nfsdir->fh.data.data_len); + if (nfsdir->fh.data.data_val == NULL) { + rpc_set_error(nfs->rpc, "OOM when allocating fh for nfsdir"); + data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data); + free_nfs_cb_data(data); + return -1; + } + memcpy(nfsdir->fh.data.data_val, data->fh.data.data_val, data->fh.data.data_len); args.dir = data->fh; args.cookie = 0; @@ -3195,9 +3317,9 @@ struct nfsdirent *nfs_readdir(struct nfs_context *nfs _U_, struct nfsdir *nfsdir /* * closedir() */ -void nfs_closedir(struct nfs_context *nfs _U_, struct nfsdir *nfsdir) +void nfs_closedir(struct nfs_context *nfs, struct nfsdir *nfsdir) { - nfs_free_nfsdir(nfsdir); + nfs_dircache_add(nfs, nfsdir); } @@ -3364,7 +3486,7 @@ static void nfs_statvfs_1_cb(struct rpc_context *rpc, int status, void *command_ free_nfs_cb_data(data); } -static int nfs_statvfs_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_statvfs_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { FSSTAT3args args; @@ -3426,7 +3548,7 @@ static void nfs_readlink_1_cb(struct rpc_context *rpc, int status, void *command free_nfs_cb_data(data); } -static int nfs_readlink_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_readlink_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { READLINK3args args; @@ -3488,7 +3610,7 @@ static void nfs_chmod_cb(struct rpc_context *rpc, int status, void *command_data free_nfs_cb_data(data); } -static int nfs_chmod_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_chmod_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { SETATTR3args args; @@ -3543,7 +3665,7 @@ int nfs_fchmod_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int mode, nfs } memcpy(data->fh.data.data_val, nfsfh->fh.data.data_val, data->fh.data.data_len); - if (nfs_chmod_continue_internal(nfs, data) != 0) { + if (nfs_chmod_continue_internal(nfs, NULL, data) != 0) { return -1; } @@ -3591,7 +3713,7 @@ struct nfs_chown_data { gid_t gid; }; -static int nfs_chown_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_chown_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { SETATTR3args args; struct nfs_chown_data *chown_data = data->continue_data; @@ -3677,7 +3799,7 @@ int nfs_fchown_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int } memcpy(data->fh.data.data_val, nfsfh->fh.data.data_val, data->fh.data.data_len); - if (nfs_chown_continue_internal(nfs, data) != 0) { + if (nfs_chown_continue_internal(nfs, NULL, data) != 0) { return -1; } @@ -3722,7 +3844,7 @@ static void nfs_utimes_cb(struct rpc_context *rpc, int status, void *command_dat free_nfs_cb_data(data); } -static int nfs_utimes_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_utimes_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { SETATTR3args args; struct timeval *utimes_data = data->continue_data; @@ -3860,7 +3982,7 @@ static void nfs_access_cb(struct rpc_context *rpc, int status, void *command_dat free_nfs_cb_data(data); } -static int nfs_access_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_access_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { int nfsmode = 0; ACCESS3args args; @@ -3957,7 +4079,7 @@ static void nfs_symlink_cb(struct rpc_context *rpc, int status, void *command_da free_nfs_cb_data(data); } -static int nfs_symlink_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_symlink_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { struct nfs_symlink_data *symlink_data = data->continue_data; SYMLINK3args args; @@ -4093,7 +4215,7 @@ static void nfs_rename_cb(struct rpc_context *rpc, int status, void *command_dat free_nfs_cb_data(data); } -static int nfs_rename_continue_2_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_rename_continue_2_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { struct nfs_rename_data *rename_data = data->continue_data; RENAME3args args; @@ -4116,7 +4238,7 @@ static int nfs_rename_continue_2_internal(struct nfs_context *nfs, struct nfs_cb } -static int nfs_rename_continue_1_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_rename_continue_1_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { struct nfs_rename_data *rename_data = data->continue_data; char* newpath = strdup(rename_data->newpath); @@ -4263,7 +4385,7 @@ static void nfs_link_cb(struct rpc_context *rpc, int status, void *command_data, free_nfs_cb_data(data); } -static int nfs_link_continue_2_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_link_continue_2_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { struct nfs_link_data *link_data = data->continue_data; LINK3args args; @@ -4286,7 +4408,7 @@ static int nfs_link_continue_2_internal(struct nfs_context *nfs, struct nfs_cb_d } -static int nfs_link_continue_1_internal(struct nfs_context *nfs, struct nfs_cb_data *data) +static int nfs_link_continue_1_internal(struct nfs_context *nfs, fattr3 *attr _U_, struct nfs_cb_data *data) { struct nfs_link_data *link_data = data->continue_data; diff --git a/mount/Makefile.am b/mount/Makefile.am index 138d031..de7fdbd 100644 --- a/mount/Makefile.am +++ b/mount/Makefile.am @@ -17,6 +17,8 @@ mount-stamp : mount.x rm -f $(mount_GENERATED) touch mount-stamp -compile_rpc: - rpcgen -h mount.x | sed -e "s/#include //" | sed -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" > libnfs-raw-mount.h - rpcgen -c mount.x | sed -e "s/#include \".*mount.h\"/#include \"libnfs-xdr.h\"\n#include \"libnfs-raw-mount.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/register int32_t \*buf;/register int32_t *buf;\n buf = NULL;/" > libnfs-raw-mount.c +compile_rpc: + cat mount.x | head -29 >libnfs-raw-mount.h + rpcgen -h mount.x | sed -e "s/#include //" | sed -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" >> libnfs-raw-mount.h + cat mount.x | head -29 >libnfs-raw-mount.c + rpcgen -c mount.x | sed -e "s/#include \".*mount.h\"/#include \"libnfs-xdr.h\"\n#include \"libnfs-raw-mount.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/register int32_t \*buf;/register int32_t *buf;\n buf = NULL;/" >> libnfs-raw-mount.c diff --git a/mount/libnfs-raw-mount.c b/mount/libnfs-raw-mount.c index 81fae00..0a70d43 100644 --- a/mount/libnfs-raw-mount.c +++ b/mount/libnfs-raw-mount.c @@ -1,3 +1,32 @@ +/* +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ + /* * Please do not edit this file. * It was generated using rpcgen. diff --git a/mount/libnfs-raw-mount.h b/mount/libnfs-raw-mount.h index 1cb2775..9f07d31 100644 --- a/mount/libnfs-raw-mount.h +++ b/mount/libnfs-raw-mount.h @@ -1,3 +1,32 @@ +/* +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ + /* * Please do not edit this file. * It was generated using rpcgen. @@ -6,7 +35,8 @@ #ifndef _MOUNT_H_RPCGEN #define _MOUNT_H_RPCGEN -#include + + #ifdef __cplusplus extern "C" { diff --git a/mount/mount.x b/mount/mount.x index 10e6a1f..62b4e39 100644 --- a/mount/mount.x +++ b/mount/mount.x @@ -1,4 +1,31 @@ -/* copied from RFC1813 and RFC1094 */ +/* +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ const MNTPATHLEN = 1024; /* Maximum bytes in a path name */ const MNTNAMLEN = 255; /* Maximum bytes in a name */ diff --git a/nfs/Makefile.am b/nfs/Makefile.am index aad66ce..2177519 100644 --- a/nfs/Makefile.am +++ b/nfs/Makefile.am @@ -18,5 +18,7 @@ nfs-stamp : nfs.x touch nfs-stamp compile_rpc: - rpcgen -h nfs.x | sed -e "s/#include //" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/#define _NFS_H_RPCGEN/#define _NFS_H_RPCGEN\n#include /g" -e "s/#define NFS3_COOKIEVERFSIZE 8/#define NFS3_COOKIEVERFSIZE 8\n\n#if defined(ANDROID)\ntypedef long long int quad_t;\ntypedef long long unsigned u_quad_t;\n#endif\n#if defined(WIN32)\ntypedef long long int quad_t;\ntypedef long long unsigned u_quad_t;\n#endif/g" > libnfs-raw-nfs.h - rpcgen -c nfs.x | sed -e "s/#include \".*nfs.h\"/#include \"libnfs-xdr.h\"\n#include \"libnfs-raw-nfs.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/register int32_t \*buf;/register int32_t *buf;\n buf = NULL;/" > libnfs-raw-nfs.c + cat nfs.x | head -29 >libnfs-raw-nfs.h + rpcgen -h nfs.x | sed -e "s/#include //" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/#define _NFS_H_RPCGEN/#define _NFS_H_RPCGEN\n#include /g" -e "s/#define NFS3_COOKIEVERFSIZE 8/#define NFS3_COOKIEVERFSIZE 8\n\n#if defined(ANDROID)\ntypedef long long int quad_t;\ntypedef long long unsigned u_quad_t;\n#endif\n#if defined(WIN32)\ntypedef long long int quad_t;\ntypedef long long unsigned u_quad_t;\n#endif/g" >> libnfs-raw-nfs.h + cat nfs.x | head -29 >libnfs-raw-nfs.c + rpcgen -c nfs.x | sed -e "s/#include \".*nfs.h\"/#include \"libnfs-xdr.h\"\n#include \"libnfs-raw-nfs.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/register int32_t \*buf;/register int32_t *buf;\n buf = NULL;/" >> libnfs-raw-nfs.c diff --git a/nfs/libnfs-raw-nfs.c b/nfs/libnfs-raw-nfs.c index 04e914d..30d05a5 100644 --- a/nfs/libnfs-raw-nfs.c +++ b/nfs/libnfs-raw-nfs.c @@ -1,3 +1,32 @@ +/* +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ + /* * Please do not edit this file. * It was generated using rpcgen. @@ -17,24 +46,13 @@ zdr_cookieverf3 (ZDR *zdrs, cookieverf3 objp) return TRUE; } -bool_t -zdr_uint64 (ZDR *zdrs, uint64 *objp) -{ - register int32_t *buf; - buf = NULL; - - if (!zdr_u_quad_t (zdrs, objp)) - return FALSE; - return TRUE; -} - bool_t zdr_cookie3 (ZDR *zdrs, cookie3 *objp) { register int32_t *buf; buf = NULL; - if (!zdr_uint64 (zdrs, objp)) + if (!zdr_u_quad_t (zdrs, objp)) return FALSE; return TRUE; } @@ -124,7 +142,7 @@ zdr_size3 (ZDR *zdrs, size3 *objp) register int32_t *buf; buf = NULL; - if (!zdr_uint64 (zdrs, objp)) + if (!zdr_u_quad_t (zdrs, objp)) return FALSE; return TRUE; } @@ -135,7 +153,7 @@ zdr_fileid3 (ZDR *zdrs, fileid3 *objp) register int32_t *buf; buf = NULL; - if (!zdr_uint64 (zdrs, objp)) + if (!zdr_u_quad_t (zdrs, objp)) return FALSE; return TRUE; } @@ -188,7 +206,7 @@ zdr_fattr3 (ZDR *zdrs, fattr3 *objp) return FALSE; if (!zdr_specdata3 (zdrs, &objp->rdev)) return FALSE; - if (!zdr_uint64 (zdrs, &objp->fsid)) + if (!zdr_u_quad_t (zdrs, &objp->fsid)) return FALSE; if (!zdr_fileid3 (zdrs, &objp->fileid)) return FALSE; @@ -250,7 +268,7 @@ zdr_offset3 (ZDR *zdrs, offset3 *objp) register int32_t *buf; buf = NULL; - if (!zdr_uint64 (zdrs, objp)) + if (!zdr_u_quad_t (zdrs, objp)) return FALSE; return TRUE; } diff --git a/nfs/libnfs-raw-nfs.h b/nfs/libnfs-raw-nfs.h index 8eb3b2e..4b4c874 100644 --- a/nfs/libnfs-raw-nfs.h +++ b/nfs/libnfs-raw-nfs.h @@ -1,3 +1,32 @@ +/* +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ + /* * Please do not edit this file. * It was generated using rpcgen. @@ -30,9 +59,7 @@ typedef long long unsigned u_quad_t; typedef char cookieverf3[NFS3_COOKIEVERFSIZE]; -typedef u_quad_t uint64; - -typedef uint64 cookie3; +typedef u_quad_t cookie3; struct nfs_fh3 { struct { @@ -67,9 +94,9 @@ typedef u_int uid3; typedef u_int gid3; -typedef uint64 size3; +typedef u_quad_t size3; -typedef uint64 fileid3; +typedef u_quad_t fileid3; struct specdata3 { u_int specdata1; @@ -92,7 +119,7 @@ struct fattr3 { size3 size; size3 used; specdata3 rdev; - uint64 fsid; + u_quad_t fsid; fileid3 fileid; nfstime3 atime; nfstime3 mtime; @@ -148,7 +175,7 @@ enum stable_how { }; typedef enum stable_how stable_how; -typedef uint64 offset3; +typedef u_quad_t offset3; typedef u_int count3; @@ -1611,7 +1638,6 @@ extern int nfsacl_program_3_freeresult (); #if defined(__STDC__) || defined(__cplusplus) extern bool_t zdr_cookieverf3 (ZDR *, cookieverf3); -extern bool_t zdr_uint64 (ZDR *, uint64*); extern bool_t zdr_cookie3 (ZDR *, cookie3*); extern bool_t zdr_nfs_fh3 (ZDR *, nfs_fh3*); extern bool_t zdr_filename3 (ZDR *, filename3*); @@ -1799,7 +1825,6 @@ extern bool_t zdr_SETACL3res (ZDR *, SETACL3res*); #else /* K&R C */ extern bool_t zdr_cookieverf3 (); -extern bool_t zdr_uint64 (); extern bool_t zdr_cookie3 (); extern bool_t zdr_nfs_fh3 (); extern bool_t zdr_filename3 (); diff --git a/nfs/nfs.x b/nfs/nfs.x index cc19757..ca48c03 100644 --- a/nfs/nfs.x +++ b/nfs/nfs.x @@ -1,4 +1,31 @@ -/* NFS part from rfc 1813, NFSACL part is from wireshark sources */ +/* +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ /* * NFS v3 Definitions @@ -10,16 +37,7 @@ const NFS3_COOKIEVERFSIZE = 8; typedef opaque cookieverf3[NFS3_COOKIEVERFSIZE]; -/*unsigned hyper can be overridden by giving rpcgen -DU_INT64_PLATTFORM_TYPE=" - where rpcgen doesn't know anything about hyper - default to unsigned hyper as of rfc 1813 */ -#ifndef U_INT64_PLATTFORM_TYPE -#define U_INT64_PLATTFORM_TYPE unsigned hyper -#endif/*U_INT64_PLATTFORM_TYPE*/ - -typedef U_INT64_PLATTFORM_TYPE uint64; - -typedef uint64 cookie3; +typedef u_quad_t cookie3; struct nfs_fh3 { opaque data; @@ -48,9 +66,9 @@ typedef unsigned int uid3; typedef unsigned int gid3; -typedef uint64 size3; +typedef u_quad_t size3; -typedef uint64 fileid3; +typedef u_quad_t fileid3; struct specdata3 { unsigned int specdata1; @@ -71,7 +89,7 @@ struct fattr3 { size3 size; size3 used; specdata3 rdev; - uint64 fsid; + u_quad_t fsid; fileid3 fileid; nfstime3 atime; nfstime3 mtime; @@ -124,7 +142,7 @@ enum stable_how { FILE_SYNC = 2 }; -typedef uint64 offset3; +typedef u_quad_t offset3; typedef unsigned int count3; diff --git a/nlm/Makefile.am b/nlm/Makefile.am index 5b6d02f..0cc563d 100644 --- a/nlm/Makefile.am +++ b/nlm/Makefile.am @@ -18,5 +18,7 @@ nlm-stamp : nlm.x touch nlm-stamp compile_rpc: - rpcgen -h nlm.x | sed -e "s/#include //" | sed -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" > libnfs-raw-nlm.h - rpcgen -c nlm.x | sed -e "s/#include \".*nlm.h\"/#include \"libnfs-xdr.h\"\n#include \"libnfs-raw-nlm.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/register int32_t \*buf;/register int32_t *buf;\n buf = NULL;/" > libnfs-raw-nlm.c + cat nlm.x | head -29 >libnfs-raw-nlm.h + rpcgen -h nlm.x | sed -e "s/#include //" | sed -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" >> libnfs-raw-nlm.h + cat nlm.x | head -29 >libnfs-raw-nlm.c + rpcgen -c nlm.x | sed -e "s/#include \".*nlm.h\"/#include \"libnfs-xdr.h\"\n#include \"libnfs-raw-nlm.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/register int32_t \*buf;/register int32_t *buf;\n buf = NULL;/" >> libnfs-raw-nlm.c diff --git a/nlm/libnfs-raw-nlm.c b/nlm/libnfs-raw-nlm.c index 808924a..7930261 100644 --- a/nlm/libnfs-raw-nlm.c +++ b/nlm/libnfs-raw-nlm.c @@ -1,3 +1,32 @@ +/* +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ + /* * Please do not edit this file. * It was generated using rpcgen. diff --git a/nlm/libnfs-raw-nlm.h b/nlm/libnfs-raw-nlm.h index 6437aa4..eb73c1a 100644 --- a/nlm/libnfs-raw-nlm.h +++ b/nlm/libnfs-raw-nlm.h @@ -1,3 +1,32 @@ +/* +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ + /* * Please do not edit this file. * It was generated using rpcgen. @@ -6,20 +35,13 @@ #ifndef _NLM_H_RPCGEN #define _NLM_H_RPCGEN -#include + + #ifdef __cplusplus extern "C" { #endif -#if defined(ANDROID) -typedef long long int quad_t; -typedef long long unsigned u_quad_t; -#endif -#if defined(WIN32) -typedef long long int quad_t; -typedef long long unsigned u_quad_t; -#endif struct nlm_fh4 { struct { diff --git a/nlm/nlm.x b/nlm/nlm.x index 8ec6614..6cd39c2 100644 --- a/nlm/nlm.x +++ b/nlm/nlm.x @@ -1,6 +1,31 @@ -/* based on rfc1813 and wireshark */ - -typedef unsigned hyper uint64; +/* +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ struct nlm_fh4 { opaque data<>; @@ -29,8 +54,8 @@ struct nlm4_holder { bool exclusive; unsigned int svid; nlm4_oh oh; - uint64 l_offset; - uint64 l_len; + u_quad_t l_offset; + u_quad_t l_len; }; const NLM_MAXNAME = 256; @@ -39,8 +64,8 @@ struct nlm4_lock { struct nlm_fh4 fh; nlm4_oh oh; unsigned int svid; - uint64 l_offset; - uint64 l_len; + u_quad_t l_offset; + u_quad_t l_len; }; struct nlm4_share { diff --git a/nsm/Makefile.am b/nsm/Makefile.am index 6362ddb..3bf06a8 100644 --- a/nsm/Makefile.am +++ b/nsm/Makefile.am @@ -18,5 +18,7 @@ nsm-stamp : nsm.x touch nsm-stamp compile_rpc: - rpcgen -h nsm.x | sed -e "s/#include //" | sed -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" > libnfs-raw-nsm.h - rpcgen -c nsm.x | sed -e "s/#include \".*nsm.h\"/#include \"libnfs-xdr.h\"\n#include \"libnfs-raw-nsm.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/register int32_t \*buf;/register int32_t *buf;\n buf = NULL;/" > libnfs-raw-nsm.c + cat nsm.x | head -29 >libnfs-raw-nsm.h + rpcgen -h nsm.x | sed -e "s/#include //" | sed -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" >> libnfs-raw-nsm.h + cat nsm.x | head -29 >libnfs-raw-nsm.c + rpcgen -c nsm.x | sed -e "s/#include \".*nsm.h\"/#include \"libnfs-xdr.h\"\n#include \"libnfs-raw-nsm.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/register int32_t \*buf;/register int32_t *buf;\n buf = NULL;/" >> libnfs-raw-nsm.c diff --git a/nsm/libnfs-raw-nsm.c b/nsm/libnfs-raw-nsm.c index cee4d89..d3be832 100644 --- a/nsm/libnfs-raw-nsm.c +++ b/nsm/libnfs-raw-nsm.c @@ -1,3 +1,32 @@ +/* +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ + /* * Please do not edit this file. * It was generated using rpcgen. @@ -90,6 +119,7 @@ zdr_NSM1_MONargs (ZDR *zdrs, NSM1_MONargs *objp) register int32_t *buf; buf = NULL; + int i; if (!zdr_nsm_mon_id (zdrs, &objp->mon_id)) return FALSE; if (!zdr_opaque (zdrs, objp->priv, 16)) diff --git a/nsm/libnfs-raw-nsm.h b/nsm/libnfs-raw-nsm.h index b68a1bd..d656f3f 100644 --- a/nsm/libnfs-raw-nsm.h +++ b/nsm/libnfs-raw-nsm.h @@ -1,3 +1,32 @@ +/* +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ + /* * Please do not edit this file. * It was generated using rpcgen. diff --git a/nsm/nsm.x b/nsm/nsm.x index 43fbc14..430a5e4 100644 --- a/nsm/nsm.x +++ b/nsm/nsm.x @@ -1,11 +1,31 @@ /* - * NSM definitions from: - * Protocols for Interworking: XNFS, Version 3W - * http://pubs.opengroup.org/onlinepubs/9629799/chap11.htm - * - * Symbols then massaged to avoid too much namespace pollution - * and to bring more inline with convention in nlm. - */ +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ /* * This defines the maximum length of the string diff --git a/portmap/Makefile.am b/portmap/Makefile.am index 4d486fc..682ca2a 100644 --- a/portmap/Makefile.am +++ b/portmap/Makefile.am @@ -18,5 +18,7 @@ portmap-stamp : portmap.x touch portmap-stamp compile_rpc: - rpcgen -h portmap.x | sed -e "s/#include //" | sed -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" > libnfs-raw-portmap.h - rpcgen -c portmap.x | sed -e "s/#include \".*portmap.h\"/#include \"libnfs-zdr.h\"\n#include \"libnfs-raw-portmap.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/register int32_t \*buf;/register int32_t *buf;\n buf = NULL;/" > libnfs-raw-portmap.c + cat portmap.x | head -29 >libnfs-raw-portmap.h + rpcgen -h portmap.x | sed -e "s/#include //" | sed -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" >> libnfs-raw-portmap.h + cat portmap.x | head -29 >libnfs-raw-portmap.c + rpcgen -c portmap.x | sed -e "s/#include \".*portmap.h\"/#include \"libnfs-zdr.h\"\n#include \"libnfs-raw-portmap.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/register int32_t \*buf;/register int32_t *buf;\n buf = NULL;/" >> libnfs-raw-portmap.c diff --git a/portmap/libnfs-raw-portmap.c b/portmap/libnfs-raw-portmap.c index 1afcd63..12b919d 100644 --- a/portmap/libnfs-raw-portmap.c +++ b/portmap/libnfs-raw-portmap.c @@ -1,3 +1,32 @@ +/* +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ + /* * Please do not edit this file. * It was generated using rpcgen. diff --git a/portmap/libnfs-raw-portmap.h b/portmap/libnfs-raw-portmap.h index ae0d067..676be5e 100644 --- a/portmap/libnfs-raw-portmap.h +++ b/portmap/libnfs-raw-portmap.h @@ -1,3 +1,32 @@ +/* +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ + /* * Please do not edit this file. * It was generated using rpcgen. diff --git a/portmap/portmap.x b/portmap/portmap.x index abe31b9..5ceb436 100644 --- a/portmap/portmap.x +++ b/portmap/portmap.x @@ -1,7 +1,31 @@ /* - * From RFC1833 - * and http://tools.ietf.org/html/draft-ietf-oncrpc-rpcbind-00 - */ +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ const PMAP_PORT = 111; /* portmapper port number */ diff --git a/rquota/Makefile.am b/rquota/Makefile.am index 02f86f7..5a604a8 100644 --- a/rquota/Makefile.am +++ b/rquota/Makefile.am @@ -16,7 +16,9 @@ $(rquota_GENERATED) : rquota-stamp rquota-stamp : rquota.x rm -f $(rquota_GENERATED) touch rquota-stamp - + compile_rpc: - rpcgen -h rquota.x | sed -e "s/#include //" | sed -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" > libnfs-raw-rquota.h - rpcgen -c rquota.x | sed -e "s/#include \".*rquota.h\"/#include \"libnfs-xdr.h\"\n#include \"libnfs-raw-rquota.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/register int32_t \*buf;/register int32_t *buf;\n buf = NULL;/" > libnfs-raw-rquota.c + cat rquota.x | head -29 >libnfs-raw-rquota.h + rpcgen -h rquota.x | sed -e "s/#include //" | sed -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" >> libnfs-raw-rquota.h + cat rquota.x | head -29 >libnfs-raw-rquota.c + rpcgen -c rquota.x | sed -e "s/#include \".*rquota.h\"/#include \"libnfs-xdr.h\"\n#include \"libnfs-raw-rquota.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/register int32_t \*buf;/register int32_t *buf;\n buf = NULL;/" >> libnfs-raw-rquota.c diff --git a/rquota/libnfs-raw-rquota.c b/rquota/libnfs-raw-rquota.c index 4b0e330..482645f 100644 --- a/rquota/libnfs-raw-rquota.c +++ b/rquota/libnfs-raw-rquota.c @@ -1,3 +1,32 @@ +/* +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ + /* * Please do not edit this file. * It was generated using rpcgen. diff --git a/rquota/libnfs-raw-rquota.h b/rquota/libnfs-raw-rquota.h index 4690da6..ed5fcb9 100644 --- a/rquota/libnfs-raw-rquota.h +++ b/rquota/libnfs-raw-rquota.h @@ -1,3 +1,32 @@ +/* +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ + /* * Please do not edit this file. * It was generated using rpcgen. @@ -6,7 +35,8 @@ #ifndef _RQUOTA_H_RPCGEN #define _RQUOTA_H_RPCGEN -#include + + #ifdef __cplusplus extern "C" { diff --git a/rquota/rquota.x b/rquota/rquota.x index fb8bc0e..e0a764f 100644 --- a/rquota/rquota.x +++ b/rquota/rquota.x @@ -1,4 +1,31 @@ -/* implementation based on wireshark c-code */ +/* +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ const RQUOTAPATHLEN = 1024; /* Guess this is max. It is max for mount so probably rquota too */ diff --git a/utils/nfs-ls.c b/utils/nfs-ls.c index 974a6e1..7653f56 100644 --- a/utils/nfs-ls.c +++ b/utils/nfs-ls.c @@ -91,7 +91,6 @@ void process_dir(struct nfs_context *nfs, char *dir, int level) { struct nfsdirent *nfsdirent; struct statvfs svfs; struct nfsdir *nfsdir; - struct nfs_stat_64 st; if (!level) { printf("Recursion detected!\n"); @@ -109,15 +108,9 @@ void process_dir(struct nfs_context *nfs, char *dir, int level) { if (!strcmp(nfsdirent->name, ".") || !strcmp(nfsdirent->name, "..")) { continue; } - snprintf(path, 1024, "%s/%s", dir, nfsdirent->name); - ret = nfs_stat64(nfs, path, &st); - if (ret != 0) { - fprintf(stderr, "Failed to stat(%s) %s\n", path, nfs_get_error(nfs)); - continue; - } - switch (st.nfs_mode & S_IFMT) { + switch (nfsdirent->mode & S_IFMT) { #ifndef WIN32 case S_IFLNK: printf("l"); @@ -137,28 +130,28 @@ void process_dir(struct nfs_context *nfs, char *dir, int level) { break; } printf("%c%c%c", - "-r"[!!(st.nfs_mode & S_IRUSR)], - "-w"[!!(st.nfs_mode & S_IWUSR)], - "-x"[!!(st.nfs_mode & S_IXUSR)] + "-r"[!!(nfsdirent->mode & S_IRUSR)], + "-w"[!!(nfsdirent->mode & S_IWUSR)], + "-x"[!!(nfsdirent->mode & S_IXUSR)] ); printf("%c%c%c", - "-r"[!!(st.nfs_mode & S_IRGRP)], - "-w"[!!(st.nfs_mode & S_IWGRP)], - "-x"[!!(st.nfs_mode & S_IXGRP)] + "-r"[!!(nfsdirent->mode & S_IRGRP)], + "-w"[!!(nfsdirent->mode & S_IWGRP)], + "-x"[!!(nfsdirent->mode & S_IXGRP)] ); printf("%c%c%c", - "-r"[!!(st.nfs_mode & S_IROTH)], - "-w"[!!(st.nfs_mode & S_IWOTH)], - "-x"[!!(st.nfs_mode & S_IXOTH)] + "-r"[!!(nfsdirent->mode & S_IROTH)], + "-w"[!!(nfsdirent->mode & S_IWOTH)], + "-x"[!!(nfsdirent->mode & S_IXOTH)] ); - printf(" %2d", (int)st.nfs_nlink); - printf(" %5d", (int)st.nfs_uid); - printf(" %5d", (int)st.nfs_gid); - printf(" %12" PRId64, st.nfs_size); + printf(" %2d", (int)nfsdirent->nlink); + printf(" %5d", (int)nfsdirent->uid); + printf(" %5d", (int)nfsdirent->gid); + printf(" %12" PRId64, nfsdirent->size); printf(" %s\n", path + 1); - if (recursive && (st.nfs_mode & S_IFMT) == S_IFDIR) { + if (recursive && (nfsdirent->mode & S_IFMT) == S_IFDIR) { process_dir(nfs, path, level - 1); } } diff --git a/win32/win32_errnowrapper.h b/win32/win32_errnowrapper.h index ebed01c..1699d5e 100644 --- a/win32/win32_errnowrapper.h +++ b/win32/win32_errnowrapper.h @@ -1,3 +1,24 @@ +/* +Copyright (c) 2014, Ronnie Sahlberg + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ #ifndef WIN32_ERRNOWRAPPER_H_ #define WIN32_ERRNOWRAPPER_H_