Exemplo n.º 1
0
/*------------------------------------------------------------------------
 * lflWrite  --  write data to a previously opened local disk file
 *------------------------------------------------------------------------
 */
devcall	lflWrite (
	  struct dentry *devptr,	/* entry in device switch table */
	  char	*buff,			/* buffer holding data to write	*/
	  int32	count			/* number of bytes to write	*/
	)
{
	int32		i;		/* number of bytes written	*/

	if (count < 0) {
		return SYSERR;
	}
	for (i=0; i<count; i++) {
		if (lflPutc(devptr, *buff++) == SYSERR) {
			return SYSERR;
		}
	}
	return count;
}
Exemplo n.º 2
0
int testlfl(void){


//  lfsInit(0);
  int f;
  //  printf("getdev %d\n", getdev("EXTROOTFS"));
  f = lfsOpen(getdev("EXTROOTFS"), "./test" , 0);
  printf( "File0: %d\n", getdev("LFILE0"));

  printf( "Char %c\n", lflGetc( &devtab[getdev("LFILE0")] ));

  char testing[14];

  lflRead( &devtab[getdev("LFILE0")], (void*)testing, 20);
  printf("String %s\n", testing);

  lflPutc( &devtab[getdev("LFILE0")], '!');

  printf( "Char %c\n", lflGetc( &devtab[getdev("LFILE0")] ));

  lfltab[0].lfpos=0;

  char reading[30];
  lflRead( &devtab[getdev("LFILE0")], (void*)reading, 20);
  printf("NS: %s\n", reading);

  char lolface[40] = "HELLLLLOOO";;
  lflWrite( &devtab[getdev("LFILE0")], (void*)lolface, 20);

  lfltab[0].lfpos=0;
  lflRead( &devtab[getdev("LFILE0")], (void*)reading, 30);
  printf("NS: %s\n", reading);

  lflClose( &devtab[getdev("LFILE0")]);

  lfsOpen(getdev("EXTROOTFS"), "./test", 0);
  lflRead( &devtab[getdev("LFILE0")], (void*)reading, 30);
  printf("NS: %s\n", reading);

  return 0;
}