Changeset View
Changeset View
Standalone View
Standalone View
head/stand/libsa/tftp.c
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | |||||
struct tftprecv_extra; | struct tftprecv_extra; | ||||
static ssize_t recvtftp(struct iodesc *d, void **pkt, void **payload, | static ssize_t recvtftp(struct iodesc *d, void **pkt, void **payload, | ||||
time_t tleft, void *recv_extra); | time_t tleft, void *recv_extra); | ||||
static int tftp_open(const char *path, struct open_file *f); | static int tftp_open(const char *path, struct open_file *f); | ||||
static int tftp_close(struct open_file *f); | static int tftp_close(struct open_file *f); | ||||
static int tftp_parse_oack(struct tftp_handle *h, char *buf, size_t len); | static int tftp_parse_oack(struct tftp_handle *h, char *buf, size_t len); | ||||
static int tftp_read(struct open_file *f, void *buf, size_t size, size_t *resid); | static int tftp_read(struct open_file *f, void *buf, size_t size, size_t *resid); | ||||
static int tftp_write(struct open_file *f, const void *buf, size_t size, | |||||
size_t *resid); | |||||
static off_t tftp_seek(struct open_file *f, off_t offset, int where); | static off_t tftp_seek(struct open_file *f, off_t offset, int where); | ||||
static int tftp_set_blksize(struct tftp_handle *h, const char *str); | static int tftp_set_blksize(struct tftp_handle *h, const char *str); | ||||
static int tftp_stat(struct open_file *f, struct stat *sb); | static int tftp_stat(struct open_file *f, struct stat *sb); | ||||
struct fs_ops tftp_fsops = { | struct fs_ops tftp_fsops = { | ||||
"tftp", | "tftp", | ||||
tftp_open, | tftp_open, | ||||
tftp_close, | tftp_close, | ||||
tftp_read, | tftp_read, | ||||
tftp_write, | null_write, | ||||
tftp_seek, | tftp_seek, | ||||
tftp_stat, | tftp_stat, | ||||
null_readdir | null_readdir | ||||
}; | }; | ||||
extern struct in_addr servip; | extern struct in_addr servip; | ||||
static int tftpport = 2000; | static int tftpport = 2000; | ||||
▲ Show 20 Lines • Show All 475 Lines • ▼ Show 20 Lines | tftp_close(struct open_file *f) | ||||
if (tftpfile) { | if (tftpfile) { | ||||
free(tftpfile->path); | free(tftpfile->path); | ||||
free(tftpfile->pkt); | free(tftpfile->pkt); | ||||
free(tftpfile); | free(tftpfile); | ||||
} | } | ||||
is_open = 0; | is_open = 0; | ||||
return (0); | return (0); | ||||
} | |||||
static int | |||||
tftp_write(struct open_file *f __unused, const void *start __unused, | |||||
size_t size __unused, size_t *resid __unused /* out */) | |||||
{ | |||||
return (EROFS); | |||||
} | } | ||||
static int | static int | ||||
tftp_stat(struct open_file *f, struct stat *sb) | tftp_stat(struct open_file *f, struct stat *sb) | ||||
{ | { | ||||
struct tftp_handle *tftpfile; | struct tftp_handle *tftpfile; | ||||
tftpfile = (struct tftp_handle *) f->f_fsdata; | tftpfile = (struct tftp_handle *) f->f_fsdata; | ||||
▲ Show 20 Lines • Show All 151 Lines • Show Last 20 Lines |