Browse Source

Updated to use buffer rather than processor

tags/v0.9.3
Michael Brown 19 years ago
parent
commit
5ae60bd95d
1 changed files with 7 additions and 16 deletions
  1. 7
    16
      src/proto/nfs.c

+ 7
- 16
src/proto/nfs.c View File

484
 /**************************************************************************
484
 /**************************************************************************
485
 NFS - Download extended BOOTP data, or kernel image from NFS server
485
 NFS - Download extended BOOTP data, or kernel image from NFS server
486
 **************************************************************************/
486
 **************************************************************************/
487
-static int nfs ( char *url __unused,
488
-		 struct sockaddr_in *server,
489
-		 char *name,
490
-		 int ( * process ) ( unsigned char *data,
491
-				     unsigned int blocknum,
492
-				     unsigned int len, int eof ) ) {
487
+static int nfs ( char *url __unused, struct sockaddr_in *server,
488
+		 char *name, struct buffer *buffer ) {
493
 	static int recursion = 0;
489
 	static int recursion = 0;
494
 	int sport;
490
 	int sport;
495
 	int err, namelen = strlen(name);
491
 	int err, namelen = strlen(name);
496
 	char dirname[300], *fname;
492
 	char dirname[300], *fname;
497
 	char dirfh[NFS_FHSIZE];		/* file handle of directory */
493
 	char dirfh[NFS_FHSIZE];		/* file handle of directory */
498
 	char filefh[NFS_FHSIZE];	/* file handle of kernel image */
494
 	char filefh[NFS_FHSIZE];	/* file handle of kernel image */
499
-	unsigned int block;
500
 	int rlen, size, offs, len;
495
 	int rlen, size, offs, len;
501
 	struct rpc_t *rpc;
496
 	struct rpc_t *rpc;
502
 
497
 
562
 	}
557
 	}
563
 
558
 
564
 	offs = 0;
559
 	offs = 0;
565
-	block = 1;	/* blocks are numbered starting from 1 */
566
 	size = -1;	/* will be set properly with the first reply */
560
 	size = -1;	/* will be set properly with the first reply */
567
 	len = NFS_READ_SIZE;	/* first request is always full size */
561
 	len = NFS_READ_SIZE;	/* first request is always full size */
568
 	do {
562
 	do {
571
 			// An error occured. NFS servers tend to sending
565
 			// An error occured. NFS servers tend to sending
572
 			// errors 21 / 22 when symlink instead of real file
566
 			// errors 21 / 22 when symlink instead of real file
573
 			// is requested. So check if it's a symlink!
567
 			// is requested. So check if it's a symlink!
574
-			block = nfs_readlink(&nfs_server, dirfh, dirname,
575
-			                filefh, sport);
576
-			if ( 0 == block ) {
568
+			if ( nfs_readlink(&nfs_server, dirfh, dirname,
569
+					  filefh, sport) == 0 ) {
577
 				printf("\nLoading symlink:%s ..",dirname);
570
 				printf("\nLoading symlink:%s ..",dirname);
578
 				goto nfssymlink;
571
 				goto nfssymlink;
579
 			}
572
 			}
599
 			rlen = len;	/* shouldn't happen...  */
592
 			rlen = len;	/* shouldn't happen...  */
600
 		}
593
 		}
601
 
594
 
602
-		err = process((char *)&rpc->u.reply.data[19], block, rlen,
603
-			(offs+rlen == size));
604
-		if (err <= 0) {
595
+		if ( ! fill_buffer ( buffer, &rpc->u.reply.data[19],
596
+				     offs, rlen ) ) {
605
 			nfs_reset();
597
 			nfs_reset();
606
-			return err;
598
+			return 0;
607
 		}
599
 		}
608
 
600
 
609
-		block++;
610
 		offs += rlen;
601
 		offs += rlen;
611
 		/* last request is done with matching requested read size */
602
 		/* last request is done with matching requested read size */
612
 		if (size-offs < NFS_READ_SIZE) {
603
 		if (size-offs < NFS_READ_SIZE) {

Loading…
Cancel
Save