Initial revision
This commit is contained in:
parent
a319ff3671
commit
44f42f99bb
92
clients/fspprof.l
Normal file
92
clients/fspprof.l
Normal file
|
|
@ -0,0 +1,92 @@
|
||||||
|
%option nounput
|
||||||
|
%option noyyget_lineno
|
||||||
|
%option noyyset_lineno
|
||||||
|
%option noyyget_debug
|
||||||
|
%option noyyset_debug
|
||||||
|
%option noyyget_in
|
||||||
|
%option noyyget_out
|
||||||
|
%option noyyget_leng
|
||||||
|
%option noyyget_text
|
||||||
|
%option noyyset_in
|
||||||
|
%option noyyset_out
|
||||||
|
%option case-insensitive
|
||||||
|
%option never-interactive
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include <string.h>
|
||||||
|
#include "fhost.h"
|
||||||
|
|
||||||
|
static struct fsp_host *host=NULL;
|
||||||
|
%}
|
||||||
|
DIGIT [0-9]
|
||||||
|
NUMBER {DIGIT}+
|
||||||
|
WHITECHAR [ \t\n\r]
|
||||||
|
OPTWHITESPACE {WHITECHAR}*
|
||||||
|
WHITESPACE {WHITECHAR}+
|
||||||
|
COMMENT #.*$
|
||||||
|
IPADDRESS {NUMBER}\.{NUMBER}\.{NUMBER}\.{NUMBER}
|
||||||
|
HOSTNAME [[:alpha:]][\-._[:alnum:]]+
|
||||||
|
/* stavy */
|
||||||
|
%s shostname
|
||||||
|
%s shost
|
||||||
|
%s sport
|
||||||
|
%s salias
|
||||||
|
%s slport
|
||||||
|
%s sdir
|
||||||
|
%s sldir
|
||||||
|
%s sdelay
|
||||||
|
%s spassword
|
||||||
|
%s stimeout
|
||||||
|
%%
|
||||||
|
{COMMENT} /* ignore comments */
|
||||||
|
^{WHITESPACE} /* ignore whitespace at begining of line */
|
||||||
|
^{OPTWHITESPACE}(host|machine){WHITESPACE} {
|
||||||
|
add_host(host);
|
||||||
|
host=NULL;
|
||||||
|
BEGIN(shostname);
|
||||||
|
}
|
||||||
|
<shostname>{HOSTNAME} {
|
||||||
|
host=init_host();
|
||||||
|
/* printf("host %s!\n",yytext); */
|
||||||
|
host->hostname=strdup(yytext);
|
||||||
|
BEGIN(shost);
|
||||||
|
}
|
||||||
|
<shostname>{IPADDRESS} {
|
||||||
|
host=init_host();
|
||||||
|
/* printf("ihost %s!\n",yytext); */
|
||||||
|
host->hostaddr=strdup(yytext);
|
||||||
|
BEGIN(shost);
|
||||||
|
}
|
||||||
|
<shostname>.|\n fprintf(stderr,"invalid hostname `%s`\n",yytext);BEGIN(INITIAL);
|
||||||
|
<shost>(fsp{WHITESPACE})?port BEGIN(sport);
|
||||||
|
<sport>{WHITESPACE}
|
||||||
|
<sport>{NUMBER} host->port=atoi(yytext);BEGIN(shost);
|
||||||
|
<sport>.|\n fprintf(stderr,"invalid port `%s`\n",yytext);BEGIN(shost);
|
||||||
|
<shost>alias{WHITESPACE} BEGIN(salias);
|
||||||
|
<salias>{HOSTNAME} add_host_alias(host,yytext);BEGIN(shost);
|
||||||
|
<shost>local{WHITESPACE}port BEGIN(slport);
|
||||||
|
<slport>{WHITESPACE}
|
||||||
|
<slport>{NUMBER} host->local_port=atoi(yytext);BEGIN(shost);
|
||||||
|
<shost>(fsp{WHITESPACE})?directory{WHITESPACE} BEGIN(sdir);
|
||||||
|
<sdir>\/[[:graph:]]* host->dir=strdup(yytext);BEGIN(shost);
|
||||||
|
<sdir>.|\n fprintf(stderr,"invalid directory `%s`\n",yytext);BEGIN(shost);
|
||||||
|
<shost>local{WHITESPACE}directory{WHITESPACE} BEGIN(sldir);
|
||||||
|
<sldir>[[:graph:]]* host->local_dir=strdup(yytext);BEGIN(shost);
|
||||||
|
<sldir>.|\n fprintf(stderr,"invalid local directory `%s`\n",yytext);BEGIN(shost);
|
||||||
|
<shost>delay BEGIN(sdelay);
|
||||||
|
<sdelay>{WHITESPACE}
|
||||||
|
<sdelay>{NUMBER} host->delay=atoi(yytext);BEGIN(shost);
|
||||||
|
<sdelay>.|\n fprintf(stderr,"invalid delay `%s`\n",yytext);BEGIN(shost);
|
||||||
|
<shost>timeout BEGIN(stimeout);
|
||||||
|
<stimeout>{WHITESPACE}
|
||||||
|
<stimeout>{NUMBER} host->timeout=atoi(yytext);BEGIN(shost);
|
||||||
|
<stimeout>.|\n fprintf(stderr,"invalid timeout `%s`\n",yytext);BEGIN(shost);
|
||||||
|
<shost>trace{WHITESPACE}on host->trace=1;
|
||||||
|
<shost>trace{WHITESPACE}off host->trace=0;
|
||||||
|
<shost>password{WHITESPACE} BEGIN(spassword);
|
||||||
|
<spassword>[[:graph:]]+ host->password=strdup(yytext);BEGIN(shost);
|
||||||
|
<shost><<EOF>> add_host(host);host=NULL;yyterminate();
|
||||||
|
|
||||||
|
{WHITECHAR} /* ignore */
|
||||||
|
. fprintf(stderr," %s",yytext);/* no default rule */
|
||||||
|
%%
|
||||||
62
tests/mklargefile.c
Normal file
62
tests/mklargefile.c
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
/* this file is public domain */
|
||||||
|
/* return values:
|
||||||
|
* 3 - invocation error
|
||||||
|
* 2 - no LFS support
|
||||||
|
* 1 - file creation failed
|
||||||
|
* 0 - okay!
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "tweak.h"
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(int argc,char *argv[])
|
||||||
|
{
|
||||||
|
off_t GB=1024*1024*1024;
|
||||||
|
FILE *fd;
|
||||||
|
off_t pos;
|
||||||
|
float size;
|
||||||
|
|
||||||
|
if(argc<3)
|
||||||
|
{
|
||||||
|
printf("Makes a large file with hole using fseeko\n");
|
||||||
|
printf("%s <filename> <floating point size in GB>\n",argv[0]);
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
fd = fopen(argv[1],"w");
|
||||||
|
if(fd == NULL)
|
||||||
|
{
|
||||||
|
perror("fopen");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
size=atof(argv[2]);
|
||||||
|
#if SIZEOF_OFF_T <= 4
|
||||||
|
if(size>2)
|
||||||
|
{
|
||||||
|
printf("You do not have LFS your system.\nMaximum supported filesize is 2 GB.\n");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
pos=size*GB;
|
||||||
|
if(fseeko(fd,pos,SEEK_SET))
|
||||||
|
{
|
||||||
|
perror("fseeko");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(fwrite("!",1,1,fd)<1)
|
||||||
|
{
|
||||||
|
perror("write");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(fclose(fd))
|
||||||
|
{
|
||||||
|
perror("fclose");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user