Updated to use buffer rather than processor
This commit is contained in:
parent
022661283a
commit
5ae60bd95d
|
@ -484,19 +484,14 @@ static int nfs_read(struct sockaddr_in *server, char *fh, int offset, int len,
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
NFS - Download extended BOOTP data, or kernel image from NFS server
|
NFS - Download extended BOOTP data, or kernel image from NFS server
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
static int nfs ( char *url __unused,
|
static int nfs ( char *url __unused, struct sockaddr_in *server,
|
||||||
struct sockaddr_in *server,
|
char *name, struct buffer *buffer ) {
|
||||||
char *name,
|
|
||||||
int ( * process ) ( unsigned char *data,
|
|
||||||
unsigned int blocknum,
|
|
||||||
unsigned int len, int eof ) ) {
|
|
||||||
static int recursion = 0;
|
static int recursion = 0;
|
||||||
int sport;
|
int sport;
|
||||||
int err, namelen = strlen(name);
|
int err, namelen = strlen(name);
|
||||||
char dirname[300], *fname;
|
char dirname[300], *fname;
|
||||||
char dirfh[NFS_FHSIZE]; /* file handle of directory */
|
char dirfh[NFS_FHSIZE]; /* file handle of directory */
|
||||||
char filefh[NFS_FHSIZE]; /* file handle of kernel image */
|
char filefh[NFS_FHSIZE]; /* file handle of kernel image */
|
||||||
unsigned int block;
|
|
||||||
int rlen, size, offs, len;
|
int rlen, size, offs, len;
|
||||||
struct rpc_t *rpc;
|
struct rpc_t *rpc;
|
||||||
|
|
||||||
|
@ -562,7 +557,6 @@ nfssymlink:
|
||||||
}
|
}
|
||||||
|
|
||||||
offs = 0;
|
offs = 0;
|
||||||
block = 1; /* blocks are numbered starting from 1 */
|
|
||||||
size = -1; /* will be set properly with the first reply */
|
size = -1; /* will be set properly with the first reply */
|
||||||
len = NFS_READ_SIZE; /* first request is always full size */
|
len = NFS_READ_SIZE; /* first request is always full size */
|
||||||
do {
|
do {
|
||||||
|
@ -571,9 +565,8 @@ nfssymlink:
|
||||||
// An error occured. NFS servers tend to sending
|
// An error occured. NFS servers tend to sending
|
||||||
// errors 21 / 22 when symlink instead of real file
|
// errors 21 / 22 when symlink instead of real file
|
||||||
// is requested. So check if it's a symlink!
|
// is requested. So check if it's a symlink!
|
||||||
block = nfs_readlink(&nfs_server, dirfh, dirname,
|
if ( nfs_readlink(&nfs_server, dirfh, dirname,
|
||||||
filefh, sport);
|
filefh, sport) == 0 ) {
|
||||||
if ( 0 == block ) {
|
|
||||||
printf("\nLoading symlink:%s ..",dirname);
|
printf("\nLoading symlink:%s ..",dirname);
|
||||||
goto nfssymlink;
|
goto nfssymlink;
|
||||||
}
|
}
|
||||||
|
@ -599,14 +592,12 @@ nfssymlink:
|
||||||
rlen = len; /* shouldn't happen... */
|
rlen = len; /* shouldn't happen... */
|
||||||
}
|
}
|
||||||
|
|
||||||
err = process((char *)&rpc->u.reply.data[19], block, rlen,
|
if ( ! fill_buffer ( buffer, &rpc->u.reply.data[19],
|
||||||
(offs+rlen == size));
|
offs, rlen ) ) {
|
||||||
if (err <= 0) {
|
|
||||||
nfs_reset();
|
nfs_reset();
|
||||||
return err;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
block++;
|
|
||||||
offs += rlen;
|
offs += rlen;
|
||||||
/* last request is done with matching requested read size */
|
/* last request is done with matching requested read size */
|
||||||
if (size-offs < NFS_READ_SIZE) {
|
if (size-offs < NFS_READ_SIZE) {
|
||||||
|
|
Reference in New Issue